[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] x86: Print source of e820 memory map during boot. Fix Xen-e801 memmap



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1181242947 -3600
# Node ID 345ae2e61ba0130cf4913fee13b378c4e21d24e7
# Parent  a5ae31a91b100b2bfbb3923564e77bdf2f729704
x86: Print source of e820 memory map during boot. Fix Xen-e801 memmap
parsing. Get rid of unneeded e820_raw variable -- map straight onto
boot-trampoline e820 array.
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/arch/x86/boot/mem.S    |    2 +-
 xen/arch/x86/e820.c        |    5 +++--
 xen/arch/x86/setup.c       |   27 ++++++++++++++-------------
 xen/include/asm-x86/e820.h |    7 +++++--
 4 files changed, 23 insertions(+), 18 deletions(-)

diff -r a5ae31a91b10 -r 345ae2e61ba0 xen/arch/x86/boot/mem.S
--- a/xen/arch/x86/boot/mem.S   Thu Jun 07 19:41:59 2007 +0100
+++ b/xen/arch/x86/boot/mem.S   Thu Jun 07 20:02:27 2007 +0100
@@ -71,7 +71,7 @@ e820map:
 e820map:
         .fill   E820MAX*20,1,0
 e820nr:
-        .byte   0
+        .long   0
 lowmem_kb:
         .long   0
 highmem_kb:
diff -r a5ae31a91b10 -r 345ae2e61ba0 xen/arch/x86/e820.c
--- a/xen/arch/x86/e820.c       Thu Jun 07 19:41:59 2007 +0100
+++ b/xen/arch/x86/e820.c       Thu Jun 07 20:02:27 2007 +0100
@@ -412,10 +412,11 @@ static void __init machine_specific_memo
     clip_mem();
 }
 
-unsigned long __init init_e820(struct e820entry *raw, int *raw_nr)
+unsigned long __init init_e820(
+    const char *str, struct e820entry *raw, int *raw_nr)
 {
     machine_specific_memory_setup(raw, raw_nr);
-    printk(KERN_INFO "Physical RAM map:\n");
+    printk(KERN_INFO "%s RAM map:\n", str);
     print_e820_memory_map(e820.map, e820.nr_map);
     return find_max_pfn();
 }
diff -r a5ae31a91b10 -r 345ae2e61ba0 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Thu Jun 07 19:41:59 2007 +0100
+++ b/xen/arch/x86/setup.c      Thu Jun 07 20:02:27 2007 +0100
@@ -162,8 +162,6 @@ static void __init do_initcalls(void)
     for ( ; ; ) __asm__ __volatile__ ( "hlt" ); \
 } while (0)
 
-static struct e820entry __initdata e820_raw[E820MAX];
-
 static unsigned long __initdata initial_images_start, initial_images_end;
 
 unsigned long __init initial_images_nrpages(void)
@@ -338,6 +336,7 @@ void init_done(void)
 
 void __init __start_xen(multiboot_info_t *mbi)
 {
+    char *memmap_type = NULL;
     char __cmdline[] = "", *cmdline = __cmdline;
     unsigned long _initrd_start = 0, _initrd_len = 0;
     unsigned int initrdidx = 1;
@@ -345,7 +344,7 @@ void __init __start_xen(multiboot_info_t
     unsigned long _policy_len = 0;
     module_t *mod = (module_t *)__va(mbi->mods_addr);
     unsigned long nr_pages, modules_length;
-    int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0;
+    int i, e820_warn = 0, bytes = 0;
     struct ns16550_defaults ns16550 = {
         .data_bits = 8,
         .parity    = 'n',
@@ -395,23 +394,24 @@ void __init __start_xen(multiboot_info_t
     if ( opt_xenheap_megabytes > 2048 )
         opt_xenheap_megabytes = 2048;
 
-    if ( bootsym(e820nr) != 0 )
-    {
-        e820_raw_nr = bootsym(e820nr);
-        memcpy(e820_raw, bootsym(e820map), e820_raw_nr * sizeof(e820_raw[0]));
-    }
-    else if ( lowmem_kb )
-    {
+    if ( e820_raw_nr != 0 )
+    {
+        memmap_type = "Xen-e820";
+    }
+    else if ( bootsym(lowmem_kb) )
+    {
+        memmap_type = "Xen-e801";
         e820_raw[0].addr = 0;
-        e820_raw[0].size = lowmem_kb << 10;
+        e820_raw[0].size = bootsym(lowmem_kb) << 10;
         e820_raw[0].type = E820_RAM;
         e820_raw[1].addr = 0x100000;
-        e820_raw[1].size = highmem_kb << 10;
+        e820_raw[1].size = bootsym(highmem_kb) << 10;
         e820_raw[1].type = E820_RAM;
         e820_raw_nr = 2;
     }
     else if ( mbi->flags & MBI_MEMMAP )
     {
+        memmap_type = "Multiboot-e820";
         while ( bytes < mbi->mmap_length )
         {
             memory_map_t *map = __va(mbi->mmap_addr + bytes);
@@ -449,6 +449,7 @@ void __init __start_xen(multiboot_info_t
     }
     else if ( mbi->flags & MBI_MEMLIMITS )
     {
+        memmap_type = "Multiboot-e801";
         e820_raw[0].addr = 0;
         e820_raw[0].size = mbi->mem_lower << 10;
         e820_raw[0].type = E820_RAM;
@@ -480,7 +481,7 @@ void __init __start_xen(multiboot_info_t
     }
 
     /* Sanitise the raw E820 map to produce a final clean version. */
-    max_page = init_e820(e820_raw, &e820_raw_nr);
+    max_page = init_e820(memmap_type, e820_raw, &e820_raw_nr);
 
     /*
      * Create a temporary copy of the E820 map. Truncate it to above 16MB
diff -r a5ae31a91b10 -r 345ae2e61ba0 xen/include/asm-x86/e820.h
--- a/xen/include/asm-x86/e820.h        Thu Jun 07 19:41:59 2007 +0100
+++ b/xen/include/asm-x86/e820.h        Thu Jun 07 20:02:27 2007 +0100
@@ -10,12 +10,15 @@ struct e820map {
     struct e820entry map[E820MAX];
 };
 
-extern unsigned long init_e820(struct e820entry *, int *);
+extern unsigned long init_e820(const char *, struct e820entry *, int *);
 extern struct e820map e820;
 
 /* These symbols live in the boot trampoline. */
 extern struct e820entry e820map[];
-extern unsigned char e820nr;
+extern int e820nr;
 extern unsigned int lowmem_kb, highmem_kb;
 
+#define e820_raw bootsym(e820map)
+#define e820_raw_nr bootsym(e820nr)
+
 #endif /*__E820_HEADER*/

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.