1 /* *********************************************************************
2 * Broadcom Common Firmware Environment (CFE)
4 * IOCB definitions File: cfe_iocb.h
6 * This module describes CFE's IOCB structure, the main
7 * data structure used to communicate API requests with CFE.
9 * Author: Mitch Lichtenberg (mpl@broadcom.com)
11 *********************************************************************
13 * Copyright 2000,2001,2002,2003
14 * Broadcom Corporation. All rights reserved.
16 * This software is furnished under license and may be used and
17 * copied only in accordance with the following terms and
18 * conditions. Subject to these conditions, you may download,
19 * copy, install, use, modify and distribute modified or unmodified
20 * copies of this software in source and/or binary form. No title
21 * or ownership is transferred hereby.
23 * 1) Any source code used, modified or distributed must reproduce
24 * and retain this copyright notice and list of conditions
25 * as they appear in the source file.
27 * 2) No right is granted to use any trade name, trademark, or
28 * logo of Broadcom Corporation. The "Broadcom Corporation"
29 * name may not be used to endorse or promote products derived
30 * from this software without the prior written permission of
31 * Broadcom Corporation.
33 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR
34 * IMPLIED WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED
35 * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
36 * PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT
37 * SHALL BROADCOM BE LIABLE FOR ANY DAMAGES WHATSOEVER, AND IN
38 * PARTICULAR, BROADCOM SHALL NOT BE LIABLE FOR DIRECT, INDIRECT,
39 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
40 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
41 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
42 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
43 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF
45 * THE POSSIBILITY OF SUCH DAMAGE.
46 ********************************************************************* */
51 /* *********************************************************************
53 ********************************************************************* */
55 #define CFE_CMD_FW_GETINFO 0
56 #define CFE_CMD_FW_RESTART 1
57 #define CFE_CMD_FW_BOOT 2
58 #define CFE_CMD_FW_CPUCTL 3
59 #define CFE_CMD_FW_GETTIME 4
60 #define CFE_CMD_FW_MEMENUM 5
61 #define CFE_CMD_FW_FLUSHCACHE 6
63 #define CFE_CMD_DEV_GETHANDLE 9
64 #define CFE_CMD_DEV_ENUM 10
65 #define CFE_CMD_DEV_OPEN 11
66 #define CFE_CMD_DEV_INPSTAT 12
67 #define CFE_CMD_DEV_READ 13
68 #define CFE_CMD_DEV_WRITE 14
69 #define CFE_CMD_DEV_IOCTL 15
70 #define CFE_CMD_DEV_CLOSE 16
71 #define CFE_CMD_DEV_GETINFO 17
73 #define CFE_CMD_ENV_ENUM 20
74 #define CFE_CMD_ENV_GET 22
75 #define CFE_CMD_ENV_SET 23
76 #define CFE_CMD_ENV_DEL 24
78 #define CFE_CMD_MAX 32
80 #define CFE_CMD_VENDOR_USE 0x8000 /* codes above this are for customer use */
82 #define CFE_MI_RESERVED 0 /* memory is reserved, do not use */
83 #define CFE_MI_AVAILABLE 1 /* memory is available */
85 #define CFE_FLG_WARMSTART 0x00000001
86 #define CFE_FLG_FULL_ARENA 0x00000001
87 #define CFE_FLG_ENV_PERMANENT 0x00000001
89 #define CFE_CPU_CMD_START 1
90 #define CFE_CPU_CMD_STOP 0
92 #define CFE_STDHANDLE_CONSOLE 0
94 #define CFE_DEV_NETWORK 1
95 #define CFE_DEV_DISK 2
96 #define CFE_DEV_FLASH 3
97 #define CFE_DEV_SERIAL 4
99 #define CFE_DEV_NVRAM 6
100 #define CFE_DEV_CLOCK 7
101 #define CFE_DEV_OTHER 8
102 #define CFE_DEV_MASK 0x0F
104 #define CFE_CACHE_FLUSH_D 1
105 #define CFE_CACHE_INVAL_I 2
106 #define CFE_CACHE_INVAL_D 4
107 #define CFE_CACHE_INVAL_L2 8
109 /* *********************************************************************
111 ********************************************************************* */
113 typedef unsigned long long cfe_xuint_t
;
114 typedef long long cfe_xint_t
;
115 typedef long long cfe_xptr_t
;
117 typedef struct xiocb_buffer_s
{
118 cfe_xuint_t buf_offset
; /* offset on device (bytes) */
119 cfe_xptr_t buf_ptr
; /* pointer to a buffer */
120 cfe_xuint_t buf_length
; /* length of this buffer */
121 cfe_xuint_t buf_retlen
; /* returned length (for read ops) */
122 cfe_xuint_t buf_ioctlcmd
; /* IOCTL command (used only for IOCTLs) */
125 #define buf_devflags buf_ioctlcmd /* returned device info flags */
127 typedef struct xiocb_inpstat_s
{
128 cfe_xuint_t inp_status
; /* 1 means input available */
131 typedef struct xiocb_envbuf_s
{
132 cfe_xint_t enum_idx
; /* 0-based enumeration index */
133 cfe_xptr_t name_ptr
; /* name string buffer */
134 cfe_xint_t name_length
; /* size of name buffer */
135 cfe_xptr_t val_ptr
; /* value string buffer */
136 cfe_xint_t val_length
; /* size of value string buffer */
139 typedef struct xiocb_cpuctl_s
{
140 cfe_xuint_t cpu_number
; /* cpu number to control */
141 cfe_xuint_t cpu_command
; /* command to issue to CPU */
142 cfe_xuint_t start_addr
; /* CPU start address */
143 cfe_xuint_t gp_val
; /* starting GP value */
144 cfe_xuint_t sp_val
; /* starting SP value */
145 cfe_xuint_t a1_val
; /* starting A1 value */
148 typedef struct xiocb_time_s
{
149 cfe_xint_t ticks
; /* current time in ticks */
152 typedef struct xiocb_exitstat_s
{
156 typedef struct xiocb_meminfo_s
{
157 cfe_xint_t mi_idx
; /* 0-based enumeration index */
158 cfe_xint_t mi_type
; /* type of memory block */
159 cfe_xuint_t mi_addr
; /* physical start address */
160 cfe_xuint_t mi_size
; /* block size */
163 #define CFE_FWI_64BIT 0x00000001
164 #define CFE_FWI_32BIT 0x00000002
165 #define CFE_FWI_RELOC 0x00000004
166 #define CFE_FWI_UNCACHED 0x00000008
167 #define CFE_FWI_MULTICPU 0x00000010
168 #define CFE_FWI_FUNCSIM 0x00000020
169 #define CFE_FWI_RTLSIM 0x00000040
171 typedef struct xiocb_fwinfo_s
{
172 cfe_xint_t fwi_version
; /* major, minor, eco version */
173 cfe_xint_t fwi_totalmem
; /* total installed mem */
174 cfe_xint_t fwi_flags
; /* various flags */
175 cfe_xint_t fwi_boardid
; /* board ID */
176 cfe_xint_t fwi_bootarea_va
; /* VA of boot area */
177 cfe_xint_t fwi_bootarea_pa
; /* PA of boot area */
178 cfe_xint_t fwi_bootarea_size
; /* size of boot area */
179 cfe_xint_t fwi_reserved1
;
180 cfe_xint_t fwi_reserved2
;
181 cfe_xint_t fwi_reserved3
;
184 typedef struct cfe_xiocb_s
{
185 cfe_xuint_t xiocb_fcode
; /* IOCB function code */
186 cfe_xint_t xiocb_status
; /* return status */
187 cfe_xint_t xiocb_handle
; /* file/device handle */
188 cfe_xuint_t xiocb_flags
; /* flags for this IOCB */
189 cfe_xuint_t xiocb_psize
; /* size of parameter list */
191 xiocb_buffer_t xiocb_buffer
; /* buffer parameters */
192 xiocb_inpstat_t xiocb_inpstat
; /* input status parameters */
193 xiocb_envbuf_t xiocb_envbuf
; /* environment function parameters */
194 xiocb_cpuctl_t xiocb_cpuctl
; /* CPU control parameters */
195 xiocb_time_t xiocb_time
; /* timer parameters */
196 xiocb_meminfo_t xiocb_meminfo
; /* memory arena info parameters */
197 xiocb_fwinfo_t xiocb_fwinfo
; /* firmware information */
198 xiocb_exitstat_t xiocb_exitstat
; /* Exit Status */