aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pseries/eeh_pseries.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pseries/eeh_pseries.c')
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 7fbc25b1813f..ccb633e077b1 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -189,8 +189,9 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
189 struct eeh_dev *edev; 189 struct eeh_dev *edev;
190 struct eeh_pe pe; 190 struct eeh_pe pe;
191 struct pci_dn *pdn = PCI_DN(dn); 191 struct pci_dn *pdn = PCI_DN(dn);
192 const u32 *class_code, *vendor_id, *device_id; 192 const __be32 *classp, *vendorp, *devicep;
193 const u32 *regs; 193 u32 class_code;
194 const __be32 *regs;
194 u32 pcie_flags; 195 u32 pcie_flags;
195 int enable = 0; 196 int enable = 0;
196 int ret; 197 int ret;
@@ -201,22 +202,24 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
201 return NULL; 202 return NULL;
202 203
203 /* Retrieve class/vendor/device IDs */ 204 /* Retrieve class/vendor/device IDs */
204 class_code = of_get_property(dn, "class-code", NULL); 205 classp = of_get_property(dn, "class-code", NULL);
205 vendor_id = of_get_property(dn, "vendor-id", NULL); 206 vendorp = of_get_property(dn, "vendor-id", NULL);
206 device_id = of_get_property(dn, "device-id", NULL); 207 devicep = of_get_property(dn, "device-id", NULL);
207 208
208 /* Skip for bad OF node or PCI-ISA bridge */ 209 /* Skip for bad OF node or PCI-ISA bridge */
209 if (!class_code || !vendor_id || !device_id) 210 if (!classp || !vendorp || !devicep)
210 return NULL; 211 return NULL;
211 if (dn->type && !strcmp(dn->type, "isa")) 212 if (dn->type && !strcmp(dn->type, "isa"))
212 return NULL; 213 return NULL;
213 214
215 class_code = of_read_number(classp, 1);
216
214 /* 217 /*
215 * Update class code and mode of eeh device. We need 218 * Update class code and mode of eeh device. We need
216 * correctly reflects that current device is root port 219 * correctly reflects that current device is root port
217 * or PCIe switch downstream port. 220 * or PCIe switch downstream port.
218 */ 221 */
219 edev->class_code = *class_code; 222 edev->class_code = class_code;
220 edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP); 223 edev->pcie_cap = pseries_eeh_find_cap(dn, PCI_CAP_ID_EXP);
221 edev->mode &= 0xFFFFFF00; 224 edev->mode &= 0xFFFFFF00;
222 if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) { 225 if ((edev->class_code >> 8) == PCI_CLASS_BRIDGE_PCI) {
@@ -243,12 +246,12 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
243 /* Initialize the fake PE */ 246 /* Initialize the fake PE */
244 memset(&pe, 0, sizeof(struct eeh_pe)); 247 memset(&pe, 0, sizeof(struct eeh_pe));
245 pe.phb = edev->phb; 248 pe.phb = edev->phb;
246 pe.config_addr = regs[0]; 249 pe.config_addr = of_read_number(regs, 1);
247 250
248 /* Enable EEH on the device */ 251 /* Enable EEH on the device */
249 ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE); 252 ret = eeh_ops->set_option(&pe, EEH_OPT_ENABLE);
250 if (!ret) { 253 if (!ret) {
251 edev->config_addr = regs[0]; 254 edev->config_addr = of_read_number(regs, 1);
252 /* Retrieve PE address */ 255 /* Retrieve PE address */
253 edev->pe_config_addr = eeh_ops->get_pe_addr(&pe); 256 edev->pe_config_addr = eeh_ops->get_pe_addr(&pe);
254 pe.addr = edev->pe_config_addr; 257 pe.addr = edev->pe_config_addr;