aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/intel-iommu.h
diff options
context:
space:
mode:
authorDavid Miller <davem@davemloft.net>2008-02-06 04:36:23 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-06 13:41:01 -0500
commitf661197e0a95ec7305e1e790d95b72a74a1c4a0f (patch)
treea6916d877a3d9db9bc658758bd347d4f436f6d59 /drivers/pci/intel-iommu.h
parentb1ed88b47f5e18c6efb8041275c16eeead5377df (diff)
Genericizing iova.[ch]
I would like to potentially move the sparc64 IOMMU code over to using the nice new drivers/pci/iova.[ch] code for free area management.. In order to do that we have to detach the IOMMU page size assumptions which only really need to exist in the intel-iommu.[ch] code. This patch attempts to implement that. [akpm@linux-foundation.org: build fix] Signed-off-by: David S. Miller <davem@davemloft.net> Acked-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pci/intel-iommu.h')
-rw-r--r--drivers/pci/intel-iommu.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h
index 459ad1f9dc54..0e4862675ad2 100644
--- a/drivers/pci/intel-iommu.h
+++ b/drivers/pci/intel-iommu.h
@@ -23,10 +23,24 @@
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/msi.h> 25#include <linux/msi.h>
26#include <linux/sysdev.h>
26#include "iova.h" 27#include "iova.h"
27#include <linux/io.h> 28#include <linux/io.h>
28 29
29/* 30/*
31 * We need a fixed PAGE_SIZE of 4K irrespective of
32 * arch PAGE_SIZE for IOMMU page tables.
33 */
34#define PAGE_SHIFT_4K (12)
35#define PAGE_SIZE_4K (1UL << PAGE_SHIFT_4K)
36#define PAGE_MASK_4K (((u64)-1) << PAGE_SHIFT_4K)
37#define PAGE_ALIGN_4K(addr) (((addr) + PAGE_SIZE_4K - 1) & PAGE_MASK_4K)
38
39#define IOVA_PFN(addr) ((addr) >> PAGE_SHIFT_4K)
40#define DMA_32BIT_PFN IOVA_PFN(DMA_32BIT_MASK)
41#define DMA_64BIT_PFN IOVA_PFN(DMA_64BIT_MASK)
42
43/*
30 * Intel IOMMU register specification per version 1.0 public spec. 44 * Intel IOMMU register specification per version 1.0 public spec.
31 */ 45 */
32 46