direct-io.hg

changeset 15238:345ae2e61ba0

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@xensource.com>
author kfraser@localhost.localdomain
date Thu Jun 07 20:02:27 2007 +0100 (2007-06-07)
parents a5ae31a91b10
children 656b8175f4f2
files xen/arch/x86/boot/mem.S xen/arch/x86/e820.c xen/arch/x86/setup.c xen/include/asm-x86/e820.h
line diff
     1.1 --- a/xen/arch/x86/boot/mem.S	Thu Jun 07 19:41:59 2007 +0100
     1.2 +++ b/xen/arch/x86/boot/mem.S	Thu Jun 07 20:02:27 2007 +0100
     1.3 @@ -71,7 +71,7 @@ 1:      andl    $0xffff,%edx            
     1.4  e820map:
     1.5          .fill   E820MAX*20,1,0
     1.6  e820nr:
     1.7 -        .byte   0
     1.8 +        .long   0
     1.9  lowmem_kb:
    1.10          .long   0
    1.11  highmem_kb:
     2.1 --- a/xen/arch/x86/e820.c	Thu Jun 07 19:41:59 2007 +0100
     2.2 +++ b/xen/arch/x86/e820.c	Thu Jun 07 20:02:27 2007 +0100
     2.3 @@ -412,10 +412,11 @@ static void __init machine_specific_memo
     2.4      clip_mem();
     2.5  }
     2.6  
     2.7 -unsigned long __init init_e820(struct e820entry *raw, int *raw_nr)
     2.8 +unsigned long __init init_e820(
     2.9 +    const char *str, struct e820entry *raw, int *raw_nr)
    2.10  {
    2.11      machine_specific_memory_setup(raw, raw_nr);
    2.12 -    printk(KERN_INFO "Physical RAM map:\n");
    2.13 +    printk(KERN_INFO "%s RAM map:\n", str);
    2.14      print_e820_memory_map(e820.map, e820.nr_map);
    2.15      return find_max_pfn();
    2.16  }
     3.1 --- a/xen/arch/x86/setup.c	Thu Jun 07 19:41:59 2007 +0100
     3.2 +++ b/xen/arch/x86/setup.c	Thu Jun 07 20:02:27 2007 +0100
     3.3 @@ -162,8 +162,6 @@ static void __init do_initcalls(void)
     3.4      for ( ; ; ) __asm__ __volatile__ ( "hlt" ); \
     3.5  } while (0)
     3.6  
     3.7 -static struct e820entry __initdata e820_raw[E820MAX];
     3.8 -
     3.9  static unsigned long __initdata initial_images_start, initial_images_end;
    3.10  
    3.11  unsigned long __init initial_images_nrpages(void)
    3.12 @@ -338,6 +336,7 @@ void init_done(void)
    3.13  
    3.14  void __init __start_xen(multiboot_info_t *mbi)
    3.15  {
    3.16 +    char *memmap_type = NULL;
    3.17      char __cmdline[] = "", *cmdline = __cmdline;
    3.18      unsigned long _initrd_start = 0, _initrd_len = 0;
    3.19      unsigned int initrdidx = 1;
    3.20 @@ -345,7 +344,7 @@ void __init __start_xen(multiboot_info_t
    3.21      unsigned long _policy_len = 0;
    3.22      module_t *mod = (module_t *)__va(mbi->mods_addr);
    3.23      unsigned long nr_pages, modules_length;
    3.24 -    int i, e820_warn = 0, e820_raw_nr = 0, bytes = 0;
    3.25 +    int i, e820_warn = 0, bytes = 0;
    3.26      struct ns16550_defaults ns16550 = {
    3.27          .data_bits = 8,
    3.28          .parity    = 'n',
    3.29 @@ -395,23 +394,24 @@ void __init __start_xen(multiboot_info_t
    3.30      if ( opt_xenheap_megabytes > 2048 )
    3.31          opt_xenheap_megabytes = 2048;
    3.32  
    3.33 -    if ( bootsym(e820nr) != 0 )
    3.34 +    if ( e820_raw_nr != 0 )
    3.35      {
    3.36 -        e820_raw_nr = bootsym(e820nr);
    3.37 -        memcpy(e820_raw, bootsym(e820map), e820_raw_nr * sizeof(e820_raw[0]));
    3.38 +        memmap_type = "Xen-e820";
    3.39      }
    3.40 -    else if ( lowmem_kb )
    3.41 +    else if ( bootsym(lowmem_kb) )
    3.42      {
    3.43 +        memmap_type = "Xen-e801";
    3.44          e820_raw[0].addr = 0;
    3.45 -        e820_raw[0].size = lowmem_kb << 10;
    3.46 +        e820_raw[0].size = bootsym(lowmem_kb) << 10;
    3.47          e820_raw[0].type = E820_RAM;
    3.48          e820_raw[1].addr = 0x100000;
    3.49 -        e820_raw[1].size = highmem_kb << 10;
    3.50 +        e820_raw[1].size = bootsym(highmem_kb) << 10;
    3.51          e820_raw[1].type = E820_RAM;
    3.52          e820_raw_nr = 2;
    3.53      }
    3.54      else if ( mbi->flags & MBI_MEMMAP )
    3.55      {
    3.56 +        memmap_type = "Multiboot-e820";
    3.57          while ( bytes < mbi->mmap_length )
    3.58          {
    3.59              memory_map_t *map = __va(mbi->mmap_addr + bytes);
    3.60 @@ -449,6 +449,7 @@ void __init __start_xen(multiboot_info_t
    3.61      }
    3.62      else if ( mbi->flags & MBI_MEMLIMITS )
    3.63      {
    3.64 +        memmap_type = "Multiboot-e801";
    3.65          e820_raw[0].addr = 0;
    3.66          e820_raw[0].size = mbi->mem_lower << 10;
    3.67          e820_raw[0].type = E820_RAM;
    3.68 @@ -480,7 +481,7 @@ void __init __start_xen(multiboot_info_t
    3.69      }
    3.70  
    3.71      /* Sanitise the raw E820 map to produce a final clean version. */
    3.72 -    max_page = init_e820(e820_raw, &e820_raw_nr);
    3.73 +    max_page = init_e820(memmap_type, e820_raw, &e820_raw_nr);
    3.74  
    3.75      /*
    3.76       * Create a temporary copy of the E820 map. Truncate it to above 16MB
     4.1 --- a/xen/include/asm-x86/e820.h	Thu Jun 07 19:41:59 2007 +0100
     4.2 +++ b/xen/include/asm-x86/e820.h	Thu Jun 07 20:02:27 2007 +0100
     4.3 @@ -10,12 +10,15 @@ struct e820map {
     4.4      struct e820entry map[E820MAX];
     4.5  };
     4.6  
     4.7 -extern unsigned long init_e820(struct e820entry *, int *);
     4.8 +extern unsigned long init_e820(const char *, struct e820entry *, int *);
     4.9  extern struct e820map e820;
    4.10  
    4.11  /* These symbols live in the boot trampoline. */
    4.12  extern struct e820entry e820map[];
    4.13 -extern unsigned char e820nr;
    4.14 +extern int e820nr;
    4.15  extern unsigned int lowmem_kb, highmem_kb;
    4.16  
    4.17 +#define e820_raw bootsym(e820map)
    4.18 +#define e820_raw_nr bootsym(e820nr)
    4.19 +
    4.20  #endif /*__E820_HEADER*/