[PATCH 07/34] AMD IOMMU: add functions for mapping/unmapping the MMIO space
Joerg Roedel
joerg.roedel at amd.com
Thu Jun 26 12:27:43 PDT 2008
This patch contains two functions to map and unmap the MMIO region of an IOMMU.
Signed-off-by: Joerg Roedel <joerg.roedel at amd.com>
---
arch/x86/kernel/amd_iommu_init.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
index ee0b2da..3147e69 100644
--- a/arch/x86/kernel/amd_iommu_init.c
+++ b/arch/x86/kernel/amd_iommu_init.c
@@ -117,6 +117,29 @@ static u32 dev_table_size;
static u32 alias_table_size;
static u32 rlookup_table_size;
+static u8 * __init iommu_map_mmio_space(u64 address)
+{
+ u8 *ret;
+
+ if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu"))
+ return NULL;
+
+ ret = ioremap_nocache(address, MMIO_REGION_LENGTH);
+ if (ret != NULL)
+ return ret;
+
+ release_mem_region(address, MMIO_REGION_LENGTH);
+
+ return NULL;
+}
+
+static void __init iommu_unmap_mmio_space(struct amd_iommu *iommu)
+{
+ if (iommu->mmio_base)
+ iounmap(iommu->mmio_base);
+ release_mem_region(iommu->mmio_phys, MMIO_REGION_LENGTH);
+}
+
static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr)
{
u32 cap;
--
1.5.3.7
More information about the iommu
mailing list