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 (dm@engr.sgi.com)
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 <linux/config.h>
16 #include <asm/types.h>
17 #include <asm/arc/types.h>
19 /* Various ARCS error codes. */
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
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 /* SGI ARCS specific errno's. */
43 #define PROM_EADDRNOTAVAIL 0x1f
44 #define PROM_ETIMEDOUT 0x20
45 #define PROM_ECONNABORTED 0x21
46 #define PROM_ENOCONNECT 0x22
48 /* Device classes, types, and identifiers for prom
49 * device inventory queries.
52 system
, processor
, cache
, adapter
, controller
, peripheral
, memory
59 /* Primary insn and data caches. */
62 /* Secondary insn, data, and combined caches. */
63 sicache
, sdcache
, sccache
,
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
75 enum linux_identifier
{
76 bogus
, ronly
, removable
, consin
, consout
, input
, output
79 /* A prom device tree component. */
80 struct linux_component
{
81 enum linux_devclass
class; /* node class */
82 enum linux_devtypes type
; /* node type */
83 enum linux_identifier iflags
; /* node flags */
84 USHORT vers
; /* node version */
85 USHORT rev
; /* node revision */
86 ULONG key
; /* completely magic */
87 ULONG amask
; /* XXX affinity mask??? */
88 ULONG cdsize
; /* size of configuration data */
89 ULONG ilen
; /* length of string identifier */
90 _PULONG iname
; /* string identifier */
92 typedef struct linux_component pcomponent
;
95 char vend
[8], prod
[8];
98 /* ARCS prom memory descriptors. */
100 arcs_eblock
, /* exception block */
101 arcs_rvpage
, /* ARCS romvec page */
102 arcs_fcontig
, /* Contiguous and free */
103 arcs_free
, /* Generic free memory */
104 arcs_bmem
, /* Borken memory, don't use */
105 arcs_prog
, /* A loaded program resides here */
106 arcs_atmp
, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
107 arcs_aperm
, /* ARCS permanent storage... */
110 /* ARC has slightly different types than ARCS */
112 arc_eblock
, /* exception block */
113 arc_rvpage
, /* romvec page */
114 arc_free
, /* Generic free memory */
115 arc_bmem
, /* Borken memory, don't use */
116 arc_prog
, /* A loaded program resides here */
117 arc_atmp
, /* temporary storage area */
118 arc_aperm
, /* permanent storage */
119 arc_fcontig
, /* Contiguous and free */
122 union linux_memtypes
{
123 enum arcs_memtypes arcs
;
124 enum arc_memtypes arc
;
128 union linux_memtypes type
;
133 /* Time of day descriptor. */
144 /* ARCS virtual dirents. */
145 struct linux_vdirent
{
148 char fname
[32]; /* XXX imperical, should be a define */
151 /* Other stuff for files. */
153 rdonly
, wronly
, rdwr
, wronly_creat
, rdwr_creat
,
154 wronly_ssede
, rdwr_ssede
, dirent
, dirent_creat
157 enum linux_seekmode
{
161 enum linux_mountops
{
162 media_load
, media_unload
165 /* This prom has a bolixed design. */
166 struct linux_bigint
{
170 #else /* !(__MIPSEL__) */
177 struct linux_bigint begin
;
178 struct linux_bigint end
;
179 struct linux_bigint cur
;
180 enum linux_devtypes dtype
;
181 unsigned long namelen
;
183 char name
[32]; /* XXX imperical, should be define */
186 /* This describes the vector containing function pointers to the ARC
187 firmware functions. */
188 struct linux_romvec
{
189 LONG load
; /* Load an executable image. */
190 LONG invoke
; /* Invoke a standalong image. */
191 LONG exec
; /* Load and begin execution of a
193 LONG halt
; /* Halt the machine. */
194 LONG pdown
; /* Power down the machine. */
195 LONG restart
; /* XXX soft reset??? */
196 LONG reboot
; /* Reboot the machine. */
197 LONG imode
; /* Enter PROM interactive mode. */
198 LONG _unused1
; /* Was ReturnFromMain(). */
200 /* PROM device tree interface. */
202 LONG child_component
;
203 LONG parent_component
;
207 LONG component_by_path
;
213 /* Probing for memory. */
215 LONG _unused2
; /* was Signal() */
220 /* File type operations. */
230 /* Dealing with firmware environment variables. */
239 LONG TestUnicodeCharacter
; /* ARC; not sure if ARCS too */
240 LONG GetDisplayStatus
;
243 /* The SGI ARCS parameter block is in a fixed location for standalone
244 * programs to access PROM facilities easily.
246 typedef struct _SYSTEM_PARAMETER_BLOCK
{
247 ULONG magic
; /* magic cookie */
248 #define PROMBLOCK_MAGIC 0x53435241
250 ULONG len
; /* length of parm block */
251 USHORT ver
; /* ARCS firmware version */
252 USHORT rev
; /* ARCS firmware revision */
253 _PLONG rs_block
; /* Restart block. */
254 _PLONG dbg_block
; /* Debug block. */
255 _PLONG gevect
; /* XXX General vector??? */
256 _PLONG utlbvect
; /* XXX UTLB vector??? */
257 ULONG rveclen
; /* Size of romvec struct. */
258 _PVOID romvec
; /* Function interface. */
259 ULONG pveclen
; /* Length of private vector. */
260 _PVOID pvector
; /* Private vector. */
261 ULONG adap_cnt
; /* Adapter count. */
262 ULONG adap_typ0
; /* First adapter type. */
263 ULONG adap_vcnt0
; /* Adapter 0 vector count. */
264 _PVOID adap_vector
; /* Adapter 0 vector ptr. */
265 ULONG adap_typ1
; /* Second adapter type. */
266 ULONG adap_vcnt1
; /* Adapter 1 vector count. */
267 _PVOID adap_vector1
; /* Adapter 1 vector ptr. */
268 /* More adapter vectors go here... */
269 } SYSTEM_PARAMETER_BLOCK
, *PSYSTEM_PARAMETER_BLOCK
;
271 #define PROMBLOCK ((PSYSTEM_PARAMETER_BLOCK) (int)0xA0001000)
272 #define ROMVECTOR ((struct linux_romvec *) (long)(PROMBLOCK)->romvec)
274 /* Cache layout parameter block. */
275 union linux_cache_key
{
281 #else /* !(__MIPSEL__) */
287 unsigned long allinfo
;
290 /* Configuration data. */
294 enum linux_devtypes type
;
297 /* Common SGI ARCS firmware file descriptors. */
298 #define SGIPROM_STDIN 0
299 #define SGIPROM_STDOUT 1
301 /* Common SGI ARCS firmware file types. */
302 #define SGIPROM_ROFILE 0x01 /* read-only file */
303 #define SGIPROM_HFILE 0x02 /* hidden file */
304 #define SGIPROM_SFILE 0x04 /* System file */
305 #define SGIPROM_AFILE 0x08 /* Archive file */
306 #define SGIPROM_DFILE 0x10 /* Directory file */
307 #define SGIPROM_DELFILE 0x20 /* Deleted file */
309 /* SGI ARCS boot record information. */
310 struct sgi_partition
{
312 #define SGIPART_UNUSED 0x00
313 #define SGIPART_ACTIVE 0x80
315 unsigned char shead
, ssect
, scyl
; /* unused */
316 unsigned char systype
; /* OS type, Irix or NT */
317 unsigned char ehead
, esect
, ecyl
; /* unused */
318 unsigned char rsect0
, rsect1
, rsect2
, rsect3
;
319 unsigned char tsect0
, tsect1
, tsect2
, tsect3
;
322 #define SGIBBLOCK_MAGIC 0xaa55
323 #define SGIBBLOCK_MAXPART 0x0004
325 struct sgi_bootblock
{
326 unsigned char _unused
[446];
327 struct sgi_partition partitions
[SGIBBLOCK_MAXPART
];
328 unsigned short magic
;
331 /* BIOS parameter block. */
332 struct sgi_bparm_block
{
333 unsigned short bytes_sect
; /* bytes per sector */
334 unsigned char sect_clust
; /* sectors per cluster */
335 unsigned short sect_resv
; /* reserved sectors */
336 unsigned char nfats
; /* # of allocation tables */
337 unsigned short nroot_dirents
; /* # of root directory entries */
338 unsigned short sect_volume
; /* sectors in volume */
339 unsigned char media_type
; /* media descriptor */
340 unsigned short sect_fat
; /* sectors per allocation table */
341 unsigned short sect_track
; /* sectors per track */
342 unsigned short nheads
; /* # of heads */
343 unsigned short nhsects
; /* # of hidden sectors */
347 unsigned char jmpinfo
[3];
348 unsigned char manuf_name
[8];
349 struct sgi_bparm_block info
;
352 /* Debugging block used with SGI symmon symbolic debugger. */
353 #define SMB_DEBUG_MAGIC 0xfeeddead
354 struct linux_smonblock
{
356 void (*handler
)(void); /* Breakpoint routine. */
357 unsigned long dtable_base
; /* Base addr of dbg table. */
358 int (*printf
)(const char *fmt
, ...);
359 unsigned long btable_base
; /* Breakpoint table. */
360 unsigned long mpflushreqs
; /* SMP cache flush request list. */
361 unsigned long ntab
; /* Name table. */
362 unsigned long stab
; /* Symbol table. */
363 int smax
; /* Max # of symbols. */
367 * Macros for calling a 32-bit ARC implementation from 64-bit code
370 #if defined(CONFIG_64BIT) && defined(CONFIG_ARC32)
372 #define __arc_clobbers \
373 "$2","$3" /* ... */, "$8","$9","$10","$11", \
374 "$12","$13","$14","$15","$16","$24","$25","$31"
376 #define ARC_CALL0(dest) \
378 long __vec = (long) romvec->dest; \
379 __asm__ __volatile__( \
380 "dsubu\t$29, 32\n\t" \
382 "daddu\t$29, 32\n\t" \
384 : "=r" (__res), "=r" (__vec) \
386 : __arc_clobbers, "$4","$5","$6","$7"); \
387 (unsigned long) __res; \
390 #define ARC_CALL1(dest,a1) \
392 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
393 long __vec = (long) romvec->dest; \
394 __asm__ __volatile__( \
395 "dsubu\t$29, 32\n\t" \
397 "daddu\t$29, 32\n\t" \
399 : "=r" (__res), "=r" (__vec) \
400 : "1" (__vec), "r" (__a1) \
401 : __arc_clobbers, "$5","$6","$7"); \
402 (unsigned long) __res; \
405 #define ARC_CALL2(dest,a1,a2) \
407 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
408 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
409 long __vec = (long) romvec->dest; \
410 __asm__ __volatile__( \
411 "dsubu\t$29, 32\n\t" \
413 "daddu\t$29, 32\n\t" \
415 : "=r" (__res), "=r" (__vec) \
416 : "1" (__vec), "r" (__a1), "r" (__a2) \
417 : __arc_clobbers, "$6","$7"); \
421 #define ARC_CALL3(dest,a1,a2,a3) \
423 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
424 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
425 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
426 long __vec = (long) romvec->dest; \
427 __asm__ __volatile__( \
428 "dsubu\t$29, 32\n\t" \
430 "daddu\t$29, 32\n\t" \
432 : "=r" (__res), "=r" (__vec) \
433 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3) \
434 : __arc_clobbers, "$7"); \
438 #define ARC_CALL4(dest,a1,a2,a3,a4) \
440 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
441 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
442 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
443 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
444 long __vec = (long) romvec->dest; \
445 __asm__ __volatile__( \
446 "dsubu\t$29, 32\n\t" \
448 "daddu\t$29, 32\n\t" \
450 : "=r" (__res), "=r" (__vec) \
451 : "1" (__vec), "r" (__a1), "r" (__a2), "r" (__a3), \
457 #define ARC_CALL5(dest,a1,a2,a3,a4,a5) \
459 register signed int __a1 __asm__("$4") = (int) (long) (a1); \
460 register signed int __a2 __asm__("$5") = (int) (long) (a2); \
461 register signed int __a3 __asm__("$6") = (int) (long) (a3); \
462 register signed int __a4 __asm__("$7") = (int) (long) (a4); \
463 register signed int __a5 = (a5); \
464 long __vec = (long) romvec->dest; \
465 __asm__ __volatile__( \
466 "dsubu\t$29, 32\n\t" \
467 "sw\t%7, 16($29)\n\t" \
469 "daddu\t$29, 32\n\t" \
471 : "=r" (__res), "=r" (__vec) \
473 "r" (__a1), "r" (__a2), "r" (__a3), "r" (__a4), \
479 #endif /* defined(CONFIG_64BIT) && defined(CONFIG_ARC32) */
481 #if (defined(CONFIG_32BIT) && defined(CONFIG_ARC32)) || \
482 (defined(CONFIG_64BIT) && defined(CONFIG_ARC64))
484 #define ARC_CALL0(dest) \
486 long (*__vec)(void) = (void *) romvec->dest; \
492 #define ARC_CALL1(dest,a1) \
494 long __a1 = (long) (a1); \
495 long (*__vec)(long) = (void *) romvec->dest; \
497 __res = __vec(__a1); \
501 #define ARC_CALL2(dest,a1,a2) \
503 long __a1 = (long) (a1); \
504 long __a2 = (long) (a2); \
505 long (*__vec)(long, long) = (void *) romvec->dest; \
507 __res = __vec(__a1, __a2); \
511 #define ARC_CALL3(dest,a1,a2,a3) \
513 long __a1 = (long) (a1); \
514 long __a2 = (long) (a2); \
515 long __a3 = (long) (a3); \
516 long (*__vec)(long, long, long) = (void *) romvec->dest; \
518 __res = __vec(__a1, __a2, __a3); \
522 #define ARC_CALL4(dest,a1,a2,a3,a4) \
524 long __a1 = (long) (a1); \
525 long __a2 = (long) (a2); \
526 long __a3 = (long) (a3); \
527 long __a4 = (long) (a4); \
528 long (*__vec)(long, long, long, long) = (void *) romvec->dest; \
530 __res = __vec(__a1, __a2, __a3, __a4); \
534 #define ARC_CALL5(dest,a1,a2,a3,a4,a5) \
536 long __a1 = (long) (a1); \
537 long __a2 = (long) (a2); \
538 long __a3 = (long) (a3); \
539 long __a4 = (long) (a4); \
540 long __a5 = (long) (a5); \
541 long (*__vec)(long, long, long, long, long); \
542 __vec = (void *) romvec->dest; \
544 __res = __vec(__a1, __a2, __a3, __a4, __a5); \
547 #endif /* both kernel and ARC either 32-bit or 64-bit */
549 #endif /* _ASM_SGIARCS_H */