aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2009-04-30 05:26:21 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2009-05-21 01:44:24 -0400
commit2eb4afb69ff3cdd357d5e68ed82cd131916bd8a7 (patch)
treed34aa8f91b110718ae29e357d2b93bd1361c73cc /arch
parent58513dc40d8e01f0c0ccea4cdcbc32e9dcee62fd (diff)
powerpc/pci: Move pseries code into pseries platform specific area
There doesn't appear to be any specific reason that we need to setup the pseries specific notifier in generic arch pci code. Move it into pseries land. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h1
-rw-r--r--arch/powerpc/kernel/pci_dn.c28
-rw-r--r--arch/powerpc/platforms/pseries/setup.c25
3 files changed, 27 insertions, 27 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 9861258f6a4c..0dbf66bdb01d 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -223,6 +223,7 @@ struct pci_dn {
223#define PCI_DN(dn) ((struct pci_dn *) (dn)->data) 223#define PCI_DN(dn) ((struct pci_dn *) (dn)->data)
224 224
225extern struct device_node *fetch_dev_dn(struct pci_dev *dev); 225extern struct device_node *fetch_dev_dn(struct pci_dev *dev);
226extern void * update_dn_pci_info(struct device_node *dn, void *data);
226 227
227/* Get a device_node from a pci_dev. This code must be fast except 228/* Get a device_node from a pci_dev. This code must be fast except
228 * in the case where the sysdata is incorrect and needs to be fixed 229 * in the case where the sysdata is incorrect and needs to be fixed
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index 1c67de52e3ce..d5e36e5dc7c2 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -27,7 +27,6 @@
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/pSeries_reconfig.h>
31#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
32#include <asm/firmware.h> 31#include <asm/firmware.h>
33 32
@@ -35,7 +34,7 @@
35 * Traverse_func that inits the PCI fields of the device node. 34 * Traverse_func that inits the PCI fields of the device node.
36 * NOTE: this *must* be done before read/write config to the device. 35 * NOTE: this *must* be done before read/write config to the device.
37 */ 36 */
38static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) 37void * __devinit update_dn_pci_info(struct device_node *dn, void *data)
39{ 38{
40 struct pci_controller *phb = data; 39 struct pci_controller *phb = data;
41 const int *type = 40 const int *type =
@@ -184,29 +183,6 @@ struct device_node *fetch_dev_dn(struct pci_dev *dev)
184} 183}
185EXPORT_SYMBOL(fetch_dev_dn); 184EXPORT_SYMBOL(fetch_dev_dn);
186 185
187static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
188{
189 struct device_node *np = node;
190 struct pci_dn *pci = NULL;
191 int err = NOTIFY_OK;
192
193 switch (action) {
194 case PSERIES_RECONFIG_ADD:
195 pci = np->parent->data;
196 if (pci)
197 update_dn_pci_info(np, pci->phb);
198 break;
199 default:
200 err = NOTIFY_DONE;
201 break;
202 }
203 return err;
204}
205
206static struct notifier_block pci_dn_reconfig_nb = {
207 .notifier_call = pci_dn_reconfig_notifier,
208};
209
210/** 186/**
211 * pci_devs_phb_init - Initialize phbs and pci devs under them. 187 * pci_devs_phb_init - Initialize phbs and pci devs under them.
212 * 188 *
@@ -223,6 +199,4 @@ void __init pci_devs_phb_init(void)
223 /* This must be done first so the device nodes have valid pci info! */ 199 /* This must be done first so the device nodes have valid pci info! */
224 list_for_each_entry_safe(phb, tmp, &hose_list, list_node) 200 list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
225 pci_devs_phb_init_dynamic(phb); 201 pci_devs_phb_init_dynamic(phb);
226
227 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
228} 202}
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ec341707e41b..8d75ea21296f 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -63,6 +63,7 @@
63#include <asm/smp.h> 63#include <asm/smp.h>
64#include <asm/firmware.h> 64#include <asm/firmware.h>
65#include <asm/eeh.h> 65#include <asm/eeh.h>
66#include <asm/pSeries_reconfig.h>
66 67
67#include "plpar_wrappers.h" 68#include "plpar_wrappers.h"
68#include "pseries.h" 69#include "pseries.h"
@@ -254,6 +255,29 @@ static void __init pseries_discover_pic(void)
254 " interrupt-controller\n"); 255 " interrupt-controller\n");
255} 256}
256 257
258static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
259{
260 struct device_node *np = node;
261 struct pci_dn *pci = NULL;
262 int err = NOTIFY_OK;
263
264 switch (action) {
265 case PSERIES_RECONFIG_ADD:
266 pci = np->parent->data;
267 if (pci)
268 update_dn_pci_info(np, pci->phb);
269 break;
270 default:
271 err = NOTIFY_DONE;
272 break;
273 }
274 return err;
275}
276
277static struct notifier_block pci_dn_reconfig_nb = {
278 .notifier_call = pci_dn_reconfig_notifier,
279};
280
257static void __init pSeries_setup_arch(void) 281static void __init pSeries_setup_arch(void)
258{ 282{
259 /* Discover PIC type and setup ppc_md accordingly */ 283 /* Discover PIC type and setup ppc_md accordingly */
@@ -271,6 +295,7 @@ static void __init pSeries_setup_arch(void)
271 /* Find and initialize PCI host bridges */ 295 /* Find and initialize PCI host bridges */
272 init_pci_config_tokens(); 296 init_pci_config_tokens();
273 find_and_init_phbs(); 297 find_and_init_phbs();
298 pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
274 eeh_init(); 299 eeh_init();
275 300
276 pSeries_nvram_init(); 301 pSeries_nvram_init();