예제 #1
0
static int
rtaspci_attach(device_t dev)
{
	struct		rtaspci_softc *sc;

	sc = device_get_softc(dev);

	sc->read_pci_config = rtas_token_lookup("read-pci-config");
	sc->write_pci_config = rtas_token_lookup("write-pci-config");
	sc->ex_read_pci_config = rtas_token_lookup("ibm,read-pci-config");
	sc->ex_write_pci_config = rtas_token_lookup("ibm,write-pci-config");

	sc->sc_extended_config = 0;
	OF_getprop(ofw_bus_get_node(dev), "ibm,pci-config-space-type",
	    &sc->sc_extended_config, sizeof(sc->sc_extended_config));

	bus_dma_tag_create(bus_get_dma_tag(dev),
	    1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
	    NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
	    BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->dma_tag);
#ifdef __powerpc64__
	if (!(mfmsr() & PSL_HV))
		phyp_iommu_set_dma_tag(dev, dev, sc->dma_tag);
#endif

	return (ofw_pci_attach(dev));
}
예제 #2
0
static bus_dma_tag_t
vdevice_get_dma_tag(device_t dev, device_t child)
{
	struct vdevice_devinfo *dinfo;
	while (child != NULL && device_get_parent(child) != dev)
		child = device_get_parent(child);
        dinfo = device_get_ivars(child);

	if (dinfo->mdi_dma_tag == NULL) {
		bus_dma_tag_create(bus_get_dma_tag(dev),
		    1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
		    NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
		    BUS_SPACE_MAXSIZE, 0, NULL, NULL, &dinfo->mdi_dma_tag);
		phyp_iommu_set_dma_tag(dev, child, dinfo->mdi_dma_tag);
	}

        return (dinfo->mdi_dma_tag);
}