vgabios: Unify code to generate the vbe mode list.
[seabios.git] / src / memmap.c
index 005c474cc7b660a10f57f0dacacbe43698b974db..20ccae0d4909fe291e87634b32231d1e1d89d5a6 100644 (file)
@@ -27,7 +27,7 @@ static void
 insert_e820(int i, u64 start, u64 size, u32 type)
 {
     if (e820_count >= CONFIG_MAX_E820) {
-        dprintf(1, "Overflowed e820 list!\n");
+        warn_noalloc();
         return;
     }
 
@@ -40,19 +40,33 @@ 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()
+dump_map(void)
 {
     dprintf(1, "e820 map has %d items:\n", e820_count);
     int i;
     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));
     }
 }
 
@@ -119,16 +133,9 @@ add_e820(u64 start, u64 size, u32 type)
     //dump_map();
 }
 
-// Prep for memmap stuff - init bios table locations.
-void
-memmap_setup()
-{
-    e820_count = 0;
-}
-
 // Report on final memory locations.
 void
-memmap_finalize()
+memmap_finalize(void)
 {
     dump_map();
 }