diff options
author | Michael Neuling <mikey@neuling.org> | 2017-05-12 15:49:39 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-05-16 15:41:35 +1000 |
commit | 6301aedf77f332e8266c3c51799582af1b60f277 (patch) | |
tree | ccd4fab302745b50c7746cfe479d12007347c06a /hw/test | |
parent | f4a7a7ccc41b74f74eeccc4e41c6577906afe11f (diff) | |
download | skiboot-6301aedf77f332e8266c3c51799582af1b60f277.zip skiboot-6301aedf77f332e8266c3c51799582af1b60f277.tar.gz skiboot-6301aedf77f332e8266c3c51799582af1b60f277.tar.bz2 |
phys map: Add tests for holes in MMIO region and order
This adds a couple of tests to ensure that there are no holes in the
map for MMIO mappings and the map is sorted by start address.
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/test')
-rw-r--r-- | hw/test/phys-map-test.c | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/hw/test/phys-map-test.c b/hw/test/phys-map-test.c index 55ebff1..3381074 100644 --- a/hw/test/phys-map-test.c +++ b/hw/test/phys-map-test.c @@ -89,13 +89,14 @@ static void check_map_call(void) struct proc_chip c; uint64_t start, size, end; const struct phys_map_entry *e; - struct map_call_entry *tbl, *t; + struct map_call_entry *tbl, *t, *tnext; int tbl_size = 0; bool passed; for (e = phys_map->table; !phys_map_entry_null(e); e++) tbl_size++; + tbl_size++; /* allow for null entry at end */ tbl_size *= sizeof(struct map_call_entry); tbl = malloc(tbl_size); assert(tbl != NULL); @@ -143,6 +144,31 @@ static void check_map_call(void) t->end = end; } + for (t = tbl; !map_call_entry_null(t + 1); t++) { + tnext = t + 1; + /* Make sure the table is sorted */ + if (t->start > tnext->start) { + printf("Phys map test FAILED: Entry not sorted\n"); + printf("First: addr:%016lx size:%016lx\n", + t->start, t->end - t->start); + printf("Second: addr:%016lx size:%016lx\n", + tnext->start, tnext->end - tnext->start); + assert(0); + } + + /* Look for holes in the table in MMIO region */ + /* We assume over 1PB is MMIO. */ + if ((t->end != tnext->start) && + (t->start > 0x0004000000000000)) { + printf("Phys map test FAILED: Hole in map\n"); + printf("First: addr:%016lx size:%016lx\n", + t->start, t->end - t->start); + printf("Second: addr:%016lx size:%016lx\n", + tnext->start, tnext->end - tnext->start); + assert(0); + } + } + free(tbl); } |