diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2008-06-26 15:27:43 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-06-27 04:12:09 -0400 |
commit | 6c56747b46717b4c6a890b35e8518f4be961dc7e (patch) | |
tree | 90e30fd9df9945f298a8e9fb7af3bce8438d00c2 | |
parent | ca7ed057ae25e5e60814f950995f22f051d2e449 (diff) |
x86, AMD IOMMU: add functions for mapping/unmapping the MMIO space
This patch contains two functions to map and unmap the MMIO region of an IOMMU.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Cc: iommu@lists.linux-foundation.org
Cc: bhavna.sarathy@amd.com
Cc: Sebastian.Biemueller@amd.com
Cc: robert.richter@amd.com
Cc: joro@8bytes.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | 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 ee0b2da027bc..3147e6991005 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; | |||
117 | static u32 alias_table_size; | 117 | static u32 alias_table_size; |
118 | static u32 rlookup_table_size; | 118 | static u32 rlookup_table_size; |
119 | 119 | ||
120 | static u8 * __init iommu_map_mmio_space(u64 address) | ||
121 | { | ||
122 | u8 *ret; | ||
123 | |||
124 | if (!request_mem_region(address, MMIO_REGION_LENGTH, "amd_iommu")) | ||
125 | return NULL; | ||
126 | |||
127 | ret = ioremap_nocache(address, MMIO_REGION_LENGTH); | ||
128 | if (ret != NULL) | ||
129 | return ret; | ||
130 | |||
131 | release_mem_region(address, MMIO_REGION_LENGTH); | ||
132 | |||
133 | return NULL; | ||
134 | } | ||
135 | |||
136 | static void __init iommu_unmap_mmio_space(struct amd_iommu *iommu) | ||
137 | { | ||
138 | if (iommu->mmio_base) | ||
139 | iounmap(iommu->mmio_base); | ||
140 | release_mem_region(iommu->mmio_phys, MMIO_REGION_LENGTH); | ||
141 | } | ||
142 | |||
120 | static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr) | 143 | static int __init find_last_devid_on_pci(int bus, int dev, int fn, int cap_ptr) |
121 | { | 144 | { |
122 | u32 cap; | 145 | u32 cap; |