diff options
author | Aurelien Jarno <aurelien@aurel32.net> | 2007-09-05 02:58:26 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-10-11 18:46:05 -0400 |
commit | df78b5c8faa72b3c04f82faab126de93af178348 (patch) | |
tree | 769f342740526699d116b7a89bd0dba34b381845 /include/asm-mips | |
parent | cc6e8e0812cf95aea397c457ff48de2ac069614f (diff) |
[MIPS] Move CFE code into arch/mips/fw/cfe
Move the platform independent part of the CFE code to arch/mips/fw/cfe from
arch/mips/sibyte/cfe.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/asm-mips')
-rw-r--r-- | include/asm-mips/fw/cfe/cfe_api.h | 185 | ||||
-rw-r--r-- | include/asm-mips/fw/cfe/cfe_error.h | 85 |
2 files changed, 270 insertions, 0 deletions
diff --git a/include/asm-mips/fw/cfe/cfe_api.h b/include/asm-mips/fw/cfe/cfe_api.h new file mode 100644 index 000000000000..d8230cc53b81 --- /dev/null +++ b/include/asm-mips/fw/cfe/cfe_api.h | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
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. | ||
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 | |||
33 | #ifndef CFE_API_H | ||
34 | #define CFE_API_H | ||
35 | |||
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> | ||
47 | #include <linux/string.h> | ||
48 | |||
49 | typedef long intptr_t; | ||
50 | |||
51 | #define cfe_strlen strlen | ||
52 | |||
53 | #define CFE_API_ALL | ||
54 | #define CFE_API_STRLEN_CUSTOM | ||
55 | /* End customization. */ | ||
56 | |||
57 | |||
58 | /* ********************************************************************* | ||
59 | * Constants | ||
60 | ********************************************************************* */ | ||
61 | |||
62 | /* Seal indicating CFE's presence, passed to user program. */ | ||
63 | #define CFE_EPTSEAL 0x43464531 | ||
64 | |||
65 | #define CFE_MI_RESERVED 0 /* memory is reserved, do not use */ | ||
66 | #define CFE_MI_AVAILABLE 1 /* memory is available */ | ||
67 | |||
68 | #define CFE_FLG_WARMSTART 0x00000001 | ||
69 | #define CFE_FLG_FULL_ARENA 0x00000001 | ||
70 | #define CFE_FLG_ENV_PERMANENT 0x00000001 | ||
71 | |||
72 | #define CFE_CPU_CMD_START 1 | ||
73 | #define CFE_CPU_CMD_STOP 0 | ||
74 | |||
75 | #define CFE_STDHANDLE_CONSOLE 0 | ||
76 | |||
77 | #define CFE_DEV_NETWORK 1 | ||
78 | #define CFE_DEV_DISK 2 | ||
79 | #define CFE_DEV_FLASH 3 | ||
80 | #define CFE_DEV_SERIAL 4 | ||
81 | #define CFE_DEV_CPU 5 | ||
82 | #define CFE_DEV_NVRAM 6 | ||
83 | #define CFE_DEV_CLOCK 7 | ||
84 | #define CFE_DEV_OTHER 8 | ||
85 | #define CFE_DEV_MASK 0x0F | ||
86 | |||
87 | #define CFE_CACHE_FLUSH_D 1 | ||
88 | #define CFE_CACHE_INVAL_I 2 | ||
89 | #define CFE_CACHE_INVAL_D 4 | ||
90 | #define CFE_CACHE_INVAL_L2 8 | ||
91 | |||
92 | #define CFE_FWI_64BIT 0x00000001 | ||
93 | #define CFE_FWI_32BIT 0x00000002 | ||
94 | #define CFE_FWI_RELOC 0x00000004 | ||
95 | #define CFE_FWI_UNCACHED 0x00000008 | ||
96 | #define CFE_FWI_MULTICPU 0x00000010 | ||
97 | #define CFE_FWI_FUNCSIM 0x00000020 | ||
98 | #define CFE_FWI_RTLSIM 0x00000040 | ||
99 | |||
100 | typedef struct { | ||
101 | int64_t fwi_version; /* major, minor, eco version */ | ||
102 | int64_t fwi_totalmem; /* total installed mem */ | ||
103 | int64_t fwi_flags; /* various flags */ | ||
104 | int64_t fwi_boardid; /* board ID */ | ||
105 | int64_t fwi_bootarea_va; /* VA of boot area */ | ||
106 | int64_t fwi_bootarea_pa; /* PA of boot area */ | ||
107 | int64_t fwi_bootarea_size; /* size of boot area */ | ||
108 | } cfe_fwinfo_t; | ||
109 | |||
110 | |||
111 | /* | ||
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. | ||
126 | */ | ||
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); | ||
132 | #endif | ||
133 | |||
134 | /* | ||
135 | * Defines and prototypes for the rest of the functions. | ||
136 | */ | ||
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); | ||
161 | int cfe_cpu_start(int cpu, void (*fn) (void), long sp, long gp, long a1); | ||
162 | int cfe_cpu_stop(int cpu); | ||
163 | int cfe_enumenv(int idx, char *name, int namelen, char *val, int vallen); | ||
164 | int cfe_enummem(int idx, int flags, uint64_t * start, uint64_t * length, | ||
165 | uint64_t * type); | ||
166 | int cfe_exit(int warm, int status); | ||
167 | int cfe_flushcache(int flg); | ||
168 | int cfe_getdevinfo(char *name); | ||
169 | int cfe_getenv(char *name, char *dest, int destlen); | ||
170 | int cfe_getfwinfo(cfe_fwinfo_t * info); | ||
171 | int cfe_getstdhandle(int flg); | ||
172 | int cfe_init(uint64_t handle, uint64_t ept); | ||
173 | int cfe_inpstat(int handle); | ||
174 | int cfe_ioctl(int handle, unsigned int ioctlnum, unsigned char *buffer, | ||
175 | int length, int *retlen, uint64_t offset); | ||
176 | int cfe_open(char *name); | ||
177 | int cfe_read(int handle, unsigned char *buffer, int length); | ||
178 | int cfe_readblk(int handle, int64_t offset, unsigned char *buffer, | ||
179 | int length); | ||
180 | int cfe_setenv(char *name, char *val); | ||
181 | int cfe_write(int handle, unsigned char *buffer, int length); | ||
182 | int cfe_writeblk(int handle, int64_t offset, unsigned char *buffer, | ||
183 | int length); | ||
184 | |||
185 | #endif /* CFE_API_H */ | ||
diff --git a/include/asm-mips/fw/cfe/cfe_error.h b/include/asm-mips/fw/cfe/cfe_error.h new file mode 100644 index 000000000000..975f00002cbe --- /dev/null +++ b/include/asm-mips/fw/cfe/cfe_error.h | |||
@@ -0,0 +1,85 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2000, 2001, 2002 Broadcom Corporation | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version 2 | ||
7 | * of the License, or (at your option) any later version. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
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. | ||
17 | */ | ||
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 | |||
31 | |||
32 | #define CFE_OK 0 | ||
33 | #define CFE_ERR -1 /* generic error */ | ||
34 | #define CFE_ERR_INV_COMMAND -2 | ||
35 | #define CFE_ERR_EOF -3 | ||
36 | #define CFE_ERR_IOERR -4 | ||
37 | #define CFE_ERR_NOMEM -5 | ||
38 | #define CFE_ERR_DEVNOTFOUND -6 | ||
39 | #define CFE_ERR_DEVOPEN -7 | ||
40 | #define CFE_ERR_INV_PARAM -8 | ||
41 | #define CFE_ERR_ENVNOTFOUND -9 | ||
42 | #define CFE_ERR_ENVREADONLY -10 | ||
43 | |||
44 | #define CFE_ERR_NOTELF -11 | ||
45 | #define CFE_ERR_NOT32BIT -12 | ||
46 | #define CFE_ERR_WRONGENDIAN -13 | ||
47 | #define CFE_ERR_BADELFVERS -14 | ||
48 | #define CFE_ERR_NOTMIPS -15 | ||
49 | #define CFE_ERR_BADELFFMT -16 | ||
50 | #define CFE_ERR_BADADDR -17 | ||
51 | |||
52 | #define CFE_ERR_FILENOTFOUND -18 | ||
53 | #define CFE_ERR_UNSUPPORTED -19 | ||
54 | |||
55 | #define CFE_ERR_HOSTUNKNOWN -20 | ||
56 | |||
57 | #define CFE_ERR_TIMEOUT -21 | ||
58 | |||
59 | #define CFE_ERR_PROTOCOLERR -22 | ||
60 | |||
61 | #define CFE_ERR_NETDOWN -23 | ||
62 | #define CFE_ERR_NONAMESERVER -24 | ||
63 | |||
64 | #define CFE_ERR_NOHANDLES -25 | ||
65 | #define CFE_ERR_ALREADYBOUND -26 | ||
66 | |||
67 | #define CFE_ERR_CANNOTSET -27 | ||
68 | #define CFE_ERR_NOMORE -28 | ||
69 | #define CFE_ERR_BADFILESYS -29 | ||
70 | #define CFE_ERR_FSNOTAVAIL -30 | ||
71 | |||
72 | #define CFE_ERR_INVBOOTBLOCK -31 | ||
73 | #define CFE_ERR_WRONGDEVTYPE -32 | ||
74 | #define CFE_ERR_BBCHECKSUM -33 | ||
75 | #define CFE_ERR_BOOTPROGCHKSUM -34 | ||
76 | |||
77 | #define CFE_ERR_LDRNOTAVAIL -35 | ||
78 | |||
79 | #define CFE_ERR_NOTREADY -36 | ||
80 | |||
81 | #define CFE_ERR_GETMEM -37 | ||
82 | #define CFE_ERR_SETMEM -38 | ||
83 | |||
84 | #define CFE_ERR_NOTCONN -39 | ||
85 | #define CFE_ERR_ADDRINUSE -40 | ||