aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-03-28 07:15:54 -0500
committerPaul Mackerras <paulus@samba.org>2006-03-28 07:15:54 -0500
commite8222502ee6157e2713da9e0792c21f4ad458d50 (patch)
tree0f970fb99912c257a7e5254f863a53f79d22ab14 /include/asm-powerpc
parent056cb48a2fb6fb31debf665695a9f97b45cfb8ec (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')
-rw-r--r--include/asm-powerpc/machdep.h26
-rw-r--r--include/asm-powerpc/pmac_feature.h2
-rw-r--r--include/asm-powerpc/processor.h37
-rw-r--r--include/asm-powerpc/prom.h14
-rw-r--r--include/asm-powerpc/vdso_datapage.h3
5 files changed, 41 insertions, 41 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
49struct machdep_calls { 49struct 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 {
244extern void power4_idle(void); 243extern void power4_idle(void);
245extern void ppc6xx_idle(void); 244extern 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 */
247extern struct machdep_calls ppc_md; 251extern struct machdep_calls ppc_md;
252extern 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
264extern void probe_machine(void);
265
248extern char cmd_line[COMMAND_LINE_SIZE]; 266extern char cmd_line[COMMAND_LINE_SIZE];
249 267
250#ifdef CONFIG_PPC_PMAC 268#ifdef CONFIG_PPC_PMAC
diff --git a/include/asm-powerpc/pmac_feature.h b/include/asm-powerpc/pmac_feature.h
index 3221628130c4..d3599cc9aa74 100644
--- a/include/asm-powerpc/pmac_feature.h
+++ b/include/asm-powerpc/pmac_feature.h
@@ -305,7 +305,7 @@ extern void pmac_feature_init(void);
305extern void pmac_set_early_video_resume(void (*proc)(void *data), void *data); 305extern void pmac_set_early_video_resume(void (*proc)(void *data), void *data);
306extern void pmac_call_early_video_resume(void); 306extern void pmac_call_early_video_resume(void);
307 307
308#define PMAC_FTR_DEF(x) ((_MACH_Pmac << 16) | (x)) 308#define PMAC_FTR_DEF(x) ((0x6660000) | (x))
309 309
310/* The AGP driver registers itself here */ 310/* The AGP driver registers itself here */
311extern void pmac_register_agp_pm(struct pci_dev *bridge, 311extern void pmac_register_agp_pm(struct pci_dev *bridge,
diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h
index 57643b5b782f..93f83efeb310 100644
--- a/include/asm-powerpc/processor.h
+++ b/include/asm-powerpc/processor.h
@@ -22,22 +22,6 @@
22 * -- BenH. 22 * -- BenH.
23 */ 23 */
24 24
25/* Platforms codes (to be obsoleted) */
26#define PLATFORM_PSERIES 0x0100
27#define PLATFORM_PSERIES_LPAR 0x0101
28#define PLATFORM_ISERIES_LPAR 0x0201
29#define PLATFORM_LPAR 0x0001
30#define PLATFORM_POWERMAC 0x0400
31#define PLATFORM_MAPLE 0x0500
32#define PLATFORM_PREP 0x0600
33#define PLATFORM_CHRP 0x0700
34#define PLATFORM_CELL 0x1000
35
36/* Compat platform codes for 32 bits */
37#define _MACH_prep PLATFORM_PREP
38#define _MACH_Pmac PLATFORM_POWERMAC
39#define _MACH_chrp PLATFORM_CHRP
40
41/* PREP sub-platform types see residual.h for these */ 25/* PREP sub-platform types see residual.h for these */
42#define _PREP_Motorola 0x01 /* motorola prep */ 26#define _PREP_Motorola 0x01 /* motorola prep */
43#define _PREP_Firm 0x02 /* firmworks prep */ 27#define _PREP_Firm 0x02 /* firmworks prep */
@@ -49,15 +33,14 @@
49#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 33#define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */
50#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 34#define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */
51 35
52#ifdef __KERNEL__ 36#if defined(__KERNEL__) && defined(CONFIG_PPC32)
53#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ 37
54 _machine == PLATFORM_PSERIES_LPAR) 38extern int _chrp_type;
55 39
56#ifdef CONFIG_PPC_PREP 40#ifdef CONFIG_PPC_PREP
57 41
58/* what kind of prep workstation we are */ 42/* what kind of prep workstation we are */
59extern int _prep_type; 43extern int _prep_type;
60extern int _chrp_type;
61 44
62/* 45/*
63 * This is used to identify the board type from a given PReP board 46 * This is used to identify the board type from a given PReP board
@@ -69,18 +52,12 @@ extern unsigned char ucBoardRevMaj, ucBoardRevMin;
69 52
70#endif /* CONFIG_PPC_PREP */ 53#endif /* CONFIG_PPC_PREP */
71 54
72#if defined(CONFIG_PPC_MULTIPLATFORM) 55#ifndef CONFIG_PPC_MULTIPLATFORM
73extern int _machine;
74
75#elif defined(CONFIG_PPC_ISERIES)
76/*
77 * iSeries is soon to become MULTIPLATFORM hopefully ...
78 */
79#define _machine PLATFORM_ISERIES_LPAR
80#else
81#define _machine 0 56#define _machine 0
82#endif /* CONFIG_PPC_MULTIPLATFORM */ 57#endif /* CONFIG_PPC_MULTIPLATFORM */
83#endif /* __KERNEL__ */ 58
59#endif /* defined(__KERNEL__) && defined(CONFIG_PPC32) */
60
84/* 61/*
85 * Default implementation of macro that returns current 62 * Default implementation of macro that returns current
86 * instruction pointer ("program counter"). 63 * instruction pointer ("program counter").
diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 782e13a070a1..97ef1cd71a4d 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -149,12 +149,14 @@ extern struct device_node *of_node_get(struct device_node *node);
149extern void of_node_put(struct device_node *node); 149extern void of_node_put(struct device_node *node);
150 150
151/* For scanning the flat device-tree at boot time */ 151/* For scanning the flat device-tree at boot time */
152int __init of_scan_flat_dt(int (*it)(unsigned long node, 152extern int __init of_scan_flat_dt(int (*it)(unsigned long node,
153 const char *uname, int depth, 153 const char *uname, int depth,
154 void *data), 154 void *data),
155 void *data); 155 void *data);
156void* __init of_get_flat_dt_prop(unsigned long node, const char *name, 156extern void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
157 unsigned long *size); 157 unsigned long *size);
158extern int __init of_flat_dt_is_compatible(unsigned long node, const char *name);
159extern unsigned long __init of_get_flat_dt_root(void);
158 160
159/* For updating the device tree at runtime */ 161/* For updating the device tree at runtime */
160extern void of_attach_node(struct device_node *); 162extern void of_attach_node(struct device_node *);
diff --git a/include/asm-powerpc/vdso_datapage.h b/include/asm-powerpc/vdso_datapage.h
index 7aa92086c3fb..8a94f0eba5e9 100644
--- a/include/asm-powerpc/vdso_datapage.h
+++ b/include/asm-powerpc/vdso_datapage.h
@@ -55,6 +55,9 @@ struct vdso_data {
55 __u32 minor; /* Minor number 0x14 */ 55 __u32 minor; /* Minor number 0x14 */
56 } version; 56 } version;
57 57
58 /* Note about the platform flags: it now only contains the lpar
59 * bit. The actual platform number is dead and burried
60 */
58 __u32 platform; /* Platform flags 0x18 */ 61 __u32 platform; /* Platform flags 0x18 */
59 __u32 processor; /* Processor type 0x1C */ 62 __u32 processor; /* Processor type 0x1C */
60 __u64 processorCount; /* # of physical processors 0x20 */ 63 __u64 processorCount; /* # of physical processors 0x20 */