3 #include <linux/ioctl.h>
5 #include <mach/m4u_port.h>
6 #include <linux/scatterlist.h>
8 typedef int M4U_PORT_ID_ENUM
;
9 typedef int M4U_MODULE_ID_ENUM
;
13 RT_RANGE_HIGH_PRIORITY
=0,
14 SEQ_RANGE_LOW_PRIORITY
=1
15 } M4U_RANGE_PRIORITY_ENUM
;
18 // port related: virtuality, security, distance
19 typedef struct _M4U_PORT
21 M4U_PORT_ID_ENUM ePortID
; //hardware port ID, defined in M4U_PORT_ID_ENUM
22 unsigned int Virtuality
;
23 unsigned int Security
;
24 unsigned int domain
; //domain : 0 1 2 3
25 unsigned int Distance
;
26 unsigned int Direction
; //0:- 1:+
41 typedef struct _M4U_PORT_ROTATOR
43 M4U_PORT_ID_ENUM ePortID
; // hardware port ID, defined in M4U_PORT_ID_ENUM
44 unsigned int Virtuality
;
45 unsigned int Security
;
46 // unsigned int Distance; // will be caculated actomatically inside M4U driver
47 // unsigned int Direction;
48 unsigned int MVAStart
;
51 M4U_ROTATOR_ENUM angle
;
52 }M4U_PORT_STRUCT_ROTATOR
;
56 M4U_CACHE_FLUSH_BEFORE_HW_READ_MEM
= 0, // optimized, recommand to use
57 M4U_CACHE_FLUSH_BEFORE_HW_WRITE_MEM
= 1, // optimized, recommand to use
58 M4U_CACHE_CLEAN_BEFORE_HW_READ_MEM
= 2,
59 M4U_CACHE_INVALID_AFTER_HW_WRITE_MEM
= 3,
61 } M4U_CACHE_SYNC_ENUM
;
64 // for kernel direct call --------------------------------------------
65 int m4u_dump_reg(int m4u_index
);
66 int m4u_dump_info(int m4u_index
);
67 int m4u_power_on(int m4u_index
);
68 int m4u_power_off(int m4u_index
);
70 int m4u_alloc_mva(M4U_MODULE_ID_ENUM eModuleID
,
71 const unsigned int BufAddr
,
72 const unsigned int BufSize
,
75 unsigned int *pRetMVABuf
);
77 int m4u_alloc_mva_sg(M4U_MODULE_ID_ENUM eModuleID
,
78 struct sg_table
*sg_table
,
79 const unsigned int BufSize
,
82 unsigned int *pRetMVABuf
);
85 int m4u_dealloc_mva(M4U_MODULE_ID_ENUM eModuleID
,
86 const unsigned int BufAddr
,
87 const unsigned int BufSize
,
88 const unsigned int MVA
);
90 int m4u_dealloc_mva_sg(M4U_MODULE_ID_ENUM eModuleID
,
91 struct sg_table
* sg_table
,
92 const unsigned int BufSize
,
93 const unsigned int MVA
);
95 int m4u_insert_wrapped_range(M4U_MODULE_ID_ENUM eModuleID
,
96 M4U_PORT_ID_ENUM portID
,
97 unsigned int MVAStart
,
100 int m4u_invalid_wrapped_range(M4U_MODULE_ID_ENUM eModuleID
,
101 M4U_PORT_ID_ENUM portID
,
102 unsigned int MVAStart
,
103 unsigned int MVAEnd
);
105 int m4u_insert_seq_range(M4U_MODULE_ID_ENUM eModuleID
,
106 unsigned int MVAStart
,
108 M4U_RANGE_PRIORITY_ENUM ePriority
,
109 unsigned int entryCount
); //0:disable multi-entry, 1,2,4,8,16: enable multi-entry
111 int m4u_invalid_seq_range(M4U_MODULE_ID_ENUM eModuleID
,
112 unsigned int MVAStart
,
113 unsigned int MVAEnd
);
115 int m4u_config_port_rotator(M4U_PORT_STRUCT_ROTATOR
*pM4uPort
);
117 int m4u_config_port(M4U_PORT_STRUCT
* pM4uPort
); //native
118 //int m4u_config_port_rotator(M4U_PORT_STRUCT_ROTATOR *pM4uPort);
119 int m4u_monitor_start(int m4u_id
);
120 int m4u_monitor_stop(int m4u_id
);
123 int m4u_dma_cache_maint(M4U_MODULE_ID_ENUM eModuleID
,
128 int m4u_mau_check_pagetable(unsigned int start_addr
, unsigned int end_addr
);
129 int m4u_mau_get_physical_port(unsigned int* engineMask
);
131 // used for those looply used buffer
132 // will check link list for mva rather than re-build pagetable by get_user_pages()
133 // if can not find the VA in link list, will call m4u_alloc_mva() internally
134 int m4u_query_mva(M4U_MODULE_ID_ENUM eModuleID
,
135 const unsigned int BufAddr
,
136 const unsigned int BufSize
,
137 unsigned int *pRetMVABuf
,
138 struct file
* a_pstFile
);
140 int m4u_log_on(void);
141 int m4u_log_off(void);
142 int m4u_debug_command(unsigned int command
);
143 int m4u_mva_map_kernel(unsigned int mva
, unsigned int size
, int sec
,
144 unsigned int* map_va
, unsigned int* map_size
);
145 int m4u_mva_unmap_kernel(unsigned int mva
, unsigned int size
, unsigned int va
);
146 int m4u_fill_linear_pagetable(unsigned int pa
, unsigned int size
);
147 // m4u driver internal use ---------------------------------------------------
150 *only for ovl 4 layger (sync nonsec pt 2 sec pt)
151 *if ovl config port NonSec to Sec, and also want to use a nonsec memory,
152 * please call this function before you use it.
153 * return : 0 : successful
156 int m4u_sync_nonsec_sec_pgtable(unsigned int mva
,