aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64/kernel/pci_psycho.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64/kernel/pci_psycho.c')
-rw-r--r--arch/sparc64/kernel/pci_psycho.c77
1 files changed, 35 insertions, 42 deletions
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 405c1dba781b..b6f073ed31d4 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -268,7 +268,6 @@ static unsigned long stc_line_buf[16];
268static void __psycho_check_one_stc(struct pci_pbm_info *pbm, 268static void __psycho_check_one_stc(struct pci_pbm_info *pbm,
269 int is_pbm_a) 269 int is_pbm_a)
270{ 270{
271 struct pci_controller_info *p = pbm->parent;
272 struct strbuf *strbuf = &pbm->stc; 271 struct strbuf *strbuf = &pbm->stc;
273 unsigned long regbase = pbm->controller_regs; 272 unsigned long regbase = pbm->controller_regs;
274 unsigned long err_base, tag_base, line_base; 273 unsigned long err_base, tag_base, line_base;
@@ -326,9 +325,8 @@ static void __psycho_check_one_stc(struct pci_pbm_info *pbm,
326 unsigned long errval = stc_error_buf[j]; 325 unsigned long errval = stc_error_buf[j];
327 if (errval != 0) { 326 if (errval != 0) {
328 saw_error++; 327 saw_error++;
329 printk("PSYCHO%d(PBM%c): STC_ERR(%d)[wr(%d)rd(%d)]\n", 328 printk("%s: STC_ERR(%d)[wr(%d)rd(%d)]\n",
330 p->index, 329 pbm->name,
331 (is_pbm_a ? 'A' : 'B'),
332 j, 330 j,
333 (errval & PSYCHO_STCERR_WRITE) ? 1 : 0, 331 (errval & PSYCHO_STCERR_WRITE) ? 1 : 0,
334 (errval & PSYCHO_STCERR_READ) ? 1 : 0); 332 (errval & PSYCHO_STCERR_READ) ? 1 : 0);
@@ -337,18 +335,16 @@ static void __psycho_check_one_stc(struct pci_pbm_info *pbm,
337 if (saw_error != 0) { 335 if (saw_error != 0) {
338 unsigned long tagval = stc_tag_buf[i]; 336 unsigned long tagval = stc_tag_buf[i];
339 unsigned long lineval = stc_line_buf[i]; 337 unsigned long lineval = stc_line_buf[i];
340 printk("PSYCHO%d(PBM%c): STC_TAG(%d)[PA(%016lx)VA(%08lx)V(%d)W(%d)]\n", 338 printk("%s: STC_TAG(%d)[PA(%016lx)VA(%08lx)V(%d)W(%d)]\n",
341 p->index, 339 pbm->name,
342 (is_pbm_a ? 'A' : 'B'),
343 i, 340 i,
344 ((tagval & PSYCHO_STCTAG_PPN) >> 19UL), 341 ((tagval & PSYCHO_STCTAG_PPN) >> 19UL),
345 (tagval & PSYCHO_STCTAG_VPN), 342 (tagval & PSYCHO_STCTAG_VPN),
346 ((tagval & PSYCHO_STCTAG_VALID) ? 1 : 0), 343 ((tagval & PSYCHO_STCTAG_VALID) ? 1 : 0),
347 ((tagval & PSYCHO_STCTAG_WRITE) ? 1 : 0)); 344 ((tagval & PSYCHO_STCTAG_WRITE) ? 1 : 0));
348 printk("PSYCHO%d(PBM%c): STC_LINE(%d)[LIDX(%lx)SP(%lx)LADDR(%lx)EP(%lx)" 345 printk("%s: STC_LINE(%d)[LIDX(%lx)SP(%lx)LADDR(%lx)EP(%lx)"
349 "V(%d)FOFN(%d)]\n", 346 "V(%d)FOFN(%d)]\n",
350 p->index, 347 pbm->name,
351 (is_pbm_a ? 'A' : 'B'),
352 i, 348 i,
353 ((lineval & PSYCHO_STCLINE_LINDX) >> 21UL), 349 ((lineval & PSYCHO_STCLINE_LINDX) >> 21UL),
354 ((lineval & PSYCHO_STCLINE_SPTR) >> 15UL), 350 ((lineval & PSYCHO_STCLINE_SPTR) >> 15UL),
@@ -411,7 +407,6 @@ static void psycho_check_iommu_error(struct pci_pbm_info *pbm,
411 unsigned long afar, 407 unsigned long afar,
412 enum psycho_error_type type) 408 enum psycho_error_type type)
413{ 409{
414 struct pci_controller_info *p = pbm->parent;
415 struct iommu *iommu = pbm->iommu; 410 struct iommu *iommu = pbm->iommu;
416 unsigned long iommu_tag[16]; 411 unsigned long iommu_tag[16];
417 unsigned long iommu_data[16]; 412 unsigned long iommu_data[16];
@@ -443,8 +438,8 @@ static void psycho_check_iommu_error(struct pci_pbm_info *pbm,
443 type_string = "ECC Error"; 438 type_string = "ECC Error";
444 break; 439 break;
445 }; 440 };
446 printk("PSYCHO%d: IOMMU Error, type[%s]\n", 441 printk("%s: IOMMU Error, type[%s]\n",
447 p->index, type_string); 442 pbm->name, type_string);
448 443
449 /* Put the IOMMU into diagnostic mode and probe 444 /* Put the IOMMU into diagnostic mode and probe
450 * it's TLB for entries with error status. 445 * it's TLB for entries with error status.
@@ -497,14 +492,14 @@ static void psycho_check_iommu_error(struct pci_pbm_info *pbm,
497 type_string = "ECC Error"; 492 type_string = "ECC Error";
498 break; 493 break;
499 }; 494 };
500 printk("PSYCHO%d: IOMMU TAG(%d)[error(%s) wr(%d) str(%d) sz(%dK) vpg(%08lx)]\n", 495 printk("%s: IOMMU TAG(%d)[error(%s) wr(%d) str(%d) sz(%dK) vpg(%08lx)]\n",
501 p->index, i, type_string, 496 pbm->name, i, type_string,
502 ((tag & PSYCHO_IOMMU_TAG_WRITE) ? 1 : 0), 497 ((tag & PSYCHO_IOMMU_TAG_WRITE) ? 1 : 0),
503 ((tag & PSYCHO_IOMMU_TAG_STREAM) ? 1 : 0), 498 ((tag & PSYCHO_IOMMU_TAG_STREAM) ? 1 : 0),
504 ((tag & PSYCHO_IOMMU_TAG_SIZE) ? 64 : 8), 499 ((tag & PSYCHO_IOMMU_TAG_SIZE) ? 64 : 8),
505 (tag & PSYCHO_IOMMU_TAG_VPAGE) << IOMMU_PAGE_SHIFT); 500 (tag & PSYCHO_IOMMU_TAG_VPAGE) << IOMMU_PAGE_SHIFT);
506 printk("PSYCHO%d: IOMMU DATA(%d)[valid(%d) cache(%d) ppg(%016lx)]\n", 501 printk("%s: IOMMU DATA(%d)[valid(%d) cache(%d) ppg(%016lx)]\n",
507 p->index, i, 502 pbm->name, i,
508 ((data & PSYCHO_IOMMU_DATA_VALID) ? 1 : 0), 503 ((data & PSYCHO_IOMMU_DATA_VALID) ? 1 : 0),
509 ((data & PSYCHO_IOMMU_DATA_CACHE) ? 1 : 0), 504 ((data & PSYCHO_IOMMU_DATA_CACHE) ? 1 : 0),
510 (data & PSYCHO_IOMMU_DATA_PPAGE) << IOMMU_PAGE_SHIFT); 505 (data & PSYCHO_IOMMU_DATA_PPAGE) << IOMMU_PAGE_SHIFT);
@@ -555,22 +550,22 @@ static irqreturn_t psycho_ue_intr(int irq, void *dev_id)
555 psycho_write(afsr_reg, error_bits); 550 psycho_write(afsr_reg, error_bits);
556 551
557 /* Log the error. */ 552 /* Log the error. */
558 printk("PSYCHO%d: Uncorrectable Error, primary error type[%s]\n", 553 printk("%s: Uncorrectable Error, primary error type[%s]\n",
559 p->index, 554 pbm->name,
560 (((error_bits & PSYCHO_UEAFSR_PPIO) ? 555 (((error_bits & PSYCHO_UEAFSR_PPIO) ?
561 "PIO" : 556 "PIO" :
562 ((error_bits & PSYCHO_UEAFSR_PDRD) ? 557 ((error_bits & PSYCHO_UEAFSR_PDRD) ?
563 "DMA Read" : 558 "DMA Read" :
564 ((error_bits & PSYCHO_UEAFSR_PDWR) ? 559 ((error_bits & PSYCHO_UEAFSR_PDWR) ?
565 "DMA Write" : "???"))))); 560 "DMA Write" : "???")))));
566 printk("PSYCHO%d: bytemask[%04lx] dword_offset[%lx] UPA_MID[%02lx] was_block(%d)\n", 561 printk("%s: bytemask[%04lx] dword_offset[%lx] UPA_MID[%02lx] was_block(%d)\n",
567 p->index, 562 pbm->name,
568 (afsr & PSYCHO_UEAFSR_BMSK) >> 32UL, 563 (afsr & PSYCHO_UEAFSR_BMSK) >> 32UL,
569 (afsr & PSYCHO_UEAFSR_DOFF) >> 29UL, 564 (afsr & PSYCHO_UEAFSR_DOFF) >> 29UL,
570 (afsr & PSYCHO_UEAFSR_MID) >> 24UL, 565 (afsr & PSYCHO_UEAFSR_MID) >> 24UL,
571 ((afsr & PSYCHO_UEAFSR_BLK) ? 1 : 0)); 566 ((afsr & PSYCHO_UEAFSR_BLK) ? 1 : 0));
572 printk("PSYCHO%d: UE AFAR [%016lx]\n", p->index, afar); 567 printk("%s: UE AFAR [%016lx]\n", pbm->name, afar);
573 printk("PSYCHO%d: UE Secondary errors [", p->index); 568 printk("%s: UE Secondary errors [", pbm->name);
574 reported = 0; 569 reported = 0;
575 if (afsr & PSYCHO_UEAFSR_SPIO) { 570 if (afsr & PSYCHO_UEAFSR_SPIO) {
576 reported++; 571 reported++;
@@ -615,7 +610,6 @@ static irqreturn_t psycho_ue_intr(int irq, void *dev_id)
615static irqreturn_t psycho_ce_intr(int irq, void *dev_id) 610static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
616{ 611{
617 struct pci_pbm_info *pbm = dev_id; 612 struct pci_pbm_info *pbm = dev_id;
618 struct pci_controller_info *p = pbm->parent;
619 unsigned long afsr_reg = pbm->controller_regs + PSYCHO_CE_AFSR; 613 unsigned long afsr_reg = pbm->controller_regs + PSYCHO_CE_AFSR;
620 unsigned long afar_reg = pbm->controller_regs + PSYCHO_CE_AFAR; 614 unsigned long afar_reg = pbm->controller_regs + PSYCHO_CE_AFAR;
621 unsigned long afsr, afar, error_bits; 615 unsigned long afsr, afar, error_bits;
@@ -634,8 +628,8 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
634 psycho_write(afsr_reg, error_bits); 628 psycho_write(afsr_reg, error_bits);
635 629
636 /* Log the error. */ 630 /* Log the error. */
637 printk("PSYCHO%d: Correctable Error, primary error type[%s]\n", 631 printk("%s: Correctable Error, primary error type[%s]\n",
638 p->index, 632 pbm->name,
639 (((error_bits & PSYCHO_CEAFSR_PPIO) ? 633 (((error_bits & PSYCHO_CEAFSR_PPIO) ?
640 "PIO" : 634 "PIO" :
641 ((error_bits & PSYCHO_CEAFSR_PDRD) ? 635 ((error_bits & PSYCHO_CEAFSR_PDRD) ?
@@ -646,16 +640,16 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
646 /* XXX Use syndrome and afar to print out module string just like 640 /* XXX Use syndrome and afar to print out module string just like
647 * XXX UDB CE trap handler does... -DaveM 641 * XXX UDB CE trap handler does... -DaveM
648 */ 642 */
649 printk("PSYCHO%d: syndrome[%02lx] bytemask[%04lx] dword_offset[%lx] " 643 printk("%s: syndrome[%02lx] bytemask[%04lx] dword_offset[%lx] "
650 "UPA_MID[%02lx] was_block(%d)\n", 644 "UPA_MID[%02lx] was_block(%d)\n",
651 p->index, 645 pbm->name,
652 (afsr & PSYCHO_CEAFSR_ESYND) >> 48UL, 646 (afsr & PSYCHO_CEAFSR_ESYND) >> 48UL,
653 (afsr & PSYCHO_CEAFSR_BMSK) >> 32UL, 647 (afsr & PSYCHO_CEAFSR_BMSK) >> 32UL,
654 (afsr & PSYCHO_CEAFSR_DOFF) >> 29UL, 648 (afsr & PSYCHO_CEAFSR_DOFF) >> 29UL,
655 (afsr & PSYCHO_CEAFSR_MID) >> 24UL, 649 (afsr & PSYCHO_CEAFSR_MID) >> 24UL,
656 ((afsr & PSYCHO_CEAFSR_BLK) ? 1 : 0)); 650 ((afsr & PSYCHO_CEAFSR_BLK) ? 1 : 0));
657 printk("PSYCHO%d: CE AFAR [%016lx]\n", p->index, afar); 651 printk("%s: CE AFAR [%016lx]\n", pbm->name, afar);
658 printk("PSYCHO%d: CE Secondary errors [", p->index); 652 printk("%s: CE Secondary errors [", pbm->name);
659 reported = 0; 653 reported = 0;
660 if (afsr & PSYCHO_CEAFSR_SPIO) { 654 if (afsr & PSYCHO_CEAFSR_SPIO) {
661 reported++; 655 reported++;
@@ -770,8 +764,8 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id)
770 psycho_write(afsr_reg, error_bits); 764 psycho_write(afsr_reg, error_bits);
771 765
772 /* Log the error. */ 766 /* Log the error. */
773 printk("PSYCHO%d(PBM%c): PCI Error, primary error type[%s]\n", 767 printk("%s: PCI Error, primary error type[%s]\n",
774 p->index, (is_pbm_a ? 'A' : 'B'), 768 pbm->name,
775 (((error_bits & PSYCHO_PCIAFSR_PMA) ? 769 (((error_bits & PSYCHO_PCIAFSR_PMA) ?
776 "Master Abort" : 770 "Master Abort" :
777 ((error_bits & PSYCHO_PCIAFSR_PTA) ? 771 ((error_bits & PSYCHO_PCIAFSR_PTA) ?
@@ -780,15 +774,13 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id)
780 "Excessive Retries" : 774 "Excessive Retries" :
781 ((error_bits & PSYCHO_PCIAFSR_PPERR) ? 775 ((error_bits & PSYCHO_PCIAFSR_PPERR) ?
782 "Parity Error" : "???")))))); 776 "Parity Error" : "???"))))));
783 printk("PSYCHO%d(PBM%c): bytemask[%04lx] UPA_MID[%02lx] was_block(%d)\n", 777 printk("%s: bytemask[%04lx] UPA_MID[%02lx] was_block(%d)\n",
784 p->index, (is_pbm_a ? 'A' : 'B'), 778 pbm->name,
785 (afsr & PSYCHO_PCIAFSR_BMSK) >> 32UL, 779 (afsr & PSYCHO_PCIAFSR_BMSK) >> 32UL,
786 (afsr & PSYCHO_PCIAFSR_MID) >> 25UL, 780 (afsr & PSYCHO_PCIAFSR_MID) >> 25UL,
787 (afsr & PSYCHO_PCIAFSR_BLK) ? 1 : 0); 781 (afsr & PSYCHO_PCIAFSR_BLK) ? 1 : 0);
788 printk("PSYCHO%d(PBM%c): PCI AFAR [%016lx]\n", 782 printk("%s: PCI AFAR [%016lx]\n", pbm->name, afar);
789 p->index, (is_pbm_a ? 'A' : 'B'), afar); 783 printk("%s: PCI Secondary errors [", pbm->name);
790 printk("PSYCHO%d(PBM%c): PCI Secondary errors [",
791 p->index, (is_pbm_a ? 'A' : 'B'));
792 reported = 0; 784 reported = 0;
793 if (afsr & PSYCHO_PCIAFSR_SMA) { 785 if (afsr & PSYCHO_PCIAFSR_SMA) {
794 reported++; 786 reported++;
@@ -821,10 +813,10 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id)
821 */ 813 */
822 if (error_bits & (PSYCHO_PCIAFSR_PTA | PSYCHO_PCIAFSR_STA)) { 814 if (error_bits & (PSYCHO_PCIAFSR_PTA | PSYCHO_PCIAFSR_STA)) {
823 psycho_check_iommu_error(pbm, afsr, afar, PCI_ERR); 815 psycho_check_iommu_error(pbm, afsr, afar, PCI_ERR);
824 pci_scan_for_target_abort(pbm->parent, pbm, pbm->pci_bus); 816 pci_scan_for_target_abort(pbm, pbm->pci_bus);
825 } 817 }
826 if (error_bits & (PSYCHO_PCIAFSR_PMA | PSYCHO_PCIAFSR_SMA)) 818 if (error_bits & (PSYCHO_PCIAFSR_PMA | PSYCHO_PCIAFSR_SMA))
827 pci_scan_for_master_abort(pbm->parent, pbm, pbm->pci_bus); 819 pci_scan_for_master_abort(pbm, pbm->pci_bus);
828 820
829 /* For excessive retries, PSYCHO/PBM will abort the device 821 /* For excessive retries, PSYCHO/PBM will abort the device
830 * and there is no way to specifically check for excessive 822 * and there is no way to specifically check for excessive
@@ -834,7 +826,7 @@ static irqreturn_t psycho_pcierr_intr(int irq, void *dev_id)
834 */ 826 */
835 827
836 if (error_bits & (PSYCHO_PCIAFSR_PPERR | PSYCHO_PCIAFSR_SPERR)) 828 if (error_bits & (PSYCHO_PCIAFSR_PPERR | PSYCHO_PCIAFSR_SPERR))
837 pci_scan_for_parity_error(pbm->parent, pbm, pbm->pci_bus); 829 pci_scan_for_parity_error(pbm, pbm->pci_bus);
838 830
839 return IRQ_HANDLED; 831 return IRQ_HANDLED;
840} 832}
@@ -1089,6 +1081,8 @@ static void psycho_pbm_init(struct pci_controller_info *p,
1089 pbm->scan_bus = psycho_scan_bus; 1081 pbm->scan_bus = psycho_scan_bus;
1090 pbm->pci_ops = &psycho_ops; 1082 pbm->pci_ops = &psycho_ops;
1091 1083
1084 pbm->index = pci_num_pbms++;
1085
1092 pbm->chip_type = PBM_CHIP_TYPE_PSYCHO; 1086 pbm->chip_type = PBM_CHIP_TYPE_PSYCHO;
1093 pbm->chip_version = 0; 1087 pbm->chip_version = 0;
1094 prop = of_find_property(dp, "version#", NULL); 1088 prop = of_find_property(dp, "version#", NULL);
@@ -1155,7 +1149,6 @@ void psycho_init(struct device_node *dp, char *model_name)
1155 1149
1156 p->pbm_A.portid = upa_portid; 1150 p->pbm_A.portid = upa_portid;
1157 p->pbm_B.portid = upa_portid; 1151 p->pbm_B.portid = upa_portid;
1158 p->index = pci_num_controllers++;
1159 1152
1160 prop = of_find_property(dp, "reg", NULL); 1153 prop = of_find_property(dp, "reg", NULL);
1161 pr_regs = prop->value; 1154 pr_regs = prop->value;