27 extern void griommu_register_drv(
void);
29 #define GRIOMMU_ERR_OK 0 30 #define GRIOMMU_ERR_NOINIT -1 31 #define GRIOMMU_ERR_EINVAL -2 32 #define GRIOMMU_ERR_IMPLEMENTED -3 33 #define GRIOMMU_ERR_NOTFOUND -4 36 #define GRIOMMU_APV_SIZE 0x20000000 39 #define GRIOMMU_APV_ALIGN 0x10 42 extern void * griommu_apv_new(
void);
43 extern void griommu_apv_delete(
void * apv);
51 #define MASTER_VENDOR (0xff << MASTER_VENDOR_BIT) 52 #define MASTER_DEVICE (0xfff << MASTER_DEVICE_BIT) 53 #define MASTER_BS (0x1 << MASTER_BS_BIT) 54 #define MASTER_GROUP (0xf << MASTER_GROUP_BIT) 56 #define MASTER_VENDOR_BIT 24 57 #define MASTER_DEVICE_BIT 12 58 #define MASTER_BS_BIT 4 59 #define MASTER_GROUP_BIT 0 61 #define GRIOMMU_OPTIONS_BUS0 0 62 #define GRIOMMU_OPTIONS_BUS1 1 63 extern int griommu_master_setup(
int master,
int group,
int options);
64 extern int griommu_master_find(
int vendor,
int device,
int instance);
65 extern int griommu_master_info(
int master, uint32_t * info);
66 #define griommu_get_master_vendor(info) \ 67 ((info & MASTER_VENDOR) >> MASTER_VENDOR_BIT) 68 #define griommu_get_master_device(info) \ 69 ((info & MASTER_DEVICE) >> MASTER_DEVICE_BIT) 70 #define griommu_get_master_routing(info) \ 71 ((info & MASTER_BS) >> MASTER_BS_BIT) 72 #define griommu_get_master_group(info) \ 73 ((info & MASTER_GROUP) >> MASTER_GROUP_BIT) 76 #define GRIOMMU_OPTIONS_GROUP_PASSTHROUGH 2 77 #define GRIOMMU_OPTIONS_GROUP_ENABLE 1 78 #define GRIOMMU_OPTIONS_GROUP_DISABLE 0 79 extern int griommu_group_setup(
int group,
void * apv,
int options);
80 extern int griommu_group_info(
int group, uint32_t * info);
81 #define GRIOMMU_OPTIONS_APV_ALLOW 0x1 82 #define GRIOMMU_OPTIONS_APV_DONTALLOW 0x0 83 extern int griommu_group_apv_init(
int group,
int options);
84 extern int griommu_group_apv_address_set(
int group, uint32_t addr,
int size,
86 extern int griommu_group_apv_page_set(
int group,
int index,
int size,
88 extern int griommu_group_apv_flush(
int group);
94 #define CTRL_PGSZ (0x7 << CTRL_PGSZ_BIT) 95 #define CTRL_LB (0x1 << CTRL_LB_BIT) 96 #define CTRL_SP (0x1 << CTRL_SP_BIT) 97 #define CTRL_ITR (0xf << CTRL_ITR_BIT) 98 #define CTRL_DP (0x1 << CTRL_DP_BIT) 99 #define CTRL_SIV (0x1 << CTRL_SIV_BIT) 100 #define CTRL_HPROT (0x3 << CTRL_HPROT_BIT) 101 #define CTRL_AU (0x1 << CTRL_AU_BIT) 102 #define CTRL_WP (0x1 << CTRL_WP_BIT) 103 #define CTRL_DM (0x1 << CTRL_DM_BIT) 104 #define CTRL_GS (0x1 << CTRL_GS_BIT) 105 #define CTRL_CE (0x1 << CTRL_CE_BIT) 106 #define CTRL_PM (0x3 << CTRL_PM_BIT) 107 #define CTRL_PM_APV (0x0 << CTRL_PM_BIT) 108 #define CTRL_PM_IOMMU (0x1 << CTRL_PM_BIT) 109 #define CTRL_EN (0x1 << CTRL_EN_BIT) 111 #define CTRL_PGSZ_BIT 18 112 #define CTRL_LB_BIT 17 113 #define CTRL_SP_BIT 16 114 #define CTRL_ITR_BIT 12 115 #define CTRL_DP_BIT 11 116 #define CTRL_SIV_BIT 10 117 #define CTRL_HPROT_BIT 8 118 #define CTRL_AU_BIT 7 119 #define CTRL_WP_BIT 6 120 #define CTRL_DM_BIT 5 121 #define CTRL_GS_BIT 4 122 #define CTRL_CE_BIT 3 123 #define CTRL_PM_BIT 1 124 #define CTRL_EN_BIT 0 126 #define GRIOMMU_OPTIONS_LOOKUPBUS_BUS0 0 127 #define GRIOMMU_OPTIONS_LOOKUPBUS_BUS1 CTRL_LB 128 #define GRIOMMU_OPTIONS_CACHE_DISABLE 0 129 #define GRIOMMU_OPTIONS_CACHE_ENABLE CTRL_CE 130 #define GRIOMMU_OPTIONS_GROUPADDRESSING_DISABLE 0 131 #define GRIOMMU_OPTIONS_GROUPADDRESSING_ENABLE CTRL_GS 132 #define GRIOMMU_OPTIONS_WPROTONLY_DISABLE 0 133 #define GRIOMMU_OPTIONS_WPROTONLY_ENABLE CTRL_WP 134 #define GRIOMMU_OPTIONS_AHBUPDATE_DISABLE 0 135 #define GRIOMMU_OPTIONS_AHBUPDATE_ENABLE CTRL_AU 136 #define GRIOMMU_OPTIONS_PREFETCH_DISABLE CTRL_DP 137 #define GRIOMMU_OPTIONS_PREFETCH_ENABLE 0 138 #define GRIOMMU_OPTIONS_PAGESIZE_4KIB 0 139 #define GRIOMMU_OPTIONS_PAGESIZE_8KIB (0x1 << CTRL_PGSZ_BIT) 140 #define GRIOMMU_OPTIONS_PAGESIZE_16KIB (0x2 << CTRL_PGSZ_BIT) 141 #define GRIOMMU_OPTIONS_PAGESIZE_32KIB (0x3 << CTRL_PGSZ_BIT) 142 #define GRIOMMU_OPTIONS_PAGESIZE_64KIB (0x4 << CTRL_PGSZ_BIT) 143 #define GRIOMMU_OPTIONS_PAGESIZE_128KIB (0x5 << CTRL_PGSZ_BIT) 144 #define GRIOMMU_OPTIONS_PAGESIZE_256KIB (0x6 << CTRL_PGSZ_BIT) 145 #define GRIOMMU_OPTIONS_PAGESIZE_512KIB (0x7 << CTRL_PGSZ_BIT) 146 extern int griommu_setup(
int options);
147 extern int griommu_status(
void);
149 #define GRIOMMU_MODE_IOMMU 1 150 #define GRIOMMU_MODE_GROUPAPV 0 151 extern int griommu_enable(
int mode);
152 extern int griommu_disable(
void);
155 extern int griommu_apv_flush(
void);
156 extern int griommu_apv_init(
void * apv,
int options);
157 extern int griommu_apv_address_set(
void * apv, uint32_t addr,
int size,
159 extern int griommu_apv_page_set(
void * apv,
int index,
int size,
int options);
167 typedef void (*griommu_isr_t)(
void *arg, uint32_t access, uint32_t status);
168 #define GRIOMMU_INTERRUPT_ALL (0x2f << 0) 169 #define GRIOMMU_INTERRUPT_PARITY_ERROR (0x1 << 5) 170 #define GRIOMMU_INTERRUPT_FLUSH_COMPLETED (0x1 << 3) 171 #define GRIOMMU_INTERRUPT_FLUSH_START (0x1 << 2) 172 #define GRIOMMU_INTERRUPT_ACCESS_DENIED (0x1 << 1) 173 #define GRIOMMU_INTERRUPT_TRANSLATION_ERROR (0x1 << 0) 174 extern int griommu_isr_register(griommu_isr_t isr,
void * arg,
int options);
175 extern int griommu_isr_unregister(
void);
176 extern int griommu_interrupt_unmask(
int options);
177 extern int griommu_interrupt_mask(
int options);
179 extern int griommu_error_status(uint32_t * access);
181 extern int griommu_print(
void);
Definition: rtemscompat1.h:15
unsigned size
Definition: tte.h:74