aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexander van Heukelum <heukelum@mailshack.com>2008-03-01 11:12:43 -0500
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:40:52 -0400
commit320a6b2efceccb652befca0b1c9a92d6e4256ef6 (patch)
treeaa8e2e2009d9ac63b5f36952c085db9a25197221 /arch
parentf6eb62b6924b99ec7da97fb6f554685a9ad6dce4 (diff)
x86: reserve end-of-conventional-memory to 1MB, 64-bit
This patch is an add-on to the 64-bit ebda patch. It makes the functions reserve_ebda_region (renamed from reserve_ebda) and copy_e820_map equal to the 32-bit versions of the previous patch. Changes: Use u64 and u32 for local variables in copy_e820_map. The amount of conventional memory and the start of the EBDA are detected by reading the BIOS data area directly. Paravirtual environments do not provide this area, so we bail out early in that case. They will just have to set up a correct memory map to start with. Add a safety net for zeroed out BIOS data area. Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/e820_64.c8
-rw-r--r--arch/x86/kernel/head64.c28
2 files changed, 27 insertions, 9 deletions
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 8b914a833ac6..4a0953857cb2 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -621,10 +621,10 @@ static int __init copy_e820_map(struct e820entry *biosmap, int nr_map)
621 return -1; 621 return -1;
622 622
623 do { 623 do {
624 unsigned long start = biosmap->addr; 624 u64 start = biosmap->addr;
625 unsigned long size = biosmap->size; 625 u64 size = biosmap->size;
626 unsigned long end = start + size; 626 u64 end = start + size;
627 unsigned long type = biosmap->type; 627 u32 type = biosmap->type;
628 628
629 /* Overflow in 64 bits? Ignore the memory map. */ 629 /* Overflow in 64 bits? Ignore the memory map. */
630 if (start > end) 630 if (start > end)
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index b684552347df..269a6b481fe6 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -55,12 +55,30 @@ static void __init copy_bootdata(char *real_mode_data)
55/* 55/*
56 * The BIOS places the EBDA/XBDA at the top of conventional 56 * The BIOS places the EBDA/XBDA at the top of conventional
57 * memory, and usually decreases the reported amount of 57 * memory, and usually decreases the reported amount of
58 * conventional memory (int 0x12) too. 58 * conventional memory (int 0x12) too. This also contains a
59 * workaround for Dell systems that neglect to reserve EBDA.
60 * The same workaround also avoids a problem with the AMD768MPX
61 * chipset: reserve a page before VGA to prevent PCI prefetch
62 * into it (errata #56). Usually the page is reserved anyways,
63 * unless you have no PS/2 mouse plugged in.
59 */ 64 */
60static __init void reserve_ebda(void) 65static void __init reserve_ebda_region(void)
61{ 66{
62 unsigned int lowmem, ebda_addr; 67 unsigned int lowmem, ebda_addr;
63 68
69 /* To determine the position of the EBDA and the */
70 /* end of conventional memory, we need to look at */
71 /* the BIOS data area. In a paravirtual environment */
72 /* that area is absent. We'll just have to assume */
73 /* that the paravirt case can handle memory setup */
74 /* correctly, without our help. */
75#ifdef CONFIG_PARAVIRT
76 if ((boot_params.hdr.version >= 0x207) &&
77 (boot_params.hdr.hardware_subarch != 0)) {
78 return;
79 }
80#endif
81
64 /* end of low (conventional) memory */ 82 /* end of low (conventional) memory */
65 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES); 83 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
66 lowmem <<= 10; 84 lowmem <<= 10;
@@ -80,8 +98,8 @@ static __init void reserve_ebda(void)
80 lowmem = 0x9f000; 98 lowmem = 0x9f000;
81 99
82 /* Paranoia: should never happen, but... */ 100 /* Paranoia: should never happen, but... */
83 if (lowmem >= 0x100000) 101 if ((lowmem == 0) || (lowmem >= 0x100000))
84 lowmem = 0xa0000; 102 lowmem = 0x9f000;
85 103
86 /* reserve all memory between lowmem and the 1MB mark */ 104 /* reserve all memory between lowmem and the 1MB mark */
87 reserve_early(lowmem, 0x100000, "BIOS reserved"); 105 reserve_early(lowmem, 0x100000, "BIOS reserved");
@@ -140,7 +158,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
140 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK"); 158 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
141 } 159 }
142 160
143 reserve_ebda(); 161 reserve_ebda_region();
144 162
145 /* 163 /*
146 * At this point everything still needed from the boot loader 164 * At this point everything still needed from the boot loader