Path: blob/master/arch/arm/mach-msm/include/mach/iommu.h
17683 views
/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.1*2* This program is free software; you can redistribute it and/or modify3* it under the terms of the GNU General Public License version 2 and4* only version 2 as published by the Free Software Foundation.5*6* This program is distributed in the hope that it will be useful,7* but WITHOUT ANY WARRANTY; without even the implied warranty of8* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the9* GNU General Public License for more details.10*11* You should have received a copy of the GNU General Public License12* along with this program; if not, write to the Free Software13* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA14* 02110-1301, USA.15*/1617#ifndef MSM_IOMMU_H18#define MSM_IOMMU_H1920#include <linux/interrupt.h>21#include <linux/clk.h>2223/* Sharability attributes of MSM IOMMU mappings */24#define MSM_IOMMU_ATTR_NON_SH 0x025#define MSM_IOMMU_ATTR_SH 0x42627/* Cacheability attributes of MSM IOMMU mappings */28#define MSM_IOMMU_ATTR_NONCACHED 0x029#define MSM_IOMMU_ATTR_CACHED_WB_WA 0x130#define MSM_IOMMU_ATTR_CACHED_WB_NWA 0x231#define MSM_IOMMU_ATTR_CACHED_WT 0x33233/* Mask for the cache policy attribute */34#define MSM_IOMMU_CP_MASK 0x033536/* Maximum number of Machine IDs that we are allowing to be mapped to the same37* context bank. The number of MIDs mapped to the same CB does not affect38* performance, but there is a practical limit on how many distinct MIDs may39* be present. These mappings are typically determined at design time and are40* not expected to change at run time.41*/42#define MAX_NUM_MIDS 324344/**45* struct msm_iommu_dev - a single IOMMU hardware instance46* name Human-readable name given to this IOMMU HW instance47* ncb Number of context banks present on this IOMMU HW instance48*/49struct msm_iommu_dev {50const char *name;51int ncb;52};5354/**55* struct msm_iommu_ctx_dev - an IOMMU context bank instance56* name Human-readable name given to this context bank57* num Index of this context bank within the hardware58* mids List of Machine IDs that are to be mapped into this context59* bank, terminated by -1. The MID is a set of signals on the60* AXI bus that identifies the function associated with a specific61* memory request. (See ARM spec).62*/63struct msm_iommu_ctx_dev {64const char *name;65int num;66int mids[MAX_NUM_MIDS];67};686970/**71* struct msm_iommu_drvdata - A single IOMMU hardware instance72* @base: IOMMU config port base address (VA)73* @ncb The number of contexts on this IOMMU74* @irq: Interrupt number75* @clk: The bus clock for this IOMMU hardware instance76* @pclk: The clock for the IOMMU bus interconnect77*78* A msm_iommu_drvdata holds the global driver data about a single piece79* of an IOMMU hardware instance.80*/81struct msm_iommu_drvdata {82void __iomem *base;83int irq;84int ncb;85struct clk *clk;86struct clk *pclk;87};8889/**90* struct msm_iommu_ctx_drvdata - an IOMMU context bank instance91* @num: Hardware context number of this context92* @pdev: Platform device associated wit this HW instance93* @attached_elm: List element for domains to track which devices are94* attached to them95*96* A msm_iommu_ctx_drvdata holds the driver data for a single context bank97* within each IOMMU hardware instance98*/99struct msm_iommu_ctx_drvdata {100int num;101struct platform_device *pdev;102struct list_head attached_elm;103};104105/*106* Look up an IOMMU context device by its context name. NULL if none found.107* Useful for testing and drivers that do not yet fully have IOMMU stuff in108* their platform devices.109*/110struct device *msm_iommu_get_ctx(const char *ctx_name);111112/*113* Interrupt handler for the IOMMU context fault interrupt. Hooking the114* interrupt is not supported in the API yet, but this will print an error115* message and dump useful IOMMU registers.116*/117irqreturn_t msm_iommu_fault_handler(int irq, void *dev_id);118119#endif120121122