diff options
author | Shuah Khan <shuah.khan@hp.com> | 2013-02-27 19:07:30 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2013-03-26 18:21:58 -0400 |
commit | 6f2729bab2cc386bb603698646dacd9ab6297ba0 (patch) | |
tree | 40e0daad672d14546cf810bfd77bb1006575a999 /drivers/iommu | |
parent | c5081cd7a2b3db31a72b4c697321cf0425dbc2f1 (diff) |
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: Shuah Khan <shuah.khan@hp.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Joerg Roedel <joro@8bytes.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/amd_iommu.c | 2 | ||||
-rw-r--r-- | drivers/iommu/amd_iommu_init.c | 6 | ||||
-rw-r--r-- | drivers/iommu/amd_iommu_types.h | 7 |
3 files changed, 4 insertions, 11 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 2a50fbe31c7b..e046d7acca84 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
@@ -173,7 +173,7 @@ static inline u16 get_device_id(struct device *dev) | |||
173 | { | 173 | { |
174 | struct pci_dev *pdev = to_pci_dev(dev); | 174 | struct pci_dev *pdev = to_pci_dev(dev); |
175 | 175 | ||
176 | return calc_devid(pdev->bus->number, pdev->devfn); | 176 | return PCI_DEVID(pdev->bus->number, pdev->devfn); |
177 | } | 177 | } |
178 | 178 | ||
179 | static struct iommu_dev_data *get_dev_data(struct device *dev) | 179 | static struct iommu_dev_data *get_dev_data(struct device *dev) |
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index f8ed6f143d9d..551768af3fe7 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -406,7 +406,7 @@ static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr) | |||
406 | u32 cap; | 406 | u32 cap; |
407 | 407 | ||
408 | cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET); | 408 | cap = read_pci_config(bus, dev, fn, cap_ptr+MMIO_RANGE_OFFSET); |
409 | update_last_devid(calc_devid(MMIO_GET_BUS(cap), MMIO_GET_LD(cap))); | 409 | update_last_devid(PCI_DEVID(MMIO_GET_BUS(cap), MMIO_GET_LD(cap))); |
410 | 410 | ||
411 | return 0; | 411 | return 0; |
412 | } | 412 | } |
@@ -1128,9 +1128,9 @@ static int iommu_init_pci(struct amd_iommu *iommu) | |||
1128 | pci_read_config_dword(iommu->dev, cap_ptr + MMIO_MISC_OFFSET, | 1128 | pci_read_config_dword(iommu->dev, cap_ptr + MMIO_MISC_OFFSET, |
1129 | &misc); | 1129 | &misc); |
1130 | 1130 | ||
1131 | iommu->first_device = calc_devid(MMIO_GET_BUS(range), | 1131 | iommu->first_device = PCI_DEVID(MMIO_GET_BUS(range), |
1132 | MMIO_GET_FD(range)); | 1132 | MMIO_GET_FD(range)); |
1133 | iommu->last_device = calc_devid(MMIO_GET_BUS(range), | 1133 | iommu->last_device = PCI_DEVID(MMIO_GET_BUS(range), |
1134 | MMIO_GET_LD(range)); | 1134 | MMIO_GET_LD(range)); |
1135 | 1135 | ||
1136 | if (!(iommu->cap & (1 << IOMMU_CAP_IOTLB))) | 1136 | if (!(iommu->cap & (1 << IOMMU_CAP_IOTLB))) |
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index a07882f60b32..ec36cf63e0ca 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h | |||
@@ -701,13 +701,6 @@ extern int amd_iommu_max_glx_val; | |||
701 | */ | 701 | */ |
702 | extern void iommu_flush_all_caches(struct amd_iommu *iommu); | 702 | extern void iommu_flush_all_caches(struct amd_iommu *iommu); |
703 | 703 | ||
704 | /* takes bus and device/function and returns the device id | ||
705 | * FIXME: should that be in generic PCI code? */ | ||
706 | static inline u16 calc_devid(u8 bus, u8 devfn) | ||
707 | { | ||
708 | return (((u16)bus) << 8) | devfn; | ||
709 | } | ||
710 | |||
711 | static inline int get_ioapic_devid(int id) | 704 | static inline int get_ioapic_devid(int id) |
712 | { | 705 | { |
713 | struct devid_map *entry; | 706 | struct devid_map *entry; |