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