diff options
Diffstat (limited to 'sys/x86/iommu/busdma_dmar.c')
-rw-r--r-- | sys/x86/iommu/busdma_dmar.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/sys/x86/iommu/busdma_dmar.c b/sys/x86/iommu/busdma_dmar.c index a397f42..488c7bb 100644 --- a/sys/x86/iommu/busdma_dmar.c +++ b/sys/x86/iommu/busdma_dmar.c @@ -93,7 +93,7 @@ dmar_bus_dma_is_dev_disabled(int domain, int bus, int slot, int func) * bounce mapping. */ static device_t -dmar_get_requester(device_t dev, uint16_t *rid) +dmar_get_requester(device_t dev, int *bus, int *slot, int *func) { devclass_t pci_class; device_t pci, pcib, requester; @@ -102,7 +102,9 @@ dmar_get_requester(device_t dev, uint16_t *rid) pci_class = devclass_find("pci"); requester = dev; - *rid = pci_get_rid(dev); + *bus = pci_get_bus(dev); + *slot = pci_get_slot(dev); + *func = pci_get_function(dev); /* * Walk the bridge hierarchy from the target device to the @@ -159,7 +161,8 @@ dmar_get_requester(device_t dev, uint16_t *rid) * same page tables for taken and * non-taken transactions. */ - *rid = PCI_RID(pci_get_bus(dev), 0, 0); + *bus = pci_get_bus(dev); + *slot = *func = 0; } else { /* * Neither the device nor the bridge @@ -168,7 +171,9 @@ dmar_get_requester(device_t dev, uint16_t *rid) * will use the bridge's BSF as the * requester ID. */ - *rid = pci_get_rid(pcib); + *bus = pci_get_bus(pcib); + *slot = pci_get_slot(pcib); + *func = pci_get_function(pcib); } } /* @@ -188,9 +193,9 @@ dmar_instantiate_ctx(struct dmar_unit *dmar, device_t dev, bool rmrr) device_t requester; struct dmar_ctx *ctx; bool disabled; - uint16_t rid; + int bus, slot, func; - requester = dmar_get_requester(dev, &rid); + requester = dmar_get_requester(dev, &bus, &slot, &func); /* * If the user requested the IOMMU disabled for the device, we @@ -199,10 +204,9 @@ dmar_instantiate_ctx(struct dmar_unit *dmar, device_t dev, bool rmrr) * Instead provide the identity mapping for the device * context. */ - disabled = dmar_bus_dma_is_dev_disabled(pci_get_domain(requester), - pci_get_bus(requester), pci_get_slot(requester), - pci_get_function(requester)); - ctx = dmar_get_ctx(dmar, requester, rid, disabled, rmrr); + disabled = dmar_bus_dma_is_dev_disabled(pci_get_domain(dev), bus, + slot, func); + ctx = dmar_get_ctx(dmar, requester, bus, slot, func, disabled, rmrr); if (ctx == NULL) return (NULL); if (disabled) { |