diff options
author | Christoph Hellwig <hch@lst.de> | 2007-10-29 10:23:43 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2008-01-29 05:14:55 -0500 |
commit | 417345d8f5bacc291138c99a292a8ca69947530e (patch) | |
tree | a8a5e61b0466fd0a914bef82fc266a87eccaa016 | |
parent | 8b6c2324bf2b023e26d53052bbcddcbf2f2c97ee (diff) |
[MIPS] CFE: Make code remotely resemble Linux code.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r-- | arch/mips/fw/cfe/cfe_api.c | 184 | ||||
-rw-r--r-- | arch/mips/fw/cfe/cfe_api_int.h | 186 | ||||
-rw-r--r-- | include/asm-mips/fw/cfe/cfe_api.h | 87 | ||||
-rw-r--r-- | include/asm-mips/fw/cfe/cfe_error.h | 19 |
4 files changed, 167 insertions, 309 deletions
diff --git a/arch/mips/fw/cfe/cfe_api.c b/arch/mips/fw/cfe/cfe_api.c index a9f69e4e40ac..717db74f7c6e 100644 --- a/arch/mips/fw/cfe/cfe_api.c +++ b/arch/mips/fw/cfe/cfe_api.c | |||
@@ -16,19 +16,16 @@ | |||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* ********************************************************************* | 19 | /* |
20 | * | 20 | * |
21 | * Broadcom Common Firmware Environment (CFE) | 21 | * Broadcom Common Firmware Environment (CFE) |
22 | * | 22 | * |
23 | * Device Function stubs File: cfe_api.c | 23 | * This module contains device function stubs (small routines to |
24 | * | 24 | * call the standard "iocb" interface entry point to CFE). |
25 | * This module contains device function stubs (small routines to | 25 | * There should be one routine here per iocb function call. |
26 | * call the standard "iocb" interface entry point to CFE). | 26 | * |
27 | * There should be one routine here per iocb function call. | 27 | * Authors: Mitch Lichtenberg, Chris Demetriou |
28 | * | 28 | */ |
29 | * Authors: Mitch Lichtenberg, Chris Demetriou | ||
30 | * | ||
31 | ********************************************************************* */ | ||
32 | 29 | ||
33 | #include <asm/fw/cfe/cfe_api.h> | 30 | #include <asm/fw/cfe/cfe_api.h> |
34 | #include "cfe_api_int.h" | 31 | #include "cfe_api_int.h" |
@@ -37,12 +34,8 @@ | |||
37 | #define XPTR_FROM_NATIVE(n) ((cfe_xptr_t) (intptr_t) (n)) | 34 | #define XPTR_FROM_NATIVE(n) ((cfe_xptr_t) (intptr_t) (n)) |
38 | #define NATIVE_FROM_XPTR(x) ((void *) (intptr_t) (x)) | 35 | #define NATIVE_FROM_XPTR(x) ((void *) (intptr_t) (x)) |
39 | 36 | ||
40 | #ifdef CFE_API_IMPL_NAMESPACE | 37 | int cfe_iocb_dispatch(struct cfe_xiocb *xiocb); |
41 | #define cfe_iocb_dispatch(a) __cfe_iocb_dispatch(a) | ||
42 | #endif | ||
43 | int cfe_iocb_dispatch(cfe_xiocb_t * xiocb); | ||
44 | 38 | ||
45 | #if defined(CFE_API_common) || defined(CFE_API_ALL) | ||
46 | /* | 39 | /* |
47 | * Declare the dispatch function with args of "intptr_t". | 40 | * Declare the dispatch function with args of "intptr_t". |
48 | * This makes sure whatever model we're compiling in | 41 | * This makes sure whatever model we're compiling in |
@@ -53,27 +46,25 @@ int cfe_iocb_dispatch(cfe_xiocb_t * xiocb); | |||
53 | */ | 46 | */ |
54 | 47 | ||
55 | static int (*cfe_dispfunc) (intptr_t handle, intptr_t xiocb) = 0; | 48 | static int (*cfe_dispfunc) (intptr_t handle, intptr_t xiocb) = 0; |
56 | static cfe_xuint_t cfe_handle = 0; | 49 | static u64 cfe_handle = 0; |
57 | 50 | ||
58 | int cfe_init(cfe_xuint_t handle, cfe_xuint_t ept) | 51 | int cfe_init(u64 handle, u64 ept) |
59 | { | 52 | { |
60 | cfe_dispfunc = NATIVE_FROM_XPTR(ept); | 53 | cfe_dispfunc = NATIVE_FROM_XPTR(ept); |
61 | cfe_handle = handle; | 54 | cfe_handle = handle; |
62 | return 0; | 55 | return 0; |
63 | } | 56 | } |
64 | 57 | ||
65 | int cfe_iocb_dispatch(cfe_xiocb_t * xiocb) | 58 | int cfe_iocb_dispatch(struct cfe_xiocb * xiocb) |
66 | { | 59 | { |
67 | if (!cfe_dispfunc) | 60 | if (!cfe_dispfunc) |
68 | return -1; | 61 | return -1; |
69 | return (*cfe_dispfunc) ((intptr_t) cfe_handle, (intptr_t) xiocb); | 62 | return (*cfe_dispfunc) ((intptr_t) cfe_handle, (intptr_t) xiocb); |
70 | } | 63 | } |
71 | #endif /* CFE_API_common || CFE_API_ALL */ | ||
72 | 64 | ||
73 | #if defined(CFE_API_close) || defined(CFE_API_ALL) | ||
74 | int cfe_close(int handle) | 65 | int cfe_close(int handle) |
75 | { | 66 | { |
76 | cfe_xiocb_t xiocb; | 67 | struct cfe_xiocb xiocb; |
77 | 68 | ||
78 | xiocb.xiocb_fcode = CFE_CMD_DEV_CLOSE; | 69 | xiocb.xiocb_fcode = CFE_CMD_DEV_CLOSE; |
79 | xiocb.xiocb_status = 0; | 70 | xiocb.xiocb_status = 0; |
@@ -86,18 +77,16 @@ int cfe_close(int handle) | |||
86 | return xiocb.xiocb_status; | 77 | return xiocb.xiocb_status; |
87 | 78 | ||
88 | } | 79 | } |
89 | #endif /* CFE_API_close || CFE_API_ALL */ | ||
90 | 80 | ||
91 | #if defined(CFE_API_cpu_start) || defined(CFE_API_ALL) | ||
92 | int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1) | 81 | int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1) |
93 | { | 82 | { |
94 | cfe_xiocb_t xiocb; | 83 | struct cfe_xiocb xiocb; |
95 | 84 | ||
96 | xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL; | 85 | xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL; |
97 | xiocb.xiocb_status = 0; | 86 | xiocb.xiocb_status = 0; |
98 | xiocb.xiocb_handle = 0; | 87 | xiocb.xiocb_handle = 0; |
99 | xiocb.xiocb_flags = 0; | 88 | xiocb.xiocb_flags = 0; |
100 | xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t); | 89 | xiocb.xiocb_psize = sizeof(struct xiocb_cpuctl); |
101 | xiocb.plist.xiocb_cpuctl.cpu_number = cpu; | 90 | xiocb.plist.xiocb_cpuctl.cpu_number = cpu; |
102 | xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_START; | 91 | xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_START; |
103 | xiocb.plist.xiocb_cpuctl.gp_val = gp; | 92 | xiocb.plist.xiocb_cpuctl.gp_val = gp; |
@@ -109,18 +98,16 @@ int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1) | |||
109 | 98 | ||
110 | return xiocb.xiocb_status; | 99 | return xiocb.xiocb_status; |
111 | } | 100 | } |
112 | #endif /* CFE_API_cpu_start || CFE_API_ALL */ | ||
113 | 101 | ||
114 | #if defined(CFE_API_cpu_stop) || defined(CFE_API_ALL) | ||
115 | int cfe_cpu_stop(int cpu) | 102 | int cfe_cpu_stop(int cpu) |
116 | { | 103 | { |
117 | cfe_xiocb_t xiocb; | 104 | struct cfe_xiocb xiocb; |
118 | 105 | ||
119 | xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL; | 106 | xiocb.xiocb_fcode = CFE_CMD_FW_CPUCTL; |
120 | xiocb.xiocb_status = 0; | 107 | xiocb.xiocb_status = 0; |
121 | xiocb.xiocb_handle = 0; | 108 | xiocb.xiocb_handle = 0; |
122 | xiocb.xiocb_flags = 0; | 109 | xiocb.xiocb_flags = 0; |
123 | xiocb.xiocb_psize = sizeof(xiocb_cpuctl_t); | 110 | xiocb.xiocb_psize = sizeof(struct xiocb_cpuctl); |
124 | xiocb.plist.xiocb_cpuctl.cpu_number = cpu; | 111 | xiocb.plist.xiocb_cpuctl.cpu_number = cpu; |
125 | xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_STOP; | 112 | xiocb.plist.xiocb_cpuctl.cpu_command = CFE_CPU_CMD_STOP; |
126 | 113 | ||
@@ -128,18 +115,16 @@ int cfe_cpu_stop(int cpu) | |||
128 | 115 | ||
129 | return xiocb.xiocb_status; | 116 | return xiocb.xiocb_status; |
130 | } | 117 | } |
131 | #endif /* CFE_API_cpu_stop || CFE_API_ALL */ | ||
132 | 118 | ||
133 | #if defined(CFE_API_enumenv) || defined(CFE_API_ALL) | ||
134 | int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen) | 119 | int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen) |
135 | { | 120 | { |
136 | cfe_xiocb_t xiocb; | 121 | struct cfe_xiocb xiocb; |
137 | 122 | ||
138 | xiocb.xiocb_fcode = CFE_CMD_ENV_SET; | 123 | xiocb.xiocb_fcode = CFE_CMD_ENV_SET; |
139 | xiocb.xiocb_status = 0; | 124 | xiocb.xiocb_status = 0; |
140 | xiocb.xiocb_handle = 0; | 125 | xiocb.xiocb_handle = 0; |
141 | xiocb.xiocb_flags = 0; | 126 | xiocb.xiocb_flags = 0; |
142 | xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); | 127 | xiocb.xiocb_psize = sizeof(struct xiocb_envbuf); |
143 | xiocb.plist.xiocb_envbuf.enum_idx = idx; | 128 | xiocb.plist.xiocb_envbuf.enum_idx = idx; |
144 | xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); | 129 | xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); |
145 | xiocb.plist.xiocb_envbuf.name_length = namelen; | 130 | xiocb.plist.xiocb_envbuf.name_length = namelen; |
@@ -150,20 +135,17 @@ int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen) | |||
150 | 135 | ||
151 | return xiocb.xiocb_status; | 136 | return xiocb.xiocb_status; |
152 | } | 137 | } |
153 | #endif /* CFE_API_enumenv || CFE_API_ALL */ | ||
154 | 138 | ||
155 | #if defined(CFE_API_enummem) || defined(CFE_API_ALL) | ||
156 | int | 139 | int |
157 | cfe_enummem(int idx, int flags, cfe_xuint_t * start, cfe_xuint_t * length, | 140 | cfe_enummem(int idx, int flags, u64 *start, u64 *length, u64 *type) |
158 | cfe_xuint_t * type) | ||
159 | { | 141 | { |
160 | cfe_xiocb_t xiocb; | 142 | struct cfe_xiocb xiocb; |
161 | 143 | ||
162 | xiocb.xiocb_fcode = CFE_CMD_FW_MEMENUM; | 144 | xiocb.xiocb_fcode = CFE_CMD_FW_MEMENUM; |
163 | xiocb.xiocb_status = 0; | 145 | xiocb.xiocb_status = 0; |
164 | xiocb.xiocb_handle = 0; | 146 | xiocb.xiocb_handle = 0; |
165 | xiocb.xiocb_flags = flags; | 147 | xiocb.xiocb_flags = flags; |
166 | xiocb.xiocb_psize = sizeof(xiocb_meminfo_t); | 148 | xiocb.xiocb_psize = sizeof(struct xiocb_meminfo); |
167 | xiocb.plist.xiocb_meminfo.mi_idx = idx; | 149 | xiocb.plist.xiocb_meminfo.mi_idx = idx; |
168 | 150 | ||
169 | cfe_iocb_dispatch(&xiocb); | 151 | cfe_iocb_dispatch(&xiocb); |
@@ -177,30 +159,26 @@ cfe_enummem(int idx, int flags, cfe_xuint_t * start, cfe_xuint_t * length, | |||
177 | 159 | ||
178 | return 0; | 160 | return 0; |
179 | } | 161 | } |
180 | #endif /* CFE_API_enummem || CFE_API_ALL */ | ||
181 | 162 | ||
182 | #if defined(CFE_API_exit) || defined(CFE_API_ALL) | ||
183 | int cfe_exit(int warm, int status) | 163 | int cfe_exit(int warm, int status) |
184 | { | 164 | { |
185 | cfe_xiocb_t xiocb; | 165 | struct cfe_xiocb xiocb; |
186 | 166 | ||
187 | xiocb.xiocb_fcode = CFE_CMD_FW_RESTART; | 167 | xiocb.xiocb_fcode = CFE_CMD_FW_RESTART; |
188 | xiocb.xiocb_status = 0; | 168 | xiocb.xiocb_status = 0; |
189 | xiocb.xiocb_handle = 0; | 169 | xiocb.xiocb_handle = 0; |
190 | xiocb.xiocb_flags = warm ? CFE_FLG_WARMSTART : 0; | 170 | xiocb.xiocb_flags = warm ? CFE_FLG_WARMSTART : 0; |
191 | xiocb.xiocb_psize = sizeof(xiocb_exitstat_t); | 171 | xiocb.xiocb_psize = sizeof(struct xiocb_exitstat); |
192 | xiocb.plist.xiocb_exitstat.status = status; | 172 | xiocb.plist.xiocb_exitstat.status = status; |
193 | 173 | ||
194 | cfe_iocb_dispatch(&xiocb); | 174 | cfe_iocb_dispatch(&xiocb); |
195 | 175 | ||
196 | return xiocb.xiocb_status; | 176 | return xiocb.xiocb_status; |
197 | } | 177 | } |
198 | #endif /* CFE_API_exit || CFE_API_ALL */ | ||
199 | 178 | ||
200 | #if defined(CFE_API_flushcache) || defined(CFE_API_ALL) | ||
201 | int cfe_flushcache(int flg) | 179 | int cfe_flushcache(int flg) |
202 | { | 180 | { |
203 | cfe_xiocb_t xiocb; | 181 | struct cfe_xiocb xiocb; |
204 | 182 | ||
205 | xiocb.xiocb_fcode = CFE_CMD_FW_FLUSHCACHE; | 183 | xiocb.xiocb_fcode = CFE_CMD_FW_FLUSHCACHE; |
206 | xiocb.xiocb_status = 0; | 184 | xiocb.xiocb_status = 0; |
@@ -212,34 +190,30 @@ int cfe_flushcache(int flg) | |||
212 | 190 | ||
213 | return xiocb.xiocb_status; | 191 | return xiocb.xiocb_status; |
214 | } | 192 | } |
215 | #endif /* CFE_API_flushcache || CFE_API_ALL */ | ||
216 | 193 | ||
217 | #if defined(CFE_API_getdevinfo) || defined(CFE_API_ALL) | ||
218 | int cfe_getdevinfo(char *name) | 194 | int cfe_getdevinfo(char *name) |
219 | { | 195 | { |
220 | cfe_xiocb_t xiocb; | 196 | struct cfe_xiocb xiocb; |
221 | 197 | ||
222 | xiocb.xiocb_fcode = CFE_CMD_DEV_GETINFO; | 198 | xiocb.xiocb_fcode = CFE_CMD_DEV_GETINFO; |
223 | xiocb.xiocb_status = 0; | 199 | xiocb.xiocb_status = 0; |
224 | xiocb.xiocb_handle = 0; | 200 | xiocb.xiocb_handle = 0; |
225 | xiocb.xiocb_flags = 0; | 201 | xiocb.xiocb_flags = 0; |
226 | xiocb.xiocb_psize = sizeof(xiocb_buffer_t); | 202 | xiocb.xiocb_psize = sizeof(struct xiocb_buffer); |
227 | xiocb.plist.xiocb_buffer.buf_offset = 0; | 203 | xiocb.plist.xiocb_buffer.buf_offset = 0; |
228 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name); | 204 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name); |
229 | xiocb.plist.xiocb_buffer.buf_length = cfe_strlen(name); | 205 | xiocb.plist.xiocb_buffer.buf_length = strlen(name); |
230 | 206 | ||
231 | cfe_iocb_dispatch(&xiocb); | 207 | cfe_iocb_dispatch(&xiocb); |
232 | 208 | ||
233 | if (xiocb.xiocb_status < 0) | 209 | if (xiocb.xiocb_status < 0) |
234 | return xiocb.xiocb_status; | 210 | return xiocb.xiocb_status; |
235 | return xiocb.plist.xiocb_buffer.buf_devflags; | 211 | return xiocb.plist.xiocb_buffer.buf_ioctlcmd; |
236 | } | 212 | } |
237 | #endif /* CFE_API_getdevinfo || CFE_API_ALL */ | ||
238 | 213 | ||
239 | #if defined(CFE_API_getenv) || defined(CFE_API_ALL) | ||
240 | int cfe_getenv(char *name, char *dest, int destlen) | 214 | int cfe_getenv(char *name, char *dest, int destlen) |
241 | { | 215 | { |
242 | cfe_xiocb_t xiocb; | 216 | struct cfe_xiocb xiocb; |
243 | 217 | ||
244 | *dest = 0; | 218 | *dest = 0; |
245 | 219 | ||
@@ -247,10 +221,10 @@ int cfe_getenv(char *name, char *dest, int destlen) | |||
247 | xiocb.xiocb_status = 0; | 221 | xiocb.xiocb_status = 0; |
248 | xiocb.xiocb_handle = 0; | 222 | xiocb.xiocb_handle = 0; |
249 | xiocb.xiocb_flags = 0; | 223 | xiocb.xiocb_flags = 0; |
250 | xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); | 224 | xiocb.xiocb_psize = sizeof(struct xiocb_envbuf); |
251 | xiocb.plist.xiocb_envbuf.enum_idx = 0; | 225 | xiocb.plist.xiocb_envbuf.enum_idx = 0; |
252 | xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); | 226 | xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); |
253 | xiocb.plist.xiocb_envbuf.name_length = cfe_strlen(name); | 227 | xiocb.plist.xiocb_envbuf.name_length = strlen(name); |
254 | xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(dest); | 228 | xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(dest); |
255 | xiocb.plist.xiocb_envbuf.val_length = destlen; | 229 | xiocb.plist.xiocb_envbuf.val_length = destlen; |
256 | 230 | ||
@@ -258,18 +232,16 @@ int cfe_getenv(char *name, char *dest, int destlen) | |||
258 | 232 | ||
259 | return xiocb.xiocb_status; | 233 | return xiocb.xiocb_status; |
260 | } | 234 | } |
261 | #endif /* CFE_API_getenv || CFE_API_ALL */ | ||
262 | 235 | ||
263 | #if defined(CFE_API_getfwinfo) || defined(CFE_API_ALL) | ||
264 | int cfe_getfwinfo(cfe_fwinfo_t * info) | 236 | int cfe_getfwinfo(cfe_fwinfo_t * info) |
265 | { | 237 | { |
266 | cfe_xiocb_t xiocb; | 238 | struct cfe_xiocb xiocb; |
267 | 239 | ||
268 | xiocb.xiocb_fcode = CFE_CMD_FW_GETINFO; | 240 | xiocb.xiocb_fcode = CFE_CMD_FW_GETINFO; |
269 | xiocb.xiocb_status = 0; | 241 | xiocb.xiocb_status = 0; |
270 | xiocb.xiocb_handle = 0; | 242 | xiocb.xiocb_handle = 0; |
271 | xiocb.xiocb_flags = 0; | 243 | xiocb.xiocb_flags = 0; |
272 | xiocb.xiocb_psize = sizeof(xiocb_fwinfo_t); | 244 | xiocb.xiocb_psize = sizeof(struct xiocb_fwinfo); |
273 | 245 | ||
274 | cfe_iocb_dispatch(&xiocb); | 246 | cfe_iocb_dispatch(&xiocb); |
275 | 247 | ||
@@ -292,12 +264,10 @@ int cfe_getfwinfo(cfe_fwinfo_t * info) | |||
292 | 264 | ||
293 | return 0; | 265 | return 0; |
294 | } | 266 | } |
295 | #endif /* CFE_API_getfwinfo || CFE_API_ALL */ | ||
296 | 267 | ||
297 | #if defined(CFE_API_getstdhandle) || defined(CFE_API_ALL) | ||
298 | int cfe_getstdhandle(int flg) | 268 | int cfe_getstdhandle(int flg) |
299 | { | 269 | { |
300 | cfe_xiocb_t xiocb; | 270 | struct cfe_xiocb xiocb; |
301 | 271 | ||
302 | xiocb.xiocb_fcode = CFE_CMD_DEV_GETHANDLE; | 272 | xiocb.xiocb_fcode = CFE_CMD_DEV_GETHANDLE; |
303 | xiocb.xiocb_status = 0; | 273 | xiocb.xiocb_status = 0; |
@@ -311,23 +281,17 @@ int cfe_getstdhandle(int flg) | |||
311 | return xiocb.xiocb_status; | 281 | return xiocb.xiocb_status; |
312 | return xiocb.xiocb_handle; | 282 | return xiocb.xiocb_handle; |
313 | } | 283 | } |
314 | #endif /* CFE_API_getstdhandle || CFE_API_ALL */ | ||
315 | 284 | ||
316 | #if defined(CFE_API_getticks) || defined(CFE_API_ALL) | ||
317 | int64_t | 285 | int64_t |
318 | #ifdef CFE_API_IMPL_NAMESPACE | ||
319 | __cfe_getticks(void) | ||
320 | #else | ||
321 | cfe_getticks(void) | 286 | cfe_getticks(void) |
322 | #endif | ||
323 | { | 287 | { |
324 | cfe_xiocb_t xiocb; | 288 | struct cfe_xiocb xiocb; |
325 | 289 | ||
326 | xiocb.xiocb_fcode = CFE_CMD_FW_GETTIME; | 290 | xiocb.xiocb_fcode = CFE_CMD_FW_GETTIME; |
327 | xiocb.xiocb_status = 0; | 291 | xiocb.xiocb_status = 0; |
328 | xiocb.xiocb_handle = 0; | 292 | xiocb.xiocb_handle = 0; |
329 | xiocb.xiocb_flags = 0; | 293 | xiocb.xiocb_flags = 0; |
330 | xiocb.xiocb_psize = sizeof(xiocb_time_t); | 294 | xiocb.xiocb_psize = sizeof(struct xiocb_time); |
331 | xiocb.plist.xiocb_time.ticks = 0; | 295 | xiocb.plist.xiocb_time.ticks = 0; |
332 | 296 | ||
333 | cfe_iocb_dispatch(&xiocb); | 297 | cfe_iocb_dispatch(&xiocb); |
@@ -335,18 +299,16 @@ cfe_getticks(void) | |||
335 | return xiocb.plist.xiocb_time.ticks; | 299 | return xiocb.plist.xiocb_time.ticks; |
336 | 300 | ||
337 | } | 301 | } |
338 | #endif /* CFE_API_getticks || CFE_API_ALL */ | ||
339 | 302 | ||
340 | #if defined(CFE_API_inpstat) || defined(CFE_API_ALL) | ||
341 | int cfe_inpstat(int handle) | 303 | int cfe_inpstat(int handle) |
342 | { | 304 | { |
343 | cfe_xiocb_t xiocb; | 305 | struct cfe_xiocb xiocb; |
344 | 306 | ||
345 | xiocb.xiocb_fcode = CFE_CMD_DEV_INPSTAT; | 307 | xiocb.xiocb_fcode = CFE_CMD_DEV_INPSTAT; |
346 | xiocb.xiocb_status = 0; | 308 | xiocb.xiocb_status = 0; |
347 | xiocb.xiocb_handle = handle; | 309 | xiocb.xiocb_handle = handle; |
348 | xiocb.xiocb_flags = 0; | 310 | xiocb.xiocb_flags = 0; |
349 | xiocb.xiocb_psize = sizeof(xiocb_inpstat_t); | 311 | xiocb.xiocb_psize = sizeof(struct xiocb_inpstat); |
350 | xiocb.plist.xiocb_inpstat.inp_status = 0; | 312 | xiocb.plist.xiocb_inpstat.inp_status = 0; |
351 | 313 | ||
352 | cfe_iocb_dispatch(&xiocb); | 314 | cfe_iocb_dispatch(&xiocb); |
@@ -355,20 +317,18 @@ int cfe_inpstat(int handle) | |||
355 | return xiocb.xiocb_status; | 317 | return xiocb.xiocb_status; |
356 | return xiocb.plist.xiocb_inpstat.inp_status; | 318 | return xiocb.plist.xiocb_inpstat.inp_status; |
357 | } | 319 | } |
358 | #endif /* CFE_API_inpstat || CFE_API_ALL */ | ||
359 | 320 | ||
360 | #if defined(CFE_API_ioctl) || defined(CFE_API_ALL) | ||
361 | int | 321 | int |
362 | cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer, | 322 | cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer, |
363 | int length, int *retlen, cfe_xuint_t offset) | 323 | int length, int *retlen, u64 offset) |
364 | { | 324 | { |
365 | cfe_xiocb_t xiocb; | 325 | struct cfe_xiocb xiocb; |
366 | 326 | ||
367 | xiocb.xiocb_fcode = CFE_CMD_DEV_IOCTL; | 327 | xiocb.xiocb_fcode = CFE_CMD_DEV_IOCTL; |
368 | xiocb.xiocb_status = 0; | 328 | xiocb.xiocb_status = 0; |
369 | xiocb.xiocb_handle = handle; | 329 | xiocb.xiocb_handle = handle; |
370 | xiocb.xiocb_flags = 0; | 330 | xiocb.xiocb_flags = 0; |
371 | xiocb.xiocb_psize = sizeof(xiocb_buffer_t); | 331 | xiocb.xiocb_psize = sizeof(struct xiocb_buffer); |
372 | xiocb.plist.xiocb_buffer.buf_offset = offset; | 332 | xiocb.plist.xiocb_buffer.buf_offset = offset; |
373 | xiocb.plist.xiocb_buffer.buf_ioctlcmd = ioctlnum; | 333 | xiocb.plist.xiocb_buffer.buf_ioctlcmd = ioctlnum; |
374 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); | 334 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); |
@@ -380,21 +340,19 @@ cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer, | |||
380 | *retlen = xiocb.plist.xiocb_buffer.buf_retlen; | 340 | *retlen = xiocb.plist.xiocb_buffer.buf_retlen; |
381 | return xiocb.xiocb_status; | 341 | return xiocb.xiocb_status; |
382 | } | 342 | } |
383 | #endif /* CFE_API_ioctl || CFE_API_ALL */ | ||
384 | 343 | ||
385 | #if defined(CFE_API_open) || defined(CFE_API_ALL) | ||
386 | int cfe_open(char *name) | 344 | int cfe_open(char *name) |
387 | { | 345 | { |
388 | cfe_xiocb_t xiocb; | 346 | struct cfe_xiocb xiocb; |
389 | 347 | ||
390 | xiocb.xiocb_fcode = CFE_CMD_DEV_OPEN; | 348 | xiocb.xiocb_fcode = CFE_CMD_DEV_OPEN; |
391 | xiocb.xiocb_status = 0; | 349 | xiocb.xiocb_status = 0; |
392 | xiocb.xiocb_handle = 0; | 350 | xiocb.xiocb_handle = 0; |
393 | xiocb.xiocb_flags = 0; | 351 | xiocb.xiocb_flags = 0; |
394 | xiocb.xiocb_psize = sizeof(xiocb_buffer_t); | 352 | xiocb.xiocb_psize = sizeof(struct xiocb_buffer); |
395 | xiocb.plist.xiocb_buffer.buf_offset = 0; | 353 | xiocb.plist.xiocb_buffer.buf_offset = 0; |
396 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name); | 354 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(name); |
397 | xiocb.plist.xiocb_buffer.buf_length = cfe_strlen(name); | 355 | xiocb.plist.xiocb_buffer.buf_length = strlen(name); |
398 | 356 | ||
399 | cfe_iocb_dispatch(&xiocb); | 357 | cfe_iocb_dispatch(&xiocb); |
400 | 358 | ||
@@ -402,27 +360,21 @@ int cfe_open(char *name) | |||
402 | return xiocb.xiocb_status; | 360 | return xiocb.xiocb_status; |
403 | return xiocb.xiocb_handle; | 361 | return xiocb.xiocb_handle; |
404 | } | 362 | } |
405 | #endif /* CFE_API_open || CFE_API_ALL */ | ||
406 | 363 | ||
407 | #if defined(CFE_API_read) || defined(CFE_API_ALL) | ||
408 | int cfe_read(int handle, unsigned char *buffer, int length) | 364 | int cfe_read(int handle, unsigned char *buffer, int length) |
409 | { | 365 | { |
410 | return cfe_readblk(handle, 0, buffer, length); | 366 | return cfe_readblk(handle, 0, buffer, length); |
411 | } | 367 | } |
412 | #endif /* CFE_API_read || CFE_API_ALL */ | ||
413 | 368 | ||
414 | #if defined(CFE_API_readblk) || defined(CFE_API_ALL) | 369 | int cfe_readblk(int handle, s64 offset, unsigned char *buffer, int length) |
415 | int | ||
416 | cfe_readblk(int handle, cfe_xint_t offset, unsigned char *buffer, | ||
417 | int length) | ||
418 | { | 370 | { |
419 | cfe_xiocb_t xiocb; | 371 | struct cfe_xiocb xiocb; |
420 | 372 | ||
421 | xiocb.xiocb_fcode = CFE_CMD_DEV_READ; | 373 | xiocb.xiocb_fcode = CFE_CMD_DEV_READ; |
422 | xiocb.xiocb_status = 0; | 374 | xiocb.xiocb_status = 0; |
423 | xiocb.xiocb_handle = handle; | 375 | xiocb.xiocb_handle = handle; |
424 | xiocb.xiocb_flags = 0; | 376 | xiocb.xiocb_flags = 0; |
425 | xiocb.xiocb_psize = sizeof(xiocb_buffer_t); | 377 | xiocb.xiocb_psize = sizeof(struct xiocb_buffer); |
426 | xiocb.plist.xiocb_buffer.buf_offset = offset; | 378 | xiocb.plist.xiocb_buffer.buf_offset = offset; |
427 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); | 379 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); |
428 | xiocb.plist.xiocb_buffer.buf_length = length; | 380 | xiocb.plist.xiocb_buffer.buf_length = length; |
@@ -433,62 +385,41 @@ cfe_readblk(int handle, cfe_xint_t offset, unsigned char *buffer, | |||
433 | return xiocb.xiocb_status; | 385 | return xiocb.xiocb_status; |
434 | return xiocb.plist.xiocb_buffer.buf_retlen; | 386 | return xiocb.plist.xiocb_buffer.buf_retlen; |
435 | } | 387 | } |
436 | #endif /* CFE_API_readblk || CFE_API_ALL */ | ||
437 | 388 | ||
438 | #if defined(CFE_API_setenv) || defined(CFE_API_ALL) | ||
439 | int cfe_setenv(char *name, char *val) | 389 | int cfe_setenv(char *name, char *val) |
440 | { | 390 | { |
441 | cfe_xiocb_t xiocb; | 391 | struct cfe_xiocb xiocb; |
442 | 392 | ||
443 | xiocb.xiocb_fcode = CFE_CMD_ENV_SET; | 393 | xiocb.xiocb_fcode = CFE_CMD_ENV_SET; |
444 | xiocb.xiocb_status = 0; | 394 | xiocb.xiocb_status = 0; |
445 | xiocb.xiocb_handle = 0; | 395 | xiocb.xiocb_handle = 0; |
446 | xiocb.xiocb_flags = 0; | 396 | xiocb.xiocb_flags = 0; |
447 | xiocb.xiocb_psize = sizeof(xiocb_envbuf_t); | 397 | xiocb.xiocb_psize = sizeof(struct xiocb_envbuf); |
448 | xiocb.plist.xiocb_envbuf.enum_idx = 0; | 398 | xiocb.plist.xiocb_envbuf.enum_idx = 0; |
449 | xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); | 399 | xiocb.plist.xiocb_envbuf.name_ptr = XPTR_FROM_NATIVE(name); |
450 | xiocb.plist.xiocb_envbuf.name_length = cfe_strlen(name); | 400 | xiocb.plist.xiocb_envbuf.name_length = strlen(name); |
451 | xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(val); | 401 | xiocb.plist.xiocb_envbuf.val_ptr = XPTR_FROM_NATIVE(val); |
452 | xiocb.plist.xiocb_envbuf.val_length = cfe_strlen(val); | 402 | xiocb.plist.xiocb_envbuf.val_length = strlen(val); |
453 | 403 | ||
454 | cfe_iocb_dispatch(&xiocb); | 404 | cfe_iocb_dispatch(&xiocb); |
455 | 405 | ||
456 | return xiocb.xiocb_status; | 406 | return xiocb.xiocb_status; |
457 | } | 407 | } |
458 | #endif /* CFE_API_setenv || CFE_API_ALL */ | ||
459 | |||
460 | #if (defined(CFE_API_strlen) || defined(CFE_API_ALL)) \ | ||
461 | && !defined(CFE_API_STRLEN_CUSTOM) | ||
462 | int cfe_strlen(char *name) | ||
463 | { | ||
464 | int count = 0; | ||
465 | |||
466 | while (*name++) | ||
467 | count++; | ||
468 | 408 | ||
469 | return count; | ||
470 | } | ||
471 | #endif /* CFE_API_strlen || CFE_API_ALL */ | ||
472 | |||
473 | #if defined(CFE_API_write) || defined(CFE_API_ALL) | ||
474 | int cfe_write(int handle, unsigned char *buffer, int length) | 409 | int cfe_write(int handle, unsigned char *buffer, int length) |
475 | { | 410 | { |
476 | return cfe_writeblk(handle, 0, buffer, length); | 411 | return cfe_writeblk(handle, 0, buffer, length); |
477 | } | 412 | } |
478 | #endif /* CFE_API_write || CFE_API_ALL */ | ||
479 | 413 | ||
480 | #if defined(CFE_API_writeblk) || defined(CFE_API_ALL) | 414 | int cfe_writeblk(int handle, s64 offset, unsigned char *buffer, int length) |
481 | int | ||
482 | cfe_writeblk(int handle, cfe_xint_t offset, unsigned char *buffer, | ||
483 | int length) | ||
484 | { | 415 | { |
485 | cfe_xiocb_t xiocb; | 416 | struct cfe_xiocb xiocb; |
486 | 417 | ||
487 | xiocb.xiocb_fcode = CFE_CMD_DEV_WRITE; | 418 | xiocb.xiocb_fcode = CFE_CMD_DEV_WRITE; |
488 | xiocb.xiocb_status = 0; | 419 | xiocb.xiocb_status = 0; |
489 | xiocb.xiocb_handle = handle; | 420 | xiocb.xiocb_handle = handle; |
490 | xiocb.xiocb_flags = 0; | 421 | xiocb.xiocb_flags = 0; |
491 | xiocb.xiocb_psize = sizeof(xiocb_buffer_t); | 422 | xiocb.xiocb_psize = sizeof(struct xiocb_buffer); |
492 | xiocb.plist.xiocb_buffer.buf_offset = offset; | 423 | xiocb.plist.xiocb_buffer.buf_offset = offset; |
493 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); | 424 | xiocb.plist.xiocb_buffer.buf_ptr = XPTR_FROM_NATIVE(buffer); |
494 | xiocb.plist.xiocb_buffer.buf_length = length; | 425 | xiocb.plist.xiocb_buffer.buf_length = length; |
@@ -499,4 +430,3 @@ cfe_writeblk(int handle, cfe_xint_t offset, unsigned char *buffer, | |||
499 | return xiocb.xiocb_status; | 430 | return xiocb.xiocb_status; |
500 | return xiocb.plist.xiocb_buffer.buf_retlen; | 431 | return xiocb.plist.xiocb_buffer.buf_retlen; |
501 | } | 432 | } |
502 | #endif /* CFE_API_writeblk || CFE_API_ALL */ | ||
diff --git a/arch/mips/fw/cfe/cfe_api_int.h b/arch/mips/fw/cfe/cfe_api_int.h index f7e5a64b55f3..d9759e646956 100644 --- a/arch/mips/fw/cfe/cfe_api_int.h +++ b/arch/mips/fw/cfe/cfe_api_int.h | |||
@@ -15,28 +15,12 @@ | |||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | |||
19 | /* ********************************************************************* | ||
20 | * | ||
21 | * Broadcom Common Firmware Environment (CFE) | ||
22 | * | ||
23 | * Device function prototypes File: cfe_api_int.h | ||
24 | * | ||
25 | * This header defines all internal types and macros for the | ||
26 | * library. This is stuff that's not exported to an app | ||
27 | * using the library. | ||
28 | * | ||
29 | * Authors: Mitch Lichtenberg, Chris Demetriou | ||
30 | * | ||
31 | ********************************************************************* */ | ||
32 | |||
33 | #ifndef CFE_API_INT_H | 18 | #ifndef CFE_API_INT_H |
34 | #define CFE_API_INT_H | 19 | #define CFE_API_INT_H |
35 | 20 | ||
36 | /* ********************************************************************* | 21 | /* |
37 | * Constants | 22 | * Constants. |
38 | ********************************************************************* */ | 23 | */ |
39 | |||
40 | #define CFE_CMD_FW_GETINFO 0 | 24 | #define CFE_CMD_FW_GETINFO 0 |
41 | #define CFE_CMD_FW_RESTART 1 | 25 | #define CFE_CMD_FW_RESTART 1 |
42 | #define CFE_CMD_FW_BOOT 2 | 26 | #define CFE_CMD_FW_BOOT 2 |
@@ -64,89 +48,101 @@ | |||
64 | 48 | ||
65 | #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ | 49 | #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */ |
66 | 50 | ||
67 | /* ********************************************************************* | 51 | /* |
68 | * Structures | 52 | * Structures. |
69 | ********************************************************************* */ | 53 | */ |
70 | 54 | ||
71 | typedef uint64_t cfe_xuint_t; | 55 | /* eeek, signed "pointers" */ |
72 | typedef int64_t cfe_xint_t; | 56 | typedef s64 cfe_xptr_t; |
73 | typedef int64_t cfe_xptr_t; | ||
74 | 57 | ||
75 | typedef struct xiocb_buffer_s { | 58 | struct xiocb_buffer { |
76 | cfe_xuint_t buf_offset; /* offset on device (bytes) */ | 59 | u64 buf_offset; /* offset on device (bytes) */ |
77 | cfe_xptr_t buf_ptr; /* pointer to a buffer */ | 60 | cfe_xptr_t buf_ptr; /* pointer to a buffer */ |
78 | cfe_xuint_t buf_length; /* length of this buffer */ | 61 | u64 buf_length; /* length of this buffer */ |
79 | cfe_xuint_t buf_retlen; /* returned length (for read ops) */ | 62 | u64 buf_retlen; /* returned length (for read ops) */ |
80 | cfe_xuint_t buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ | 63 | u64 buf_ioctlcmd; /* IOCTL command (used only for IOCTLs) */ |
81 | } xiocb_buffer_t; | 64 | }; |
82 | |||
83 | #define buf_devflags buf_ioctlcmd /* returned device info flags */ | ||
84 | 65 | ||
85 | typedef struct xiocb_inpstat_s { | 66 | struct xiocb_inpstat { |
86 | cfe_xuint_t inp_status; /* 1 means input available */ | 67 | u64 inp_status; /* 1 means input available */ |
87 | } xiocb_inpstat_t; | 68 | }; |
88 | 69 | ||
89 | typedef struct xiocb_envbuf_s { | 70 | struct xiocb_envbuf { |
90 | cfe_xint_t enum_idx; /* 0-based enumeration index */ | 71 | s64 enum_idx; /* 0-based enumeration index */ |
91 | cfe_xptr_t name_ptr; /* name string buffer */ | 72 | cfe_xptr_t name_ptr; /* name string buffer */ |
92 | cfe_xint_t name_length; /* size of name buffer */ | 73 | s64 name_length; /* size of name buffer */ |
93 | cfe_xptr_t val_ptr; /* value string buffer */ | 74 | cfe_xptr_t val_ptr; /* value string buffer */ |
94 | cfe_xint_t val_length; /* size of value string buffer */ | 75 | s64 val_length; /* size of value string buffer */ |
95 | } xiocb_envbuf_t; | 76 | }; |
96 | 77 | ||
97 | typedef struct xiocb_cpuctl_s { | 78 | struct xiocb_cpuctl { |
98 | cfe_xuint_t cpu_number; /* cpu number to control */ | 79 | u64 cpu_number; /* cpu number to control */ |
99 | cfe_xuint_t cpu_command; /* command to issue to CPU */ | 80 | u64 cpu_command; /* command to issue to CPU */ |
100 | cfe_xuint_t start_addr; /* CPU start address */ | 81 | u64 start_addr; /* CPU start address */ |
101 | cfe_xuint_t gp_val; /* starting GP value */ | 82 | u64 gp_val; /* starting GP value */ |
102 | cfe_xuint_t sp_val; /* starting SP value */ | 83 | u64 sp_val; /* starting SP value */ |
103 | cfe_xuint_t a1_val; /* starting A1 value */ | 84 | u64 a1_val; /* starting A1 value */ |
104 | } xiocb_cpuctl_t; | 85 | }; |
105 | 86 | ||
106 | typedef struct xiocb_time_s { | 87 | struct xiocb_time { |
107 | cfe_xint_t ticks; /* current time in ticks */ | 88 | s64 ticks; /* current time in ticks */ |
108 | } xiocb_time_t; | 89 | }; |
109 | 90 | ||
110 | typedef struct xiocb_exitstat_s { | 91 | struct xiocb_exitstat{ |
111 | cfe_xint_t status; | 92 | s64 status; |
112 | } xiocb_exitstat_t; | 93 | }; |
113 | 94 | ||
114 | typedef struct xiocb_meminfo_s { | 95 | struct xiocb_meminfo { |
115 | cfe_xint_t mi_idx; /* 0-based enumeration index */ | 96 | s64 mi_idx; /* 0-based enumeration index */ |
116 | cfe_xint_t mi_type; /* type of memory block */ | 97 | s64 mi_type; /* type of memory block */ |
117 | cfe_xuint_t mi_addr; /* physical start address */ | 98 | u64 mi_addr; /* physical start address */ |
118 | cfe_xuint_t mi_size; /* block size */ | 99 | u64 mi_size; /* block size */ |
119 | } xiocb_meminfo_t; | 100 | }; |
120 | 101 | ||
121 | typedef struct xiocb_fwinfo_s { | 102 | struct xiocb_fwinfo { |
122 | cfe_xint_t fwi_version; /* major, minor, eco version */ | 103 | s64 fwi_version; /* major, minor, eco version */ |
123 | cfe_xint_t fwi_totalmem; /* total installed mem */ | 104 | s64 fwi_totalmem; /* total installed mem */ |
124 | cfe_xint_t fwi_flags; /* various flags */ | 105 | s64 fwi_flags; /* various flags */ |
125 | cfe_xint_t fwi_boardid; /* board ID */ | 106 | s64 fwi_boardid; /* board ID */ |
126 | cfe_xint_t fwi_bootarea_va; /* VA of boot area */ | 107 | s64 fwi_bootarea_va; /* VA of boot area */ |
127 | cfe_xint_t fwi_bootarea_pa; /* PA of boot area */ | 108 | s64 fwi_bootarea_pa; /* PA of boot area */ |
128 | cfe_xint_t fwi_bootarea_size; /* size of boot area */ | 109 | s64 fwi_bootarea_size; /* size of boot area */ |
129 | cfe_xint_t fwi_reserved1; | 110 | s64 fwi_reserved1; |
130 | cfe_xint_t fwi_reserved2; | 111 | s64 fwi_reserved2; |
131 | cfe_xint_t fwi_reserved3; | 112 | s64 fwi_reserved3; |
132 | } xiocb_fwinfo_t; | 113 | }; |
133 | 114 | ||
134 | typedef struct cfe_xiocb_s { | 115 | struct cfe_xiocb { |
135 | cfe_xuint_t xiocb_fcode; /* IOCB function code */ | 116 | u64 xiocb_fcode; /* IOCB function code */ |
136 | cfe_xint_t xiocb_status; /* return status */ | 117 | s64 xiocb_status; /* return status */ |
137 | cfe_xint_t xiocb_handle; /* file/device handle */ | 118 | s64 xiocb_handle; /* file/device handle */ |
138 | cfe_xuint_t xiocb_flags; /* flags for this IOCB */ | 119 | u64 xiocb_flags; /* flags for this IOCB */ |
139 | cfe_xuint_t xiocb_psize; /* size of parameter list */ | 120 | u64 xiocb_psize; /* size of parameter list */ |
140 | union { | 121 | union { |
141 | xiocb_buffer_t xiocb_buffer; /* buffer parameters */ | 122 | /* buffer parameters */ |
142 | xiocb_inpstat_t xiocb_inpstat; /* input status parameters */ | 123 | struct xiocb_buffer xiocb_buffer; |
143 | xiocb_envbuf_t xiocb_envbuf; /* environment function parameters */ | 124 | |
144 | xiocb_cpuctl_t xiocb_cpuctl; /* CPU control parameters */ | 125 | /* input status parameters */ |
145 | xiocb_time_t xiocb_time; /* timer parameters */ | 126 | struct xiocb_inpstat xiocb_inpstat; |
146 | xiocb_meminfo_t xiocb_meminfo; /* memory arena info parameters */ | 127 | |
147 | xiocb_fwinfo_t xiocb_fwinfo; /* firmware information */ | 128 | /* environment function parameters */ |
148 | xiocb_exitstat_t xiocb_exitstat; /* Exit Status */ | 129 | struct xiocb_envbuf xiocb_envbuf; |
130 | |||
131 | /* CPU control parameters */ | ||
132 | struct xiocb_cpuctl xiocb_cpuctl; | ||
133 | |||
134 | /* timer parameters */ | ||
135 | struct xiocb_time xiocb_time; | ||
136 | |||
137 | /* memory arena info parameters */ | ||
138 | struct xiocb_meminfo xiocb_meminfo; | ||
139 | |||
140 | /* firmware information */ | ||
141 | struct xiocb_fwinfo xiocb_fwinfo; | ||
142 | |||
143 | /* Exit Status */ | ||
144 | struct xiocb_exitstat xiocb_exitstat; | ||
149 | } plist; | 145 | } plist; |
150 | } cfe_xiocb_t; | 146 | }; |
151 | 147 | ||
152 | #endif /* CFE_API_INT_H */ | 148 | #endif /* CFE_API_INT_H */ |
diff --git a/include/asm-mips/fw/cfe/cfe_api.h b/include/asm-mips/fw/cfe/cfe_api.h index 1003e7156bfc..0995575db320 100644 --- a/include/asm-mips/fw/cfe/cfe_api.h +++ b/include/asm-mips/fw/cfe/cfe_api.h | |||
@@ -15,49 +15,27 @@ | |||
15 | * along with this program; if not, write to the Free Software | 15 | * along with this program; if not, write to the Free Software |
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | /* | |
19 | /* ********************************************************************* | 19 | * Broadcom Common Firmware Environment (CFE) |
20 | * | 20 | * |
21 | * Broadcom Common Firmware Environment (CFE) | 21 | * This file contains declarations for doing callbacks to |
22 | * | 22 | * cfe from an application. It should be the only header |
23 | * Device function prototypes File: cfe_api.h | 23 | * needed by the application to use this library |
24 | * | 24 | * |
25 | * This file contains declarations for doing callbacks to | 25 | * Authors: Mitch Lichtenberg, Chris Demetriou |
26 | * cfe from an application. It should be the only header | 26 | */ |
27 | * needed by the application to use this library | ||
28 | * | ||
29 | * Authors: Mitch Lichtenberg, Chris Demetriou | ||
30 | * | ||
31 | ********************************************************************* */ | ||
32 | |||
33 | #ifndef CFE_API_H | 27 | #ifndef CFE_API_H |
34 | #define CFE_API_H | 28 | #define CFE_API_H |
35 | 29 | ||
36 | /* | ||
37 | * Apply customizations here for different OSes. These need to: | ||
38 | * * typedef uint64_t, int64_t, intptr_t, uintptr_t. | ||
39 | * * define cfe_strlen() if use of an existing function is desired. | ||
40 | * * define CFE_API_IMPL_NAMESPACE if API functions are to use | ||
41 | * names in the implementation namespace. | ||
42 | * Also, optionally, if the build environment does not do so automatically, | ||
43 | * CFE_API_* can be defined here as desired. | ||
44 | */ | ||
45 | /* Begin customization. */ | ||
46 | #include <linux/types.h> | 30 | #include <linux/types.h> |
47 | #include <linux/string.h> | 31 | #include <linux/string.h> |
48 | 32 | ||
49 | typedef long intptr_t; | 33 | typedef long intptr_t; |
50 | 34 | ||
51 | #define cfe_strlen strlen | ||
52 | 35 | ||
53 | #define CFE_API_ALL | 36 | /* |
54 | #define CFE_API_STRLEN_CUSTOM | 37 | * Constants |
55 | /* End customization. */ | 38 | */ |
56 | |||
57 | |||
58 | /* ********************************************************************* | ||
59 | * Constants | ||
60 | ********************************************************************* */ | ||
61 | 39 | ||
62 | /* Seal indicating CFE's presence, passed to user program. */ | 40 | /* Seal indicating CFE's presence, passed to user program. */ |
63 | #define CFE_EPTSEAL 0x43464531 | 41 | #define CFE_EPTSEAL 0x43464531 |
@@ -109,54 +87,13 @@ typedef struct { | |||
109 | 87 | ||
110 | 88 | ||
111 | /* | 89 | /* |
112 | * cfe_strlen is handled specially: If already defined, it has been | ||
113 | * overridden in this environment with a standard strlen-like function. | ||
114 | */ | ||
115 | #ifdef cfe_strlen | ||
116 | # define CFE_API_STRLEN_CUSTOM | ||
117 | #else | ||
118 | # ifdef CFE_API_IMPL_NAMESPACE | ||
119 | # define cfe_strlen(a) __cfe_strlen(a) | ||
120 | # endif | ||
121 | int cfe_strlen(char *name); | ||
122 | #endif | ||
123 | |||
124 | /* | ||
125 | * Defines and prototypes for functions which take no arguments. | 90 | * Defines and prototypes for functions which take no arguments. |
126 | */ | 91 | */ |
127 | #ifdef CFE_API_IMPL_NAMESPACE | ||
128 | int64_t __cfe_getticks(void); | ||
129 | #define cfe_getticks() __cfe_getticks() | ||
130 | #else | ||
131 | int64_t cfe_getticks(void); | 92 | int64_t cfe_getticks(void); |
132 | #endif | ||
133 | 93 | ||
134 | /* | 94 | /* |
135 | * Defines and prototypes for the rest of the functions. | 95 | * Defines and prototypes for the rest of the functions. |
136 | */ | 96 | */ |
137 | #ifdef CFE_API_IMPL_NAMESPACE | ||
138 | #define cfe_close(a) __cfe_close(a) | ||
139 | #define cfe_cpu_start(a, b, c, d, e) __cfe_cpu_start(a, b, c, d, e) | ||
140 | #define cfe_cpu_stop(a) __cfe_cpu_stop(a) | ||
141 | #define cfe_enumenv(a, b, d, e, f) __cfe_enumenv(a, b, d, e, f) | ||
142 | #define cfe_enummem(a, b, c, d, e) __cfe_enummem(a, b, c, d, e) | ||
143 | #define cfe_exit(a, b) __cfe_exit(a, b) | ||
144 | #define cfe_flushcache(a) __cfe_cacheflush(a) | ||
145 | #define cfe_getdevinfo(a) __cfe_getdevinfo(a) | ||
146 | #define cfe_getenv(a, b, c) __cfe_getenv(a, b, c) | ||
147 | #define cfe_getfwinfo(a) __cfe_getfwinfo(a) | ||
148 | #define cfe_getstdhandle(a) __cfe_getstdhandle(a) | ||
149 | #define cfe_init(a, b) __cfe_init(a, b) | ||
150 | #define cfe_inpstat(a) __cfe_inpstat(a) | ||
151 | #define cfe_ioctl(a, b, c, d, e, f) __cfe_ioctl(a, b, c, d, e, f) | ||
152 | #define cfe_open(a) __cfe_open(a) | ||
153 | #define cfe_read(a, b, c) __cfe_read(a, b, c) | ||
154 | #define cfe_readblk(a, b, c, d) __cfe_readblk(a, b, c, d) | ||
155 | #define cfe_setenv(a, b) __cfe_setenv(a, b) | ||
156 | #define cfe_write(a, b, c) __cfe_write(a, b, c) | ||
157 | #define cfe_writeblk(a, b, c, d) __cfe_writeblk(a, b, c, d) | ||
158 | #endif /* CFE_API_IMPL_NAMESPACE */ | ||
159 | |||
160 | int cfe_close(int handle); | 97 | int cfe_close(int handle); |
161 | int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1); | 98 | int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1); |
162 | int cfe_cpu_stop(int cpu); | 99 | int cfe_cpu_stop(int cpu); |
diff --git a/include/asm-mips/fw/cfe/cfe_error.h b/include/asm-mips/fw/cfe/cfe_error.h index 975f00002cbe..b80374636279 100644 --- a/include/asm-mips/fw/cfe/cfe_error.h +++ b/include/asm-mips/fw/cfe/cfe_error.h | |||
@@ -16,18 +16,13 @@ | |||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | /* ********************************************************************* | 19 | /* |
20 | * | 20 | * Broadcom Common Firmware Environment (CFE) |
21 | * Broadcom Common Firmware Environment (CFE) | 21 | * |
22 | * | 22 | * CFE's global error code list is here. |
23 | * Error codes File: cfe_error.h | 23 | * |
24 | * | 24 | * Author: Mitch Lichtenberg |
25 | * CFE's global error code list is here. | 25 | */ |
26 | * | ||
27 | * Author: Mitch Lichtenberg | ||
28 | * | ||
29 | ********************************************************************* */ | ||
30 | |||
31 | 26 | ||
32 | #define CFE_OK 0 | 27 | #define CFE_OK 0 |
33 | #define CFE_ERR -1 /* generic error */ | 28 | #define CFE_ERR -1 /* generic error */ |