Пример #1
0
static inline struct iommu_table *devnode_table(struct device *dev)
{
	struct pci_dev *pdev;

	if (!dev) {
		pdev = ppc64_isabridge_dev;
		if (!pdev)
			return NULL;
	} else
		pdev = to_pci_dev(dev);

	return PCI_DN(PCI_GET_DN(pdev))->iommu_table;
}
Пример #2
0
void iommu_setup_pSeries(void)
{
	struct pci_dev *dev = NULL;
	struct device_node *dn, *mydn;

	if (systemcfg->platform == PLATFORM_PSERIES_LPAR)
		iommu_buses_init_lpar(&pci_root_buses);
	else
		iommu_buses_init();

	/* Now copy the iommu_table ptr from the bus devices down to every
	 * pci device_node.  This means get_iommu_table() won't need to search
	 * up the device tree to find it.
	 */
	while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
		mydn = dn = PCI_GET_DN(dev);

		while (dn && dn->iommu_table == NULL)
			dn = dn->parent;
		if (dn)
			mydn->iommu_table = dn->iommu_table;
	}
}
Пример #3
0
static void iommu_buses_init_lpar(struct list_head *bus_list)
{
	struct list_head *ln;
	struct pci_bus *bus;
	struct device_node *busdn;
	unsigned int *dma_window;

	for (ln=bus_list->next; ln != bus_list; ln=ln->next) {
		bus = pci_bus_b(ln);
		busdn = PCI_GET_DN(bus);

		dma_window = (unsigned int *)get_property(busdn, "ibm,dma-window", 0);
		if (dma_window) {
			/* Bussubno hasn't been copied yet.
			 * Do it now because iommu_table_setparms_lpar needs it.
			 */
			busdn->bussubno = bus->number;
			iommu_devnode_init(busdn);
		}

		/* look for a window on a bridge even if the PHB had one */
		iommu_buses_init_lpar(&bus->children);
	}
}