aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/powernv
diff options
context:
space:
mode:
authorGuo Chao <yan@linux.vnet.ibm.com>2014-06-09 04:58:51 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-06-11 03:03:23 -0400
commitddf0322a3ffe2d98facc72f255ac5c140b547c72 (patch)
tree72c1e1a794a0b2363e8053617accb9c306d04777 /arch/powerpc/platforms/powernv
parent8b9f9269bcfb4fe9b44bb52aac1ce796834109fe (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')
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c36
-rw-r--r--arch/powerpc/platforms/powernv/pci.c81
2 files changed, 69 insertions, 48 deletions
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 753f08e36dfa..e0d6a3a213e2 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -267,7 +267,7 @@ static int ioda_eeh_get_state(struct eeh_pe *pe)
267{ 267{
268 s64 ret = 0; 268 s64 ret = 0;
269 u8 fstate; 269 u8 fstate;
270 u16 pcierr; 270 __be16 pcierr;
271 u32 pe_no; 271 u32 pe_no;
272 int result; 272 int result;
273 struct pci_controller *hose = pe->phb; 273 struct pci_controller *hose = pe->phb;
@@ -316,7 +316,7 @@ static int ioda_eeh_get_state(struct eeh_pe *pe)
316 result = 0; 316 result = 0;
317 result &= ~EEH_STATE_RESET_ACTIVE; 317 result &= ~EEH_STATE_RESET_ACTIVE;
318 318
319 if (pcierr != OPAL_EEH_PHB_ERROR) { 319 if (be16_to_cpu(pcierr) != OPAL_EEH_PHB_ERROR) {
320 result |= EEH_STATE_MMIO_ACTIVE; 320 result |= EEH_STATE_MMIO_ACTIVE;
321 result |= EEH_STATE_DMA_ACTIVE; 321 result |= EEH_STATE_DMA_ACTIVE;
322 result |= EEH_STATE_MMIO_ENABLED; 322 result |= EEH_STATE_MMIO_ENABLED;
@@ -706,8 +706,8 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
706 struct pci_controller *hose; 706 struct pci_controller *hose;
707 struct pnv_phb *phb; 707 struct pnv_phb *phb;
708 struct eeh_pe *phb_pe; 708 struct eeh_pe *phb_pe;
709 u64 frozen_pe_no; 709 __be64 frozen_pe_no;
710 u16 err_type, severity; 710 __be16 err_type, severity;
711 long rc; 711 long rc;
712 int ret = EEH_NEXT_ERR_NONE; 712 int ret = EEH_NEXT_ERR_NONE;
713 713
@@ -742,8 +742,8 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
742 } 742 }
743 743
744 /* If the PHB doesn't have error, stop processing */ 744 /* If the PHB doesn't have error, stop processing */
745 if (err_type == OPAL_EEH_NO_ERROR || 745 if (be16_to_cpu(err_type) == OPAL_EEH_NO_ERROR ||
746 severity == OPAL_EEH_SEV_NO_ERROR) { 746 be16_to_cpu(severity) == OPAL_EEH_SEV_NO_ERROR) {
747 pr_devel("%s: No error found on PHB#%x\n", 747 pr_devel("%s: No error found on PHB#%x\n",
748 __func__, hose->global_number); 748 __func__, hose->global_number);
749 continue; 749 continue;
@@ -755,14 +755,14 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
755 * specific PHB. 755 * specific PHB.
756 */ 756 */
757 pr_devel("%s: Error (%d, %d, %llu) on PHB#%x\n", 757 pr_devel("%s: Error (%d, %d, %llu) on PHB#%x\n",
758 __func__, err_type, severity, 758 __func__, be16_to_cpu(err_type), be16_to_cpu(severity),
759 frozen_pe_no, hose->global_number); 759 be64_to_cpu(frozen_pe_no), hose->global_number);
760 switch (err_type) { 760 switch (be16_to_cpu(err_type)) {
761 case OPAL_EEH_IOC_ERROR: 761 case OPAL_EEH_IOC_ERROR:
762 if (severity == OPAL_EEH_SEV_IOC_DEAD) { 762 if (be16_to_cpu(severity) == OPAL_EEH_SEV_IOC_DEAD) {
763 pr_err("EEH: dead IOC detected\n"); 763 pr_err("EEH: dead IOC detected\n");
764 ret = EEH_NEXT_ERR_DEAD_IOC; 764 ret = EEH_NEXT_ERR_DEAD_IOC;
765 } else if (severity == OPAL_EEH_SEV_INF) { 765 } else if (be16_to_cpu(severity) == OPAL_EEH_SEV_INF) {
766 pr_info("EEH: IOC informative error " 766 pr_info("EEH: IOC informative error "
767 "detected\n"); 767 "detected\n");
768 ioda_eeh_hub_diag(hose); 768 ioda_eeh_hub_diag(hose);
@@ -771,17 +771,18 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
771 771
772 break; 772 break;
773 case OPAL_EEH_PHB_ERROR: 773 case OPAL_EEH_PHB_ERROR:
774 if (severity == OPAL_EEH_SEV_PHB_DEAD) { 774 if (be16_to_cpu(severity) == OPAL_EEH_SEV_PHB_DEAD) {
775 *pe = phb_pe; 775 *pe = phb_pe;
776 pr_err("EEH: dead PHB#%x detected\n", 776 pr_err("EEH: dead PHB#%x detected\n",
777 hose->global_number); 777 hose->global_number);
778 ret = EEH_NEXT_ERR_DEAD_PHB; 778 ret = EEH_NEXT_ERR_DEAD_PHB;
779 } else if (severity == OPAL_EEH_SEV_PHB_FENCED) { 779 } else if (be16_to_cpu(severity) ==
780 OPAL_EEH_SEV_PHB_FENCED) {
780 *pe = phb_pe; 781 *pe = phb_pe;
781 pr_err("EEH: fenced PHB#%x detected\n", 782 pr_err("EEH: fenced PHB#%x detected\n",
782 hose->global_number); 783 hose->global_number);
783 ret = EEH_NEXT_ERR_FENCED_PHB; 784 ret = EEH_NEXT_ERR_FENCED_PHB;
784 } else if (severity == OPAL_EEH_SEV_INF) { 785 } else if (be16_to_cpu(severity) == OPAL_EEH_SEV_INF) {
785 pr_info("EEH: PHB#%x informative error " 786 pr_info("EEH: PHB#%x informative error "
786 "detected\n", 787 "detected\n",
787 hose->global_number); 788 hose->global_number);
@@ -801,12 +802,13 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
801 * progress with recovery. We needn't report 802 * progress with recovery. We needn't report
802 * it again. 803 * it again.
803 */ 804 */
804 if (ioda_eeh_get_pe(hose, frozen_pe_no, pe)) { 805 if (ioda_eeh_get_pe(hose,
806 be64_to_cpu(frozen_pe_no), pe)) {
805 *pe = phb_pe; 807 *pe = phb_pe;
806 pr_err("EEH: Escalated fenced PHB#%x " 808 pr_err("EEH: Escalated fenced PHB#%x "
807 "detected for PE#%llx\n", 809 "detected for PE#%llx\n",
808 hose->global_number, 810 hose->global_number,
809 frozen_pe_no); 811 be64_to_cpu(frozen_pe_no));
810 ret = EEH_NEXT_ERR_FENCED_PHB; 812 ret = EEH_NEXT_ERR_FENCED_PHB;
811 } else if ((*pe)->state & EEH_PE_ISOLATED) { 813 } else if ((*pe)->state & EEH_PE_ISOLATED) {
812 ret = EEH_NEXT_ERR_NONE; 814 ret = EEH_NEXT_ERR_NONE;
@@ -819,7 +821,7 @@ static int ioda_eeh_next_error(struct eeh_pe **pe)
819 break; 821 break;
820 default: 822 default:
821 pr_warn("%s: Unexpected error type %d\n", 823 pr_warn("%s: Unexpected error type %d\n",
822 __func__, err_type); 824 __func__, be16_to_cpu(err_type));
823 } 825 }
824 826
825 /* 827 /*
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