aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/head32.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel/head32.c')
-rw-r--r--arch/x86/kernel/head32.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 3db059058927..c216d3c2a991 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -8,7 +8,83 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/start_kernel.h> 9#include <linux/start_kernel.h>
10 10
11#include <asm/setup.h>
12#include <asm/sections.h>
13#include <asm/e820.h>
14#include <asm/bios_ebda.h>
15
16#define BIOS_LOWMEM_KILOBYTES 0x413
17
18/*
19 * The BIOS places the EBDA/XBDA at the top of conventional
20 * memory, and usually decreases the reported amount of
21 * conventional memory (int 0x12) too. This also contains a
22 * workaround for Dell systems that neglect to reserve EBDA.
23 * The same workaround also avoids a problem with the AMD768MPX
24 * chipset: reserve a page before VGA to prevent PCI prefetch
25 * into it (errata #56). Usually the page is reserved anyways,
26 * unless you have no PS/2 mouse plugged in.
27 */
28static void __init reserve_ebda_region(void)
29{
30 unsigned int lowmem, ebda_addr;
31
32 /* To determine the position of the EBDA and the */
33 /* end of conventional memory, we need to look at */
34 /* the BIOS data area. In a paravirtual environment */
35 /* that area is absent. We'll just have to assume */
36 /* that the paravirt case can handle memory setup */
37 /* correctly, without our help. */
38 if (paravirt_enabled())
39 return;
40
41 /* end of low (conventional) memory */
42 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
43 lowmem <<= 10;
44
45 /* start of EBDA area */
46 ebda_addr = get_bios_ebda();
47
48 /* Fixup: bios puts an EBDA in the top 64K segment */
49 /* of conventional memory, but does not adjust lowmem. */
50 if ((lowmem - ebda_addr) <= 0x10000)
51 lowmem = ebda_addr;
52
53 /* Fixup: bios does not report an EBDA at all. */
54 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
55 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
56 lowmem = 0x9f000;
57
58 /* Paranoia: should never happen, but... */
59 if ((lowmem == 0) || (lowmem >= 0x100000))
60 lowmem = 0x9f000;
61
62 /* reserve all memory between lowmem and the 1MB mark */
63 reserve_early(lowmem, 0x100000, "BIOS reserved");
64}
65
11void __init i386_start_kernel(void) 66void __init i386_start_kernel(void)
12{ 67{
68 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
69
70#ifdef CONFIG_BLK_DEV_INITRD
71 /* Reserve INITRD */
72 if (boot_params.hdr.type_of_loader && boot_params.hdr.ramdisk_image) {
73 u64 ramdisk_image = boot_params.hdr.ramdisk_image;
74 u64 ramdisk_size = boot_params.hdr.ramdisk_size;
75 u64 ramdisk_end = ramdisk_image + ramdisk_size;
76 reserve_early(ramdisk_image, ramdisk_end, "RAMDISK");
77 }
78#endif
79 reserve_early(__pa_symbol(&_end), init_pg_tables_end, "INIT_PG_TABLE");
80
81 reserve_ebda_region();
82
83 /*
84 * At this point everything still needed from the boot loader
85 * or BIOS or kernel text should be early reserved or marked not
86 * RAM in e820. All other memory is free game.
87 */
88
13 start_kernel(); 89 start_kernel();
14} 90}