diff options
author | Guo Chao <yan@linux.vnet.ibm.com> | 2014-06-09 04:58:51 -0400 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-06-11 03:03:23 -0400 |
commit | ddf0322a3ffe2d98facc72f255ac5c140b547c72 (patch) | |
tree | 72c1e1a794a0b2363e8053617accb9c306d04777 /arch/powerpc/platforms/powernv/pci.c | |
parent | 8b9f9269bcfb4fe9b44bb52aac1ce796834109fe (diff) |
powerpc/powernv: Fix endianness problems in EEH
EEH information fetched from OPAL need fix before using in LE environment.
To be included in sparse's endian check, declare them as __beXX and
access them by accessors.
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
Acked-by: Gavin Shan <gwshan@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/platforms/powernv/pci.c')
-rw-r--r-- | arch/powerpc/platforms/powernv/pci.c | 81 |
1 files changed, 50 insertions, 31 deletions
diff --git a/arch/powerpc/platforms/powernv/pci.c b/arch/powerpc/platforms/powernv/pci.c index eefbfcc3fd8c..f91a4e5d872e 100644 --- a/arch/powerpc/platforms/powernv/pci.c +++ b/arch/powerpc/platforms/powernv/pci.c | |||
@@ -206,72 +206,91 @@ static void pnv_pci_dump_phb3_diag_data(struct pci_controller *hose, | |||
206 | 206 | ||
207 | data = (struct OpalIoPhb3ErrorData*)common; | 207 | data = (struct OpalIoPhb3ErrorData*)common; |
208 | pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n", | 208 | pr_info("PHB3 PHB#%d Diag-data (Version: %d)\n", |
209 | hose->global_number, common->version); | 209 | hose->global_number, be32_to_cpu(common->version)); |
210 | if (data->brdgCtl) | 210 | if (data->brdgCtl) |
211 | pr_info("brdgCtl: %08x\n", | 211 | pr_info("brdgCtl: %08x\n", |
212 | data->brdgCtl); | 212 | be32_to_cpu(data->brdgCtl)); |
213 | if (data->portStatusReg || data->rootCmplxStatus || | 213 | if (data->portStatusReg || data->rootCmplxStatus || |
214 | data->busAgentStatus) | 214 | data->busAgentStatus) |
215 | pr_info("UtlSts: %08x %08x %08x\n", | 215 | pr_info("UtlSts: %08x %08x %08x\n", |
216 | data->portStatusReg, data->rootCmplxStatus, | 216 | be32_to_cpu(data->portStatusReg), |
217 | data->busAgentStatus); | 217 | be32_to_cpu(data->rootCmplxStatus), |
218 | be32_to_cpu(data->busAgentStatus)); | ||
218 | if (data->deviceStatus || data->slotStatus || | 219 | if (data->deviceStatus || data->slotStatus || |
219 | data->linkStatus || data->devCmdStatus || | 220 | data->linkStatus || data->devCmdStatus || |
220 | data->devSecStatus) | 221 | data->devSecStatus) |
221 | pr_info("RootSts: %08x %08x %08x %08x %08x\n", | 222 | pr_info("RootSts: %08x %08x %08x %08x %08x\n", |
222 | data->deviceStatus, data->slotStatus, | 223 | be32_to_cpu(data->deviceStatus), |
223 | data->linkStatus, data->devCmdStatus, | 224 | be32_to_cpu(data->slotStatus), |
224 | data->devSecStatus); | 225 | be32_to_cpu(data->linkStatus), |
226 | be32_to_cpu(data->devCmdStatus), | ||
227 | be32_to_cpu(data->devSecStatus)); | ||
225 | if (data->rootErrorStatus || data->uncorrErrorStatus || | 228 | if (data->rootErrorStatus || data->uncorrErrorStatus || |
226 | data->corrErrorStatus) | 229 | data->corrErrorStatus) |
227 | pr_info("RootErrSts: %08x %08x %08x\n", | 230 | pr_info("RootErrSts: %08x %08x %08x\n", |
228 | data->rootErrorStatus, data->uncorrErrorStatus, | 231 | be32_to_cpu(data->rootErrorStatus), |
229 | data->corrErrorStatus); | 232 | be32_to_cpu(data->uncorrErrorStatus), |
233 | be32_to_cpu(data->corrErrorStatus)); | ||
230 | if (data->tlpHdr1 || data->tlpHdr2 || | 234 | if (data->tlpHdr1 || data->tlpHdr2 || |
231 | data->tlpHdr3 || data->tlpHdr4) | 235 | data->tlpHdr3 || data->tlpHdr4) |
232 | pr_info("RootErrLog: %08x %08x %08x %08x\n", | 236 | pr_info("RootErrLog: %08x %08x %08x %08x\n", |
233 | data->tlpHdr1, data->tlpHdr2, | 237 | be32_to_cpu(data->tlpHdr1), |
234 | data->tlpHdr3, data->tlpHdr4); | 238 | be32_to_cpu(data->tlpHdr2), |
239 | be32_to_cpu(data->tlpHdr3), | ||
240 | be32_to_cpu(data->tlpHdr4)); | ||
235 | if (data->sourceId || data->errorClass || | 241 | if (data->sourceId || data->errorClass || |
236 | data->correlator) | 242 | data->correlator) |
237 | pr_info("RootErrLog1: %08x %016llx %016llx\n", | 243 | pr_info("RootErrLog1: %08x %016llx %016llx\n", |
238 | data->sourceId, data->errorClass, | 244 | be32_to_cpu(data->sourceId), |
239 | data->correlator); | 245 | be64_to_cpu(data->errorClass), |
246 | be64_to_cpu(data->correlator)); | ||
240 | if (data->nFir) | 247 | if (data->nFir) |
241 | pr_info("nFir: %016llx %016llx %016llx\n", | 248 | pr_info("nFir: %016llx %016llx %016llx\n", |
242 | data->nFir, data->nFirMask, | 249 | be64_to_cpu(data->nFir), |
243 | data->nFirWOF); | 250 | be64_to_cpu(data->nFirMask), |
251 | be64_to_cpu(data->nFirWOF)); | ||
244 | if (data->phbPlssr || data->phbCsr) | 252 | if (data->phbPlssr || data->phbCsr) |
245 | pr_info("PhbSts: %016llx %016llx\n", | 253 | pr_info("PhbSts: %016llx %016llx\n", |
246 | data->phbPlssr, data->phbCsr); | 254 | be64_to_cpu(data->phbPlssr), |
255 | be64_to_cpu(data->phbCsr)); | ||
247 | if (data->lemFir) | 256 | if (data->lemFir) |
248 | pr_info("Lem: %016llx %016llx %016llx\n", | 257 | pr_info("Lem: %016llx %016llx %016llx\n", |
249 | data->lemFir, data->lemErrorMask, | 258 | be64_to_cpu(data->lemFir), |
250 | data->lemWOF); | 259 | be64_to_cpu(data->lemErrorMask), |
260 | be64_to_cpu(data->lemWOF)); | ||
251 | if (data->phbErrorStatus) | 261 | if (data->phbErrorStatus) |
252 | pr_info("PhbErr: %016llx %016llx %016llx %016llx\n", | 262 | pr_info("PhbErr: %016llx %016llx %016llx %016llx\n", |
253 | data->phbErrorStatus, data->phbFirstErrorStatus, | 263 | be64_to_cpu(data->phbErrorStatus), |
254 | data->phbErrorLog0, data->phbErrorLog1); | 264 | be64_to_cpu(data->phbFirstErrorStatus), |
265 | be64_to_cpu(data->phbErrorLog0), | ||
266 | be64_to_cpu(data->phbErrorLog1)); | ||
255 | if (data->mmioErrorStatus) | 267 | if (data->mmioErrorStatus) |
256 | pr_info("OutErr: %016llx %016llx %016llx %016llx\n", | 268 | pr_info("OutErr: %016llx %016llx %016llx %016llx\n", |
257 | data->mmioErrorStatus, data->mmioFirstErrorStatus, | 269 | be64_to_cpu(data->mmioErrorStatus), |
258 | data->mmioErrorLog0, data->mmioErrorLog1); | 270 | be64_to_cpu(data->mmioFirstErrorStatus), |
271 | be64_to_cpu(data->mmioErrorLog0), | ||
272 | be64_to_cpu(data->mmioErrorLog1)); | ||
259 | if (data->dma0ErrorStatus) | 273 | if (data->dma0ErrorStatus) |
260 | pr_info("InAErr: %016llx %016llx %016llx %016llx\n", | 274 | pr_info("InAErr: %016llx %016llx %016llx %016llx\n", |
261 | data->dma0ErrorStatus, data->dma0FirstErrorStatus, | 275 | be64_to_cpu(data->dma0ErrorStatus), |
262 | data->dma0ErrorLog0, data->dma0ErrorLog1); | 276 | be64_to_cpu(data->dma0FirstErrorStatus), |
277 | be64_to_cpu(data->dma0ErrorLog0), | ||
278 | be64_to_cpu(data->dma0ErrorLog1)); | ||
263 | if (data->dma1ErrorStatus) | 279 | if (data->dma1ErrorStatus) |
264 | pr_info("InBErr: %016llx %016llx %016llx %016llx\n", | 280 | pr_info("InBErr: %016llx %016llx %016llx %016llx\n", |
265 | data->dma1ErrorStatus, data->dma1FirstErrorStatus, | 281 | be64_to_cpu(data->dma1ErrorStatus), |
266 | data->dma1ErrorLog0, data->dma1ErrorLog1); | 282 | be64_to_cpu(data->dma1FirstErrorStatus), |
283 | be64_to_cpu(data->dma1ErrorLog0), | ||
284 | be64_to_cpu(data->dma1ErrorLog1)); | ||
267 | 285 | ||
268 | for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { | 286 | for (i = 0; i < OPAL_PHB3_NUM_PEST_REGS; i++) { |
269 | if ((data->pestA[i] >> 63) == 0 && | 287 | if ((be64_to_cpu(data->pestA[i]) >> 63) == 0 && |
270 | (data->pestB[i] >> 63) == 0) | 288 | (be64_to_cpu(data->pestB[i]) >> 63) == 0) |
271 | continue; | 289 | continue; |
272 | 290 | ||
273 | pr_info("PE[%3d] A/B: %016llx %016llx\n", | 291 | pr_info("PE[%3d] A/B: %016llx %016llx\n", |
274 | i, data->pestA[i], data->pestB[i]); | 292 | i, be64_to_cpu(data->pestA[i]), |
293 | be64_to_cpu(data->pestB[i])); | ||
275 | } | 294 | } |
276 | } | 295 | } |
277 | 296 | ||
@@ -284,7 +303,7 @@ void pnv_pci_dump_phb_diag_data(struct pci_controller *hose, | |||
284 | return; | 303 | return; |
285 | 304 | ||
286 | common = (struct OpalIoPhbErrorCommon *)log_buff; | 305 | common = (struct OpalIoPhbErrorCommon *)log_buff; |
287 | switch (common->ioType) { | 306 | switch (be32_to_cpu(common->ioType)) { |
288 | case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: | 307 | case OPAL_PHB_ERROR_DATA_TYPE_P7IOC: |
289 | pnv_pci_dump_p7ioc_diag_data(hose, common); | 308 | pnv_pci_dump_p7ioc_diag_data(hose, common); |
290 | break; | 309 | break; |
@@ -293,7 +312,7 @@ void pnv_pci_dump_phb_diag_data(struct pci_controller *hose, | |||
293 | break; | 312 | break; |
294 | default: | 313 | default: |
295 | pr_warn("%s: Unrecognized ioType %d\n", | 314 | pr_warn("%s: Unrecognized ioType %d\n", |
296 | __func__, common->ioType); | 315 | __func__, be32_to_cpu(common->ioType)); |
297 | } | 316 | } |
298 | } | 317 | } |
299 | 318 | ||