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