Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Enumerations | Functions
exynos-iommu.c File Reference
#include <linux/io.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/pm_runtime.h>
#include <linux/clk.h>
#include <linux/err.h>
#include <linux/mm.h>
#include <linux/iommu.h>
#include <linux/errno.h>
#include <linux/list.h>
#include <linux/memblock.h>
#include <linux/export.h>
#include <asm/cacheflush.h>
#include <asm/pgtable.h>
#include <mach/sysmmu.h>

Go to the source code of this file.

Data Structures

struct  exynos_iommu_domain
 
struct  sysmmu_drvdata
 

Macros

#define SECT_ORDER   20
 
#define LPAGE_ORDER   16
 
#define SPAGE_ORDER   12
 
#define SECT_SIZE   (1 << SECT_ORDER)
 
#define LPAGE_SIZE   (1 << LPAGE_ORDER)
 
#define SPAGE_SIZE   (1 << SPAGE_ORDER)
 
#define SECT_MASK   (~(SECT_SIZE - 1))
 
#define LPAGE_MASK   (~(LPAGE_SIZE - 1))
 
#define SPAGE_MASK   (~(SPAGE_SIZE - 1))
 
#define lv1ent_fault(sent)   (((*(sent) & 3) == 0) || ((*(sent) & 3) == 3))
 
#define lv1ent_page(sent)   ((*(sent) & 3) == 1)
 
#define lv1ent_section(sent)   ((*(sent) & 3) == 2)
 
#define lv2ent_fault(pent)   ((*(pent) & 3) == 0)
 
#define lv2ent_small(pent)   ((*(pent) & 2) == 2)
 
#define lv2ent_large(pent)   ((*(pent) & 3) == 1)
 
#define section_phys(sent)   (*(sent) & SECT_MASK)
 
#define section_offs(iova)   ((iova) & 0xFFFFF)
 
#define lpage_phys(pent)   (*(pent) & LPAGE_MASK)
 
#define lpage_offs(iova)   ((iova) & 0xFFFF)
 
#define spage_phys(pent)   (*(pent) & SPAGE_MASK)
 
#define spage_offs(iova)   ((iova) & 0xFFF)
 
#define lv1ent_offset(iova)   ((iova) >> SECT_ORDER)
 
#define lv2ent_offset(iova)   (((iova) & 0xFF000) >> SPAGE_ORDER)
 
#define NUM_LV1ENTRIES   4096
 
#define NUM_LV2ENTRIES   256
 
#define LV2TABLE_SIZE   (NUM_LV2ENTRIES * sizeof(long))
 
#define SPAGES_PER_LPAGE   (LPAGE_SIZE / SPAGE_SIZE)
 
#define lv2table_base(sent)   (*(sent) & 0xFFFFFC00)
 
#define mk_lv1ent_sect(pa)   ((pa) | 2)
 
#define mk_lv1ent_page(pa)   ((pa) | 1)
 
#define mk_lv2ent_lpage(pa)   ((pa) | 1)
 
#define mk_lv2ent_spage(pa)   ((pa) | 2)
 
#define CTRL_ENABLE   0x5
 
#define CTRL_BLOCK   0x7
 
#define CTRL_DISABLE   0x0
 
#define REG_MMU_CTRL   0x000
 
#define REG_MMU_CFG   0x004
 
#define REG_MMU_STATUS   0x008
 
#define REG_MMU_FLUSH   0x00C
 
#define REG_MMU_FLUSH_ENTRY   0x010
 
#define REG_PT_BASE_ADDR   0x014
 
#define REG_INT_STATUS   0x018
 
#define REG_INT_CLEAR   0x01C
 
#define REG_PAGE_FAULT_ADDR   0x024
 
#define REG_AW_FAULT_ADDR   0x028
 
#define REG_AR_FAULT_ADDR   0x02C
 
#define REG_DEFAULT_SLAVE_ADDR   0x030
 
#define REG_MMU_VERSION   0x034
 
#define REG_PB0_SADDR   0x04C
 
#define REG_PB0_EADDR   0x050
 
#define REG_PB1_SADDR   0x054
 
#define REG_PB1_EADDR   0x058
 

Typedefs

typedef int(* sysmmu_fault_handler_t )(enum exynos_sysmmu_inttype itype, unsigned long pgtable_base, unsigned long fault_addr)
 

Enumerations

enum  exynos_sysmmu_inttype {
  SYSMMU_PAGEFAULT, SYSMMU_AR_MULTIHIT, SYSMMU_AW_MULTIHIT, SYSMMU_BUSERROR,
  SYSMMU_AR_SECURITY, SYSMMU_AR_ACCESS, SYSMMU_AW_SECURITY, SYSMMU_AW_PROTECTION,
  SYSMMU_FAULT_UNKNOWN, SYSMMU_FAULTS_NUM
}
 

Functions

void exynos_sysmmu_set_prefbuf (struct device *dev, unsigned long base0, unsigned long size0, unsigned long base1, unsigned long size1)
 
void exynos_sysmmu_set_fault_handler (struct device *dev, sysmmu_fault_handler_t handler)
 
int exynos_sysmmu_enable (struct device *dev, unsigned long pgtable)
 
bool exynos_sysmmu_disable (struct device *dev)
 
void exynos_sysmmu_tlb_invalidate (struct device *dev)
 
 subsys_initcall (exynos_iommu_init)
 

Macro Definition Documentation

#define CTRL_BLOCK   0x7

Definition at line 80 of file exynos-iommu.c.

#define CTRL_DISABLE   0x0

Definition at line 81 of file exynos-iommu.c.

#define CTRL_ENABLE   0x5

Definition at line 79 of file exynos-iommu.c.

#define LPAGE_MASK   (~(LPAGE_SIZE - 1))

Definition at line 44 of file exynos-iommu.c.

#define lpage_offs (   iova)    ((iova) & 0xFFFF)

Definition at line 58 of file exynos-iommu.c.

#define LPAGE_ORDER   16

Definition at line 36 of file exynos-iommu.c.

#define lpage_phys (   pent)    (*(pent) & LPAGE_MASK)

Definition at line 57 of file exynos-iommu.c.

#define LPAGE_SIZE   (1 << LPAGE_ORDER)

Definition at line 40 of file exynos-iommu.c.

#define lv1ent_fault (   sent)    (((*(sent) & 3) == 0) || ((*(sent) & 3) == 3))

Definition at line 47 of file exynos-iommu.c.

#define lv1ent_offset (   iova)    ((iova) >> SECT_ORDER)

Definition at line 62 of file exynos-iommu.c.

#define lv1ent_page (   sent)    ((*(sent) & 3) == 1)

Definition at line 48 of file exynos-iommu.c.

#define lv1ent_section (   sent)    ((*(sent) & 3) == 2)

Definition at line 49 of file exynos-iommu.c.

#define lv2ent_fault (   pent)    ((*(pent) & 3) == 0)

Definition at line 51 of file exynos-iommu.c.

#define lv2ent_large (   pent)    ((*(pent) & 3) == 1)

Definition at line 53 of file exynos-iommu.c.

#define lv2ent_offset (   iova)    (((iova) & 0xFF000) >> SPAGE_ORDER)

Definition at line 63 of file exynos-iommu.c.

#define lv2ent_small (   pent)    ((*(pent) & 2) == 2)

Definition at line 52 of file exynos-iommu.c.

#define lv2table_base (   sent)    (*(sent) & 0xFFFFFC00)

Definition at line 72 of file exynos-iommu.c.

#define LV2TABLE_SIZE   (NUM_LV2ENTRIES * sizeof(long))

Definition at line 68 of file exynos-iommu.c.

#define mk_lv1ent_page (   pa)    ((pa) | 1)

Definition at line 75 of file exynos-iommu.c.

#define mk_lv1ent_sect (   pa)    ((pa) | 2)

Definition at line 74 of file exynos-iommu.c.

#define mk_lv2ent_lpage (   pa)    ((pa) | 1)

Definition at line 76 of file exynos-iommu.c.

#define mk_lv2ent_spage (   pa)    ((pa) | 2)

Definition at line 77 of file exynos-iommu.c.

#define NUM_LV1ENTRIES   4096

Definition at line 65 of file exynos-iommu.c.

#define NUM_LV2ENTRIES   256

Definition at line 66 of file exynos-iommu.c.

#define REG_AR_FAULT_ADDR   0x02C

Definition at line 94 of file exynos-iommu.c.

#define REG_AW_FAULT_ADDR   0x028

Definition at line 93 of file exynos-iommu.c.

#define REG_DEFAULT_SLAVE_ADDR   0x030

Definition at line 95 of file exynos-iommu.c.

#define REG_INT_CLEAR   0x01C

Definition at line 90 of file exynos-iommu.c.

#define REG_INT_STATUS   0x018

Definition at line 89 of file exynos-iommu.c.

#define REG_MMU_CFG   0x004

Definition at line 84 of file exynos-iommu.c.

#define REG_MMU_CTRL   0x000

Definition at line 83 of file exynos-iommu.c.

#define REG_MMU_FLUSH   0x00C

Definition at line 86 of file exynos-iommu.c.

#define REG_MMU_FLUSH_ENTRY   0x010

Definition at line 87 of file exynos-iommu.c.

#define REG_MMU_STATUS   0x008

Definition at line 85 of file exynos-iommu.c.

#define REG_MMU_VERSION   0x034

Definition at line 97 of file exynos-iommu.c.

#define REG_PAGE_FAULT_ADDR   0x024

Definition at line 92 of file exynos-iommu.c.

#define REG_PB0_EADDR   0x050

Definition at line 100 of file exynos-iommu.c.

#define REG_PB0_SADDR   0x04C

Definition at line 99 of file exynos-iommu.c.

#define REG_PB1_EADDR   0x058

Definition at line 102 of file exynos-iommu.c.

#define REG_PB1_SADDR   0x054

Definition at line 101 of file exynos-iommu.c.

#define REG_PT_BASE_ADDR   0x014

Definition at line 88 of file exynos-iommu.c.

#define SECT_MASK   (~(SECT_SIZE - 1))

Definition at line 43 of file exynos-iommu.c.

#define SECT_ORDER   20

Definition at line 35 of file exynos-iommu.c.

#define SECT_SIZE   (1 << SECT_ORDER)

Definition at line 39 of file exynos-iommu.c.

#define section_offs (   iova)    ((iova) & 0xFFFFF)

Definition at line 56 of file exynos-iommu.c.

#define section_phys (   sent)    (*(sent) & SECT_MASK)

Definition at line 55 of file exynos-iommu.c.

#define SPAGE_MASK   (~(SPAGE_SIZE - 1))

Definition at line 45 of file exynos-iommu.c.

#define spage_offs (   iova)    ((iova) & 0xFFF)

Definition at line 60 of file exynos-iommu.c.

#define SPAGE_ORDER   12

Definition at line 37 of file exynos-iommu.c.

#define spage_phys (   pent)    (*(pent) & SPAGE_MASK)

Definition at line 59 of file exynos-iommu.c.

#define SPAGE_SIZE   (1 << SPAGE_ORDER)

Definition at line 41 of file exynos-iommu.c.

#define SPAGES_PER_LPAGE   (LPAGE_SIZE / SPAGE_SIZE)

Definition at line 70 of file exynos-iommu.c.

Typedef Documentation

typedef int(* sysmmu_fault_handler_t)(enum exynos_sysmmu_inttype itype, unsigned long pgtable_base, unsigned long fault_addr)

Definition at line 134 of file exynos-iommu.c.

Enumeration Type Documentation

Enumerator:
SYSMMU_PAGEFAULT 
SYSMMU_AR_MULTIHIT 
SYSMMU_AW_MULTIHIT 
SYSMMU_BUSERROR 
SYSMMU_AR_SECURITY 
SYSMMU_AR_ACCESS 
SYSMMU_AW_SECURITY 
SYSMMU_AW_PROTECTION 
SYSMMU_FAULT_UNKNOWN 
SYSMMU_FAULTS_NUM 

Definition at line 114 of file exynos-iommu.c.

Function Documentation

bool exynos_sysmmu_disable ( struct device dev)

Definition at line 514 of file exynos-iommu.c.

int exynos_sysmmu_enable ( struct device dev,
unsigned long  pgtable 
)

Definition at line 488 of file exynos-iommu.c.

void exynos_sysmmu_set_fault_handler ( struct device dev,
sysmmu_fault_handler_t  handler 
)

Definition at line 304 of file exynos-iommu.c.

void exynos_sysmmu_set_prefbuf ( struct device dev,
unsigned long  base0,
unsigned long  size0,
unsigned long  base1,
unsigned long  size1 
)

Definition at line 250 of file exynos-iommu.c.

void exynos_sysmmu_tlb_invalidate ( struct device dev)

Definition at line 550 of file exynos-iommu.c.

subsys_initcall ( exynos_iommu_init  )