aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/Makefile1
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/head.c55
-rw-r--r--arch/x86/kernel/head32.c50
-rw-r--r--arch/x86/kernel/head64.c50
5 files changed, 57 insertions, 101 deletions
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 3cff3c894cf3..30b046bcccb6 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -160,6 +160,7 @@ KBUILD_AFLAGS += $(mflags-y)
160 160
161head-y := arch/x86/kernel/head_$(BITS).o 161head-y := arch/x86/kernel/head_$(BITS).o
162head-y += arch/x86/kernel/head$(BITS).o 162head-y += arch/x86/kernel/head$(BITS).o
163head-y += arch/x86/kernel/head.o
163head-y += arch/x86/kernel/init_task.o 164head-y += arch/x86/kernel/init_task.o
164 165
165libs-y += arch/x86/lib/ 166libs-y += arch/x86/lib/
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 5369a4e36f17..7e01ce39c836 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5extra-y := head_$(BITS).o head$(BITS).o init_task.o vmlinux.lds 5extra-y := head_$(BITS).o head$(BITS).o head.o init_task.o vmlinux.lds
6 6
7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE) 7CPPFLAGS_vmlinux.lds += -U$(UTS_MACHINE)
8 8
diff --git a/arch/x86/kernel/head.c b/arch/x86/kernel/head.c
new file mode 100644
index 000000000000..e0d0ce58979e
--- /dev/null
+++ b/arch/x86/kernel/head.c
@@ -0,0 +1,55 @@
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
9/*
10 * The BIOS places the EBDA/XBDA at the top of conventional
11 * memory, and usually decreases the reported amount of
12 * conventional memory (int 0x12) too. This also contains a
13 * workaround for Dell systems that neglect to reserve EBDA.
14 * The same workaround also avoids a problem with the AMD768MPX
15 * chipset: reserve a page before VGA to prevent PCI prefetch
16 * into it (errata #56). Usually the page is reserved anyways,
17 * unless you have no PS/2 mouse plugged in.
18 */
19void __init reserve_ebda_region(void)
20{
21 unsigned int lowmem, ebda_addr;
22
23 /* To determine the position of the EBDA and the */
24 /* end of conventional memory, we need to look at */
25 /* the BIOS data area. In a paravirtual environment */
26 /* that area is absent. We'll just have to assume */
27 /* that the paravirt case can handle memory setup */
28 /* correctly, without our help. */
29 if (paravirt_enabled())
30 return;
31
32 /* end of low (conventional) memory */
33 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
34 lowmem <<= 10;
35
36 /* start of EBDA area */
37 ebda_addr = get_bios_ebda();
38
39 /* Fixup: bios puts an EBDA in the top 64K segment */
40 /* of conventional memory, but does not adjust lowmem. */
41 if ((lowmem - ebda_addr) <= 0x10000)
42 lowmem = ebda_addr;
43
44 /* Fixup: bios does not report an EBDA at all. */
45 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
46 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
47 lowmem = 0x9f000;
48
49 /* Paranoia: should never happen, but... */
50 if ((lowmem == 0) || (lowmem >= 0x100000))
51 lowmem = 0x9f000;
52
53 /* reserve all memory between lowmem and the 1MB mark */
54 reserve_early(lowmem, 0x100000, "BIOS reserved");
55}
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 0b6cb9fba71e..fa1d25dd83e3 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -13,56 +13,6 @@
13#include <asm/e820.h> 13#include <asm/e820.h>
14#include <asm/bios_ebda.h> 14#include <asm/bios_ebda.h>
15 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
66void __init i386_start_kernel(void) 16void __init i386_start_kernel(void)
67{ 17{
68 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS"); 18 reserve_early(__pa_symbol(&_text), __pa_symbol(&_end), "TEXT DATA BSS");
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index e25c57b8aa84..f1773c8ee21e 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -51,56 +51,6 @@ static void __init copy_bootdata(char *real_mode_data)
51 } 51 }
52} 52}
53 53
54#define BIOS_LOWMEM_KILOBYTES 0x413
55
56/*
57 * The BIOS places the EBDA/XBDA at the top of conventional
58 * memory, and usually decreases the reported amount of
59 * conventional memory (int 0x12) too. This also contains a
60 * workaround for Dell systems that neglect to reserve EBDA.
61 * The same workaround also avoids a problem with the AMD768MPX
62 * chipset: reserve a page before VGA to prevent PCI prefetch
63 * into it (errata #56). Usually the page is reserved anyways,
64 * unless you have no PS/2 mouse plugged in.
65 */
66static void __init reserve_ebda_region(void)
67{
68 unsigned int lowmem, ebda_addr;
69
70 /* To determine the position of the EBDA and the */
71 /* end of conventional memory, we need to look at */
72 /* the BIOS data area. In a paravirtual environment */
73 /* that area is absent. We'll just have to assume */
74 /* that the paravirt case can handle memory setup */
75 /* correctly, without our help. */
76 if (paravirt_enabled())
77 return;
78
79 /* end of low (conventional) memory */
80 lowmem = *(unsigned short *)__va(BIOS_LOWMEM_KILOBYTES);
81 lowmem <<= 10;
82
83 /* start of EBDA area */
84 ebda_addr = get_bios_ebda();
85
86 /* Fixup: bios puts an EBDA in the top 64K segment */
87 /* of conventional memory, but does not adjust lowmem. */
88 if ((lowmem - ebda_addr) <= 0x10000)
89 lowmem = ebda_addr;
90
91 /* Fixup: bios does not report an EBDA at all. */
92 /* Some old Dells seem to need 4k anyhow (bugzilla 2990) */
93 if ((ebda_addr == 0) && (lowmem >= 0x9f000))
94 lowmem = 0x9f000;
95
96 /* Paranoia: should never happen, but... */
97 if ((lowmem == 0) || (lowmem >= 0x100000))
98 lowmem = 0x9f000;
99
100 /* reserve all memory between lowmem and the 1MB mark */
101 reserve_early(lowmem, 0x100000, "BIOS reserved");
102}
103
104static void __init reserve_setup_data(void) 54static void __init reserve_setup_data(void)
105{ 55{
106 struct setup_data *data; 56 struct setup_data *data;