diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2012-06-14 15:52:58 +0200 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2012-09-28 17:29:34 +0200 |
commit | 6efed63bec36e260204a50cfe6878cd36b710ade (patch) | |
tree | b558d08bfcb70faaf896fdc903c32ddbd0940d76 /drivers/iommu/amd_iommu_types.h | |
parent | 979570e02981d4a8fc20b3cc8fd651856c98ee9d (diff) | |
download | linux-stable-6efed63bec36e260204a50cfe6878cd36b710ade.tar.gz linux-stable-6efed63bec36e260204a50cfe6878cd36b710ade.tar.bz2 linux-stable-6efed63bec36e260204a50cfe6878cd36b710ade.zip |
iommu/amd: Keep track of HPET and IOAPIC device ids
The IVRS ACPI table provides information about the IOAPICs
and the HPETs available in the system and which PCI device
ID they use in transactions. Save that information for later
usage in interrupt remapping.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/iommu/amd_iommu_types.h')
-rw-r--r-- | drivers/iommu/amd_iommu_types.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index d0dab865a8b8..4495b78b1296 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h @@ -565,6 +565,16 @@ struct amd_iommu { u32 stored_l2[0x83]; }; +struct devid_map { + struct list_head list; + u8 id; + u16 devid; +}; + +/* Map HPET and IOAPIC ids to the devid used by the IOMMU */ +extern struct list_head ioapic_map; +extern struct list_head hpet_map; + /* * List with all IOMMUs in the system. This list is not locked because it is * only written and read at driver initialization or suspend time @@ -678,6 +688,30 @@ static inline u16 calc_devid(u8 bus, u8 devfn) return (((u16)bus) << 8) | devfn; } +static inline int get_ioapic_devid(int id) +{ + struct devid_map *entry; + + list_for_each_entry(entry, &ioapic_map, list) { + if (entry->id == id) + return entry->devid; + } + + return -EINVAL; +} + +static inline int get_hpet_devid(int id) +{ + struct devid_map *entry; + + list_for_each_entry(entry, &hpet_map, list) { + if (entry->id == id) + return entry->devid; + } + + return -EINVAL; +} + #ifdef CONFIG_AMD_IOMMU_STATS struct __iommu_counter { |