aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/e820_32.c110
-rw-r--r--arch/x86/kernel/e820_64.c11
-rw-r--r--arch/x86/kernel/setup_32.c106
-rw-r--r--arch/x86/kernel/setup_64.c8
4 files changed, 115 insertions, 120 deletions
diff --git a/arch/x86/kernel/e820_32.c b/arch/x86/kernel/e820_32.c
index 18f500d185a2..87cadc86d5ee 100644
--- a/arch/x86/kernel/e820_32.c
+++ b/arch/x86/kernel/e820_32.c
@@ -37,26 +37,6 @@ unsigned long pci_mem_start = 0x10000000;
37EXPORT_SYMBOL(pci_mem_start); 37EXPORT_SYMBOL(pci_mem_start);
38#endif 38#endif
39extern int user_defined_memmap; 39extern int user_defined_memmap;
40struct resource data_resource = {
41 .name = "Kernel data",
42 .start = 0,
43 .end = 0,
44 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
45};
46
47struct resource code_resource = {
48 .name = "Kernel code",
49 .start = 0,
50 .end = 0,
51 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
52};
53
54struct resource bss_resource = {
55 .name = "Kernel bss",
56 .start = 0,
57 .end = 0,
58 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
59};
60 40
61static struct resource system_rom_resource = { 41static struct resource system_rom_resource = {
62 .name = "System ROM", 42 .name = "System ROM",
@@ -111,60 +91,6 @@ static struct resource video_rom_resource = {
111 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM 91 .flags = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
112}; 92};
113 93
114static struct resource video_ram_resource = {
115 .name = "Video RAM area",
116 .start = 0xa0000,
117 .end = 0xbffff,
118 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
119};
120
121static struct resource standard_io_resources[] = { {
122 .name = "dma1",
123 .start = 0x0000,
124 .end = 0x001f,
125 .flags = IORESOURCE_BUSY | IORESOURCE_IO
126}, {
127 .name = "pic1",
128 .start = 0x0020,
129 .end = 0x0021,
130 .flags = IORESOURCE_BUSY | IORESOURCE_IO
131}, {
132 .name = "timer0",
133 .start = 0x0040,
134 .end = 0x0043,
135 .flags = IORESOURCE_BUSY | IORESOURCE_IO
136}, {
137 .name = "timer1",
138 .start = 0x0050,
139 .end = 0x0053,
140 .flags = IORESOURCE_BUSY | IORESOURCE_IO
141}, {
142 .name = "keyboard",
143 .start = 0x0060,
144 .end = 0x006f,
145 .flags = IORESOURCE_BUSY | IORESOURCE_IO
146}, {
147 .name = "dma page reg",
148 .start = 0x0080,
149 .end = 0x008f,
150 .flags = IORESOURCE_BUSY | IORESOURCE_IO
151}, {
152 .name = "pic2",
153 .start = 0x00a0,
154 .end = 0x00a1,
155 .flags = IORESOURCE_BUSY | IORESOURCE_IO
156}, {
157 .name = "dma2",
158 .start = 0x00c0,
159 .end = 0x00df,
160 .flags = IORESOURCE_BUSY | IORESOURCE_IO
161}, {
162 .name = "fpu",
163 .start = 0x00f0,
164 .end = 0x00ff,
165 .flags = IORESOURCE_BUSY | IORESOURCE_IO
166} };
167
168#define ROMSIGNATURE 0xaa55 94#define ROMSIGNATURE 0xaa55
169 95
170static int __init romsignature(const unsigned char *rom) 96static int __init romsignature(const unsigned char *rom)
@@ -260,10 +186,9 @@ static void __init probe_roms(void)
260 * Request address space for all standard RAM and ROM resources 186 * Request address space for all standard RAM and ROM resources
261 * and also for regions reported as reserved by the e820. 187 * and also for regions reported as reserved by the e820.
262 */ 188 */
263static void __init 189void __init legacy_init_iomem_resources(struct resource *code_resource,
264legacy_init_iomem_resources(struct resource *code_resource, 190 struct resource *data_resource,
265 struct resource *data_resource, 191 struct resource *bss_resource)
266 struct resource *bss_resource)
267{ 192{
268 int i; 193 int i;
269 194
@@ -305,35 +230,6 @@ legacy_init_iomem_resources(struct resource *code_resource,
305 } 230 }
306} 231}
307 232
308/*
309 * Request address space for all standard resources
310 *
311 * This is called just before pcibios_init(), which is also a
312 * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
313 */
314static int __init request_standard_resources(void)
315{
316 int i;
317
318 printk("Setting up standard PCI resources\n");
319 if (efi_enabled)
320 efi_initialize_iomem_resources(&code_resource,
321 &data_resource, &bss_resource);
322 else
323 legacy_init_iomem_resources(&code_resource,
324 &data_resource, &bss_resource);
325
326 /* EFI systems may still have VGA */
327 request_resource(&iomem_resource, &video_ram_resource);
328
329 /* request I/O space for devices used on all i[345]86 PCs */
330 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
331 request_resource(&ioport_resource, &standard_io_resources[i]);
332 return 0;
333}
334
335subsys_initcall(request_standard_resources);
336
337#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION) 233#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
338/** 234/**
339 * e820_mark_nosave_regions - Find the ranges of physical addresses that do not 235 * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c
index 11a3d65db0c1..151236896243 100644
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -47,8 +47,6 @@ unsigned long end_pfn_map;
47 */ 47 */
48static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT; 48static unsigned long __initdata end_user_pfn = MAXMEM>>PAGE_SHIFT;
49 49
50extern struct resource code_resource, data_resource, bss_resource;
51
52/* Check for some hardcoded bad areas that early boot is not allowed to touch */ 50/* Check for some hardcoded bad areas that early boot is not allowed to touch */
53static inline int bad_addr(unsigned long *addrp, unsigned long size) 51static inline int bad_addr(unsigned long *addrp, unsigned long size)
54{ 52{
@@ -213,7 +211,8 @@ unsigned long __init e820_end_of_ram(void)
213/* 211/*
214 * Mark e820 reserved areas as busy for the resource manager. 212 * Mark e820 reserved areas as busy for the resource manager.
215 */ 213 */
216void __init e820_reserve_resources(void) 214void __init e820_reserve_resources(struct resource *code_resource,
215 struct resource *data_resource, struct resource *bss_resource)
217{ 216{
218 int i; 217 int i;
219 for (i = 0; i < e820.nr_map; i++) { 218 for (i = 0; i < e820.nr_map; i++) {
@@ -235,9 +234,9 @@ void __init e820_reserve_resources(void)
235 * so we try it repeatedly and let the resource manager 234 * so we try it repeatedly and let the resource manager
236 * test it. 235 * test it.
237 */ 236 */
238 request_resource(res, &code_resource); 237 request_resource(res, code_resource);
239 request_resource(res, &data_resource); 238 request_resource(res, data_resource);
240 request_resource(res, &bss_resource); 239 request_resource(res, bss_resource);
241#ifdef CONFIG_KEXEC 240#ifdef CONFIG_KEXEC
242 if (crashk_res.start != crashk_res.end) 241 if (crashk_res.start != crashk_res.end)
243 request_resource(res, &crashk_res); 242 request_resource(res, &crashk_res);
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 236d30b264d8..32edf70d6b0d 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -73,9 +73,80 @@ int disable_pse __cpuinitdata = 0;
73/* 73/*
74 * Machine setup.. 74 * Machine setup..
75 */ 75 */
76extern struct resource code_resource; 76static struct resource data_resource = {
77extern struct resource data_resource; 77 .name = "Kernel data",
78extern struct resource bss_resource; 78 .start = 0,
79 .end = 0,
80 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
81};
82
83static struct resource code_resource = {
84 .name = "Kernel code",
85 .start = 0,
86 .end = 0,
87 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
88};
89
90static struct resource bss_resource = {
91 .name = "Kernel bss",
92 .start = 0,
93 .end = 0,
94 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
95};
96
97static struct resource video_ram_resource = {
98 .name = "Video RAM area",
99 .start = 0xa0000,
100 .end = 0xbffff,
101 .flags = IORESOURCE_BUSY | IORESOURCE_MEM
102};
103
104static struct resource standard_io_resources[] = { {
105 .name = "dma1",
106 .start = 0x0000,
107 .end = 0x001f,
108 .flags = IORESOURCE_BUSY | IORESOURCE_IO
109}, {
110 .name = "pic1",
111 .start = 0x0020,
112 .end = 0x0021,
113 .flags = IORESOURCE_BUSY | IORESOURCE_IO
114}, {
115 .name = "timer0",
116 .start = 0x0040,
117 .end = 0x0043,
118 .flags = IORESOURCE_BUSY | IORESOURCE_IO
119}, {
120 .name = "timer1",
121 .start = 0x0050,
122 .end = 0x0053,
123 .flags = IORESOURCE_BUSY | IORESOURCE_IO
124}, {
125 .name = "keyboard",
126 .start = 0x0060,
127 .end = 0x006f,
128 .flags = IORESOURCE_BUSY | IORESOURCE_IO
129}, {
130 .name = "dma page reg",
131 .start = 0x0080,
132 .end = 0x008f,
133 .flags = IORESOURCE_BUSY | IORESOURCE_IO
134}, {
135 .name = "pic2",
136 .start = 0x00a0,
137 .end = 0x00a1,
138 .flags = IORESOURCE_BUSY | IORESOURCE_IO
139}, {
140 .name = "dma2",
141 .start = 0x00c0,
142 .end = 0x00df,
143 .flags = IORESOURCE_BUSY | IORESOURCE_IO
144}, {
145 .name = "fpu",
146 .start = 0x00f0,
147 .end = 0x00ff,
148 .flags = IORESOURCE_BUSY | IORESOURCE_IO
149} };
79 150
80/* cpu data as detected by the assembly code in head.S */ 151/* cpu data as detected by the assembly code in head.S */
81struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 }; 152struct cpuinfo_x86 new_cpu_data __cpuinitdata = { 0, 0, 0, 0, -1, 1, 0, 0, -1 };
@@ -693,3 +764,32 @@ void __init setup_arch(char **cmdline_p)
693#endif 764#endif
694#endif 765#endif
695} 766}
767
768/*
769 * Request address space for all standard resources
770 *
771 * This is called just before pcibios_init(), which is also a
772 * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
773 */
774static int __init request_standard_resources(void)
775{
776 int i;
777
778 printk(KERN_INFO "Setting up standard PCI resources\n");
779 if (efi_enabled)
780 efi_initialize_iomem_resources(&code_resource,
781 &data_resource, &bss_resource);
782 else
783 legacy_init_iomem_resources(&code_resource,
784 &data_resource, &bss_resource);
785
786 /* EFI systems may still have VGA */
787 request_resource(&iomem_resource, &video_ram_resource);
788
789 /* request I/O space for devices used on all i[345]86 PCs */
790 for (i = 0; i < ARRAY_SIZE(standard_io_resources); i++)
791 request_resource(&ioport_resource, &standard_io_resources[i]);
792 return 0;
793}
794
795subsys_initcall(request_standard_resources);
diff --git a/arch/x86/kernel/setup_64.c b/arch/x86/kernel/setup_64.c
index bcb5f3aaa097..1acb435a0585 100644
--- a/arch/x86/kernel/setup_64.c
+++ b/arch/x86/kernel/setup_64.c
@@ -123,19 +123,19 @@ struct resource standard_io_resources[] = {
123 123
124#define IORESOURCE_RAM (IORESOURCE_BUSY | IORESOURCE_MEM) 124#define IORESOURCE_RAM (IORESOURCE_BUSY | IORESOURCE_MEM)
125 125
126struct resource data_resource = { 126static struct resource data_resource = {
127 .name = "Kernel data", 127 .name = "Kernel data",
128 .start = 0, 128 .start = 0,
129 .end = 0, 129 .end = 0,
130 .flags = IORESOURCE_RAM, 130 .flags = IORESOURCE_RAM,
131}; 131};
132struct resource code_resource = { 132static struct resource code_resource = {
133 .name = "Kernel code", 133 .name = "Kernel code",
134 .start = 0, 134 .start = 0,
135 .end = 0, 135 .end = 0,
136 .flags = IORESOURCE_RAM, 136 .flags = IORESOURCE_RAM,
137}; 137};
138struct resource bss_resource = { 138static struct resource bss_resource = {
139 .name = "Kernel bss", 139 .name = "Kernel bss",
140 .start = 0, 140 .start = 0,
141 .end = 0, 141 .end = 0,
@@ -438,7 +438,7 @@ void __init setup_arch(char **cmdline_p)
438 /* 438 /*
439 * We trust e820 completely. No explicit ROM probing in memory. 439 * We trust e820 completely. No explicit ROM probing in memory.
440 */ 440 */
441 e820_reserve_resources(); 441 e820_reserve_resources(&code_resource, &data_resource, &bss_resource);
442 e820_mark_nosave_regions(); 442 e820_mark_nosave_regions();
443 443
444 { 444 {