/* * omap iommu: tlb and pagetable primitives * * Copyright (C) 2008-2010 Nokia Corporation * * Written by Hiroshi DOYU <Hiroshi.DOYU@nokia.com>, * Paul Mundt and Toshihiro Kobayashi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */#include<linux/dma-mapping.h>#include<linux/err.h>#include<linux/slab.h>#include<linux/interrupt.h>#include<linux/ioport.h>#include<linux/platform_device.h>#include<linux/iommu.h>#include<linux/omap-iommu.h>#include<linux/mutex.h>#include<linux/spinlock.h>#include<linux/io.h>#include<linux/pm_runtime.h>#include<linux/of.h>#include<linux/of_iommu.h>#include<linux/of_irq.h>#include<linux/of_platform.h>#include<linux/regmap.h>#include<linux/mfd/syscon.h>#include<linux/platform_data/iommu-omap.h>#include"omap-iopgtable.h"#include"omap-iommu.h"staticconststructiommu_opsomap_iommu_ops;#define to_iommu(dev) \ ((struct omap_iommu *)platform_get_drvdata(to_platform_device(dev)))/* bitmap of the page sizes currently supported */#define OMAP_IOMMU_PGSIZES (SZ_4K | SZ_64K | SZ_1M | SZ_16M)#define MMU_LOCK_BASE_SHIFT 10#define MMU_LOCK_BASE_MASK (0x1f << MMU_LOCK_BASE_SHIFT)#define MMU_LOCK_BASE(x) \ ((x & MMU_LOCK_BASE_MASK) >> MMU_LOCK_BASE_SHIFT)#define MMU_LOCK_VICT_SHIFT 4#define MMU_LOCK_VICT_MASK (0x1f << MMU_LOCK_VICT_SHIFT)#define MMU_LOCK_VICT(x) \ ((x & MMU_LOCK_VICT_MASK) >> MMU_LOCK_VICT_SHIFT)staticstructplatform_driveromap_iommu_driver;staticstructkmem_cache*iopte_cachep;/** * to_omap_domain - Get struct omap_iommu_domain from generic iommu_domain * @dom: generic iommu domain handle **/staticstructomap_iommu_domain*to_omap_domain(structiommu_domain*dom){returncontainer_of(dom,structomap_iommu_domain,domain);}/** * omap_iommu_save_ctx - Save registers for pm off-mode support * @dev: client device **/voidomap_iommu_save_ctx(structdevice*dev){structomap_iommu*obj=dev_to_omap_iommu(dev);u32*p=obj->ctx;inti;for(i=0;i<(MMU_REG_SIZE/sizeof(u32));i++){p[i