Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_host_generic_fdt.c
Show First 20 Lines • Show All 367 Lines • ▼ Show 20 Lines | #if defined(INTRNG) | ||||
if (err != 0) | if (err != 0) | ||||
return (err); | return (err); | ||||
return (intr_release_msix(pci, child, msi_parent, irq)); | return (intr_release_msix(pci, child, msi_parent, irq)); | ||||
#else | #else | ||||
return (ENXIO); | return (ENXIO); | ||||
#endif | #endif | ||||
} | } | ||||
static int | |||||
generic_pcie_get_iommu(device_t pci, device_t child, uintptr_t *id) | |||||
{ | |||||
struct pci_id_ofw_iommu *iommu; | |||||
uint32_t iommu_rid; | |||||
uint32_t iommu_xref; | |||||
uint16_t pci_rid; | |||||
phandle_t node; | |||||
int err; | |||||
node = ofw_bus_get_node(pci); | |||||
pci_rid = pci_get_rid(child); | |||||
iommu = (struct pci_id_ofw_iommu *)id; | |||||
err = ofw_bus_iommu_map(node, pci_rid, &iommu_xref, &iommu_rid); | |||||
if (err == 0) { | |||||
iommu->id = iommu_rid; | |||||
iommu->xref = iommu_xref; | |||||
} | |||||
return (err); | |||||
} | |||||
int | int | ||||
generic_pcie_get_id(device_t pci, device_t child, enum pci_id_type type, | generic_pcie_get_id(device_t pci, device_t child, enum pci_id_type type, | ||||
uintptr_t *id) | uintptr_t *id) | ||||
{ | { | ||||
phandle_t node; | phandle_t node; | ||||
int err; | int err; | ||||
uint32_t rid; | uint32_t rid; | ||||
uint16_t pci_rid; | uint16_t pci_rid; | ||||
if (type == PCI_ID_OFW_IOMMU) | |||||
return (generic_pcie_get_iommu(pci, child, id)); | |||||
if (type != PCI_ID_MSI) | if (type != PCI_ID_MSI) | ||||
return (pcib_get_id(pci, child, type, id)); | return (pcib_get_id(pci, child, type, id)); | ||||
node = ofw_bus_get_node(pci); | node = ofw_bus_get_node(pci); | ||||
pci_rid = pci_get_rid(child); | pci_rid = pci_get_rid(child); | ||||
err = ofw_bus_msimap(node, pci_rid, NULL, &rid); | err = ofw_bus_msimap(node, pci_rid, NULL, &rid); | ||||
▲ Show 20 Lines • Show All 94 Lines • Show Last 20 Lines |