diff options
author | Jeremy Fitzhardinge <jeremy@xensource.com> | 2006-06-25 08:46:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-25 13:00:55 -0400 |
commit | e75eac33b5c7f797e4b2ddcb39183cf268e26822 (patch) | |
tree | 3c87328055c5975ca9d69df56dcc4a1d9066352c | |
parent | e6a1530d692d6a60cdf15dfbcfea07f5324d7b9f (diff) |
[PATCH] Clean up and refactor i386 sub-architecture setup
Clean up and refactor i386 sub-architecture setup.
This change moves all the code from the
asm-i386/mach-*/setup_arch_pre/post.h headers, into
arch/i386/mach-*/setup.c. mach-*/setup_arch_pre.h is renamed to
setup_arch.h, and contains only things which should be in header files. It
is purely code-motion; there should be no functional changes at all.
Several functions in arch/i386/kernel/setup.c needed to be made non-static
so that they're visible to the code in mach-*/setup.c. asm-i386/setup.h is
used to hold the prototypes for these functions.
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Cc: Zachary Amsden <zach@vmware.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Cc: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
Cc: Martin Bligh <mbligh@google.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Andrey Panin <pazke@donpac.ru>
Cc: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | arch/i386/kernel/setup.c | 19 | ||||
-rw-r--r-- | arch/i386/mach-default/setup.c | 43 | ||||
-rw-r--r-- | arch/i386/mach-visws/setup.c | 49 | ||||
-rw-r--r-- | arch/i386/mach-voyager/setup.c | 74 | ||||
-rw-r--r-- | include/asm-i386/mach-default/setup_arch.h (renamed from include/asm-i386/mach-default/setup_arch_pre.h) | 0 | ||||
-rw-r--r-- | include/asm-i386/mach-default/setup_arch_post.h | 40 | ||||
-rw-r--r-- | include/asm-i386/mach-visws/setup_arch.h (renamed from include/asm-i386/mach-visws/setup_arch_pre.h) | 0 | ||||
-rw-r--r-- | include/asm-i386/mach-visws/setup_arch_post.h | 49 | ||||
-rw-r--r-- | include/asm-i386/mach-voyager/setup_arch.h (renamed from include/asm-i386/mach-voyager/setup_arch_pre.h) | 2 | ||||
-rw-r--r-- | include/asm-i386/mach-voyager/setup_arch_post.h | 73 | ||||
-rw-r--r-- | include/asm-i386/setup.h | 15 |
11 files changed, 187 insertions, 177 deletions
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c index e6023970aa40..6c1639836e06 100644 --- a/arch/i386/kernel/setup.c +++ b/arch/i386/kernel/setup.c | |||
@@ -61,7 +61,7 @@ | |||
61 | #include <asm/io_apic.h> | 61 | #include <asm/io_apic.h> |
62 | #include <asm/ist.h> | 62 | #include <asm/ist.h> |
63 | #include <asm/io.h> | 63 | #include <asm/io.h> |
64 | #include "setup_arch_pre.h" | 64 | #include <setup_arch.h> |
65 | #include <bios_ebda.h> | 65 | #include <bios_ebda.h> |
66 | 66 | ||
67 | /* Forward Declaration. */ | 67 | /* Forward Declaration. */ |
@@ -411,8 +411,8 @@ static void __init limit_regions(unsigned long long size) | |||
411 | } | 411 | } |
412 | } | 412 | } |
413 | 413 | ||
414 | static void __init add_memory_region(unsigned long long start, | 414 | void __init add_memory_region(unsigned long long start, |
415 | unsigned long long size, int type) | 415 | unsigned long long size, int type) |
416 | { | 416 | { |
417 | int x; | 417 | int x; |
418 | 418 | ||
@@ -475,7 +475,7 @@ static struct change_member *change_point[2*E820MAX] __initdata; | |||
475 | static struct e820entry *overlap_list[E820MAX] __initdata; | 475 | static struct e820entry *overlap_list[E820MAX] __initdata; |
476 | static struct e820entry new_bios[E820MAX] __initdata; | 476 | static struct e820entry new_bios[E820MAX] __initdata; |
477 | 477 | ||
478 | static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map) | 478 | int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map) |
479 | { | 479 | { |
480 | struct change_member *change_tmp; | 480 | struct change_member *change_tmp; |
481 | unsigned long current_type, last_type; | 481 | unsigned long current_type, last_type; |
@@ -644,7 +644,7 @@ static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map) | |||
644 | * thinkpad 560x, for example, does not cooperate with the memory | 644 | * thinkpad 560x, for example, does not cooperate with the memory |
645 | * detection code.) | 645 | * detection code.) |
646 | */ | 646 | */ |
647 | static int __init copy_e820_map(struct e820entry * biosmap, int nr_map) | 647 | int __init copy_e820_map(struct e820entry * biosmap, int nr_map) |
648 | { | 648 | { |
649 | /* Only one memory region (or negative)? Ignore it */ | 649 | /* Only one memory region (or negative)? Ignore it */ |
650 | if (nr_map < 2) | 650 | if (nr_map < 2) |
@@ -702,12 +702,6 @@ static inline void copy_edd(void) | |||
702 | } | 702 | } |
703 | #endif | 703 | #endif |
704 | 704 | ||
705 | /* | ||
706 | * Do NOT EVER look at the BIOS memory size location. | ||
707 | * It does not work on many machines. | ||
708 | */ | ||
709 | #define LOWMEMSIZE() (0x9f000) | ||
710 | |||
711 | static void __init parse_cmdline_early (char ** cmdline_p) | 705 | static void __init parse_cmdline_early (char ** cmdline_p) |
712 | { | 706 | { |
713 | char c = ' ', *to = command_line, *from = saved_command_line; | 707 | char c = ' ', *to = command_line, *from = saved_command_line; |
@@ -1424,8 +1418,6 @@ static void __init register_memory(void) | |||
1424 | pci_mem_start, gapstart, gapsize); | 1418 | pci_mem_start, gapstart, gapsize); |
1425 | } | 1419 | } |
1426 | 1420 | ||
1427 | static char * __init machine_specific_memory_setup(void); | ||
1428 | |||
1429 | #ifdef CONFIG_MCA | 1421 | #ifdef CONFIG_MCA |
1430 | static void set_mca_bus(int x) | 1422 | static void set_mca_bus(int x) |
1431 | { | 1423 | { |
@@ -1708,7 +1700,6 @@ static __init int add_pcspkr(void) | |||
1708 | } | 1700 | } |
1709 | device_initcall(add_pcspkr); | 1701 | device_initcall(add_pcspkr); |
1710 | 1702 | ||
1711 | #include "setup_arch_post.h" | ||
1712 | /* | 1703 | /* |
1713 | * Local Variables: | 1704 | * Local Variables: |
1714 | * mode:c | 1705 | * mode:c |
diff --git a/arch/i386/mach-default/setup.c b/arch/i386/mach-default/setup.c index b4a7455c6993..004837c58793 100644 --- a/arch/i386/mach-default/setup.c +++ b/arch/i386/mach-default/setup.c | |||
@@ -8,6 +8,8 @@ | |||
8 | #include <linux/interrupt.h> | 8 | #include <linux/interrupt.h> |
9 | #include <asm/acpi.h> | 9 | #include <asm/acpi.h> |
10 | #include <asm/arch_hooks.h> | 10 | #include <asm/arch_hooks.h> |
11 | #include <asm/e820.h> | ||
12 | #include <asm/setup.h> | ||
11 | 13 | ||
12 | #ifdef CONFIG_HOTPLUG_CPU | 14 | #ifdef CONFIG_HOTPLUG_CPU |
13 | #define DEFAULT_SEND_IPI (1) | 15 | #define DEFAULT_SEND_IPI (1) |
@@ -130,3 +132,44 @@ static int __init print_ipi_mode(void) | |||
130 | } | 132 | } |
131 | 133 | ||
132 | late_initcall(print_ipi_mode); | 134 | late_initcall(print_ipi_mode); |
135 | |||
136 | /** | ||
137 | * machine_specific_memory_setup - Hook for machine specific memory setup. | ||
138 | * | ||
139 | * Description: | ||
140 | * This is included late in kernel/setup.c so that it can make | ||
141 | * use of all of the static functions. | ||
142 | **/ | ||
143 | |||
144 | char * __init machine_specific_memory_setup(void) | ||
145 | { | ||
146 | char *who; | ||
147 | |||
148 | |||
149 | who = "BIOS-e820"; | ||
150 | |||
151 | /* | ||
152 | * Try to copy the BIOS-supplied E820-map. | ||
153 | * | ||
154 | * Otherwise fake a memory map; one section from 0k->640k, | ||
155 | * the next section from 1mb->appropriate_mem_k | ||
156 | */ | ||
157 | sanitize_e820_map(E820_MAP, &E820_MAP_NR); | ||
158 | if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { | ||
159 | unsigned long mem_size; | ||
160 | |||
161 | /* compare results from other methods and take the greater */ | ||
162 | if (ALT_MEM_K < EXT_MEM_K) { | ||
163 | mem_size = EXT_MEM_K; | ||
164 | who = "BIOS-88"; | ||
165 | } else { | ||
166 | mem_size = ALT_MEM_K; | ||
167 | who = "BIOS-e801"; | ||
168 | } | ||
169 | |||
170 | e820.nr_map = 0; | ||
171 | add_memory_region(0, LOWMEMSIZE(), E820_RAM); | ||
172 | add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); | ||
173 | } | ||
174 | return who; | ||
175 | } | ||
diff --git a/arch/i386/mach-visws/setup.c b/arch/i386/mach-visws/setup.c index 07fac7e749c7..8a9e1a6f745d 100644 --- a/arch/i386/mach-visws/setup.c +++ b/arch/i386/mach-visws/setup.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #include <asm/fixmap.h> | 10 | #include <asm/fixmap.h> |
11 | #include <asm/arch_hooks.h> | 11 | #include <asm/arch_hooks.h> |
12 | #include <asm/io.h> | 12 | #include <asm/io.h> |
13 | #include <asm/e820.h> | ||
14 | #include <asm/setup.h> | ||
13 | #include "cobalt.h" | 15 | #include "cobalt.h" |
14 | #include "piix4.h" | 16 | #include "piix4.h" |
15 | 17 | ||
@@ -133,3 +135,50 @@ void __init time_init_hook(void) | |||
133 | /* Wire cpu IDT entry to s/w handler (and Cobalt APIC to IDT) */ | 135 | /* Wire cpu IDT entry to s/w handler (and Cobalt APIC to IDT) */ |
134 | setup_irq(0, &irq0); | 136 | setup_irq(0, &irq0); |
135 | } | 137 | } |
138 | |||
139 | /* Hook for machine specific memory setup. */ | ||
140 | |||
141 | #define MB (1024 * 1024) | ||
142 | |||
143 | static unsigned long sgivwfb_mem_phys; | ||
144 | static unsigned long sgivwfb_mem_size; | ||
145 | |||
146 | long long mem_size __initdata = 0; | ||
147 | |||
148 | char * __init machine_specific_memory_setup(void) | ||
149 | { | ||
150 | long long gfx_mem_size = 8 * MB; | ||
151 | |||
152 | mem_size = ALT_MEM_K; | ||
153 | |||
154 | if (!mem_size) { | ||
155 | printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n"); | ||
156 | mem_size = 128 * MB; | ||
157 | } | ||
158 | |||
159 | /* | ||
160 | * this hardcodes the graphics memory to 8 MB | ||
161 | * it really should be sized dynamically (or at least | ||
162 | * set as a boot param) | ||
163 | */ | ||
164 | if (!sgivwfb_mem_size) { | ||
165 | printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n"); | ||
166 | sgivwfb_mem_size = 8 * MB; | ||
167 | } | ||
168 | |||
169 | /* | ||
170 | * Trim to nearest MB | ||
171 | */ | ||
172 | sgivwfb_mem_size &= ~((1 << 20) - 1); | ||
173 | sgivwfb_mem_phys = mem_size - gfx_mem_size; | ||
174 | |||
175 | add_memory_region(0, LOWMEMSIZE(), E820_RAM); | ||
176 | add_memory_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM); | ||
177 | add_memory_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED); | ||
178 | |||
179 | return "PROM"; | ||
180 | |||
181 | /* Remove gcc warnings */ | ||
182 | (void) sanitize_e820_map(NULL, NULL); | ||
183 | (void) copy_e820_map(NULL, 0); | ||
184 | } | ||
diff --git a/arch/i386/mach-voyager/setup.c b/arch/i386/mach-voyager/setup.c index 7d8a3acb9441..0e225054e222 100644 --- a/arch/i386/mach-voyager/setup.c +++ b/arch/i386/mach-voyager/setup.c | |||
@@ -7,6 +7,9 @@ | |||
7 | #include <linux/interrupt.h> | 7 | #include <linux/interrupt.h> |
8 | #include <asm/acpi.h> | 8 | #include <asm/acpi.h> |
9 | #include <asm/arch_hooks.h> | 9 | #include <asm/arch_hooks.h> |
10 | #include <asm/voyager.h> | ||
11 | #include <asm/e820.h> | ||
12 | #include <asm/setup.h> | ||
10 | 13 | ||
11 | void __init pre_intr_init_hook(void) | 14 | void __init pre_intr_init_hook(void) |
12 | { | 15 | { |
@@ -45,3 +48,74 @@ void __init time_init_hook(void) | |||
45 | { | 48 | { |
46 | setup_irq(0, &irq0); | 49 | setup_irq(0, &irq0); |
47 | } | 50 | } |
51 | |||
52 | /* Hook for machine specific memory setup. */ | ||
53 | |||
54 | char * __init machine_specific_memory_setup(void) | ||
55 | { | ||
56 | char *who; | ||
57 | |||
58 | who = "NOT VOYAGER"; | ||
59 | |||
60 | if(voyager_level == 5) { | ||
61 | __u32 addr, length; | ||
62 | int i; | ||
63 | |||
64 | who = "Voyager-SUS"; | ||
65 | |||
66 | e820.nr_map = 0; | ||
67 | for(i=0; voyager_memory_detect(i, &addr, &length); i++) { | ||
68 | add_memory_region(addr, length, E820_RAM); | ||
69 | } | ||
70 | return who; | ||
71 | } else if(voyager_level == 4) { | ||
72 | __u32 tom; | ||
73 | __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8; | ||
74 | /* select the DINO config space */ | ||
75 | outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT); | ||
76 | /* Read DINO top of memory register */ | ||
77 | tom = ((inb(catbase + 0x4) & 0xf0) << 16) | ||
78 | + ((inb(catbase + 0x5) & 0x7f) << 24); | ||
79 | |||
80 | if(inb(catbase) != VOYAGER_DINO) { | ||
81 | printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); | ||
82 | tom = (EXT_MEM_K)<<10; | ||
83 | } | ||
84 | who = "Voyager-TOM"; | ||
85 | add_memory_region(0, 0x9f000, E820_RAM); | ||
86 | /* map from 1M to top of memory */ | ||
87 | add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM); | ||
88 | /* FIXME: Should check the ASICs to see if I need to | ||
89 | * take out the 8M window. Just do it at the moment | ||
90 | * */ | ||
91 | add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED); | ||
92 | return who; | ||
93 | } | ||
94 | |||
95 | who = "BIOS-e820"; | ||
96 | |||
97 | /* | ||
98 | * Try to copy the BIOS-supplied E820-map. | ||
99 | * | ||
100 | * Otherwise fake a memory map; one section from 0k->640k, | ||
101 | * the next section from 1mb->appropriate_mem_k | ||
102 | */ | ||
103 | sanitize_e820_map(E820_MAP, &E820_MAP_NR); | ||
104 | if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { | ||
105 | unsigned long mem_size; | ||
106 | |||
107 | /* compare results from other methods and take the greater */ | ||
108 | if (ALT_MEM_K < EXT_MEM_K) { | ||
109 | mem_size = EXT_MEM_K; | ||
110 | who = "BIOS-88"; | ||
111 | } else { | ||
112 | mem_size = ALT_MEM_K; | ||
113 | who = "BIOS-e801"; | ||
114 | } | ||
115 | |||
116 | e820.nr_map = 0; | ||
117 | add_memory_region(0, LOWMEMSIZE(), E820_RAM); | ||
118 | add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); | ||
119 | } | ||
120 | return who; | ||
121 | } | ||
diff --git a/include/asm-i386/mach-default/setup_arch_pre.h b/include/asm-i386/mach-default/setup_arch.h index fb42099e7bd4..fb42099e7bd4 100644 --- a/include/asm-i386/mach-default/setup_arch_pre.h +++ b/include/asm-i386/mach-default/setup_arch.h | |||
diff --git a/include/asm-i386/mach-default/setup_arch_post.h b/include/asm-i386/mach-default/setup_arch_post.h deleted file mode 100644 index 2fc4888721f6..000000000000 --- a/include/asm-i386/mach-default/setup_arch_post.h +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /** | ||
2 | * machine_specific_memory_setup - Hook for machine specific memory setup. | ||
3 | * | ||
4 | * Description: | ||
5 | * This is included late in kernel/setup.c so that it can make | ||
6 | * use of all of the static functions. | ||
7 | **/ | ||
8 | |||
9 | static char * __init machine_specific_memory_setup(void) | ||
10 | { | ||
11 | char *who; | ||
12 | |||
13 | |||
14 | who = "BIOS-e820"; | ||
15 | |||
16 | /* | ||
17 | * Try to copy the BIOS-supplied E820-map. | ||
18 | * | ||
19 | * Otherwise fake a memory map; one section from 0k->640k, | ||
20 | * the next section from 1mb->appropriate_mem_k | ||
21 | */ | ||
22 | sanitize_e820_map(E820_MAP, &E820_MAP_NR); | ||
23 | if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { | ||
24 | unsigned long mem_size; | ||
25 | |||
26 | /* compare results from other methods and take the greater */ | ||
27 | if (ALT_MEM_K < EXT_MEM_K) { | ||
28 | mem_size = EXT_MEM_K; | ||
29 | who = "BIOS-88"; | ||
30 | } else { | ||
31 | mem_size = ALT_MEM_K; | ||
32 | who = "BIOS-e801"; | ||
33 | } | ||
34 | |||
35 | e820.nr_map = 0; | ||
36 | add_memory_region(0, LOWMEMSIZE(), E820_RAM); | ||
37 | add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); | ||
38 | } | ||
39 | return who; | ||
40 | } | ||
diff --git a/include/asm-i386/mach-visws/setup_arch_pre.h b/include/asm-i386/mach-visws/setup_arch.h index b92d6d9a4d3c..b92d6d9a4d3c 100644 --- a/include/asm-i386/mach-visws/setup_arch_pre.h +++ b/include/asm-i386/mach-visws/setup_arch.h | |||
diff --git a/include/asm-i386/mach-visws/setup_arch_post.h b/include/asm-i386/mach-visws/setup_arch_post.h deleted file mode 100644 index cdbd895a54b1..000000000000 --- a/include/asm-i386/mach-visws/setup_arch_post.h +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | /* Hook for machine specific memory setup. | ||
2 | * | ||
3 | * This is included late in kernel/setup.c so that it can make use of all of | ||
4 | * the static functions. */ | ||
5 | |||
6 | #define MB (1024 * 1024) | ||
7 | |||
8 | unsigned long sgivwfb_mem_phys; | ||
9 | unsigned long sgivwfb_mem_size; | ||
10 | |||
11 | long long mem_size __initdata = 0; | ||
12 | |||
13 | static char * __init machine_specific_memory_setup(void) | ||
14 | { | ||
15 | long long gfx_mem_size = 8 * MB; | ||
16 | |||
17 | mem_size = ALT_MEM_K; | ||
18 | |||
19 | if (!mem_size) { | ||
20 | printk(KERN_WARNING "Bootloader didn't set memory size, upgrade it !\n"); | ||
21 | mem_size = 128 * MB; | ||
22 | } | ||
23 | |||
24 | /* | ||
25 | * this hardcodes the graphics memory to 8 MB | ||
26 | * it really should be sized dynamically (or at least | ||
27 | * set as a boot param) | ||
28 | */ | ||
29 | if (!sgivwfb_mem_size) { | ||
30 | printk(KERN_WARNING "Defaulting to 8 MB framebuffer size\n"); | ||
31 | sgivwfb_mem_size = 8 * MB; | ||
32 | } | ||
33 | |||
34 | /* | ||
35 | * Trim to nearest MB | ||
36 | */ | ||
37 | sgivwfb_mem_size &= ~((1 << 20) - 1); | ||
38 | sgivwfb_mem_phys = mem_size - gfx_mem_size; | ||
39 | |||
40 | add_memory_region(0, LOWMEMSIZE(), E820_RAM); | ||
41 | add_memory_region(HIGH_MEMORY, mem_size - sgivwfb_mem_size - HIGH_MEMORY, E820_RAM); | ||
42 | add_memory_region(sgivwfb_mem_phys, sgivwfb_mem_size, E820_RESERVED); | ||
43 | |||
44 | return "PROM"; | ||
45 | |||
46 | /* Remove gcc warnings */ | ||
47 | (void) sanitize_e820_map(NULL, NULL); | ||
48 | (void) copy_e820_map(NULL, 0); | ||
49 | } | ||
diff --git a/include/asm-i386/mach-voyager/setup_arch_pre.h b/include/asm-i386/mach-voyager/setup_arch.h index 48f7e6ff49a5..84d01ad33459 100644 --- a/include/asm-i386/mach-voyager/setup_arch_pre.h +++ b/include/asm-i386/mach-voyager/setup_arch.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | /* Hook to call BIOS initialisation function */ | 4 | /* Hook to call BIOS initialisation function */ |
5 | 5 | ||
6 | /* for voyager, pass the voyager BIOS/SUS info area to the detection | 6 | /* for voyager, pass the voyager BIOS/SUS info area to the detection |
7 | * routines */ | 7 | * routines */ |
8 | 8 | ||
9 | #define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO); | 9 | #define ARCH_SETUP voyager_detect(VOYAGER_BIOS_INFO); |
diff --git a/include/asm-i386/mach-voyager/setup_arch_post.h b/include/asm-i386/mach-voyager/setup_arch_post.h deleted file mode 100644 index f6f6c2cbc75c..000000000000 --- a/include/asm-i386/mach-voyager/setup_arch_post.h +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* Hook for machine specific memory setup. | ||
2 | * | ||
3 | * This is included late in kernel/setup.c so that it can make use of all of | ||
4 | * the static functions. */ | ||
5 | |||
6 | static char * __init machine_specific_memory_setup(void) | ||
7 | { | ||
8 | char *who; | ||
9 | |||
10 | who = "NOT VOYAGER"; | ||
11 | |||
12 | if(voyager_level == 5) { | ||
13 | __u32 addr, length; | ||
14 | int i; | ||
15 | |||
16 | who = "Voyager-SUS"; | ||
17 | |||
18 | e820.nr_map = 0; | ||
19 | for(i=0; voyager_memory_detect(i, &addr, &length); i++) { | ||
20 | add_memory_region(addr, length, E820_RAM); | ||
21 | } | ||
22 | return who; | ||
23 | } else if(voyager_level == 4) { | ||
24 | __u32 tom; | ||
25 | __u16 catbase = inb(VOYAGER_SSPB_RELOCATION_PORT)<<8; | ||
26 | /* select the DINO config space */ | ||
27 | outb(VOYAGER_DINO, VOYAGER_CAT_CONFIG_PORT); | ||
28 | /* Read DINO top of memory register */ | ||
29 | tom = ((inb(catbase + 0x4) & 0xf0) << 16) | ||
30 | + ((inb(catbase + 0x5) & 0x7f) << 24); | ||
31 | |||
32 | if(inb(catbase) != VOYAGER_DINO) { | ||
33 | printk(KERN_ERR "Voyager: Failed to get DINO for L4, setting tom to EXT_MEM_K\n"); | ||
34 | tom = (EXT_MEM_K)<<10; | ||
35 | } | ||
36 | who = "Voyager-TOM"; | ||
37 | add_memory_region(0, 0x9f000, E820_RAM); | ||
38 | /* map from 1M to top of memory */ | ||
39 | add_memory_region(1*1024*1024, tom - 1*1024*1024, E820_RAM); | ||
40 | /* FIXME: Should check the ASICs to see if I need to | ||
41 | * take out the 8M window. Just do it at the moment | ||
42 | * */ | ||
43 | add_memory_region(8*1024*1024, 8*1024*1024, E820_RESERVED); | ||
44 | return who; | ||
45 | } | ||
46 | |||
47 | who = "BIOS-e820"; | ||
48 | |||
49 | /* | ||
50 | * Try to copy the BIOS-supplied E820-map. | ||
51 | * | ||
52 | * Otherwise fake a memory map; one section from 0k->640k, | ||
53 | * the next section from 1mb->appropriate_mem_k | ||
54 | */ | ||
55 | sanitize_e820_map(E820_MAP, &E820_MAP_NR); | ||
56 | if (copy_e820_map(E820_MAP, E820_MAP_NR) < 0) { | ||
57 | unsigned long mem_size; | ||
58 | |||
59 | /* compare results from other methods and take the greater */ | ||
60 | if (ALT_MEM_K < EXT_MEM_K) { | ||
61 | mem_size = EXT_MEM_K; | ||
62 | who = "BIOS-88"; | ||
63 | } else { | ||
64 | mem_size = ALT_MEM_K; | ||
65 | who = "BIOS-e801"; | ||
66 | } | ||
67 | |||
68 | e820.nr_map = 0; | ||
69 | add_memory_region(0, LOWMEMSIZE(), E820_RAM); | ||
70 | add_memory_region(HIGH_MEMORY, mem_size << 10, E820_RAM); | ||
71 | } | ||
72 | return who; | ||
73 | } | ||
diff --git a/include/asm-i386/setup.h b/include/asm-i386/setup.h index ee941457b55d..f737e423029e 100644 --- a/include/asm-i386/setup.h +++ b/include/asm-i386/setup.h | |||
@@ -59,6 +59,21 @@ extern unsigned char boot_params[PARAM_SIZE]; | |||
59 | #define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) | 59 | #define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF)) |
60 | #define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) | 60 | #define EDD_BUF ((struct edd_info *) (PARAM+EDDBUF)) |
61 | 61 | ||
62 | /* | ||
63 | * Do NOT EVER look at the BIOS memory size location. | ||
64 | * It does not work on many machines. | ||
65 | */ | ||
66 | #define LOWMEMSIZE() (0x9f000) | ||
67 | |||
68 | struct e820entry; | ||
69 | |||
70 | char * __init machine_specific_memory_setup(void); | ||
71 | |||
72 | int __init copy_e820_map(struct e820entry * biosmap, int nr_map); | ||
73 | int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map); | ||
74 | void __init add_memory_region(unsigned long long start, | ||
75 | unsigned long long size, int type); | ||
76 | |||
62 | #endif /* __ASSEMBLY__ */ | 77 | #endif /* __ASSEMBLY__ */ |
63 | 78 | ||
64 | #endif /* _i386_SETUP_H */ | 79 | #endif /* _i386_SETUP_H */ |