Lines Matching refs:pbm
80 static void *schizo_pci_config_mkaddr(struct pci_pbm_info *pbm, in schizo_pci_config_mkaddr() argument
85 if (!pbm) in schizo_pci_config_mkaddr()
87 bus -= pbm->pci_first_busno; in schizo_pci_config_mkaddr()
89 (SCHIZO_CONFIG_BASE(pbm) | in schizo_pci_config_mkaddr()
128 static void __schizo_check_stc_error_pbm(struct pci_pbm_info *pbm, in __schizo_check_stc_error_pbm() argument
131 struct strbuf *strbuf = &pbm->stc; in __schizo_check_stc_error_pbm()
132 unsigned long regbase = pbm->pbm_regs; in __schizo_check_stc_error_pbm()
183 pbm->name, in __schizo_check_stc_error_pbm()
193 pbm->name, in __schizo_check_stc_error_pbm()
203 pbm->name, in __schizo_check_stc_error_pbm()
236 static void schizo_check_iommu_error_pbm(struct pci_pbm_info *pbm, in schizo_check_iommu_error_pbm() argument
239 struct iommu *iommu = pbm->iommu; in schizo_check_iommu_error_pbm()
272 pbm->name, type_string); in schizo_check_iommu_error_pbm()
287 base = pbm->pbm_regs; in schizo_check_iommu_error_pbm()
328 pbm->name, i, type_string, in schizo_check_iommu_error_pbm()
335 pbm->name, i, in schizo_check_iommu_error_pbm()
341 if (pbm->stc.strbuf_enabled) in schizo_check_iommu_error_pbm()
342 __schizo_check_stc_error_pbm(pbm, type); in schizo_check_iommu_error_pbm()
346 static void schizo_check_iommu_error(struct pci_pbm_info *pbm, in schizo_check_iommu_error() argument
349 schizo_check_iommu_error_pbm(pbm, type); in schizo_check_iommu_error()
350 if (pbm->sibling) in schizo_check_iommu_error()
351 schizo_check_iommu_error_pbm(pbm->sibling, type); in schizo_check_iommu_error()
375 struct pci_pbm_info *pbm = dev_id; in schizo_ue_intr() local
376 unsigned long afsr_reg = pbm->controller_regs + SCHIZO_UE_AFSR; in schizo_ue_intr()
377 unsigned long afar_reg = pbm->controller_regs + SCHIZO_UE_AFAR; in schizo_ue_intr()
403 pbm->name, in schizo_ue_intr()
411 pbm->name, in schizo_ue_intr()
416 pbm->name, in schizo_ue_intr()
422 printk("%s: UE AFAR [%016lx]\n", pbm->name, afar); in schizo_ue_intr()
423 printk("%s: UE Secondary errors [", pbm->name); in schizo_ue_intr()
438 schizo_check_iommu_error(pbm, UE_ERR); in schizo_ue_intr()
463 struct pci_pbm_info *pbm = dev_id; in schizo_ce_intr() local
464 unsigned long afsr_reg = pbm->controller_regs + SCHIZO_CE_AFSR; in schizo_ce_intr()
465 unsigned long afar_reg = pbm->controller_regs + SCHIZO_CE_AFAR; in schizo_ce_intr()
491 pbm->name, in schizo_ce_intr()
503 pbm->name, in schizo_ce_intr()
508 pbm->name, in schizo_ce_intr()
514 printk("%s: CE AFAR [%016lx]\n", pbm->name, afar); in schizo_ce_intr()
515 printk("%s: CE Secondary errors [", pbm->name); in schizo_ce_intr()
582 static irqreturn_t schizo_pcierr_intr_other(struct pci_pbm_info *pbm) in schizo_pcierr_intr_other() argument
588 csr_reg = pbm->pbm_regs + SCHIZO_PCI_CTRL; in schizo_pcierr_intr_other()
604 pbm->name); in schizo_pcierr_intr_other()
607 pbm->name); in schizo_pcierr_intr_other()
610 pbm->name); in schizo_pcierr_intr_other()
613 pbm->name); in schizo_pcierr_intr_other()
616 pbm->name); in schizo_pcierr_intr_other()
619 pbm->name); in schizo_pcierr_intr_other()
622 pbm->pci_ops->read(pbm->pci_bus, 0, PCI_STATUS, 2, &stat); in schizo_pcierr_intr_other()
629 pbm->name, stat); in schizo_pcierr_intr_other()
630 pbm->pci_ops->write(pbm->pci_bus, 0, PCI_STATUS, 2, 0xffff); in schizo_pcierr_intr_other()
638 struct pci_pbm_info *pbm = dev_id; in schizo_pcierr_intr() local
643 base = pbm->pbm_regs; in schizo_pcierr_intr()
661 return schizo_pcierr_intr_other(pbm); in schizo_pcierr_intr()
666 pbm->name, in schizo_pcierr_intr()
680 pbm->name, in schizo_pcierr_intr()
690 pbm->name, afar); in schizo_pcierr_intr()
692 pbm->name); in schizo_pcierr_intr()
732 schizo_check_iommu_error(pbm, PCI_ERR); in schizo_pcierr_intr()
733 pci_scan_for_target_abort(pbm, pbm->pci_bus); in schizo_pcierr_intr()
736 pci_scan_for_master_abort(pbm, pbm->pci_bus); in schizo_pcierr_intr()
746 pci_scan_for_parity_error(pbm, pbm->pci_bus); in schizo_pcierr_intr()
792 struct pci_pbm_info *pbm = dev_id; in schizo_safarierr_intr() local
795 errlog = upa_readq(pbm->controller_regs + SCHIZO_SAFARI_ERRLOG); in schizo_safarierr_intr()
797 pbm->controller_regs + SCHIZO_SAFARI_ERRLOG); in schizo_safarierr_intr()
801 pbm->name, errlog); in schizo_safarierr_intr()
807 pbm->name); in schizo_safarierr_intr()
808 schizo_check_iommu_error(pbm, SAFARI_ERR); in schizo_safarierr_intr()
824 static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino) in pbm_routes_this_ino() argument
828 if (pbm->ino_bitmap & (1UL << ino)) in pbm_routes_this_ino()
848 static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) in tomatillo_register_error_handlers() argument
850 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node); in tomatillo_register_error_handlers()
862 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { in tomatillo_register_error_handlers()
864 "TOMATILLO_UE", pbm); in tomatillo_register_error_handlers()
867 "err=%d\n", pbm->name, err); in tomatillo_register_error_handlers()
869 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { in tomatillo_register_error_handlers()
871 "TOMATILLO_CE", pbm); in tomatillo_register_error_handlers()
874 "err=%d\n", pbm->name, err); in tomatillo_register_error_handlers()
877 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { in tomatillo_register_error_handlers()
879 "TOMATILLO_PCIERR", pbm); in tomatillo_register_error_handlers()
880 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { in tomatillo_register_error_handlers()
882 "TOMATILLO_PCIERR", pbm); in tomatillo_register_error_handlers()
886 "err=%d\n", pbm->name, err); in tomatillo_register_error_handlers()
888 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { in tomatillo_register_error_handlers()
890 "TOMATILLO_SERR", pbm); in tomatillo_register_error_handlers()
893 "err=%d\n", pbm->name, err); in tomatillo_register_error_handlers()
899 SCHIZO_ECCCTRL_CE), pbm->controller_regs + SCHIZO_ECC_CTRL); in tomatillo_register_error_handlers()
912 tmp = upa_readq(pbm->pbm_regs + SCHIZO_PCI_CTRL); in tomatillo_register_error_handlers()
915 upa_writeq(tmp, pbm->pbm_regs + SCHIZO_PCI_CTRL); in tomatillo_register_error_handlers()
924 upa_writeq(err_mask, pbm->pbm_regs + SCHIZO_PCI_AFSR); in tomatillo_register_error_handlers()
937 pbm->controller_regs + SCHIZO_SAFARI_ERRCTRL); in tomatillo_register_error_handlers()
940 pbm->controller_regs + SCHIZO_SAFARI_IRQCTRL); in tomatillo_register_error_handlers()
943 static void schizo_register_error_handlers(struct pci_pbm_info *pbm) in schizo_register_error_handlers() argument
945 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node); in schizo_register_error_handlers()
957 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { in schizo_register_error_handlers()
959 "SCHIZO_UE", pbm); in schizo_register_error_handlers()
962 "err=%d\n", pbm->name, err); in schizo_register_error_handlers()
964 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { in schizo_register_error_handlers()
966 "SCHIZO_CE", pbm); in schizo_register_error_handlers()
969 "err=%d\n", pbm->name, err); in schizo_register_error_handlers()
972 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { in schizo_register_error_handlers()
974 "SCHIZO_PCIERR", pbm); in schizo_register_error_handlers()
975 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { in schizo_register_error_handlers()
977 "SCHIZO_PCIERR", pbm); in schizo_register_error_handlers()
981 "err=%d\n", pbm->name, err); in schizo_register_error_handlers()
983 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { in schizo_register_error_handlers()
985 "SCHIZO_SERR", pbm); in schizo_register_error_handlers()
988 "err=%d\n", pbm->name, err); in schizo_register_error_handlers()
994 SCHIZO_ECCCTRL_CE), pbm->controller_regs + SCHIZO_ECC_CTRL); in schizo_register_error_handlers()
1010 tmp = upa_readq(pbm->pbm_regs + SCHIZO_PCI_CTRL); in schizo_register_error_handlers()
1013 upa_writeq(tmp, pbm->pbm_regs + SCHIZO_PCI_CTRL); in schizo_register_error_handlers()
1021 pbm->pbm_regs + SCHIZO_PCI_AFSR); in schizo_register_error_handlers()
1049 pbm->controller_regs + SCHIZO_SAFARI_ERRCTRL); in schizo_register_error_handlers()
1052 static void pbm_config_busmastering(struct pci_pbm_info *pbm) in pbm_config_busmastering() argument
1059 addr = schizo_pci_config_mkaddr(pbm, pbm->pci_first_busno, in pbm_config_busmastering()
1064 addr = schizo_pci_config_mkaddr(pbm, pbm->pci_first_busno, in pbm_config_busmastering()
1069 static void schizo_scan_bus(struct pci_pbm_info *pbm, struct device *parent) in schizo_scan_bus() argument
1071 pbm_config_busmastering(pbm); in schizo_scan_bus()
1072 pbm->is_66mhz_capable = in schizo_scan_bus()
1073 (of_find_property(pbm->op->dev.of_node, "66mhz-capable", NULL) in schizo_scan_bus()
1076 pbm->pci_bus = pci_scan_one_pbm(pbm, parent); in schizo_scan_bus()
1078 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) in schizo_scan_bus()
1079 tomatillo_register_error_handlers(pbm); in schizo_scan_bus()
1081 schizo_register_error_handlers(pbm); in schizo_scan_bus()
1090 static void schizo_pbm_strbuf_init(struct pci_pbm_info *pbm) in schizo_pbm_strbuf_init() argument
1092 unsigned long base = pbm->pbm_regs; in schizo_pbm_strbuf_init()
1095 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) { in schizo_pbm_strbuf_init()
1101 pbm->stc.strbuf_control = base + SCHIZO_STRBUF_CONTROL; in schizo_pbm_strbuf_init()
1102 pbm->stc.strbuf_pflush = base + SCHIZO_STRBUF_FLUSH; in schizo_pbm_strbuf_init()
1103 pbm->stc.strbuf_fsync = base + SCHIZO_STRBUF_FSYNC; in schizo_pbm_strbuf_init()
1104 pbm->stc.strbuf_ctxflush = base + SCHIZO_STRBUF_CTXFLUSH; in schizo_pbm_strbuf_init()
1105 pbm->stc.strbuf_ctxmatch_base = base + SCHIZO_STRBUF_CTXMATCH; in schizo_pbm_strbuf_init()
1107 pbm->stc.strbuf_flushflag = (volatile unsigned long *) in schizo_pbm_strbuf_init()
1108 ((((unsigned long)&pbm->stc.__flushflag_buf[0]) in schizo_pbm_strbuf_init()
1111 pbm->stc.strbuf_flushflag_pa = (unsigned long) in schizo_pbm_strbuf_init()
1112 __pa(pbm->stc.strbuf_flushflag); in schizo_pbm_strbuf_init()
1118 control = upa_readq(pbm->stc.strbuf_control); in schizo_pbm_strbuf_init()
1123 upa_writeq(control, pbm->stc.strbuf_control); in schizo_pbm_strbuf_init()
1125 pbm->stc.strbuf_enabled = 1; in schizo_pbm_strbuf_init()
1133 static int schizo_pbm_iommu_init(struct pci_pbm_info *pbm) in schizo_pbm_iommu_init() argument
1137 struct iommu *iommu = pbm->iommu; in schizo_pbm_iommu_init()
1143 vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", NULL); in schizo_pbm_iommu_init()
1170 iommu->iommu_control = pbm->pbm_regs + SCHIZO_IOMMU_CONTROL; in schizo_pbm_iommu_init()
1171 iommu->iommu_tsbbase = pbm->pbm_regs + SCHIZO_IOMMU_TSBBASE; in schizo_pbm_iommu_init()
1172 iommu->iommu_flush = pbm->pbm_regs + SCHIZO_IOMMU_FLUSH; in schizo_pbm_iommu_init()
1174 iommu->iommu_ctxflush = pbm->pbm_regs + SCHIZO_IOMMU_CTXFLUSH; in schizo_pbm_iommu_init()
1179 iommu->write_complete_reg = pbm->controller_regs + 0x10000UL; in schizo_pbm_iommu_init()
1191 upa_writeq(0, pbm->pbm_regs + tagbase + (i * 8UL)); in schizo_pbm_iommu_init()
1192 upa_writeq(0, pbm->pbm_regs + database + (i * 8UL)); in schizo_pbm_iommu_init()
1199 pbm->numa_node); in schizo_pbm_iommu_init()
1258 static void schizo_pbm_hw_init(struct pci_pbm_info *pbm) in schizo_pbm_hw_init() argument
1262 upa_writeq(5, pbm->pbm_regs + SCHIZO_PCI_IRQ_RETRY); in schizo_pbm_hw_init()
1264 tmp = upa_readq(pbm->pbm_regs + SCHIZO_PCI_CTRL); in schizo_pbm_hw_init()
1269 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && in schizo_pbm_hw_init()
1270 pbm->chip_version >= 0x2) in schizo_pbm_hw_init()
1273 if (!of_find_property(pbm->op->dev.of_node, "no-bus-parking", NULL)) in schizo_pbm_hw_init()
1278 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && in schizo_pbm_hw_init()
1279 pbm->chip_version <= 0x1) in schizo_pbm_hw_init()
1284 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) in schizo_pbm_hw_init()
1289 upa_writeq(tmp, pbm->pbm_regs + SCHIZO_PCI_CTRL); in schizo_pbm_hw_init()
1291 tmp = upa_readq(pbm->pbm_regs + SCHIZO_PCI_DIAG); in schizo_pbm_hw_init()
1295 upa_writeq(tmp, pbm->pbm_regs + SCHIZO_PCI_DIAG); in schizo_pbm_hw_init()
1297 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) { in schizo_pbm_hw_init()
1307 upa_writeq(tmp, pbm->pbm_regs + TOMATILLO_PCI_IOC_CSR); in schizo_pbm_hw_init()
1311 static int schizo_pbm_init(struct pci_pbm_info *pbm, in schizo_pbm_init() argument
1348 pbm->next = pci_pbm_root; in schizo_pbm_init()
1349 pci_pbm_root = pbm; in schizo_pbm_init()
1351 pbm->numa_node = NUMA_NO_NODE; in schizo_pbm_init()
1353 pbm->pci_ops = &sun4u_pci_ops; in schizo_pbm_init()
1354 pbm->config_space_reg_bits = 8; in schizo_pbm_init()
1356 pbm->index = pci_num_pbms++; in schizo_pbm_init()
1358 pbm->portid = portid; in schizo_pbm_init()
1359 pbm->op = op; in schizo_pbm_init()
1361 pbm->chip_type = chip_type; in schizo_pbm_init()
1362 pbm->chip_version = of_getintprop_default(dp, "version#", 0); in schizo_pbm_init()
1363 pbm->chip_revision = of_getintprop_default(dp, "module-version#", 0); in schizo_pbm_init()
1365 pbm->pbm_regs = regs[0].phys_addr; in schizo_pbm_init()
1366 pbm->controller_regs = regs[1].phys_addr - 0x10000UL; in schizo_pbm_init()
1369 pbm->sync_reg = regs[3].phys_addr + 0x1a18UL; in schizo_pbm_init()
1371 pbm->name = dp->full_name; in schizo_pbm_init()
1374 pbm->name, chipset_name, in schizo_pbm_init()
1375 pbm->chip_version, pbm->chip_revision); in schizo_pbm_init()
1377 schizo_pbm_hw_init(pbm); in schizo_pbm_init()
1379 pci_determine_mem_io_space(pbm); in schizo_pbm_init()
1381 pci_get_pbm_props(pbm); in schizo_pbm_init()
1383 err = schizo_pbm_iommu_init(pbm); in schizo_pbm_init()
1387 schizo_pbm_strbuf_init(pbm); in schizo_pbm_init()
1389 schizo_scan_bus(pbm, &op->dev); in schizo_pbm_init()
1406 struct pci_pbm_info *pbm; in schizo_find_sibling() local
1408 for (pbm = pci_pbm_root; pbm; pbm = pbm->next) { in schizo_find_sibling()
1409 if (portid_compare(pbm->portid, portid, chip_type)) in schizo_find_sibling()
1410 return pbm; in schizo_find_sibling()
1418 struct pci_pbm_info *pbm; in __schizo_init() local
1426 pbm = kzalloc(sizeof(*pbm), GFP_KERNEL); in __schizo_init()
1427 if (!pbm) { in __schizo_init()
1432 pbm->sibling = schizo_find_sibling(portid, chip_type); in __schizo_init()
1440 pbm->iommu = iommu; in __schizo_init()
1442 if (schizo_pbm_init(pbm, op, portid, chip_type)) in __schizo_init()
1445 if (pbm->sibling) in __schizo_init()
1446 pbm->sibling->sibling = pbm; in __schizo_init()
1448 dev_set_drvdata(&op->dev, pbm); in __schizo_init()
1453 kfree(pbm->iommu); in __schizo_init()
1456 kfree(pbm); in __schizo_init()