aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/pci_dn.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/kernel/pci_dn.c')
-rw-r--r--arch/powerpc/kernel/pci_dn.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/arch/powerpc/kernel/pci_dn.c b/arch/powerpc/kernel/pci_dn.c
index df038442548a..1f61fab59d9b 100644
--- a/arch/powerpc/kernel/pci_dn.c
+++ b/arch/powerpc/kernel/pci_dn.c
@@ -47,9 +47,8 @@ struct pci_dn *pci_get_pdn(struct pci_dev *pdev)
47void *update_dn_pci_info(struct device_node *dn, void *data) 47void *update_dn_pci_info(struct device_node *dn, void *data)
48{ 48{
49 struct pci_controller *phb = data; 49 struct pci_controller *phb = data;
50 const int *type = 50 const __be32 *type = of_get_property(dn, "ibm,pci-config-space-type", NULL);
51 of_get_property(dn, "ibm,pci-config-space-type", NULL); 51 const __be32 *regs;
52 const u32 *regs;
53 struct pci_dn *pdn; 52 struct pci_dn *pdn;
54 53
55 pdn = zalloc_maybe_bootmem(sizeof(*pdn), GFP_KERNEL); 54 pdn = zalloc_maybe_bootmem(sizeof(*pdn), GFP_KERNEL);
@@ -63,12 +62,14 @@ void *update_dn_pci_info(struct device_node *dn, void *data)
63#endif 62#endif
64 regs = of_get_property(dn, "reg", NULL); 63 regs = of_get_property(dn, "reg", NULL);
65 if (regs) { 64 if (regs) {
65 u32 addr = of_read_number(regs, 1);
66
66 /* First register entry is addr (00BBSS00) */ 67 /* First register entry is addr (00BBSS00) */
67 pdn->busno = (regs[0] >> 16) & 0xff; 68 pdn->busno = (addr >> 16) & 0xff;
68 pdn->devfn = (regs[0] >> 8) & 0xff; 69 pdn->devfn = (addr >> 8) & 0xff;
69 } 70 }
70 71
71 pdn->pci_ext_config_space = (type && *type == 1); 72 pdn->pci_ext_config_space = (type && of_read_number(type, 1) == 1);
72 return NULL; 73 return NULL;
73} 74}
74 75
@@ -98,12 +99,13 @@ void *traverse_pci_devices(struct device_node *start, traverse_func pre,
98 99
99 /* We started with a phb, iterate all childs */ 100 /* We started with a phb, iterate all childs */
100 for (dn = start->child; dn; dn = nextdn) { 101 for (dn = start->child; dn; dn = nextdn) {
101 const u32 *classp; 102 const __be32 *classp;
102 u32 class; 103 u32 class = 0;
103 104
104 nextdn = NULL; 105 nextdn = NULL;
105 classp = of_get_property(dn, "class-code", NULL); 106 classp = of_get_property(dn, "class-code", NULL);
106 class = classp ? *classp : 0; 107 if (classp)
108 class = of_read_number(classp, 1);
107 109
108 if (pre && ((ret = pre(dn, data)) != NULL)) 110 if (pre && ((ret = pre(dn, data)) != NULL))
109 return ret; 111 return ret;