diff options
Diffstat (limited to 'arch/mips/fw')
-rw-r--r-- | arch/mips/fw/arc/cmdline.c | 2 | ||||
-rw-r--r-- | arch/mips/fw/arc/init.c | 8 | ||||
-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-- | arch/mips/fw/lib/Makefile | 5 | ||||
-rw-r--r-- | arch/mips/fw/lib/call_o32.S | 97 | ||||
-rw-r--r-- | arch/mips/fw/sni/Makefile | 5 | ||||
-rw-r--r-- | arch/mips/fw/sni/sniprom.c | 151 |
8 files changed, 415 insertions, 223 deletions
diff --git a/arch/mips/fw/arc/cmdline.c b/arch/mips/fw/arc/cmdline.c index fd604ef28823..4ca4eef934a5 100644 --- a/arch/mips/fw/arc/cmdline.c +++ b/arch/mips/fw/arc/cmdline.c | |||
@@ -52,7 +52,7 @@ static char * __init move_firmware_args(char* cp) | |||
52 | strcat(cp, used_arc[i][1]); | 52 | strcat(cp, used_arc[i][1]); |
53 | cp += strlen(used_arc[i][1]); | 53 | cp += strlen(used_arc[i][1]); |
54 | /* ... and now the argument */ | 54 | /* ... and now the argument */ |
55 | s = strstr(prom_argv(actr), "="); | 55 | s = strchr(prom_argv(actr), '='); |
56 | if (s) { | 56 | if (s) { |
57 | s++; | 57 | s++; |
58 | strcpy(cp, s); | 58 | strcpy(cp, s); |
diff --git a/arch/mips/fw/arc/init.c b/arch/mips/fw/arc/init.c index e2f75b13312f..3ad8788b6eaa 100644 --- a/arch/mips/fw/arc/init.c +++ b/arch/mips/fw/arc/init.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <asm/bootinfo.h> | 13 | #include <asm/bootinfo.h> |
14 | #include <asm/sgialib.h> | 14 | #include <asm/sgialib.h> |
15 | #include <asm/smp-ops.h> | ||
15 | 16 | ||
16 | #undef DEBUG_PROM_INIT | 17 | #undef DEBUG_PROM_INIT |
17 | 18 | ||
@@ -48,4 +49,11 @@ void __init prom_init(void) | |||
48 | ArcRead(0, &c, 1, &cnt); | 49 | ArcRead(0, &c, 1, &cnt); |
49 | ArcEnterInteractiveMode(); | 50 | ArcEnterInteractiveMode(); |
50 | #endif | 51 | #endif |
52 | #ifdef CONFIG_SGI_IP27 | ||
53 | { | ||
54 | extern struct plat_smp_ops ip27_smp_ops; | ||
55 | |||
56 | register_smp_ops(&ip27_smp_ops); | ||
57 | } | ||
58 | #endif | ||
51 | } | 59 | } |
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/arch/mips/fw/lib/Makefile b/arch/mips/fw/lib/Makefile new file mode 100644 index 000000000000..84befc968fc4 --- /dev/null +++ b/arch/mips/fw/lib/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for generic prom monitor library routines under Linux. | ||
3 | # | ||
4 | |||
5 | lib-$(CONFIG_64BIT) += call_o32.o | ||
diff --git a/arch/mips/fw/lib/call_o32.S b/arch/mips/fw/lib/call_o32.S new file mode 100644 index 000000000000..bdf7d1d4081a --- /dev/null +++ b/arch/mips/fw/lib/call_o32.S | |||
@@ -0,0 +1,97 @@ | |||
1 | /* | ||
2 | * arch/mips/dec/prom/call_o32.S | ||
3 | * | ||
4 | * O32 interface for the 64 (or N32) ABI. | ||
5 | * | ||
6 | * Copyright (C) 2002 Maciej W. Rozycki | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or | ||
9 | * modify it under the terms of the GNU General Public License | ||
10 | * as published by the Free Software Foundation; either version | ||
11 | * 2 of the License, or (at your option) any later version. | ||
12 | */ | ||
13 | |||
14 | #include <asm/asm.h> | ||
15 | #include <asm/regdef.h> | ||
16 | |||
17 | /* Maximum number of arguments supported. Must be even! */ | ||
18 | #define O32_ARGC 32 | ||
19 | /* Number of static registers we save. */ | ||
20 | #define O32_STATC 11 | ||
21 | /* Frame size for static register */ | ||
22 | #define O32_FRAMESZ (SZREG * O32_STATC) | ||
23 | /* Frame size on new stack */ | ||
24 | #define O32_FRAMESZ_NEW (SZREG + 4 * O32_ARGC) | ||
25 | |||
26 | .text | ||
27 | |||
28 | /* | ||
29 | * O32 function call dispatcher, for interfacing 32-bit ROM routines. | ||
30 | * | ||
31 | * The standard 64 (N32) calling sequence is supported, with a0 | ||
32 | * holding a function pointer, a1 a new stack pointer, a2-a7 -- its | ||
33 | * first six arguments and the stack -- remaining ones (up to O32_ARGC, | ||
34 | * including a2-a7). Static registers, gp and fp are preserved, v0 holds | ||
35 | * a result. This code relies on the called o32 function for sp and ra | ||
36 | * restoration and this dispatcher has to be placed in a KSEGx (or KUSEG) | ||
37 | * address space. Any pointers passed have to point to addresses within | ||
38 | * one of these spaces as well. | ||
39 | */ | ||
40 | NESTED(call_o32, O32_FRAMESZ, ra) | ||
41 | REG_SUBU sp,O32_FRAMESZ | ||
42 | |||
43 | REG_S ra,O32_FRAMESZ-1*SZREG(sp) | ||
44 | REG_S fp,O32_FRAMESZ-2*SZREG(sp) | ||
45 | REG_S gp,O32_FRAMESZ-3*SZREG(sp) | ||
46 | REG_S s7,O32_FRAMESZ-4*SZREG(sp) | ||
47 | REG_S s6,O32_FRAMESZ-5*SZREG(sp) | ||
48 | REG_S s5,O32_FRAMESZ-6*SZREG(sp) | ||
49 | REG_S s4,O32_FRAMESZ-7*SZREG(sp) | ||
50 | REG_S s3,O32_FRAMESZ-8*SZREG(sp) | ||
51 | REG_S s2,O32_FRAMESZ-9*SZREG(sp) | ||
52 | REG_S s1,O32_FRAMESZ-10*SZREG(sp) | ||
53 | REG_S s0,O32_FRAMESZ-11*SZREG(sp) | ||
54 | |||
55 | move jp,a0 | ||
56 | REG_SUBU s0,a1,O32_FRAMESZ_NEW | ||
57 | REG_S sp,O32_FRAMESZ_NEW-1*SZREG(s0) | ||
58 | |||
59 | sll a0,a2,zero | ||
60 | sll a1,a3,zero | ||
61 | sll a2,a4,zero | ||
62 | sll a3,a5,zero | ||
63 | sw a6,0x10(s0) | ||
64 | sw a7,0x14(s0) | ||
65 | |||
66 | PTR_LA t0,O32_FRAMESZ(sp) | ||
67 | PTR_LA t1,0x18(s0) | ||
68 | li t2,O32_ARGC-6 | ||
69 | 1: | ||
70 | lw t3,(t0) | ||
71 | REG_ADDU t0,SZREG | ||
72 | sw t3,(t1) | ||
73 | REG_SUBU t2,1 | ||
74 | REG_ADDU t1,4 | ||
75 | bnez t2,1b | ||
76 | |||
77 | move sp,s0 | ||
78 | |||
79 | jalr jp | ||
80 | |||
81 | REG_L sp,O32_FRAMESZ_NEW-1*SZREG(sp) | ||
82 | |||
83 | REG_L s0,O32_FRAMESZ-11*SZREG(sp) | ||
84 | REG_L s1,O32_FRAMESZ-10*SZREG(sp) | ||
85 | REG_L s2,O32_FRAMESZ-9*SZREG(sp) | ||
86 | REG_L s3,O32_FRAMESZ-8*SZREG(sp) | ||
87 | REG_L s4,O32_FRAMESZ-7*SZREG(sp) | ||
88 | REG_L s5,O32_FRAMESZ-6*SZREG(sp) | ||
89 | REG_L s6,O32_FRAMESZ-5*SZREG(sp) | ||
90 | REG_L s7,O32_FRAMESZ-4*SZREG(sp) | ||
91 | REG_L gp,O32_FRAMESZ-3*SZREG(sp) | ||
92 | REG_L fp,O32_FRAMESZ-2*SZREG(sp) | ||
93 | REG_L ra,O32_FRAMESZ-1*SZREG(sp) | ||
94 | |||
95 | REG_ADDU sp,O32_FRAMESZ | ||
96 | jr ra | ||
97 | END(call_o32) | ||
diff --git a/arch/mips/fw/sni/Makefile b/arch/mips/fw/sni/Makefile new file mode 100644 index 000000000000..d9740a3788e2 --- /dev/null +++ b/arch/mips/fw/sni/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | # | ||
2 | # Makefile for the SNI prom monitor routines under Linux. | ||
3 | # | ||
4 | |||
5 | lib-$(CONFIG_SNIPROM) += sniprom.o | ||
diff --git a/arch/mips/fw/sni/sniprom.c b/arch/mips/fw/sni/sniprom.c new file mode 100644 index 000000000000..96ba99202758 --- /dev/null +++ b/arch/mips/fw/sni/sniprom.c | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | * Big Endian PROM code for SNI RM machines | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2005-2006 Florian Lohoff (flo@rfc822.org) | ||
9 | * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) | ||
10 | */ | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <linux/init.h> | ||
14 | #include <linux/string.h> | ||
15 | #include <linux/console.h> | ||
16 | |||
17 | #include <asm/addrspace.h> | ||
18 | #include <asm/sni.h> | ||
19 | #include <asm/mipsprom.h> | ||
20 | #include <asm/mipsregs.h> | ||
21 | #include <asm/bootinfo.h> | ||
22 | |||
23 | /* special SNI prom calls */ | ||
24 | /* | ||
25 | * This does not exist in all proms - SINIX compares | ||
26 | * the prom env variable "version" against "2.0008" | ||
27 | * or greater. If lesser it tries to probe interesting | ||
28 | * registers | ||
29 | */ | ||
30 | #define PROM_GET_MEMCONF 58 | ||
31 | #define PROM_GET_HWCONF 61 | ||
32 | |||
33 | #define PROM_VEC (u64 *)CKSEG1ADDR(0x1fc00000) | ||
34 | #define PROM_ENTRY(x) (PROM_VEC + (x)) | ||
35 | |||
36 | #define ___prom_putchar ((int *(*)(int))PROM_ENTRY(PROM_PUTCHAR)) | ||
37 | #define ___prom_getenv ((char *(*)(char *))PROM_ENTRY(PROM_GETENV)) | ||
38 | #define ___prom_get_memconf ((void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF)) | ||
39 | #define ___prom_get_hwconf ((u32 (*)(void))PROM_ENTRY(PROM_GET_HWCONF)) | ||
40 | |||
41 | #ifdef CONFIG_64BIT | ||
42 | |||
43 | static u8 o32_stk[16384]; | ||
44 | #define O32_STK &o32_stk[sizeof(o32_stk)] | ||
45 | |||
46 | #define __PROM_O32(fun, arg) fun arg __asm__(#fun); \ | ||
47 | __asm__(#fun " = call_o32") | ||
48 | |||
49 | int __PROM_O32(__prom_putchar, (int *(*)(int), void *, int)); | ||
50 | char *__PROM_O32(__prom_getenv, (char *(*)(char *), void *, char *)); | ||
51 | void __PROM_O32(__prom_get_memconf, (void (*)(void *), void *, void *)); | ||
52 | u32 __PROM_O32(__prom_get_hwconf, (u32 (*)(void), void *)); | ||
53 | |||
54 | #define _prom_putchar(x) __prom_putchar(___prom_putchar, O32_STK, x) | ||
55 | #define _prom_getenv(x) __prom_getenv(___prom_getenv, O32_STK, x) | ||
56 | #define _prom_get_memconf(x) __prom_get_memconf(___prom_get_memconf, O32_STK, x) | ||
57 | #define _prom_get_hwconf() __prom_get_hwconf(___prom_get_hwconf, O32_STK) | ||
58 | |||
59 | #else | ||
60 | #define _prom_putchar(x) ___prom_putchar(x) | ||
61 | #define _prom_getenv(x) ___prom_getenv(x) | ||
62 | #define _prom_get_memconf(x) ___prom_get_memconf(x) | ||
63 | #define _prom_get_hwconf(x) ___prom_get_hwconf(x) | ||
64 | #endif | ||
65 | |||
66 | void prom_putchar(char c) | ||
67 | { | ||
68 | _prom_putchar(c); | ||
69 | } | ||
70 | |||
71 | |||
72 | char *prom_getenv(char *s) | ||
73 | { | ||
74 | return _prom_getenv(s); | ||
75 | } | ||
76 | |||
77 | void *prom_get_hwconf(void) | ||
78 | { | ||
79 | u32 hwconf = _prom_get_hwconf(); | ||
80 | |||
81 | if (hwconf == 0xffffffff) | ||
82 | return NULL; | ||
83 | |||
84 | return (void *)CKSEG1ADDR(hwconf); | ||
85 | } | ||
86 | |||
87 | void __init prom_free_prom_memory(void) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | /* | ||
92 | * /proc/cpuinfo system type | ||
93 | * | ||
94 | */ | ||
95 | char *system_type = "Unknown"; | ||
96 | const char *get_system_type(void) | ||
97 | { | ||
98 | return system_type; | ||
99 | } | ||
100 | |||
101 | static void __init sni_mem_init(void) | ||
102 | { | ||
103 | int i, memsize; | ||
104 | struct membank { | ||
105 | u32 size; | ||
106 | u32 base; | ||
107 | u32 size2; | ||
108 | u32 pad1; | ||
109 | u32 pad2; | ||
110 | } memconf[8]; | ||
111 | int brd_type = *(unsigned char *)SNI_IDPROM_BRDTYPE; | ||
112 | |||
113 | |||
114 | /* MemSIZE from prom in 16MByte chunks */ | ||
115 | memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; | ||
116 | |||
117 | pr_debug("IDProm memsize: %u MByte\n", memsize); | ||
118 | |||
119 | /* get memory bank layout from prom */ | ||
120 | _prom_get_memconf(&memconf); | ||
121 | |||
122 | pr_debug("prom_get_mem_conf memory configuration:\n"); | ||
123 | for (i = 0; i < 8 && memconf[i].size; i++) { | ||
124 | if (brd_type == SNI_BRD_PCI_TOWER || | ||
125 | brd_type == SNI_BRD_PCI_TOWER_CPLUS) { | ||
126 | if (memconf[i].base >= 0x20000000 && | ||
127 | memconf[i].base < 0x30000000) | ||
128 | memconf[i].base -= 0x20000000; | ||
129 | } | ||
130 | pr_debug("Bank%d: %08x @ %08x\n", i, | ||
131 | memconf[i].size, memconf[i].base); | ||
132 | add_memory_region(memconf[i].base, memconf[i].size, | ||
133 | BOOT_MEM_RAM); | ||
134 | } | ||
135 | } | ||
136 | |||
137 | void __init prom_init(void) | ||
138 | { | ||
139 | int argc = fw_arg0; | ||
140 | u32 *argv = (u32 *)CKSEG0ADDR(fw_arg1); | ||
141 | int i; | ||
142 | |||
143 | sni_mem_init(); | ||
144 | |||
145 | /* copy prom cmdline parameters to kernel cmdline */ | ||
146 | for (i = 1; i < argc; i++) { | ||
147 | strcat(arcs_cmdline, (char *)CKSEG0ADDR(argv[i])); | ||
148 | if (i < (argc - 1)) | ||
149 | strcat(arcs_cmdline, " "); | ||
150 | } | ||
151 | } | ||