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 /arch/i386/mach-voyager | |
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>
Diffstat (limited to 'arch/i386/mach-voyager')
-rw-r--r-- | arch/i386/mach-voyager/setup.c | 74 |
1 files changed, 74 insertions, 0 deletions
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 | } | ||