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 /include/asm-powerpc/machdep.h | |
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 'include/asm-powerpc/machdep.h')
-rw-r--r-- | include/asm-powerpc/machdep.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 758e47fe8c1e..5ed847680754 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h | |||
@@ -47,6 +47,7 @@ struct smp_ops_t { | |||
47 | #endif | 47 | #endif |
48 | 48 | ||
49 | struct machdep_calls { | 49 | struct machdep_calls { |
50 | char *name; | ||
50 | #ifdef CONFIG_PPC64 | 51 | #ifdef CONFIG_PPC64 |
51 | void (*hpte_invalidate)(unsigned long slot, | 52 | void (*hpte_invalidate)(unsigned long slot, |
52 | unsigned long va, | 53 | unsigned long va, |
@@ -85,9 +86,9 @@ struct machdep_calls { | |||
85 | void (*iommu_dev_setup)(struct pci_dev *dev); | 86 | void (*iommu_dev_setup)(struct pci_dev *dev); |
86 | void (*iommu_bus_setup)(struct pci_bus *bus); | 87 | void (*iommu_bus_setup)(struct pci_bus *bus); |
87 | void (*irq_bus_setup)(struct pci_bus *bus); | 88 | void (*irq_bus_setup)(struct pci_bus *bus); |
88 | #endif | 89 | #endif /* CONFIG_PPC64 */ |
89 | 90 | ||
90 | int (*probe)(int platform); | 91 | int (*probe)(void); |
91 | void (*setup_arch)(void); | 92 | void (*setup_arch)(void); |
92 | void (*init_early)(void); | 93 | void (*init_early)(void); |
93 | /* Optional, may be NULL. */ | 94 | /* Optional, may be NULL. */ |
@@ -207,8 +208,6 @@ struct machdep_calls { | |||
207 | /* Called at then very end of pcibios_init() */ | 208 | /* Called at then very end of pcibios_init() */ |
208 | void (*pcibios_after_init)(void); | 209 | void (*pcibios_after_init)(void); |
209 | 210 | ||
210 | /* this is for modules, since _machine can be a define -- Cort */ | ||
211 | int ppc_machine; | ||
212 | #endif /* CONFIG_PPC32 */ | 211 | #endif /* CONFIG_PPC32 */ |
213 | 212 | ||
214 | /* Called to shutdown machine specific hardware not already controlled | 213 | /* Called to shutdown machine specific hardware not already controlled |
@@ -244,7 +243,26 @@ struct machdep_calls { | |||
244 | extern void power4_idle(void); | 243 | extern void power4_idle(void); |
245 | extern void ppc6xx_idle(void); | 244 | extern void ppc6xx_idle(void); |
246 | 245 | ||
246 | /* | ||
247 | * ppc_md contains a copy of the machine description structure for the | ||
248 | * current platform. machine_id contains the initial address where the | ||
249 | * description was found during boot. | ||
250 | */ | ||
247 | extern struct machdep_calls ppc_md; | 251 | extern struct machdep_calls ppc_md; |
252 | extern struct machdep_calls *machine_id; | ||
253 | |||
254 | #define __machine_desc __attribute__ ((__section__ (".machine.desc"))) | ||
255 | |||
256 | #define define_machine(name) struct machdep_calls mach_##name __machine_desc = | ||
257 | #define machine_is(name) \ | ||
258 | ({ \ | ||
259 | extern struct machdep_calls mach_##name \ | ||
260 | __attribute__((weak)); \ | ||
261 | machine_id == &mach_##name; \ | ||
262 | }) | ||
263 | |||
264 | extern void probe_machine(void); | ||
265 | |||
248 | extern char cmd_line[COMMAND_LINE_SIZE]; | 266 | extern char cmd_line[COMMAND_LINE_SIZE]; |
249 | 267 | ||
250 | #ifdef CONFIG_PPC_PMAC | 268 | #ifdef CONFIG_PPC_PMAC |