1
2
3
4
5
6
7
8
9
10
11
12 #ifndef _ASM_SGIARCS_H
13 #define _ASM_SGIARCS_H
14
15 #include <asm/types.h>
16 #include <asm/fw/arc/types.h>
17
18
19 #define PROM_ESUCCESS 0x00
20 #define PROM_E2BIG 0x01
21 #define PROM_EACCESS 0x02
22 #define PROM_EAGAIN 0x03
23 #define PROM_EBADF 0x04
24 #define PROM_EBUSY 0x05
25 #define PROM_EFAULT 0x06
26 #define PROM_EINVAL 0x07
27 #define PROM_EIO 0x08
28 #define PROM_EISDIR 0x09
29 #define PROM_EMFILE 0x0a
30 #define PROM_EMLINK 0x0b
31 #define PROM_ENAMETOOLONG 0x0c
32 #define PROM_ENODEV 0x0d
33 #define PROM_ENOENT 0x0e
34 #define PROM_ENOEXEC 0x0f
35 #define PROM_ENOMEM 0x10
36 #define PROM_ENOSPC 0x11
37 #define PROM_ENOTDIR 0x12
38 #define PROM_ENOTTY 0x13
39 #define PROM_ENXIO 0x14
40 #define PROM_EROFS 0x15
41
42 #define PROM_EADDRNOTAVAIL 0x1f
43 #define PROM_ETIMEDOUT 0x20
44 #define PROM_ECONNABORTED 0x21
45 #define PROM_ENOCONNECT 0x22
46
47
48
49
50 enum linux_devclass {
51 system, processor, cache, adapter, controller, peripheral, memory
52 };
53
54 enum linux_devtypes {
55
56 Arc, Cpu, Fpu,
57
58
59 picache, pdcache,
60
61
62 sicache, sdcache, sccache,
63
64 memdev, eisa_adapter, tc_adapter, scsi_adapter, dti_adapter,
65 multifunc_adapter, dsk_controller, tp_controller, cdrom_controller,
66 worm_controller, serial_controller, net_controller, disp_controller,
67 parallel_controller, ptr_controller, kbd_controller, audio_controller,
68 misc_controller, disk_peripheral, flpy_peripheral, tp_peripheral,
69 modem_peripheral, monitor_peripheral, printer_peripheral,
70 ptr_peripheral, kbd_peripheral, term_peripheral, line_peripheral,
71 net_peripheral, misc_peripheral, anon
72 };
73
74 enum linux_identifier {
75 bogus, ronly, removable, consin, consout, input, output
76 };
77
78
79 struct linux_component {
80 enum linux_devclass class;
81 enum linux_devtypes type;
82 enum linux_identifier iflags;
83 USHORT vers;
84 USHORT rev;
85 ULONG key;
86 ULONG amask;
87 ULONG cdsize;
88 ULONG ilen;
89 _PULONG iname;
90 };
91 typedef struct linux_component pcomponent;
92
93 struct linux_sysid {
94 char vend[8], prod[8];
95 };
96
97
98 enum arcs_memtypes {
99 arcs_eblock,
100 arcs_rvpage,
101 arcs_fcontig,
102 arcs_free,
103 arcs_bmem,
104 arcs_prog,
105 arcs_atmp,
106 arcs_aperm,
107 };
108
109
110 enum arc_memtypes {
111 arc_eblock,
112 arc_rvpage,
113 arc_free,
114 arc_bmem,
115 arc_prog,
116 arc_atmp,
117 arc_aperm,
118 arc_fcontig,
119 };
120
121 union linux_memtypes {
122 enum arcs_memtypes arcs;
123 enum arc_memtypes arc;
124 };
125
126 struct linux_mdesc {
127 union linux_memtypes type;
128 ULONG base;
129 ULONG pages;
130 };
131
132
133 struct linux_tinfo {
134 unsigned short yr;
135 unsigned short mnth;
136 unsigned short day;
137 unsigned short hr;
138 unsigned short min;
139 unsigned short sec;
140 unsigned short msec;
141 };
142
143
144 struct linux_vdirent {
145 ULONG namelen;
146 unsigned char attr;
147 char fname[32];
148 };
149
150
151 enum linux_omode {
152 rdonly, wronly, rdwr, wronly_creat, rdwr_creat,
153 wronly_ssede, rdwr_ssede, dirent, dirent_creat
154 };
155
156 enum linux_seekmode {
157 absolute, relative
158 };
159
160 enum linux_mountops {
161 media_load, media_unload
162 };
163
164
165 struct linux_bigint {
166 #ifdef __MIPSEL__
167 u32 lo;
168 s32 hi;
169 #else
170 s32 hi;
171 u32 lo;
172 #endif
173 };
174
175 struct linux_finfo {
176 struct linux_bigint begin;
177 struct linux_bigint end;
178 struct linux_bigint cur;
179 enum linux_devtypes dtype;
180 unsigned long namelen;
181 unsigned char attr;
182 char name[32];
183 };
184
185
186
187 struct linux_romvec {
188 LONG load;
189 LONG invoke;
190 LONG exec;
191
192 LONG halt;
193 LONG pdown;
194 LONG restart;
195 LONG reboot;
196 LONG imode;
197 LONG _unused1;
198
199
200 LONG next_component;
201 LONG child_component;
202 LONG parent_component;
203 LONG component_data;
204 LONG child_add;
205 LONG comp_del;
206 LONG component_by_path;
207
208
209 LONG cfg_save;
210 LONG get_sysid;
211
212
213 LONG get_mdesc;
214 LONG _unused2;
215
216 LONG get_tinfo;
217 LONG get_rtime;
218
219
220 LONG get_vdirent;
221 LONG open;
222 LONG close;
223 LONG read;
224 LONG get_rstatus;
225 LONG write;
226 LONG seek;
227 LONG mount;
228
229
230 LONG get_evar;
231 LONG set_evar;
232
233 LONG get_finfo;
234 LONG set_finfo;
235
236
237 LONG cache_flush;
238 LONG TestUnicodeCharacter;
239 LONG GetDisplayStatus;
240 };
241
242
243
244
245 typedef struct _SYSTEM_PARAMETER_BLOCK {
246 ULONG magic;
247 #define PROMBLOCK_MAGIC 0x53435241
248
249 ULONG len;
250 USHORT ver;
251 USHORT rev;
252 _PLONG rs_block;
253 _PLONG dbg_block;
254 _PLONG gevect;
255 _PLONG utlbvect;
256 ULONG rveclen;
257 _PVOID romvec;
258 ULONG pveclen;
259 _PVOID pvector;
260 ULONG adap_cnt;
261 ULONG adap_typ0;
262 ULONG adap_vcnt0;
263 _PVOID adap_vector;
264 ULONG adap_typ1;
265 ULONG adap_vcnt1;
266 _PVOID adap_vector1;
267
268 } SYSTEM_PARAMETER_BLOCK, *PSYSTEM_PARAMETER_BLOCK;
269
270 #define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
271 #define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
272
273
274 union linux_cache_key {
275 struct param {
276 #ifdef __MIPSEL__
277 unsigned short size;
278 unsigned char lsize;
279 unsigned char bsize;
280 #else
281 unsigned char bsize;
282 unsigned char lsize;
283 unsigned short size;
284 #endif
285 } info;
286 unsigned long allinfo;
287 };
288
289
290 struct linux_cdata {
291 char *name;
292 int mlen;
293 enum linux_devtypes type;
294 };
295
296
297 #define SGIPROM_STDIN 0
298 #define SGIPROM_STDOUT 1
299
300
301 #define SGIPROM_ROFILE 0x01
302 #define SGIPROM_HFILE 0x02
303 #define SGIPROM_SFILE 0x04
304 #define SGIPROM_AFILE 0x08
305 #define SGIPROM_DFILE 0x10
306 #define SGIPROM_DELFILE 0x20
307
308
309 struct sgi_partition {
310 unsigned char flag;
311 #define SGIPART_UNUSED 0x00
312 #define SGIPART_ACTIVE 0x80
313
314 unsigned char shead, ssect, scyl;
315 unsigned char systype;
316 unsigned char ehead, esect, ecyl;
317 unsigned char rsect0, rsect1, rsect2, rsect3;
318 unsigned char tsect0, tsect1, tsect2, tsect3;
319 };
320
321 #define SGIBBLOCK_MAGIC 0xaa55
322 #define SGIBBLOCK_MAXPART 0x0004
323
324 struct sgi_bootblock {
325 unsigned char _unused[446];
326 struct sgi_partition partitions[SGIBBLOCK_MAXPART];
327 unsigned short magic;
328 };
329
330
331 struct sgi_bparm_block {
332 unsigned short bytes_sect;
333 unsigned char sect_clust;
334 unsigned short sect_resv;
335 unsigned char nfats;
336 unsigned short nroot_dirents;
337 unsigned short sect_volume;
338 unsigned char media_type;
339 unsigned short sect_fat;
340 unsigned short sect_track;
341 unsigned short nheads;
342 unsigned short nhsects;
343 };
344
345 struct sgi_bsector {
346 unsigned char jmpinfo[3];
347 unsigned char manuf_name[8];
348 struct sgi_bparm_block info;
349 };
350
351
352 #define SMB_DEBUG_MAGIC 0xfeeddead
353 struct linux_smonblock {
354 unsigned long magic;
355 void (*handler)(void);
356 unsigned long dtable_base;
357 int (*printf)(const char *fmt, ...);
358 unsigned long btable_base;
359 unsigned long mpflushreqs;
360 unsigned long ntab;
361 unsigned long stab;
362 int smax;
363 };
364
365
366
367
368
369 #if defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC32)
370
371 #define __arc_clobbers \
372 "$2", "$3" , "$8", "$9", "$10", "$11", \
373 "$12", "$13", "$14", "$15", "$16", "$24", "$25", "$31"
374
375 #define ARC_CALL0(dest) \
376 ({ long __res; \
377 long __vec = (long) romvec->dest; \
378 __asm__ __volatile__( \
379 "dsubu\t$29, 32\n\t" \
380 "jalr\t%1\n\t" \
381 "daddu\t$29, 32\n\t" \
382 "move\t%0, $2" \
383 : "=r" (__res), "=r" (__vec) \
384 : "1" (__vec) \
385 : __arc_clobbers, "$4", "$5", "$6", "$7"); \
386 (unsigned long) __res; \
387 })
388
389 #define ARC_CALL1(dest, a1) \
390 ({ long __res; \
391 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
392 long __vec = (long) romvec->dest; \
393 __asm__ __volatile__( \
394 "dsubu\t$29, 32\n\t" \
395 "jalr\t%1\n\t" \
396 "daddu\t$29, 32\n\t" \
397 "move\t%0, $2" \
398 : "=r" (__res), "=r" (__vec) \
399 : "1" (__vec), "r" (__a1) \
400 : __arc_clobbers, "$5", "$6", "$7"); \
401 (unsigned long) __res; \
402 })
403
404 #define ARC_CALL2(dest, a1, a2) \
405 ({ long __res; \
406 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
407 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
408 long __vec = (long) romvec->dest; \
409 __asm__ __volatile__( \
410 "dsubu\t$29, 32\n\t" \
411 "jalr\t%1\n\t" \
412 "daddu\t$29, 32\n\t" \
413 "move\t%0, $2" \
414 : "=r" (__res), "=r" (__vec) \
415 : "1" (__vec), "r" (__a1), "r" (__a2) \
416 : __arc_clobbers, "$6", "$7"); \
417 __res; \
418 })
419
420 #define ARC_CALL3(dest, a1, a2, a3) \
421 ({ long __res; \
422 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
423 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
424 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
425 long __vec = (long) romvec->dest; \
426 __asm__ __volatile__( \
427 "dsubu\t$29, 32\n\t" \
428 "jalr\t%1\n\t" \
429 "daddu\t$29, 32\n\t" \
430 "move\t%0, $2" \
431 : "=r" (__res), "=r" (__vec) \
432 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3) \
433 : __arc_clobbers, "$7"); \
434 __res; \
435 })
436
437 #define ARC_CALL4(dest, a1, a2, a3, a4) \
438 ({ long __res; \
439 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
440 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
441 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
442 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
443 long __vec = (long) romvec->dest; \
444 __asm__ __volatile__( \
445 "dsubu\t$29, 32\n\t" \
446 "jalr\t%1\n\t" \
447 "daddu\t$29, 32\n\t" \
448 "move\t%0, $2" \
449 : "=r" (__res), "=r" (__vec) \
450 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3), \
451 "r" (__a4) \
452 : __arc_clobbers); \
453 __res; \
454 })
455
456 #define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
457 ({ long __res; \
458 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
459 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
460 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
461 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
462 register signed int __a5 = (int) (long) (a5); \
463 long __vec = (long) romvec->dest; \
464 __asm__ __volatile__( \
465 "dsubu\t$29, 32\n\t" \
466 "sw\t%7, 16($29)\n\t" \
467 "jalr\t%1\n\t" \
468 "daddu\t$29, 32\n\t" \
469 "move\t%0, $2" \
470 : "=r" (__res), "=r" (__vec) \
471 : "1" (__vec), \
472 "r" (__a1), "r" (__a2), "r" (__a3), "r" (__a4), \
473 "r" (__a5) \
474 : __arc_clobbers); \
475 __res; \
476 })
477
478 #endif
479
480 #if (defined(CONFIG_32BIT) && defined(CONFIG_FW_ARC32)) || \
481 (defined(CONFIG_64BIT) && defined(CONFIG_FW_ARC64))
482
483 #define ARC_CALL0(dest) \
484 ({ long __res; \
485 long (*__vec)(void) = (void *) romvec->dest; \
486 \
487 __res = __vec(); \
488 __res; \
489 })
490
491 #define ARC_CALL1(dest, a1) \
492 ({ long __res; \
493 long __a1 = (long) (a1); \
494 long (*__vec)(long) = (void *) romvec->dest; \
495 \
496 __res = __vec(__a1); \
497 __res; \
498 })
499
500 #define ARC_CALL2(dest, a1, a2) \
501 ({ long __res; \
502 long __a1 = (long) (a1); \
503 long __a2 = (long) (a2); \
504 long (*__vec)(long, long) = (void *) romvec->dest; \
505 \
506 __res = __vec(__a1, __a2); \
507 __res; \
508 })
509
510 #define ARC_CALL3(dest, a1, a2, a3) \
511 ({ long __res; \
512 long __a1 = (long) (a1); \
513 long __a2 = (long) (a2); \
514 long __a3 = (long) (a3); \
515 long (*__vec)(long, long, long) = (void *) romvec->dest; \
516 \
517 __res = __vec(__a1, __a2, __a3); \
518 __res; \
519 })
520
521 #define ARC_CALL4(dest, a1, a2, a3, a4) \
522 ({ long __res; \
523 long __a1 = (long) (a1); \
524 long __a2 = (long) (a2); \
525 long __a3 = (long) (a3); \
526 long __a4 = (long) (a4); \
527 long (*__vec)(long, long, long, long) = (void *) romvec->dest; \
528 \
529 __res = __vec(__a1, __a2, __a3, __a4); \
530 __res; \
531 })
532
533 #define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
534 ({ long __res; \
535 long __a1 = (long) (a1); \
536 long __a2 = (long) (a2); \
537 long __a3 = (long) (a3); \
538 long __a4 = (long) (a4); \
539 long __a5 = (long) (a5); \
540 long (*__vec)(long, long, long, long, long); \
541 __vec = (void *) romvec->dest; \
542 \
543 __res = __vec(__a1, __a2, __a3, __a4, __a5); \
544 __res; \
545 })
546 #endif
547
548 #endif