Commit 6f2729ba authored by Shuah Khan's avatar Shuah Khan Committed by Bjorn Helgaas

iommu/amd: Remove calc_devid() and use PCI_DEVID() from PCI

Change to remove calc_devid() and use PCI_DEVID() from PCI instead.
Signed-off-by: default avatarShuah Khan <shuah.khan@hp.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarJoerg Roedel <joro@8bytes.org>
parent c5081cd7
...@@ -173,7 +173,7 @@ static inline u16 get_device_id(struct device *dev) ...@@ -173,7 +173,7 @@ static inline u16 get_device_id(struct device *dev)
{ {
struct pci_dev *pdev = to_pci_dev(dev); struct pci_dev *pdev = to_pci_dev(dev);
return calc_devid(pdev->bus->number, pdev->devfn); return PCI_DEVID(pdev->bus->number, pdev->devfn);
} }
static struct iommu_dev_data *get_dev_data(struct device *dev) static struct iommu_dev_data *get_dev_data(struct device *dev)
......
...@@ -406,7 +406,7 @@ static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr) ...@@ -406,7 +406,7 @@ static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr)
u32 cap; u32 cap;
cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET); cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET);
update_last_devid(calc_devid(MMIO_GET_BUS(cap), MMIO_GET_LD(cap))); update_last_devid(PCI_DEVID(MMIO_GET_BUS(cap), MMIO_GET_LD(cap)));
return 0; return 0;
} }
...@@ -1128,9 +1128,9 @@ static int iommu_init_pci(struct amd_iommu *iommu) ...@@ -1128,9 +1128,9 @@ static int iommu_init_pci(struct amd_iommu *iommu)
pci_read_config_dword(iommu->dev, cap_ptr + MMIO_MISC_OFFSET, pci_read_config_dword(iommu->dev, cap_ptr + MMIO_MISC_OFFSET,
&misc); &misc);
iommu->first_device = calc_devid(MMIO_GET_BUS(range), iommu->first_device = PCI_DEVID(MMIO_GET_BUS(range),
MMIO_GET_FD(range)); MMIO_GET_FD(range));
iommu->last_device = calc_devid(MMIO_GET_BUS(range), iommu->last_device = PCI_DEVID(MMIO_GET_BUS(range),
MMIO_GET_LD(range)); MMIO_GET_LD(range));
if (!(iommu->cap & (1 << IOMMU_CAP_IOTLB))) if (!(iommu->cap & (1 << IOMMU_CAP_IOTLB)))
......
...@@ -701,13 +701,6 @@ extern int amd_iommu_max_glx_val; ...@@ -701,13 +701,6 @@ extern int amd_iommu_max_glx_val;
*/ */
extern void iommu_flush_all_caches(struct amd_iommu *iommu); extern void iommu_flush_all_caches(struct amd_iommu *iommu);
/* takes bus and device/function and returns the device id
* FIXME: should that be in generic PCI code? */
static inline u16 calc_devid(u8 bus, u8 devfn)
{
return (((u16)bus) << 8) | devfn;
}
static inline int get_ioapic_devid(int id) static inline int get_ioapic_devid(int id)
{ {
struct devid_map *entry; struct devid_map *entry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment