[SeaBIOS] [PATCH] Print E820 type names as well as numbers, as a debug aid

Ian Campbell ian.campbell at citrix.com
Fri May 13 17:30:55 CEST 2011


Signed-off-by: Ian Campbell <ian.campbell at citrix.com>
---
 src/memmap.c |   18 ++++++++++++++++--
 1 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/memmap.c b/src/memmap.c
index ea05953..20ccae0 100644
--- a/src/memmap.c
+++ b/src/memmap.c
@@ -40,6 +40,20 @@ insert_e820(int i, u64 start, u64 size, u32 type)
     e->type = type;
 }
 
+static const char *
+e820_type_name(u32 type)
+{
+	switch (type) {
+	case E820_RAM:      return "RAM";
+	case E820_RESERVED: return "RESERVED";
+	case E820_ACPI:     return "ACPI";
+	case E820_NVS:      return "NVS";
+	case E820_UNUSABLE: return "UNUSABLE";
+	case E820_HOLE:     return "HOLE";
+	default:            return "UNKNOWN";
+	}
+}
+
 // Show the current e820_list.
 static void
 dump_map(void)
@@ -49,10 +63,10 @@ dump_map(void)
     for (i=0; i<e820_count; i++) {
         struct e820entry *e = &e820_list[i];
         u64 e_end = e->start + e->size;
-        dprintf(1, "  %d: %08x%08x - %08x%08x = %d\n", i
+        dprintf(1, "  %d: %08x%08x - %08x%08x = %d %s\n", i
                 , (u32)(e->start >> 32), (u32)e->start
                 , (u32)(e_end >> 32), (u32)e_end
-                , e->type);
+                , e->type, e820_type_name(e->type));
     }
 }
 
-- 
1.7.2.5




More information about the SeaBIOS mailing list