summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorShuo Liu <shuo.liu@intel.com>2022-08-06 01:20:44 +0800
committerMartin L Roth <gaumless@gmail.com>2022-08-13 16:38:41 +0000
commit85894aa5bcb8f53d24aedc0e6b1f4f26ec1ef3e1 (patch)
tree7d170011455f504969f50393bec5710ca34eec8a /tests
parentf26d76b062a5ca23c8b30a28ef74ece60d6fb97f (diff)
downloadcoreboot-85894aa5bcb8f53d24aedc0e6b1f4f26ec1ef3e1.tar.gz
coreboot-85894aa5bcb8f53d24aedc0e6b1f4f26ec1ef3e1.tar.bz2
coreboot-85894aa5bcb8f53d24aedc0e6b1f4f26ec1ef3e1.zip
tests/lib: Set IORESOURCE_ASSIGNED for bootmem-test and memrange-test
IORESOURCE_ASSIGNED is used to indicate the resource is actually mapped host physical address space. E.g. PCI BAR resources not mapped are not regarded as assigned. In src/include/device/device.h, standard macros, e.g. ram_resource, mmio_resource, io_resource, et al, are all following the usage above. This patch updates the bootmem-test and memrange-test to follow the usage as well. Change-Id: Ifc19302482038267cef01321a46a72d90ca76d35 Signed-off-by: Shuo Liu <shuo.liu@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/66450 Reviewed-by: Nico Huber <nico.h@gmx.de> Reviewed-by: Jonathan Zhang <jonzhang@fb.com> Reviewed-by: Jan Dabros <jsd@semihalf.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/bootmem-test.c6
-rw-r--r--tests/lib/memrange-test.c27
2 files changed, 21 insertions, 12 deletions
diff --git a/tests/lib/bootmem-test.c b/tests/lib/bootmem-test.c
index 7bdbf0d31093..4cf9a2d03efe 100644
--- a/tests/lib/bootmem-test.c
+++ b/tests/lib/bootmem-test.c
@@ -116,11 +116,11 @@ struct bootmem_ranges_t *ranges = ranges_mock;
/* Note that second region overlaps first */
struct resource res_mock[] = {
{ .base = ZERO_REGION_START, .size = ZERO_REGION_SIZE, .next = &res_mock[1],
- .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM },
+ .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM | IORESOURCE_ASSIGNED },
{ .base = CACHEABLE_START, .size = CACHEABLE_SIZE, .next = &res_mock[2],
- .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM },
+ .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM | IORESOURCE_ASSIGNED },
{ .base = RESERVED_START, .size = RESERVED_SIZE, .next = NULL,
- .flags = IORESOURCE_RESERVE | IORESOURCE_MEM }
+ .flags = IORESOURCE_RESERVE | IORESOURCE_MEM | IORESOURCE_ASSIGNED }
};
/* Device simulating RAM */
diff --git a/tests/lib/memrange-test.c b/tests/lib/memrange-test.c
index 25eb1aaaa44f..f99673df5d68 100644
--- a/tests/lib/memrange-test.c
+++ b/tests/lib/memrange-test.c
@@ -25,15 +25,18 @@ struct resource res_mock_1[] = {
[CACHEABLE_TAG] = {.base = 0xE000,
.size = 0xF2000,
.next = &res_mock_1[RESERVED_TAG],
- .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM},
+ .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED },
[RESERVED_TAG] = {.base = 4ULL * GiB,
.size = 4ULL * KiB,
.next = &res_mock_1[READONLY_TAG],
- .flags = IORESOURCE_RESERVE | IORESOURCE_MEM},
+ .flags = IORESOURCE_RESERVE | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED },
[READONLY_TAG] = {.base = 0xFF0000,
.size = 0x10000,
.next = NULL,
- .flags = IORESOURCE_READONLY | IORESOURCE_MEM}
+ .flags = IORESOURCE_READONLY | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED }
};
/* Boundary 1 byte below 4GiB and 1 byte above 4GiB. */
@@ -41,15 +44,18 @@ struct resource res_mock_2[] = {
[CACHEABLE_TAG] = {.base = 0x1000000,
.size = 4ULL * GiB - 0x1000001ULL,
.next = &res_mock_2[RESERVED_TAG],
- .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM},
+ .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED },
[RESERVED_TAG] = {.base = 4ULL * GiB + 1ULL,
.size = 4ULL * GiB,
.next = &res_mock_2[READONLY_TAG],
- .flags = IORESOURCE_RESERVE | IORESOURCE_MEM},
+ .flags = IORESOURCE_RESERVE | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED },
[READONLY_TAG] = {.base = 0,
.size = 0x10000,
.next = NULL,
- .flags = IORESOURCE_READONLY | IORESOURCE_MEM}
+ .flags = IORESOURCE_READONLY | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED }
};
/* Boundary crossing 4GiB. */
@@ -57,15 +63,18 @@ struct resource res_mock_3[] = {
[CACHEABLE_TAG] = {.base = 0xD000,
.size = 0xF3000,
.next = &res_mock_3[RESERVED_TAG],
- .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM},
+ .flags = IORESOURCE_CACHEABLE | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED },
[RESERVED_TAG] = {.base = 1ULL * GiB,
.size = 4ULL * GiB,
.next = &res_mock_3[READONLY_TAG],
- .flags = IORESOURCE_RESERVE | IORESOURCE_MEM},
+ .flags = IORESOURCE_RESERVE | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED },
[READONLY_TAG] = {.base = 0xFF0000,
.size = 0x10000,
.next = NULL,
- .flags = IORESOURCE_READONLY | IORESOURCE_MEM}
+ .flags = IORESOURCE_READONLY | IORESOURCE_MEM |
+ IORESOURCE_ASSIGNED}
};