Lines Matching +full:pci +full:- +full:iommu

1 // SPDX-License-Identifier: GPL-2.0
2 /* psycho_common.c: Code common to PSYCHO and derivative PCI controllers.
39 struct strbuf *strbuf = &pbm->stc; in psycho_check_stc_error()
43 if (!strbuf->strbuf_control) in psycho_check_stc_error()
46 err_base = strbuf->strbuf_err_stat; in psycho_check_stc_error()
47 tag_base = strbuf->strbuf_tag_diag; in psycho_check_stc_error()
48 line_base = strbuf->strbuf_line_diag; in psycho_check_stc_error()
55 * before re-enabling the streaming buffer. If any dirty data in psycho_check_stc_error()
60 control = upa_readq(strbuf->strbuf_control); in psycho_check_stc_error()
61 upa_writeq(control | PSYCHO_STRBUF_CTRL_DENAB, strbuf->strbuf_control); in psycho_check_stc_error()
77 upa_writeq(control, strbuf->strbuf_control); in psycho_check_stc_error()
91 pbm->name, in psycho_check_stc_error()
102 pbm->name, in psycho_check_stc_error()
110 pbm->name, in psycho_check_stc_error()
133 unsigned long base = pbm->controller_regs; in psycho_record_iommu_tags_and_data()
184 printk(KERN_ERR "%s: IOMMU TAG(%d)[error(%s) wr(%d) " in psycho_dump_iommu_tags_and_data()
186 pbm->name, i, type_str, in psycho_dump_iommu_tags_and_data()
191 printk(KERN_ERR "%s: IOMMU DATA(%d)[valid(%d) cache(%d) " in psycho_dump_iommu_tags_and_data()
193 pbm->name, i, in psycho_dump_iommu_tags_and_data()
209 struct iommu *iommu = pbm->iommu; in psycho_check_iommu_error() local
212 spin_lock_irqsave(&iommu->lock, flags); in psycho_check_iommu_error()
213 control = upa_readq(iommu->iommu_control); in psycho_check_iommu_error()
218 upa_writeq(control, iommu->iommu_control); in psycho_check_iommu_error()
235 printk(KERN_ERR "%s: IOMMU Error, type[%s]\n", in psycho_check_iommu_error()
236 pbm->name, type_str); in psycho_check_iommu_error()
248 spin_unlock_irqrestore(&iommu->lock, flags); in psycho_check_iommu_error()
260 csr = upa_readq(pbm->pci_csr); in psycho_pcierr_intr_other()
264 upa_writeq(csr, pbm->pci_csr); in psycho_pcierr_intr_other()
268 printk(KERN_ERR "%s: PCI streaming byte hole " in psycho_pcierr_intr_other()
269 "error asserted.\n", pbm->name); in psycho_pcierr_intr_other()
271 printk(KERN_ERR "%s: PCI SERR signal asserted.\n", in psycho_pcierr_intr_other()
272 pbm->name); in psycho_pcierr_intr_other()
275 addr = psycho_pci_config_mkaddr(pbm, pbm->pci_first_busno, in psycho_pcierr_intr_other()
283 printk(KERN_ERR "%s: PCI bus error, PCI_STATUS[%04x]\n", in psycho_pcierr_intr_other()
284 pbm->name, stat); in psycho_pcierr_intr_other()
312 afsr = upa_readq(pbm->pci_afsr); in psycho_pcierr_intr()
313 afar = upa_readq(pbm->pci_afar); in psycho_pcierr_intr()
321 upa_writeq(error_bits, pbm->pci_afsr); in psycho_pcierr_intr()
322 printk(KERN_ERR "%s: PCI Error, primary error type[%s]\n", in psycho_pcierr_intr()
323 pbm->name, in psycho_pcierr_intr()
333 pbm->name, in psycho_pcierr_intr()
337 printk(KERN_ERR "%s: PCI AFAR [%016llx]\n", pbm->name, afar); in psycho_pcierr_intr()
338 printk(KERN_ERR "%s: PCI Secondary errors [", pbm->name); in psycho_pcierr_intr()
362 pci_scan_for_target_abort(pbm, pbm->pci_bus); in psycho_pcierr_intr()
365 pci_scan_for_master_abort(pbm, pbm->pci_bus); in psycho_pcierr_intr()
368 pci_scan_for_parity_error(pbm, pbm->pci_bus); in psycho_pcierr_intr()
380 upa_writeq(0, pbm->controller_regs + PSYCHO_IOMMU_TAG + off); in psycho_iommu_flush()
381 upa_writeq(0, pbm->controller_regs + PSYCHO_IOMMU_DATA + off); in psycho_iommu_flush()
405 struct iommu *iommu = pbm->iommu; in psycho_iommu_init() local
409 iommu->iommu_control = pbm->controller_regs + PSYCHO_IOMMU_CONTROL; in psycho_iommu_init()
410 iommu->iommu_tsbbase = pbm->controller_regs + PSYCHO_IOMMU_TSBBASE; in psycho_iommu_init()
411 iommu->iommu_flush = pbm->controller_regs + PSYCHO_IOMMU_FLUSH; in psycho_iommu_init()
412 iommu->iommu_tags = pbm->controller_regs + PSYCHO_IOMMU_TAG; in psycho_iommu_init()
413 iommu->write_complete_reg = (pbm->controller_regs + in psycho_iommu_init()
416 iommu->iommu_ctxflush = 0; in psycho_iommu_init()
418 control = upa_readq(iommu->iommu_control); in psycho_iommu_init()
420 upa_writeq(control, iommu->iommu_control); in psycho_iommu_init()
424 /* Leave diag mode enabled for full-flushing done in pci_iommu.c */ in psycho_iommu_init()
425 err = iommu_table_init(iommu, tsbsize * 1024 * 8, in psycho_iommu_init()
426 dvma_offset, dma_mask, pbm->numa_node); in psycho_iommu_init()
430 upa_writeq(__pa(iommu->page_table), iommu->iommu_tsbbase); in psycho_iommu_init()
432 control = upa_readq(iommu->iommu_control); in psycho_iommu_init()
444 return -EINVAL; in psycho_iommu_init()
447 upa_writeq(control, iommu->iommu_control); in psycho_iommu_init()
456 struct device_node *dp = op->dev.of_node; in psycho_pbm_init_common()
458 pbm->name = dp->full_name; in psycho_pbm_init_common()
459 pbm->numa_node = NUMA_NO_NODE; in psycho_pbm_init_common()
460 pbm->chip_type = chip_type; in psycho_pbm_init_common()
461 pbm->chip_version = of_getintprop_default(dp, "version#", 0); in psycho_pbm_init_common()
462 pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0); in psycho_pbm_init_common()
463 pbm->op = op; in psycho_pbm_init_common()
464 pbm->pci_ops = &sun4u_pci_ops; in psycho_pbm_init_common()
465 pbm->config_space_reg_bits = 8; in psycho_pbm_init_common()
466 pbm->index = pci_num_pbms++; in psycho_pbm_init_common()
470 printk(KERN_INFO "%s: %s PCI Bus Module ver[%x:%x]\n", in psycho_pbm_init_common()
471 pbm->name, chip_name, in psycho_pbm_init_common()
472 pbm->chip_version, pbm->chip_revision); in psycho_pbm_init_common()