2 * Broadcom Common Firmware Environment (CFE) support
4 * Copyright 2000, 2001, 2002
5 * Broadcom Corporation. All rights reserved.
7 * Copyright (C) 2006 Michael Buesch
9 * Original Authors: Mitch Lichtenberg, Chris Demetriou
11 * This software is furnished under license and may be used and copied only
12 * in accordance with the following terms and conditions. Subject to these
13 * conditions, you may download, copy, install, use, modify and distribute
14 * modified or unmodified copies of this software in source and/or binary
15 * form. No title or ownership is transferred hereby.
17 * 1) Any source code used, modified or distributed must reproduce and
18 * retain this copyright notice and list of conditions as they appear in
21 * 2) No right is granted to use any trade name, trademark, or logo of
22 * Broadcom Corporation. The "Broadcom Corporation" name may not be
23 * used to endorse or promote products derived from this software
24 * without the prior written permission of Broadcom Corporation.
26 * 3) THIS SOFTWARE IS PROVIDED "AS-IS" AND ANY EXPRESS OR IMPLIED
27 * WARRANTIES, INCLUDING BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF
28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
29 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL BROADCOM BE LIABLE
30 * FOR ANY DAMAGES WHATSOEVER, AND IN PARTICULAR, BROADCOM SHALL NOT BE
31 * LIABLE FOR DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
34 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
35 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
36 * OR OTHERWISE), EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 #ifndef LINUX_CFE_API_H_
40 #define LINUX_CFE_API_H_
42 #include <linux/types.h>
45 #define CFE_MI_RESERVED 0 /* memory is reserved, do not use */
46 #define CFE_MI_AVAILABLE 1 /* memory is available */
48 #define CFE_FLG_WARMSTART 0x00000001
49 #define CFE_FLG_FULL_ARENA 0x00000001
50 #define CFE_FLG_ENV_PERMANENT 0x00000001
52 #define CFE_CPU_CMD_START 1
53 #define CFE_CPU_CMD_STOP 0
55 #define CFE_STDHANDLE_CONSOLE 0
57 #define CFE_DEV_NETWORK 1
58 #define CFE_DEV_DISK 2
59 #define CFE_DEV_FLASH 3
60 #define CFE_DEV_SERIAL 4
62 #define CFE_DEV_NVRAM 6
63 #define CFE_DEV_CLOCK 7
64 #define CFE_DEV_OTHER 8
65 #define CFE_DEV_MASK 0x0F
67 #define CFE_CACHE_FLUSH_D 1
68 #define CFE_CACHE_INVAL_I 2
69 #define CFE_CACHE_INVAL_D 4
70 #define CFE_CACHE_INVAL_L2 8
72 #define CFE_FWI_64BIT 0x00000001
73 #define CFE_FWI_32BIT 0x00000002
74 #define CFE_FWI_RELOC 0x00000004
75 #define CFE_FWI_UNCACHED 0x00000008
76 #define CFE_FWI_MULTICPU 0x00000010
77 #define CFE_FWI_FUNCSIM 0x00000020
78 #define CFE_FWI_RTLSIM 0x00000040
81 s64 version
; /* major, minor, eco version */
82 s64 totalmem
; /* total installed mem */
83 s64 flags
; /* various flags */
84 s64 boardid
; /* board ID */
85 s64 bootarea_va
; /* VA of boot area */
86 s64 bootarea_pa
; /* PA of boot area */
87 s64 bootarea_size
; /* size of boot area */
91 /* The public CFE API */
93 int cfe_present(void); /* Check if we booted from CFE. Returns bool */
95 int cfe_getticks(s64
*ticks
);
96 int cfe_close(int handle
);
97 int cfe_cpu_start(int cpu
, void (*fn
)(void), long sp
, long gp
, long a1
);
98 int cfe_cpu_stop(int cpu
);
99 int cfe_enumenv(int idx
, char *name
, int namelen
, char *val
, int vallen
);
100 int cfe_enumdev(int idx
, char *name
, int namelen
);
101 int cfe_enummem(int idx
, int flags
, u64
*start
, u64
*length
,
103 int cfe_exit(int warm
, int status
);
104 int cfe_flushcache(int flags
);
105 int cfe_getdevinfo(char *name
);
106 int cfe_getenv(char *name
, char *dest
, int destlen
);
107 int cfe_getfwinfo(struct cfe_fwinfo
*info
);
108 int cfe_getstdhandle(int handletype
);
109 int cfe_inpstat(int handle
);
110 int cfe_ioctl(int handle
, unsigned int ioctlnum
, unsigned char *buffer
,
111 int length
, int *retlen
, u64 offset
);
112 int cfe_open(char *name
);
113 int cfe_read(int handle
, unsigned char *buffer
, int length
);
114 int cfe_readblk(int handle
, s64 offset
, unsigned char *buffer
, int length
);
115 int cfe_setenv(char *name
, char *val
);
116 int cfe_write(int handle
, unsigned char *buffer
, int length
);
117 int cfe_writeblk(int handle
, s64 offset
, unsigned char *buffer
,
123 /* Print some information to CFE's console (most likely serial line) */
124 int cfe_printk(const char *fmt
, ...) __attribute__((format(printf
, 1, 2)));
125 int cfe_vprintk(const char *fmt
, va_list args
);
129 /* Error codes returned by the low API functions */
131 #define CFE_ISERR(errcode) (errcode < 0)
134 #define CFE_ERR -1 /* generic error */
135 #define CFE_ERR_INV_COMMAND -2
136 #define CFE_ERR_EOF -3
137 #define CFE_ERR_IOERR -4
138 #define CFE_ERR_NOMEM -5
139 #define CFE_ERR_DEVNOTFOUND -6
140 #define CFE_ERR_DEVOPEN -7
141 #define CFE_ERR_INV_PARAM -8
142 #define CFE_ERR_ENVNOTFOUND -9
143 #define CFE_ERR_ENVREADONLY -10
145 #define CFE_ERR_NOTELF -11
146 #define CFE_ERR_NOT32BIT -12
147 #define CFE_ERR_WRONGENDIAN -13
148 #define CFE_ERR_BADELFVERS -14
149 #define CFE_ERR_NOTMIPS -15
150 #define CFE_ERR_BADELFFMT -16
151 #define CFE_ERR_BADADDR -17
153 #define CFE_ERR_FILENOTFOUND -18
154 #define CFE_ERR_UNSUPPORTED -19
156 #define CFE_ERR_HOSTUNKNOWN -20
158 #define CFE_ERR_TIMEOUT -21
160 #define CFE_ERR_PROTOCOLERR -22
162 #define CFE_ERR_NETDOWN -23
163 #define CFE_ERR_NONAMESERVER -24
165 #define CFE_ERR_NOHANDLES -25
166 #define CFE_ERR_ALREADYBOUND -26
168 #define CFE_ERR_CANNOTSET -27
169 #define CFE_ERR_NOMORE -28
170 #define CFE_ERR_BADFILESYS -29
171 #define CFE_ERR_FSNOTAVAIL -30
173 #define CFE_ERR_INVBOOTBLOCK -31
174 #define CFE_ERR_WRONGDEVTYPE -32
175 #define CFE_ERR_BBCHECKSUM -33
176 #define CFE_ERR_BOOTPROGCHKSUM -34
178 #define CFE_ERR_LDRNOTAVAIL -35
180 #define CFE_ERR_NOTREADY -36
182 #define CFE_ERR_GETMEM -37
183 #define CFE_ERR_SETMEM -38
185 #define CFE_ERR_NOTCONN -39
186 #define CFE_ERR_ADDRINUSE -40
189 #endif /* LINUX_CFE_API_H_ */
This page took 0.046665 seconds and 5 git commands to generate.