diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-02-09 23:47:36 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-02-10 00:52:03 -0500 |
commit | 1965746bce49ddf001af52c7985e16343c768021 (patch) | |
tree | d311fce31613545f3430582322d66411566f1863 | |
parent | 0941d57aa7034ef7010bd523752c2e3bee569ef1 (diff) |
[PATCH] powerpc: Move pSeries firmware feature setup into platforms/pseries
Currently we have some stuff in firmware.h and kernel/firmware.c that is
#ifdef CONFIG_PPC_PSERIES. Move it all into platforms/pseries.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/firmware.c | 25 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/Makefile | 3 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/firmware.c | 103 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/firmware.h | 17 | ||||
-rw-r--r-- | arch/powerpc/platforms/pseries/setup.c | 45 | ||||
-rw-r--r-- | include/asm-powerpc/firmware.h | 9 |
6 files changed, 123 insertions, 79 deletions
diff --git a/arch/powerpc/kernel/firmware.c b/arch/powerpc/kernel/firmware.c index 65eae752a527..4d37a3cb80f6 100644 --- a/arch/powerpc/kernel/firmware.c +++ b/arch/powerpc/kernel/firmware.c | |||
@@ -18,28 +18,3 @@ | |||
18 | #include <asm/firmware.h> | 18 | #include <asm/firmware.h> |
19 | 19 | ||
20 | unsigned long ppc64_firmware_features; | 20 | unsigned long ppc64_firmware_features; |
21 | |||
22 | #ifdef CONFIG_PPC_PSERIES | ||
23 | firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = { | ||
24 | {FW_FEATURE_PFT, "hcall-pft"}, | ||
25 | {FW_FEATURE_TCE, "hcall-tce"}, | ||
26 | {FW_FEATURE_SPRG0, "hcall-sprg0"}, | ||
27 | {FW_FEATURE_DABR, "hcall-dabr"}, | ||
28 | {FW_FEATURE_COPY, "hcall-copy"}, | ||
29 | {FW_FEATURE_ASR, "hcall-asr"}, | ||
30 | {FW_FEATURE_DEBUG, "hcall-debug"}, | ||
31 | {FW_FEATURE_PERF, "hcall-perf"}, | ||
32 | {FW_FEATURE_DUMP, "hcall-dump"}, | ||
33 | {FW_FEATURE_INTERRUPT, "hcall-interrupt"}, | ||
34 | {FW_FEATURE_MIGRATE, "hcall-migrate"}, | ||
35 | {FW_FEATURE_PERFMON, "hcall-perfmon"}, | ||
36 | {FW_FEATURE_CRQ, "hcall-crq"}, | ||
37 | {FW_FEATURE_VIO, "hcall-vio"}, | ||
38 | {FW_FEATURE_RDMA, "hcall-rdma"}, | ||
39 | {FW_FEATURE_LLAN, "hcall-lLAN"}, | ||
40 | {FW_FEATURE_BULK, "hcall-bulk"}, | ||
41 | {FW_FEATURE_XDABR, "hcall-xdabr"}, | ||
42 | {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, | ||
43 | {FW_FEATURE_SPLPAR, "hcall-splpar"}, | ||
44 | }; | ||
45 | #endif | ||
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile index 61616d144072..930898635c9f 100644 --- a/arch/powerpc/platforms/pseries/Makefile +++ b/arch/powerpc/platforms/pseries/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ | 1 | obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ |
2 | setup.o iommu.o ras.o rtasd.o pci_dlpar.o | 2 | setup.o iommu.o ras.o rtasd.o pci_dlpar.o \ |
3 | firmware.o | ||
3 | obj-$(CONFIG_SMP) += smp.o | 4 | obj-$(CONFIG_SMP) += smp.o |
4 | obj-$(CONFIG_IBMVIO) += vio.o | 5 | obj-$(CONFIG_IBMVIO) += vio.o |
5 | obj-$(CONFIG_XICS) += xics.o | 6 | obj-$(CONFIG_XICS) += xics.o |
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c new file mode 100644 index 000000000000..989f4bc136cb --- /dev/null +++ b/arch/powerpc/platforms/pseries/firmware.c | |||
@@ -0,0 +1,103 @@ | |||
1 | /* | ||
2 | * pSeries firmware setup code. | ||
3 | * | ||
4 | * Portions from arch/powerpc/platforms/pseries/setup.c: | ||
5 | * Copyright (C) 1995 Linus Torvalds | ||
6 | * Adapted from 'alpha' version by Gary Thomas | ||
7 | * Modified by Cort Dougan (cort@cs.nmt.edu) | ||
8 | * Modified by PPC64 Team, IBM Corp | ||
9 | * | ||
10 | * Portions from arch/powerpc/kernel/firmware.c | ||
11 | * Copyright (C) 2001 Ben. Herrenschmidt (benh@kernel.crashing.org) | ||
12 | * Modifications for ppc64: | ||
13 | * Copyright (C) 2003 Dave Engebretsen <engebret@us.ibm.com> | ||
14 | * Copyright (C) 2005 Stephen Rothwell, IBM Corporation | ||
15 | * | ||
16 | * Copyright 2006 IBM Corporation. | ||
17 | * | ||
18 | * This program is free software; you can redistribute it and/or | ||
19 | * modify it under the terms of the GNU General Public License | ||
20 | * as published by the Free Software Foundation; either version | ||
21 | * 2 of the License, or (at your option) any later version. | ||
22 | */ | ||
23 | |||
24 | #undef DEBUG | ||
25 | |||
26 | #include <asm/firmware.h> | ||
27 | #include <asm/prom.h> | ||
28 | |||
29 | #ifdef DEBUG | ||
30 | #define DBG(fmt...) udbg_printf(fmt) | ||
31 | #else | ||
32 | #define DBG(fmt...) | ||
33 | #endif | ||
34 | |||
35 | typedef struct { | ||
36 | unsigned long val; | ||
37 | char * name; | ||
38 | } firmware_feature_t; | ||
39 | |||
40 | static __initdata firmware_feature_t | ||
41 | firmware_features_table[FIRMWARE_MAX_FEATURES] = { | ||
42 | {FW_FEATURE_PFT, "hcall-pft"}, | ||
43 | {FW_FEATURE_TCE, "hcall-tce"}, | ||
44 | {FW_FEATURE_SPRG0, "hcall-sprg0"}, | ||
45 | {FW_FEATURE_DABR, "hcall-dabr"}, | ||
46 | {FW_FEATURE_COPY, "hcall-copy"}, | ||
47 | {FW_FEATURE_ASR, "hcall-asr"}, | ||
48 | {FW_FEATURE_DEBUG, "hcall-debug"}, | ||
49 | {FW_FEATURE_PERF, "hcall-perf"}, | ||
50 | {FW_FEATURE_DUMP, "hcall-dump"}, | ||
51 | {FW_FEATURE_INTERRUPT, "hcall-interrupt"}, | ||
52 | {FW_FEATURE_MIGRATE, "hcall-migrate"}, | ||
53 | {FW_FEATURE_PERFMON, "hcall-perfmon"}, | ||
54 | {FW_FEATURE_CRQ, "hcall-crq"}, | ||
55 | {FW_FEATURE_VIO, "hcall-vio"}, | ||
56 | {FW_FEATURE_RDMA, "hcall-rdma"}, | ||
57 | {FW_FEATURE_LLAN, "hcall-lLAN"}, | ||
58 | {FW_FEATURE_BULK, "hcall-bulk"}, | ||
59 | {FW_FEATURE_XDABR, "hcall-xdabr"}, | ||
60 | {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, | ||
61 | {FW_FEATURE_SPLPAR, "hcall-splpar"}, | ||
62 | }; | ||
63 | |||
64 | /* Build up the firmware features bitmask using the contents of | ||
65 | * device-tree/ibm,hypertas-functions. Ultimately this functionality may | ||
66 | * be moved into prom.c prom_init(). | ||
67 | */ | ||
68 | void __init fw_feature_init(void) | ||
69 | { | ||
70 | struct device_node *dn; | ||
71 | char *hypertas, *s; | ||
72 | int len, i; | ||
73 | |||
74 | DBG(" -> fw_feature_init()\n"); | ||
75 | |||
76 | dn = of_find_node_by_path("/rtas"); | ||
77 | if (dn == NULL) { | ||
78 | printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n"); | ||
79 | goto out; | ||
80 | } | ||
81 | |||
82 | hypertas = get_property(dn, "ibm,hypertas-functions", &len); | ||
83 | if (hypertas == NULL) | ||
84 | goto out; | ||
85 | |||
86 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { | ||
87 | for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { | ||
88 | /* check value against table of strings */ | ||
89 | if (!firmware_features_table[i].name || | ||
90 | strcmp(firmware_features_table[i].name, s)) | ||
91 | continue; | ||
92 | |||
93 | /* we have a match */ | ||
94 | ppc64_firmware_features |= | ||
95 | firmware_features_table[i].val; | ||
96 | break; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | out: | ||
101 | of_node_put(dn); | ||
102 | DBG(" <- fw_feature_init()\n"); | ||
103 | } | ||
diff --git a/arch/powerpc/platforms/pseries/firmware.h b/arch/powerpc/platforms/pseries/firmware.h new file mode 100644 index 000000000000..714f56f55362 --- /dev/null +++ b/arch/powerpc/platforms/pseries/firmware.h | |||
@@ -0,0 +1,17 @@ | |||
1 | /* | ||
2 | * Copyright 2006 IBM Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _PSERIES_FIRMWARE_H | ||
11 | #define _PSERIES_FIRMWARE_H | ||
12 | |||
13 | #include <asm/firmware.h> | ||
14 | |||
15 | extern void __init fw_feature_init(void); | ||
16 | |||
17 | #endif /* _PSERIES_FIRMWARE_H */ | ||
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 984241bb776c..b5996a7060f4 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c | |||
@@ -60,7 +60,6 @@ | |||
60 | #include <asm/time.h> | 60 | #include <asm/time.h> |
61 | #include <asm/nvram.h> | 61 | #include <asm/nvram.h> |
62 | #include "xics.h" | 62 | #include "xics.h" |
63 | #include <asm/firmware.h> | ||
64 | #include <asm/pmc.h> | 63 | #include <asm/pmc.h> |
65 | #include <asm/mpic.h> | 64 | #include <asm/mpic.h> |
66 | #include <asm/ppc-pci.h> | 65 | #include <asm/ppc-pci.h> |
@@ -70,6 +69,7 @@ | |||
70 | 69 | ||
71 | #include "plpar_wrappers.h" | 70 | #include "plpar_wrappers.h" |
72 | #include "ras.h" | 71 | #include "ras.h" |
72 | #include "firmware.h" | ||
73 | 73 | ||
74 | #ifdef DEBUG | 74 | #ifdef DEBUG |
75 | #define DBG(fmt...) udbg_printf(fmt) | 75 | #define DBG(fmt...) udbg_printf(fmt) |
@@ -262,49 +262,6 @@ static int __init pSeries_init_panel(void) | |||
262 | } | 262 | } |
263 | arch_initcall(pSeries_init_panel); | 263 | arch_initcall(pSeries_init_panel); |
264 | 264 | ||
265 | |||
266 | /* Build up the firmware features bitmask using the contents of | ||
267 | * device-tree/ibm,hypertas-functions. Ultimately this functionality may | ||
268 | * be moved into prom.c prom_init(). | ||
269 | */ | ||
270 | static void __init fw_feature_init(void) | ||
271 | { | ||
272 | struct device_node *dn; | ||
273 | char *hypertas, *s; | ||
274 | int len, i; | ||
275 | |||
276 | DBG(" -> fw_feature_init()\n"); | ||
277 | |||
278 | dn = of_find_node_by_path("/rtas"); | ||
279 | if (dn == NULL) { | ||
280 | printk(KERN_ERR "WARNING! Cannot find RTAS in device-tree!\n"); | ||
281 | goto out; | ||
282 | } | ||
283 | |||
284 | hypertas = get_property(dn, "ibm,hypertas-functions", &len); | ||
285 | if (hypertas == NULL) | ||
286 | goto out; | ||
287 | |||
288 | for (s = hypertas; s < hypertas + len; s += strlen(s) + 1) { | ||
289 | for (i = 0; i < FIRMWARE_MAX_FEATURES; i++) { | ||
290 | /* check value against table of strings */ | ||
291 | if (!firmware_features_table[i].name || | ||
292 | strcmp(firmware_features_table[i].name, s)) | ||
293 | continue; | ||
294 | |||
295 | /* we have a match */ | ||
296 | ppc64_firmware_features |= | ||
297 | firmware_features_table[i].val; | ||
298 | break; | ||
299 | } | ||
300 | } | ||
301 | |||
302 | out: | ||
303 | of_node_put(dn); | ||
304 | DBG(" <- fw_feature_init()\n"); | ||
305 | } | ||
306 | |||
307 | |||
308 | static void __init pSeries_discover_pic(void) | 265 | static void __init pSeries_discover_pic(void) |
309 | { | 266 | { |
310 | struct device_node *np; | 267 | struct device_node *np; |
diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h index f804b34cf06a..b7791a1b05db 100644 --- a/include/asm-powerpc/firmware.h +++ b/include/asm-powerpc/firmware.h | |||
@@ -89,15 +89,6 @@ static inline unsigned long firmware_has_feature(unsigned long feature) | |||
89 | (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature); | 89 | (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature); |
90 | } | 90 | } |
91 | 91 | ||
92 | #ifdef CONFIG_PPC_PSERIES | ||
93 | typedef struct { | ||
94 | unsigned long val; | ||
95 | char * name; | ||
96 | } firmware_feature_t; | ||
97 | |||
98 | extern firmware_feature_t firmware_features_table[]; | ||
99 | #endif | ||
100 | |||
101 | extern void system_reset_fwnmi(void); | 92 | extern void system_reset_fwnmi(void); |
102 | extern void machine_check_fwnmi(void); | 93 | extern void machine_check_fwnmi(void); |
103 | 94 | ||