diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-03-28 07:15:54 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-28 07:15:54 -0500 |
commit | e8222502ee6157e2713da9e0792c21f4ad458d50 (patch) | |
tree | 0f970fb99912c257a7e5254f863a53f79d22ab14 /arch/powerpc/kernel/setup_32.c | |
parent | 056cb48a2fb6fb31debf665695a9f97b45cfb8ec (diff) |
[PATCH] powerpc: Kill _machine and hard-coded platform numbers
This removes statically assigned platform numbers and reworks the
powerpc platform probe code to use a better mechanism. With this,
board support files can simply declare a new machine type with a
macro, and implement a probe() function that uses the flattened
device-tree to detect if they apply for a given machine.
We now have a machine_is() macro that replaces the comparisons of
_machine with the various PLATFORM_* constants. This commit also
changes various drivers to use the new macro instead of looking at
_machine.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/setup_32.c')
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 58 |
1 files changed, 5 insertions, 53 deletions
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index a2c89435abec..ae9c33d70731 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -67,10 +67,6 @@ unsigned int DMA_MODE_WRITE; | |||
67 | int have_of = 1; | 67 | int have_of = 1; |
68 | 68 | ||
69 | #ifdef CONFIG_PPC_MULTIPLATFORM | 69 | #ifdef CONFIG_PPC_MULTIPLATFORM |
70 | extern void prep_init(void); | ||
71 | extern void pmac_init(void); | ||
72 | extern void chrp_init(void); | ||
73 | |||
74 | dev_t boot_dev; | 70 | dev_t boot_dev; |
75 | #endif /* CONFIG_PPC_MULTIPLATFORM */ | 71 | #endif /* CONFIG_PPC_MULTIPLATFORM */ |
76 | 72 | ||
@@ -82,9 +78,6 @@ unsigned long SYSRQ_KEY = 0x54; | |||
82 | unsigned long vgacon_remap_base; | 78 | unsigned long vgacon_remap_base; |
83 | #endif | 79 | #endif |
84 | 80 | ||
85 | struct machdep_calls ppc_md; | ||
86 | EXPORT_SYMBOL(ppc_md); | ||
87 | |||
88 | /* | 81 | /* |
89 | * These are used in binfmt_elf.c to put aux entries on the stack | 82 | * These are used in binfmt_elf.c to put aux entries on the stack |
90 | * for each elf executable being started. | 83 | * for each elf executable being started. |
@@ -120,48 +113,6 @@ unsigned long __init early_init(unsigned long dt_ptr) | |||
120 | return KERNELBASE + offset; | 113 | return KERNELBASE + offset; |
121 | } | 114 | } |
122 | 115 | ||
123 | #ifdef CONFIG_PPC_MULTIPLATFORM | ||
124 | /* | ||
125 | * The PPC_MULTIPLATFORM version of platform_init... | ||
126 | */ | ||
127 | void __init platform_init(void) | ||
128 | { | ||
129 | /* if we didn't get any bootinfo telling us what we are... */ | ||
130 | if (_machine == 0) { | ||
131 | /* prep boot loader tells us if we're prep or not */ | ||
132 | if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) ) | ||
133 | _machine = _MACH_prep; | ||
134 | } | ||
135 | |||
136 | #ifdef CONFIG_PPC_PREP | ||
137 | /* not much more to do here, if prep */ | ||
138 | if (_machine == _MACH_prep) { | ||
139 | prep_init(); | ||
140 | return; | ||
141 | } | ||
142 | #endif | ||
143 | |||
144 | #ifdef CONFIG_ADB | ||
145 | if (strstr(cmd_line, "adb_sync")) { | ||
146 | extern int __adb_probe_sync; | ||
147 | __adb_probe_sync = 1; | ||
148 | } | ||
149 | #endif /* CONFIG_ADB */ | ||
150 | |||
151 | switch (_machine) { | ||
152 | #ifdef CONFIG_PPC_PMAC | ||
153 | case _MACH_Pmac: | ||
154 | pmac_init(); | ||
155 | break; | ||
156 | #endif | ||
157 | #ifdef CONFIG_PPC_CHRP | ||
158 | case _MACH_chrp: | ||
159 | chrp_init(); | ||
160 | break; | ||
161 | #endif | ||
162 | } | ||
163 | } | ||
164 | #endif | ||
165 | 116 | ||
166 | /* | 117 | /* |
167 | * Find out what kind of machine we're on and save any data we need | 118 | * Find out what kind of machine we're on and save any data we need |
@@ -187,8 +138,12 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys) | |||
187 | strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); | 138 | strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); |
188 | #endif /* CONFIG_CMDLINE */ | 139 | #endif /* CONFIG_CMDLINE */ |
189 | 140 | ||
190 | /* Base init based on machine type */ | 141 | #ifdef CONFIG_PPC_MULTIPLATFORM |
142 | probe_machine(); | ||
143 | #else | ||
144 | /* Base init based on machine type. Obsoloete, please kill ! */ | ||
191 | platform_init(); | 145 | platform_init(); |
146 | #endif | ||
192 | 147 | ||
193 | #ifdef CONFIG_6xx | 148 | #ifdef CONFIG_6xx |
194 | if (cpu_has_feature(CPU_FTR_CAN_DOZE) || | 149 | if (cpu_has_feature(CPU_FTR_CAN_DOZE) || |
@@ -359,7 +314,4 @@ void __init setup_arch(char **cmdline_p) | |||
359 | if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); | 314 | if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); |
360 | 315 | ||
361 | paging_init(); | 316 | paging_init(); |
362 | |||
363 | /* this is for modules since _machine can be a define -- Cort */ | ||
364 | ppc_md.ppc_machine = _machine; | ||
365 | } | 317 | } |