diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-07-10 14:16:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-12 02:44:51 -0400 |
commit | cf1337f0447e5be8e66daa944f0ea3bcac2b6179 (patch) | |
tree | 6e5120ba9a75fee603a660b4324c147b9e455c79 /drivers/pci/intel-iommu.h | |
parent | ad3ad3f6a2caebf56869b83b69e23eb9fa5e0ab6 (diff) |
x64, x2apic/intr-remap: move IOMMU_WAIT_OP() macro to intel-iommu.h
move IOMMU_WAIT_OP() macro to header file.
This will be used by both DMA-remapping and Intr-remapping.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: akpm@linux-foundation.org
Cc: arjan@linux.intel.com
Cc: andi@firstfloor.org
Cc: ebiederm@xmission.com
Cc: jbarnes@virtuousgeek.org
Cc: steiner@sgi.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/pci/intel-iommu.h')
-rw-r--r-- | drivers/pci/intel-iommu.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h index eb167e39b464..3a650e8cba33 100644 --- a/drivers/pci/intel-iommu.h +++ b/drivers/pci/intel-iommu.h | |||
@@ -177,6 +177,21 @@ static inline void dmar_writeq(void __iomem *addr, u64 val) | |||
177 | #define dma_frcd_source_id(c) (c & 0xffff) | 177 | #define dma_frcd_source_id(c) (c & 0xffff) |
178 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */ | 178 | #define dma_frcd_page_addr(d) (d & (((u64)-1) << 12)) /* low 64 bit */ |
179 | 179 | ||
180 | #define DMAR_OPERATION_TIMEOUT ((cycles_t) tsc_khz*10*1000) /* 10sec */ | ||
181 | |||
182 | #define IOMMU_WAIT_OP(iommu, offset, op, cond, sts) \ | ||
183 | {\ | ||
184 | cycles_t start_time = get_cycles();\ | ||
185 | while (1) {\ | ||
186 | sts = op (iommu->reg + offset);\ | ||
187 | if (cond)\ | ||
188 | break;\ | ||
189 | if (DMAR_OPERATION_TIMEOUT < (get_cycles() - start_time))\ | ||
190 | panic("DMAR hardware is malfunctioning\n");\ | ||
191 | cpu_relax();\ | ||
192 | }\ | ||
193 | } | ||
194 | |||
180 | struct intel_iommu { | 195 | struct intel_iommu { |
181 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ | 196 | void __iomem *reg; /* Pointer to hardware regs, virtual addr */ |
182 | u64 cap; | 197 | u64 cap; |