Lines Matching refs:pbm
84 struct pci_pbm_info *pbm = p->dev->archdata.host_controller; in iommu_batch_flush() local
87 unsigned long devhandle = pbm->devhandle; in iommu_batch_flush()
100 if (!iommu_use_atu(pbm->iommu, mask)) { in iommu_batch_flush()
117 iotsb_num = pbm->iommu->atu->iotsb->iotsb_num; in iommu_batch_flush()
324 struct pci_pbm_info *pbm; in dma_4v_free_coherent() local
334 pbm = dev->archdata.host_controller; in dma_4v_free_coherent()
336 devhandle = pbm->devhandle; in dma_4v_free_coherent()
431 struct pci_pbm_info *pbm; in dma_4v_unmap_page() local
447 pbm = dev->archdata.host_controller; in dma_4v_unmap_page()
449 devhandle = pbm->devhandle; in dma_4v_unmap_page()
629 struct pci_pbm_info *pbm; in dma_4v_unmap_sg() local
640 pbm = dev->archdata.host_controller; in dma_4v_unmap_sg()
642 devhandle = pbm->devhandle; in dma_4v_unmap_sg()
697 static void pci_sun4v_scan_bus(struct pci_pbm_info *pbm, struct device *parent) in pci_sun4v_scan_bus() argument
702 dp = pbm->op->dev.of_node; in pci_sun4v_scan_bus()
704 pbm->is_66mhz_capable = (prop != NULL); in pci_sun4v_scan_bus()
705 pbm->pci_bus = pci_scan_one_pbm(pbm, parent); in pci_sun4v_scan_bus()
710 static unsigned long probe_existing_entries(struct pci_pbm_info *pbm, in probe_existing_entries() argument
717 devhandle = pbm->devhandle; in probe_existing_entries()
741 static int pci_sun4v_atu_alloc_iotsb(struct pci_pbm_info *pbm) in pci_sun4v_atu_alloc_iotsb() argument
743 struct atu *atu = pbm->iommu->atu; in pci_sun4v_atu_alloc_iotsb()
774 err = pci_sun4v_iotsb_conf(pbm->devhandle, in pci_sun4v_atu_alloc_iotsb()
786 err = dma_4v_iotsb_bind(pbm->devhandle, iotsb_num, pbm->pci_bus); in pci_sun4v_atu_alloc_iotsb()
802 static int pci_sun4v_atu_init(struct pci_pbm_info *pbm) in pci_sun4v_atu_init() argument
804 struct atu *atu = pbm->iommu->atu; in pci_sun4v_atu_init()
812 ranges = of_get_property(pbm->op->dev.of_node, "iommu-address-ranges", in pci_sun4v_atu_init()
819 page_size = of_get_property(pbm->op->dev.of_node, "iommu-pagesizes", in pci_sun4v_atu_init()
841 err = pci_sun4v_atu_alloc_iotsb(pbm); in pci_sun4v_atu_init()
867 static int pci_sun4v_iommu_init(struct pci_pbm_info *pbm) in pci_sun4v_iommu_init() argument
870 struct iommu *iommu = pbm->iommu; in pci_sun4v_iommu_init()
875 vdma = of_get_property(pbm->op->dev.of_node, "virtual-dma", NULL); in pci_sun4v_iommu_init()
908 sz = probe_existing_entries(pbm, &iommu->tbl); in pci_sun4v_iommu_init()
911 pbm->name, sz); in pci_sun4v_iommu_init()
961 static int pci_sun4v_get_head(struct pci_pbm_info *pbm, unsigned long msiqid, in pci_sun4v_get_head() argument
966 err = pci_sun4v_msiq_gethead(pbm->devhandle, msiqid, head); in pci_sun4v_get_head()
970 limit = pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry); in pci_sun4v_get_head()
977 static int pci_sun4v_dequeue_msi(struct pci_pbm_info *pbm, in pci_sun4v_dequeue_msi() argument
985 ep = (pbm->msi_queues + ((msiqid - pbm->msiq_first) * in pci_sun4v_dequeue_msi()
986 (pbm->msiq_ent_count * in pci_sun4v_dequeue_msi()
1000 err = pci_sun4v_msi_setstate(pbm->devhandle, in pci_sun4v_dequeue_msi()
1011 (pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry))) in pci_sun4v_dequeue_msi()
1017 static int pci_sun4v_set_head(struct pci_pbm_info *pbm, unsigned long msiqid, in pci_sun4v_set_head() argument
1022 err = pci_sun4v_msiq_sethead(pbm->devhandle, msiqid, head); in pci_sun4v_set_head()
1029 static int pci_sun4v_msi_setup(struct pci_pbm_info *pbm, unsigned long msiqid, in pci_sun4v_msi_setup() argument
1032 if (pci_sun4v_msi_setmsiq(pbm->devhandle, msi, msiqid, in pci_sun4v_msi_setup()
1036 if (pci_sun4v_msi_setstate(pbm->devhandle, msi, HV_MSISTATE_IDLE)) in pci_sun4v_msi_setup()
1038 if (pci_sun4v_msi_setvalid(pbm->devhandle, msi, HV_MSIVALID_VALID)) in pci_sun4v_msi_setup()
1043 static int pci_sun4v_msi_teardown(struct pci_pbm_info *pbm, unsigned long msi) in pci_sun4v_msi_teardown() argument
1047 err = pci_sun4v_msi_getmsiq(pbm->devhandle, msi, &msiqid); in pci_sun4v_msi_teardown()
1051 pci_sun4v_msi_setvalid(pbm->devhandle, msi, HV_MSIVALID_INVALID); in pci_sun4v_msi_teardown()
1056 static int pci_sun4v_msiq_alloc(struct pci_pbm_info *pbm) in pci_sun4v_msiq_alloc() argument
1061 q_size = pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry); in pci_sun4v_msiq_alloc()
1062 alloc_size = (pbm->msiq_num * q_size); in pci_sun4v_msiq_alloc()
1071 pbm->msi_queues = (void *) pages; in pci_sun4v_msiq_alloc()
1073 for (i = 0; i < pbm->msiq_num; i++) { in pci_sun4v_msiq_alloc()
1077 err = pci_sun4v_msiq_conf(pbm->devhandle, in pci_sun4v_msiq_alloc()
1078 pbm->msiq_first + i, in pci_sun4v_msiq_alloc()
1079 base, pbm->msiq_ent_count); in pci_sun4v_msiq_alloc()
1086 err = pci_sun4v_msiq_info(pbm->devhandle, in pci_sun4v_msiq_alloc()
1087 pbm->msiq_first + i, in pci_sun4v_msiq_alloc()
1094 if (ret1 != base || ret2 != pbm->msiq_ent_count) { in pci_sun4v_msiq_alloc()
1097 base, pbm->msiq_ent_count, in pci_sun4v_msiq_alloc()
1110 static void pci_sun4v_msiq_free(struct pci_pbm_info *pbm) in pci_sun4v_msiq_free() argument
1115 for (i = 0; i < pbm->msiq_num; i++) { in pci_sun4v_msiq_free()
1116 unsigned long msiqid = pbm->msiq_first + i; in pci_sun4v_msiq_free()
1118 (void) pci_sun4v_msiq_conf(pbm->devhandle, msiqid, 0UL, 0); in pci_sun4v_msiq_free()
1121 q_size = pbm->msiq_ent_count * sizeof(struct pci_sun4v_msiq_entry); in pci_sun4v_msiq_free()
1122 alloc_size = (pbm->msiq_num * q_size); in pci_sun4v_msiq_free()
1125 pages = (unsigned long) pbm->msi_queues; in pci_sun4v_msiq_free()
1129 pbm->msi_queues = NULL; in pci_sun4v_msiq_free()
1132 static int pci_sun4v_msiq_build_irq(struct pci_pbm_info *pbm, in pci_sun4v_msiq_build_irq() argument
1136 unsigned int irq = sun4v_build_irq(pbm->devhandle, devino); in pci_sun4v_msiq_build_irq()
1141 if (pci_sun4v_msiq_setvalid(pbm->devhandle, msiqid, HV_MSIQ_VALID)) in pci_sun4v_msiq_build_irq()
1143 if (pci_sun4v_msiq_setstate(pbm->devhandle, msiqid, HV_MSIQSTATE_IDLE)) in pci_sun4v_msiq_build_irq()
1160 static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) in pci_sun4v_msi_init() argument
1162 sparc64_pbm_msi_init(pbm, &pci_sun4v_msiq_ops); in pci_sun4v_msi_init()
1165 static void pci_sun4v_msi_init(struct pci_pbm_info *pbm) in pci_sun4v_msi_init() argument
1170 static int pci_sun4v_pbm_init(struct pci_pbm_info *pbm, in pci_sun4v_pbm_init() argument
1176 pbm->numa_node = of_node_to_nid(dp); in pci_sun4v_pbm_init()
1178 pbm->pci_ops = &sun4v_pci_ops; in pci_sun4v_pbm_init()
1179 pbm->config_space_reg_bits = 12; in pci_sun4v_pbm_init()
1181 pbm->index = pci_num_pbms++; in pci_sun4v_pbm_init()
1183 pbm->op = op; in pci_sun4v_pbm_init()
1185 pbm->devhandle = devhandle; in pci_sun4v_pbm_init()
1187 pbm->name = dp->full_name; in pci_sun4v_pbm_init()
1189 printk("%s: SUN4V PCI Bus Module\n", pbm->name); in pci_sun4v_pbm_init()
1190 printk("%s: On NUMA node %d\n", pbm->name, pbm->numa_node); in pci_sun4v_pbm_init()
1192 pci_determine_mem_io_space(pbm); in pci_sun4v_pbm_init()
1194 pci_get_pbm_props(pbm); in pci_sun4v_pbm_init()
1196 err = pci_sun4v_iommu_init(pbm); in pci_sun4v_pbm_init()
1200 pci_sun4v_msi_init(pbm); in pci_sun4v_pbm_init()
1202 pci_sun4v_scan_bus(pbm, &op->dev); in pci_sun4v_pbm_init()
1207 if (pbm->iommu->atu) { in pci_sun4v_pbm_init()
1208 err = pci_sun4v_atu_init(pbm); in pci_sun4v_pbm_init()
1210 kfree(pbm->iommu->atu); in pci_sun4v_pbm_init()
1211 pbm->iommu->atu = NULL; in pci_sun4v_pbm_init()
1216 pbm->next = pci_pbm_root; in pci_sun4v_pbm_init()
1217 pci_pbm_root = pbm; in pci_sun4v_pbm_init()
1226 struct pci_pbm_info *pbm; in pci_sun4v_probe() local
1289 pbm = kzalloc(sizeof(*pbm), GFP_KERNEL); in pci_sun4v_probe()
1290 if (!pbm) { in pci_sun4v_probe()
1301 pbm->iommu = iommu; in pci_sun4v_probe()
1311 err = pci_sun4v_pbm_init(pbm, op, devhandle); in pci_sun4v_probe()
1315 dev_set_drvdata(&op->dev, pbm); in pci_sun4v_probe()
1321 kfree(pbm->iommu); in pci_sun4v_probe()
1324 kfree(pbm); in pci_sun4v_probe()