1 /* $Id: sgiarcs.h,v 1.3 1999/02/25 20:55:08 tsbogend Exp $
3 * SGI ARCS firmware interface defines.
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
10 #include <asm/arc/types.h>
12 /* Various ARCS error codes. */
13 #define PROM_ESUCCESS 0x00
14 #define PROM_E2BIG 0x01
15 #define PROM_EACCESS 0x02
16 #define PROM_EAGAIN 0x03
17 #define PROM_EBADF 0x04
18 #define PROM_EBUSY 0x05
19 #define PROM_EFAULT 0x06
20 #define PROM_EINVAL 0x07
22 #define PROM_EISDIR 0x09
23 #define PROM_EMFILE 0x0a
24 #define PROM_EMLINK 0x0b
25 #define PROM_ENAMETOOLONG 0x0c
26 #define PROM_ENODEV 0x0d
27 #define PROM_ENOENT 0x0e
28 #define PROM_ENOEXEC 0x0f
29 #define PROM_ENOMEM 0x10
30 #define PROM_ENOSPC 0x11
31 #define PROM_ENOTDIR 0x12
32 #define PROM_ENOTTY 0x13
33 #define PROM_ENXIO 0x14
34 #define PROM_EROFS 0x15
35 /* SGI ARCS specific errno's. */
36 #define PROM_EADDRNOTAVAIL 0x1f
37 #define PROM_ETIMEDOUT 0x20
38 #define PROM_ECONNABORTED 0x21
39 #define PROM_ENOCONNECT 0x22
41 /* Device classes, types, and identifiers for prom
42 * device inventory queries.
45 system
, processor
, cache
, adapter
, controller
, peripheral
, memory
52 /* Primary insn and data caches. */
55 /* Secondary insn, data, and combined caches. */
56 sicache
, sdcache
, sccache
,
58 memdev
, eisa_adapter
, tc_adapter
, scsi_adapter
, dti_adapter
,
59 multifunc_adapter
, dsk_controller
, tp_controller
, cdrom_controller
,
60 worm_controller
, serial_controller
, net_controller
, disp_controller
,
61 parallel_controller
, ptr_controller
, kbd_controller
, audio_controller
,
62 misc_controller
, disk_peripheral
, flpy_peripheral
, tp_peripheral
,
63 modem_peripheral
, monitor_peripheral
, printer_peripheral
,
64 ptr_peripheral
, kbd_peripheral
, term_peripheral
, line_peripheral
,
65 net_peripheral
, misc_peripheral
, anon
68 enum linux_identifier
{
69 bogus
, ronly
, removable
, consin
, consout
, input
, output
72 /* A prom device tree component. */
73 struct linux_component
{
74 enum linux_devclass
class; /* node class */
75 enum linux_devtypes type
; /* node type */
76 enum linux_identifier iflags
; /* node flags */
77 unsigned short vers
; /* node version */
78 unsigned short rev
; /* node revision */
79 unsigned long key
; /* completely magic */
80 unsigned long amask
; /* XXX affinity mask??? */
81 unsigned long cdsize
; /* size of configuration data */
82 unsigned long ilen
; /* length of string identifier */
83 char *iname
; /* string identifier */
85 typedef struct linux_component pcomponent
;
88 char vend
[8], prod
[8];
91 /* ARCS prom memory descriptors. */
93 arcs_eblock
, /* exception block */
94 arcs_rvpage
, /* ARCS romvec page */
95 arcs_fcontig
, /* Contiguous and free */
96 arcs_free
, /* Generic free memory */
97 arcs_bmem
, /* Borken memory, don't use */
98 arcs_prog
, /* A loaded program resides here */
99 arcs_atmp
, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
100 arcs_aperm
, /* ARCS permanent storage... */
103 /* ARC has slightly different types than ARCS */
105 arc_eblock
, /* exception block */
106 arc_rvpage
, /* romvec page */
107 arc_free
, /* Generic free memory */
108 arc_bmem
, /* Borken memory, don't use */
109 arc_prog
, /* A loaded program resides here */
110 arc_atmp
, /* temporary storage area */
111 arc_aperm
, /* permanent storage */
112 arc_fcontig
, /* Contiguous and free */
115 union linux_memtypes
{
116 enum arcs_memtypes arcs
;
117 enum arc_memtypes arc
;
121 union linux_memtypes type
;
126 /* Time of day descriptor. */
137 /* ARCS virtual dirents. */
138 struct linux_vdirent
{
139 unsigned long namelen
;
141 char fname
[32]; /* XXX imperical, should be a define */
144 /* Other stuff for files. */
146 rdonly
, wronly
, rdwr
, wronly_creat
, rdwr_creat
,
147 wronly_ssede
, rdwr_ssede
, dirent
, dirent_creat
150 enum linux_seekmode
{
154 enum linux_mountops
{
155 media_load
, media_unload
158 /* This prom has a bolixed design. */
159 struct linux_bigint
{
163 #else /* !(__MIPSEL__) */
170 struct linux_bigint begin
;
171 struct linux_bigint end
;
172 struct linux_bigint cur
;
173 enum linux_devtypes dtype
;
174 unsigned long namelen
;
176 char name
[32]; /* XXX imperical, should be define */
179 struct linux_romvec
{
180 /* Load an executable image. */
181 long (*load
)(char *file
, unsigned long end
,
182 unsigned long *start_pc
,
183 unsigned long *end_addr
);
185 /* Invoke a standalong image. */
186 long (*invoke
)(unsigned long startpc
, unsigned long sp
,
187 long argc
, char **argv
, char **envp
);
189 /* Load and begin execution of a standalong image. */
190 long (*exec
)(char *file
, long argc
, char **argv
, char **envp
);
192 void (*halt
)(void) __attribute__((noreturn
)); /* Halt the machine. */
193 void (*pdown
)(void) __attribute__((noreturn
)); /* Power down the machine. */
194 void (*restart
)(void) __attribute__((noreturn
)); /* XXX soft reset??? */
195 void (*reboot
)(void) __attribute__((noreturn
)); /* Reboot the machine. */
196 void (*imode
)(void) __attribute__((noreturn
)); /* Enter PROM interactive mode. */
197 int _unused1
; /* padding */
199 /* PROM device tree interface. */
200 pcomponent
*(*next_component
)(pcomponent
*this);
201 pcomponent
*(*child_component
)(pcomponent
*this);
202 pcomponent
*(*parent_component
)(pcomponent
*this);
203 long (*component_data
)(void *opaque_data
, pcomponent
*this);
204 pcomponent
*(*child_add
)(pcomponent
*this,
207 long (*comp_del
)(pcomponent
*this);
208 pcomponent
*(*component_by_path
)(char *file
);
211 long (*cfg_save
)(void);
212 struct linux_sysid
*(*get_sysid
)(void);
214 /* Probing for memory. */
215 struct linux_mdesc
*(*get_mdesc
)(struct linux_mdesc
*curr
);
216 long _unused2
; /* padding */
218 struct linux_tinfo
*(*get_tinfo
)(void);
219 unsigned long (*get_rtime
)(void);
221 /* File type operations. */
222 long (*get_vdirent
)(unsigned long fd
, struct linux_vdirent
*entry
,
223 unsigned long num
, unsigned long *count
);
224 long (*open
)(char *file
, enum linux_omode mode
, unsigned long *fd
);
225 long (*close
)(unsigned long fd
);
226 long (*read
)(unsigned long fd
, void *buffer
, unsigned long num
,
227 unsigned long *count
);
228 long (*get_rstatus
)(unsigned long fd
);
229 long (*write
)(unsigned long fd
, void *buffer
, unsigned long num
,
230 unsigned long *count
);
231 long (*seek
)(unsigned long fd
, struct linux_bigint
*offset
,
232 enum linux_seekmode smode
);
233 long (*mount
)(char *file
, enum linux_mountops op
);
235 /* Dealing with firmware environment variables. */
236 PCHAR (*get_evar
)(CHAR
*name
);
237 LONG (*set_evar
)(PCHAR name
, PCHAR value
);
239 long (*get_finfo
)(unsigned long fd
, struct linux_finfo
*buf
);
240 long (*set_finfo
)(unsigned long fd
, unsigned long flags
,
244 void (*cache_flush
)(void);
247 /* The SGI ARCS parameter block is in a fixed location for standalone
248 * programs to access PROM facilities easily.
250 struct linux_promblock
{
251 long magic
; /* magic cookie */
252 #define PROMBLOCK_MAGIC 0x53435241
254 unsigned long len
; /* length of parm block */
255 unsigned short ver
; /* ARCS firmware version */
256 unsigned short rev
; /* ARCS firmware revision */
257 long *rs_block
; /* Restart block. */
258 long *dbg_block
; /* Debug block. */
259 long *gevect
; /* XXX General vector??? */
260 long *utlbvect
; /* XXX UTLB vector??? */
261 unsigned long rveclen
; /* Size of romvec struct. */
262 struct linux_romvec
*romvec
; /* Function interface. */
263 unsigned long pveclen
; /* Length of private vector. */
264 long *pvector
; /* Private vector. */
265 long adap_cnt
; /* Adapter count. */
266 long adap_typ0
; /* First adapter type. */
267 long adap_vcnt0
; /* Adapter 0 vector count. */
268 long *adap_vector
; /* Adapter 0 vector ptr. */
269 long adap_typ1
; /* Second adapter type. */
270 long adap_vcnt1
; /* Adapter 1 vector count. */
271 long *adap_vector1
; /* Adapter 1 vector ptr. */
272 /* More adapter vectors go here... */
275 #define PROMBLOCK ((struct linux_promblock *)0xA0001000UL)
276 #define ROMVECTOR ((PROMBLOCK)->romvec)
278 /* Cache layout parameter block. */
279 union linux_cache_key
{
285 #else /* !(__MIPSEL__) */
291 unsigned long allinfo
;
294 /* Configuration data. */
298 enum linux_devtypes type
;
301 /* Common SGI ARCS firmware file descriptors. */
302 #define SGIPROM_STDIN 0
303 #define SGIPROM_STDOUT 1
305 /* Common SGI ARCS firmware file types. */
306 #define SGIPROM_ROFILE 0x01 /* read-only file */
307 #define SGIPROM_HFILE 0x02 /* hidden file */
308 #define SGIPROM_SFILE 0x04 /* System file */
309 #define SGIPROM_AFILE 0x08 /* Archive file */
310 #define SGIPROM_DFILE 0x10 /* Directory file */
311 #define SGIPROM_DELFILE 0x20 /* Deleted file */
313 /* SGI ARCS boot record information. */
314 struct sgi_partition
{
316 #define SGIPART_UNUSED 0x00
317 #define SGIPART_ACTIVE 0x80
319 unsigned char shead
, ssect
, scyl
; /* unused */
320 unsigned char systype
; /* OS type, Irix or NT */
321 unsigned char ehead
, esect
, ecyl
; /* unused */
322 unsigned char rsect0
, rsect1
, rsect2
, rsect3
;
323 unsigned char tsect0
, tsect1
, tsect2
, tsect3
;
326 #define SGIBBLOCK_MAGIC 0xaa55
327 #define SGIBBLOCK_MAXPART 0x0004
329 struct sgi_bootblock
{
330 unsigned char _unused
[446];
331 struct sgi_partition partitions
[SGIBBLOCK_MAXPART
];
332 unsigned short magic
;
335 /* BIOS parameter block. */
336 struct sgi_bparm_block
{
337 unsigned short bytes_sect
; /* bytes per sector */
338 unsigned char sect_clust
; /* sectors per cluster */
339 unsigned short sect_resv
; /* reserved sectors */
340 unsigned char nfats
; /* # of allocation tables */
341 unsigned short nroot_dirents
; /* # of root directory entries */
342 unsigned short sect_volume
; /* sectors in volume */
343 unsigned char media_type
; /* media descriptor */
344 unsigned short sect_fat
; /* sectors per allocation table */
345 unsigned short sect_track
; /* sectors per track */
346 unsigned short nheads
; /* # of heads */
347 unsigned short nhsects
; /* # of hidden sectors */
351 unsigned char jmpinfo
[3];
352 unsigned char manuf_name
[8];
353 struct sgi_bparm_block info
;
356 /* Debugging block used with SGI symmon symbolic debugger. */
357 #define SMB_DEBUG_MAGIC 0xfeeddead
358 struct linux_smonblock
{
360 void (*handler
)(void); /* Breakpoint routine. */
361 unsigned long dtable_base
; /* Base addr of dbg table. */
362 int (*printf
)(const char *fmt
, ...);
363 unsigned long btable_base
; /* Breakpoint table. */
364 unsigned long mpflushreqs
; /* SMP cache flush request list. */
365 unsigned long ntab
; /* Name table. */
366 unsigned long stab
; /* Symbol table. */
367 int smax
; /* Max # of symbols. */
370 #endif /* _ASM_SGIARCS_H */