• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/arch/x86/kernel/
1#include <linux/kernel.h>
2#include <linux/init.h>
3
4#include <asm/setup.h>
5#include <asm/bios_ebda.h>
6
7#define BIOS_LOWMEM_KILOBYTES 0x413
8
9void __init reserve_ebda_region(void)
10{
11	unsigned int lowmem, ebda_addr;
12
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;
21
22	/* end of low (conventional) memory */
23	lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
24	lowmem <<= 10;
25
26	/* start of EBDA area */
27	ebda_addr = get_bios_ebda();
28
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;
33
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;
38
39	/* Paranoia: should never happen, but... */
40	if ((lowmem == 0) || (lowmem >= 0x100000))
41		lowmem = 0x9f000;
42
43	/* reserve all memory between lowmem and the 1MB mark */
44	reserve_early_overlap_ok(lowmem, 0x100000, "BIOS reserved");
45}
46