2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * ARC firmware interface defines.
8 * Copyright (C) 1996 David S. Miller (davem@davemloft.net)
9 * Copyright (C) 1999, 2001 Ralf Baechle (ralf@gnu.org)
10 * Copyright (C) 1999 Silicon Graphics, Inc.
12 #ifndef _ASM_SGIARCS_H
13 #define _ASM_SGIARCS_H
15 #include <asm/types.h>
16 #include <asm/fw/arc/types.h>
18 /* Various ARCS error codes. */
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
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 /* SGI ARCS specific errno's. */
42 #define PROM_EADDRNOTAVAIL 0x1f
43 #define PROM_ETIMEDOUT 0x20
44 #define PROM_ECONNABORTED 0x21
45 #define PROM_ENOCONNECT 0x22
47 /* Device classes, types, and identifiers for prom
48 * device inventory queries.
51 system
, processor
, cache
, adapter
, controller
, peripheral
, memory
58 /* Primary insn and data caches. */
61 /* Secondary insn, data, and combined caches. */
62 sicache
, sdcache
, sccache
,
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
74 enum linux_identifier
{
75 bogus
, ronly
, removable
, consin
, consout
, input
, output
78 /* A prom device tree component. */
79 struct linux_component
{
80 enum linux_devclass
class; /* node class */
81 enum linux_devtypes type
; /* node type */
82 enum linux_identifier iflags
; /* node flags */
83 USHORT vers
; /* node version */
84 USHORT rev
; /* node revision */
85 ULONG key
; /* completely magic */
86 ULONG amask
; /* XXX affinity mask??? */
87 ULONG cdsize
; /* size of configuration data */
88 ULONG ilen
; /* length of string identifier */
89 _PULONG iname
; /* string identifier */
91 typedef struct linux_component pcomponent
;
94 char vend
[8], prod
[8];
97 /* ARCS prom memory descriptors. */
99 arcs_eblock
, /* exception block */
100 arcs_rvpage
, /* ARCS romvec page */
101 arcs_fcontig
, /* Contiguous and free */
102 arcs_free
, /* Generic free memory */
103 arcs_bmem
, /* Borken memory, don't use */
104 arcs_prog
, /* A loaded program resides here */
105 arcs_atmp
, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
106 arcs_aperm
, /* ARCS permanent storage... */
109 /* ARC has slightly different types than ARCS */
111 arc_eblock
, /* exception block */
112 arc_rvpage
, /* romvec page */
113 arc_free
, /* Generic free memory */
114 arc_bmem
, /* Borken memory, don't use */
115 arc_prog
, /* A loaded program resides here */
116 arc_atmp
, /* temporary storage area */
117 arc_aperm
, /* permanent storage */
118 arc_fcontig
, /* Contiguous and free */
121 union linux_memtypes
{
122 enum arcs_memtypes arcs
;
123 enum arc_memtypes arc
;
127 union linux_memtypes type
;
132 /* Time of day descriptor. */
143 /* ARCS virtual dirents. */
144 struct linux_vdirent
{
147 char fname
[32]; /* XXX imperical, should be a define */
150 /* Other stuff for files. */
152 rdonly
, wronly
, rdwr
, wronly_creat
, rdwr_creat
,
153 wronly_ssede
, rdwr_ssede
, dirent
, dirent_creat
156 enum linux_seekmode
{
160 enum linux_mountops
{
161 media_load
, media_unload
164 /* This prom has a bolixed design. */
165 struct linux_bigint
{
169 #else /* !(__MIPSEL__) */
176 struct linux_bigint begin
;
177 struct linux_bigint end
;
178 struct linux_bigint cur
;
179 enum linux_devtypes dtype
;
180 unsigned long namelen
;
182 char name
[32]; /* XXX imperical, should be define */
185 /* This describes the vector containing function pointers to the ARC
186 firmware functions. */
187 struct linux_romvec
{
188 LONG load
; /* Load an executable image. */
189 LONG invoke
; /* Invoke a standalong image. */
190 LONG exec
; /* Load and begin execution of a
192 LONG halt
; /* Halt the machine. */
193 LONG pdown
; /* Power down the machine. */
194 LONG restart
; /* XXX soft reset??? */
195 LONG reboot
; /* Reboot the machine. */
196 LONG imode
; /* Enter PROM interactive mode. */
197 LONG _unused1
; /* Was ReturnFromMain(). */
199 /* PROM device tree interface. */
201 LONG child_component
;
202 LONG parent_component
;
206 LONG component_by_path
;
212 /* Probing for memory. */
214 LONG _unused2
; /* was Signal() */
219 /* File type operations. */
229 /* Dealing with firmware environment variables. */
238 LONG TestUnicodeCharacter
; /* ARC; not sure if ARCS too */
239 LONG GetDisplayStatus
;
242 /* The SGI ARCS parameter block is in a fixed location for standalone
243 * programs to access PROM facilities easily.
245 typedef struct _SYSTEM_PARAMETER_BLOCK
{
246 ULONG magic
; /* magic cookie */
247 #define PROMBLOCK_MAGIC 0x53435241
249 ULONG len
; /* length of parm block */
250 USHORT ver
; /* ARCS firmware version */
251 USHORT rev
; /* ARCS firmware revision */
252 _PLONG rs_block
; /* Restart block. */
253 _PLONG dbg_block
; /* Debug block. */
254 _PLONG gevect
; /* XXX General vector??? */
255 _PLONG utlbvect
; /* XXX UTLB vector??? */
256 ULONG rveclen
; /* Size of romvec struct. */
257 _PVOID romvec
; /* Function interface. */
258 ULONG pveclen
; /* Length of private vector. */
259 _PVOID pvector
; /* Private vector. */
260 ULONG adap_cnt
; /* Adapter count. */
261 ULONG adap_typ0
; /* First adapter type. */
262 ULONG adap_vcnt0
; /* Adapter 0 vector count. */
263 _PVOID adap_vector
; /* Adapter 0 vector ptr. */
264 ULONG adap_typ1
; /* Second adapter type. */
265 ULONG adap_vcnt1
; /* Adapter 1 vector count. */
266 _PVOID adap_vector1
; /* Adapter 1 vector ptr. */
267 /* More adapter vectors go here... */
268 } SYSTEM_PARAMETER_BLOCK
, *PSYSTEM_PARAMETER_BLOCK
;
270 #define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
271 #define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
273 /* Cache layout parameter block. */
274 union linux_cache_key
{
280 #else /* !(__MIPSEL__) */
286 unsigned long allinfo
;
289 /* Configuration data. */
293 enum linux_devtypes type
;
296 /* Common SGI ARCS firmware file descriptors. */
297 #define SGIPROM_STDIN 0
298 #define SGIPROM_STDOUT 1
300 /* Common SGI ARCS firmware file types. */
301 #define SGIPROM_ROFILE 0x01 /* read-only file */
302 #define SGIPROM_HFILE 0x02 /* hidden file */
303 #define SGIPROM_SFILE 0x04 /* System file */
304 #define SGIPROM_AFILE 0x08 /* Archive file */
305 #define SGIPROM_DFILE 0x10 /* Directory file */
306 #define SGIPROM_DELFILE 0x20 /* Deleted file */
308 /* SGI ARCS boot record information. */
309 struct sgi_partition
{
311 #define SGIPART_UNUSED 0x00
312 #define SGIPART_ACTIVE 0x80
314 unsigned char shead
, ssect
, scyl
; /* unused */
315 unsigned char systype
; /* OS type, Irix or NT */
316 unsigned char ehead
, esect
, ecyl
; /* unused */
317 unsigned char rsect0
, rsect1
, rsect2
, rsect3
;
318 unsigned char tsect0
, tsect1
, tsect2
, tsect3
;
321 #define SGIBBLOCK_MAGIC 0xaa55
322 #define SGIBBLOCK_MAXPART 0x0004
324 struct sgi_bootblock
{
325 unsigned char _unused
[446];
326 struct sgi_partition partitions
[SGIBBLOCK_MAXPART
];
327 unsigned short magic
;
330 /* BIOS parameter block. */
331 struct sgi_bparm_block
{
332 unsigned short bytes_sect
; /* bytes per sector */
333 unsigned char sect_clust
; /* sectors per cluster */
334 unsigned short sect_resv
; /* reserved sectors */
335 unsigned char nfats
; /* # of allocation tables */
336 unsigned short nroot_dirents
; /* # of root directory entries */
337 unsigned short sect_volume
; /* sectors in volume */
338 unsigned char media_type
; /* media descriptor */
339 unsigned short sect_fat
; /* sectors per allocation table */
340 unsigned short sect_track
; /* sectors per track */
341 unsigned short nheads
; /* # of heads */
342 unsigned short nhsects
; /* # of hidden sectors */
346 unsigned char jmpinfo
[3];
347 unsigned char manuf_name
[8];
348 struct sgi_bparm_block info
;
351 /* Debugging block used with SGI symmon symbolic debugger. */
352 #define SMB_DEBUG_MAGIC 0xfeeddead
353 struct linux_smonblock
{
355 void (*handler
)(void); /* Breakpoint routine. */
356 unsigned long dtable_base
; /* Base addr of dbg table. */
357 int (*printf
)(const char *fmt
, ...);
358 unsigned long btable_base
; /* Breakpoint table. */
359 unsigned long mpflushreqs
; /* SMP cache flush request list. */
360 unsigned long ntab
; /* Name table. */
361 unsigned long stab
; /* Symbol table. */
362 int smax
; /* Max # of symbols. */
366 * Macros for calling a 32-bit ARC implementation from 64-bit code
369 #if defined(CONFIG_64BIT) && defined(CONFIG_ARC32)
371 #define __arc_clobbers \
372 "$2", "$3" /* ... */, "$8", "$9", "$10", "$11", \
373 "$12", "$13", "$14", "$15", "$16", "$24", "$25", "$31"
375 #define ARC_CALL0(dest) \
377 long __vec = (long) romvec->dest; \
378 __asm__ __volatile__( \
379 "dsubu\t$29, 32\n\t" \
381 "daddu\t$29, 32\n\t" \
383 : "=r" (__res), "=r" (__vec) \
385 : __arc_clobbers, "$4", "$5", "$6", "$7"); \
386 (unsigned long) __res; \
389 #define ARC_CALL1(dest, a1) \
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" \
396 "daddu\t$29, 32\n\t" \
398 : "=r" (__res), "=r" (__vec) \
399 : "1" (__vec), "r" (__a1) \
400 : __arc_clobbers, "$5", "$6", "$7"); \
401 (unsigned long) __res; \
404 #define ARC_CALL2(dest, a1, a2) \
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" \
412 "daddu\t$29, 32\n\t" \
414 : "=r" (__res), "=r" (__vec) \
415 : "1" (__vec), "r" (__a1), "r" (__a2) \
416 : __arc_clobbers, "$6", "$7"); \
420 #define ARC_CALL3(dest, a1, a2, a3) \
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" \
429 "daddu\t$29, 32\n\t" \
431 : "=r" (__res), "=r" (__vec) \
432 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3) \
433 : __arc_clobbers, "$7"); \
437 #define ARC_CALL4(dest, a1, a2, a3, a4) \
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" \
447 "daddu\t$29, 32\n\t" \
449 : "=r" (__res), "=r" (__vec) \
450 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3), \
456 #define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
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" \
468 "daddu\t$29, 32\n\t" \
470 : "=r" (__res), "=r" (__vec) \
472 "r" (__a1), "r" (__a2), "r" (__a3), "r" (__a4), \
478 #endif /* defined(CONFIG_64BIT) && defined(CONFIG_ARC32) */
480 #if (defined(CONFIG_32BIT) && defined(CONFIG_ARC32)) || \
481 (defined(CONFIG_64BIT) && defined(CONFIG_ARC64))
483 #define ARC_CALL0(dest) \
485 long (*__vec)(void) = (void *) romvec->dest; \
491 #define ARC_CALL1(dest, a1) \
493 long __a1 = (long) (a1); \
494 long (*__vec)(long) = (void *) romvec->dest; \
496 __res = __vec(__a1); \
500 #define ARC_CALL2(dest, a1, a2) \
502 long __a1 = (long) (a1); \
503 long __a2 = (long) (a2); \
504 long (*__vec)(long, long) = (void *) romvec->dest; \
506 __res = __vec(__a1, __a2); \
510 #define ARC_CALL3(dest, a1, a2, a3) \
512 long __a1 = (long) (a1); \
513 long __a2 = (long) (a2); \
514 long __a3 = (long) (a3); \
515 long (*__vec)(long, long, long) = (void *) romvec->dest; \
517 __res = __vec(__a1, __a2, __a3); \
521 #define ARC_CALL4(dest, a1, a2, a3, a4) \
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; \
529 __res = __vec(__a1, __a2, __a3, __a4); \
533 #define ARC_CALL5(dest, a1, a2, a3, a4, a5) \
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; \
543 __res = __vec(__a1, __a2, __a3, __a4, __a5); \
546 #endif /* both kernel and ARC either 32-bit or 64-bit */
548 #endif /* _ASM_SGIARCS_H */