Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] CFE: Make code remotely resemble Linux code.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Christoph Hellwig and committed by
Ralf Baechle
417345d8 8b6c2324

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