From c8d35c84f5494d8d294205b598f927a11fd41f34 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 2 Nov 2012 12:24:03 -0700 Subject: ARM: OMAP2+: Move plat/iovmm.h to include/linux/omap-iommu.h Looks like the iommu framework does not have generic functions exported for all the needs yet. The hardware specific functions are defined in files like intel-iommu.h and amd-iommu.h. Follow the same standard for omap-iommu.h. This is needed because we are removing plat and mach includes for ARM common zImage support. Further work should continue in the iommu framework context as only pure platform data will be communicated from arch/arm/*omap*/* code to the iommu framework. Cc: Ido Yariv Cc: Laurent Pinchart Cc: Omar Ramirez Luna Cc: linux-media@vger.kernel.org Acked-by: Mauro Carvalho Chehab Acked-by: Ohad Ben-Cohen Acked-by: Joerg Roedel Signed-off-by: Tony Lindgren --- drivers/iommu/omap-iommu-debug.c | 2 +- drivers/iommu/omap-iommu.c | 1 + drivers/iommu/omap-iovmm.c | 46 +++++++++++++++++++++++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) (limited to 'drivers/iommu') diff --git a/drivers/iommu/omap-iommu-debug.c b/drivers/iommu/omap-iommu-debug.c index 0cac372b0d4..cf4a0b5c1d8 100644 --- a/drivers/iommu/omap-iommu-debug.c +++ b/drivers/iommu/omap-iommu-debug.c @@ -18,9 +18,9 @@ #include #include #include +#include #include -#include #include "omap-iopgtable.h" diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index f2bbfb0fd0e..eadcfde757e 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include diff --git a/drivers/iommu/omap-iovmm.c b/drivers/iommu/omap-iovmm.c index b332392397c..9852101cf04 100644 --- a/drivers/iommu/omap-iovmm.c +++ b/drivers/iommu/omap-iovmm.c @@ -17,15 +17,59 @@ #include #include #include +#include #include #include #include -#include #include "omap-iopgtable.h" +/* + * IOVMF_FLAGS: attribute for iommu virtual memory area(iovma) + * + * lower 16 bit is used for h/w and upper 16 bit is for s/w. + */ +#define IOVMF_SW_SHIFT 16 + +/* + * iovma: h/w flags derived from cam and ram attribute + */ +#define IOVMF_CAM_MASK (~((1 << 10) - 1)) +#define IOVMF_RAM_MASK (~IOVMF_CAM_MASK) + +#define IOVMF_PGSZ_MASK (3 << 0) +#define IOVMF_PGSZ_1M MMU_CAM_PGSZ_1M +#define IOVMF_PGSZ_64K MMU_CAM_PGSZ_64K +#define IOVMF_PGSZ_4K MMU_CAM_PGSZ_4K +#define IOVMF_PGSZ_16M MMU_CAM_PGSZ_16M + +#define IOVMF_ENDIAN_MASK (1 << 9) +#define IOVMF_ENDIAN_BIG MMU_RAM_ENDIAN_BIG + +#define IOVMF_ELSZ_MASK (3 << 7) +#define IOVMF_ELSZ_16 MMU_RAM_ELSZ_16 +#define IOVMF_ELSZ_32 MMU_RAM_ELSZ_32 +#define IOVMF_ELSZ_NONE MMU_RAM_ELSZ_NONE + +#define IOVMF_MIXED_MASK (1 << 6) +#define IOVMF_MIXED MMU_RAM_MIXED + +/* + * iovma: s/w flags, used for mapping and umapping internally. + */ +#define IOVMF_MMIO (1 << IOVMF_SW_SHIFT) +#define IOVMF_ALLOC (2 << IOVMF_SW_SHIFT) +#define IOVMF_ALLOC_MASK (3 << IOVMF_SW_SHIFT) + +/* "superpages" is supported just with physically linear pages */ +#define IOVMF_DISCONT (1 << (2 + IOVMF_SW_SHIFT)) +#define IOVMF_LINEAR (2 << (2 + IOVMF_SW_SHIFT)) +#define IOVMF_LINEAR_MASK (3 << (2 + IOVMF_SW_SHIFT)) + +#define IOVMF_DA_FIXED (1 << (4 + IOVMF_SW_SHIFT)) + static struct kmem_cache *iovm_area_cachep; /* return the offset of the first scatterlist entry in a sg table */ -- cgit v1.2.3