RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / x86 / kernel / head.c
blob1882f74c720385701d5f2346a06d1b3c9fd7ee94
1 #include <linux/kernel.h>
2 #include <linux/init.h>
4 #include <asm/setup.h>
5 #include <asm/bios_ebda.h>
7 #define BIOS_LOWMEM_KILOBYTES 0x413
9 void __init reserve_ebda_region(void)
11 unsigned int lowmem, ebda_addr;
13 /* To determine the position of the EBDA and the */
14 /* end of conventional memory, we need to look at */
15 /* the BIOS data area. In a paravirtual environment */
16 /* that area is absent. We'll just have to assume */
17 /* that the paravirt case can handle memory setup */
18 /* correctly, without our help. */
19 if (paravirt_enabled())
20 return;
22 /* end of low (conventional) memory */
23 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
24 lowmem <<= 10;
26 /* start of EBDA area */
27 ebda_addr = get_bios_ebda();
29 /* Fixup: bios puts an EBDA in the top 64K segment */
30 /* of conventional memory, but does not adjust lowmem. */
31 if ((lowmem - ebda_addr) <= 0x10000)
32 lowmem = ebda_addr;
34 /* Fixup: bios does not report an EBDA at all. */
35 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
36 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
37 lowmem = 0x9f000;
39 /* Paranoia: should never happen, but... */
40 if ((lowmem == 0) || (lowmem >= 0x100000))
41 lowmem = 0x9f000;
43 /* reserve all memory between lowmem and the 1MB mark */
44 reserve_early_overlap_ok(lowmem, 0x100000, "BIOS reserved");