Import 2.3.18pre1
[davej-history.git] / include / asm-mips / sgiarcs.h
blobef03b1bea1a6102d5db6333a645b7c814d19edc1
1 /* $Id: sgiarcs.h,v 1.2 1998/07/08 16:01:57 ralf Exp $
3 * SGI ARCS firmware interface defines.
5 * Copyright (C) 1996 David S. Miller (dm@engr.sgi.com)
6 */
8 #ifndef _MIPS_SGIARCS_H
9 #define _MIPS_SGIARCS_H
11 /* Various ARCS error codes. */
12 #define PROM_ESUCCESS 0x00
13 #define PROM_E2BIG 0x01
14 #define PROM_EACCESS 0x02
15 #define PROM_EAGAIN 0x03
16 #define PROM_EBADF 0x04
17 #define PROM_EBUSY 0x05
18 #define PROM_EFAULT 0x06
19 #define PROM_EINVAL 0x07
20 #define PROM_EIO 0x08
21 #define PROM_EISDIR 0x09
22 #define PROM_EMFILE 0x0a
23 #define PROM_EMLINK 0x0b
24 #define PROM_ENAMETOOLONG 0x0c
25 #define PROM_ENODEV 0x0d
26 #define PROM_ENOENT 0x0e
27 #define PROM_ENOEXEC 0x0f
28 #define PROM_ENOMEM 0x10
29 #define PROM_ENOSPC 0x11
30 #define PROM_ENOTDIR 0x12
31 #define PROM_ENOTTY 0x13
32 #define PROM_ENXIO 0x14
33 #define PROM_EROFS 0x15
34 /* SGI ARCS specific errno's. */
35 #define PROM_EADDRNOTAVAIL 0x1f
36 #define PROM_ETIMEDOUT 0x20
37 #define PROM_ECONNABORTED 0x21
38 #define PROM_ENOCONNECT 0x22
40 /* Device classes, types, and identifiers for prom
41 * device inventory queries.
43 enum linux_devclass {
44 system, processor, cache, adapter, controller, peripheral, memory
47 enum linux_devtypes {
48 /* Generic stuff. */
49 Arc, Cpu, Fpu,
51 /* Primary insn and data caches. */
52 picache, pdcache,
54 /* Secondary insn, data, and combined caches. */
55 sicache, sdcache, sccache,
57 memdev, eisa_adapter, tc_adapter, scsi_adapter, dti_adapter,
58 multifunc_adapter, dsk_controller, tp_controller, cdrom_controller,
59 worm_controller, serial_controller, net_controller, disp_controller,
60 parallel_controller, ptr_controller, kbd_controller, audio_controller,
61 misc_controller, disk_peripheral, flpy_peripheral, tp_peripheral,
62 modem_peripheral, monitor_peripheral, printer_peripheral,
63 ptr_peripheral, kbd_peripheral, term_peripheral, line_peripheral,
64 net_peripheral, misc_peripheral, anon
67 enum linux_identifier {
68 bogus, ronly, removable, consin, consout, input, output
71 /* A prom device tree component. */
72 struct linux_component {
73 enum linux_devclass class; /* node class */
74 enum linux_devtypes type; /* node type */
75 enum linux_identifier iflags; /* node flags */
76 unsigned short vers; /* node version */
77 unsigned short rev; /* node revision */
78 unsigned long key; /* completely magic */
79 unsigned long amask; /* XXX affinity mask??? */
80 unsigned long cdsize; /* size of configuration data */
81 unsigned long ilen; /* length of string identifier */
82 char *iname; /* string identifier */
84 typedef struct linux_component pcomponent;
86 struct linux_sysid {
87 char vend[8], prod[8];
90 /* ARCS prom memory descriptors. */
91 enum arcs_memtypes {
92 arcs_eblock, /* exception block */
93 arcs_rvpage, /* ARCS romvec page */
94 arcs_fcontig, /* Contiguous and free */
95 arcs_free, /* Generic free memory */
96 arcs_bmem, /* Borken memory, don't use */
97 arcs_prog, /* A loaded program resides here */
98 arcs_atmp, /* ARCS temporary storage area, wish Sparc OpenBoot told this */
99 arcs_aperm, /* ARCS permanent storage... */
102 /* ARC has slightly different types than ARCS */
103 enum arc_memtypes {
104 arc_eblock, /* exception block */
105 arc_rvpage, /* romvec page */
106 arc_free, /* Generic free memory */
107 arc_bmem, /* Borken memory, don't use */
108 arc_prog, /* A loaded program resides here */
109 arc_atmp, /* temporary storage area */
110 arc_aperm, /* permanent storage */
111 arc_fcontig, /* Contiguous and free */
114 union linux_memtypes {
115 enum arcs_memtypes arcs;
116 enum arc_memtypes arc;
119 struct linux_mdesc {
120 union linux_memtypes type;
121 unsigned long base;
122 unsigned long pages;
125 /* Time of day descriptor. */
126 struct linux_tinfo {
127 unsigned short yr;
128 unsigned short mnth;
129 unsigned short day;
130 unsigned short hr;
131 unsigned short min;
132 unsigned short sec;
133 unsigned short msec;
136 /* ARCS virtual dirents. */
137 struct linux_vdirent {
138 unsigned long namelen;
139 unsigned char attr;
140 char fname[32]; /* XXX imperical, should be a define */
143 /* Other stuff for files. */
144 enum linux_omode {
145 rdonly, wronly, rdwr, wronly_creat, rdwr_creat,
146 wronly_ssede, rdwr_ssede, dirent, dirent_creat
149 enum linux_seekmode {
150 absolute, relative
153 enum linux_mountops {
154 media_load, media_unload
157 /* This prom has a bolixed design. */
158 struct linux_bigint {
159 #ifdef __MIPSEL__
160 unsigned long lo;
161 long hi;
162 #else /* !(__MIPSEL__) */
163 long hi;
164 unsigned long lo;
165 #endif
168 struct linux_finfo {
169 struct linux_bigint begin;
170 struct linux_bigint end;
171 struct linux_bigint cur;
172 enum linux_devtypes dtype;
173 unsigned long namelen;
174 unsigned char attr;
175 char name[32]; /* XXX imperical, should be define */
178 struct linux_romvec {
179 /* Load an executable image. */
180 long (*load)(char *file, unsigned long end,
181 unsigned long *start_pc,
182 unsigned long *end_addr);
184 /* Invoke a standalong image. */
185 long (*invoke)(unsigned long startpc, unsigned long sp,
186 long argc, char **argv, char **envp);
188 /* Load and begin execution of a standalong image. */
189 long (*exec)(char *file, long argc, char **argv, char **envp);
191 void (*halt)(void) __attribute__((noreturn)); /* Halt the machine. */
192 void (*pdown)(void) __attribute__((noreturn)); /* Power down the machine. */
193 void (*restart)(void) __attribute__((noreturn)); /* XXX soft reset??? */
194 void (*reboot)(void) __attribute__((noreturn)); /* Reboot the machine. */
195 void (*imode)(void) __attribute__((noreturn)); /* Enter PROM interactive mode. */
196 int _unused1; /* padding */
198 /* PROM device tree interface. */
199 pcomponent *(*next_component)(pcomponent *this);
200 pcomponent *(*child_component)(pcomponent *this);
201 pcomponent *(*parent_component)(pcomponent *this);
202 long (*component_data)(void *opaque_data, pcomponent *this);
203 pcomponent *(*child_add)(pcomponent *this,
204 pcomponent *tmp,
205 void *opaque_data);
206 long (*comp_del)(pcomponent *this);
207 pcomponent *(*component_by_path)(char *file);
209 /* Misc. stuff. */
210 long (*cfg_save)(void);
211 struct linux_sysid *(*get_sysid)(void);
213 /* Probing for memory. */
214 struct linux_mdesc *(*get_mdesc)(struct linux_mdesc *curr);
215 long _unused2; /* padding */
217 struct linux_tinfo *(*get_tinfo)(void);
218 unsigned long (*get_rtime)(void);
220 /* File type operations. */
221 long (*get_vdirent)(unsigned long fd, struct linux_vdirent *entry,
222 unsigned long num, unsigned long *count);
223 long (*open)(char *file, enum linux_omode mode, unsigned long *fd);
224 long (*close)(unsigned long fd);
225 long (*read)(unsigned long fd, void *buffer, unsigned long num,
226 unsigned long *count);
227 long (*get_rstatus)(unsigned long fd);
228 long (*write)(unsigned long fd, void *buffer, unsigned long num,
229 unsigned long *count);
230 long (*seek)(unsigned long fd, struct linux_bigint *offset,
231 enum linux_seekmode smode);
232 long (*mount)(char *file, enum linux_mountops op);
234 /* Dealing with firmware environment variables. */
235 char *(*get_evar)(char *name);
236 long (*set_evar)(char *name, char *value);
238 long (*get_finfo)(unsigned long fd, struct linux_finfo *buf);
239 long (*set_finfo)(unsigned long fd, unsigned long flags,
240 unsigned long mask);
242 /* Miscellaneous. */
243 void (*cache_flush)(void);
246 /* The SGI ARCS parameter block is in a fixed location for standalone
247 * programs to access PROM facilities easily.
249 struct linux_promblock {
250 long magic; /* magic cookie */
251 #define PROMBLOCK_MAGIC 0x53435241
253 unsigned long len; /* length of parm block */
254 unsigned short ver; /* ARCS firmware version */
255 unsigned short rev; /* ARCS firmware revision */
256 long *rs_block; /* Restart block. */
257 long *dbg_block; /* Debug block. */
258 long *gevect; /* XXX General vector??? */
259 long *utlbvect; /* XXX UTLB vector??? */
260 unsigned long rveclen; /* Size of romvec struct. */
261 struct linux_romvec *romvec; /* Function interface. */
262 unsigned long pveclen; /* Length of private vector. */
263 long *pvector; /* Private vector. */
264 long adap_cnt; /* Adapter count. */
265 long adap_typ0; /* First adapter type. */
266 long adap_vcnt0; /* Adapter 0 vector count. */
267 long *adap_vector; /* Adapter 0 vector ptr. */
268 long adap_typ1; /* Second adapter type. */
269 long adap_vcnt1; /* Adapter 1 vector count. */
270 long *adap_vector1; /* Adapter 1 vector ptr. */
271 /* More adapter vectors go here... */
274 #define PROMBLOCK ((struct linux_promblock *)0xA0001000UL)
275 #define ROMVECTOR ((PROMBLOCK)->romvec)
277 /* Cache layout parameter block. */
278 union linux_cache_key {
279 struct param {
280 #ifdef __MIPSEL__
281 unsigned short size;
282 unsigned char lsize;
283 unsigned char bsize;
284 #else /* !(__MIPSEL__) */
285 unsigned char bsize;
286 unsigned char lsize;
287 unsigned short size;
288 #endif
289 } info;
290 unsigned long allinfo;
293 /* Configuration data. */
294 struct linux_cdata {
295 char *name;
296 int mlen;
297 enum linux_devtypes type;
300 /* Common SGI ARCS firmware file descriptors. */
301 #define SGIPROM_STDIN 0
302 #define SGIPROM_STDOUT 1
304 /* Common SGI ARCS firmware file types. */
305 #define SGIPROM_ROFILE 0x01 /* read-only file */
306 #define SGIPROM_HFILE 0x02 /* hidden file */
307 #define SGIPROM_SFILE 0x04 /* System file */
308 #define SGIPROM_AFILE 0x08 /* Archive file */
309 #define SGIPROM_DFILE 0x10 /* Directory file */
310 #define SGIPROM_DELFILE 0x20 /* Deleted file */
312 /* SGI ARCS boot record information. */
313 struct sgi_partition {
314 unsigned char flag;
315 #define SGIPART_UNUSED 0x00
316 #define SGIPART_ACTIVE 0x80
318 unsigned char shead, ssect, scyl; /* unused */
319 unsigned char systype; /* OS type, Irix or NT */
320 unsigned char ehead, esect, ecyl; /* unused */
321 unsigned char rsect0, rsect1, rsect2, rsect3;
322 unsigned char tsect0, tsect1, tsect2, tsect3;
325 #define SGIBBLOCK_MAGIC 0xaa55
326 #define SGIBBLOCK_MAXPART 0x0004
328 struct sgi_bootblock {
329 unsigned char _unused[446];
330 struct sgi_partition partitions[SGIBBLOCK_MAXPART];
331 unsigned short magic;
334 /* BIOS parameter block. */
335 struct sgi_bparm_block {
336 unsigned short bytes_sect; /* bytes per sector */
337 unsigned char sect_clust; /* sectors per cluster */
338 unsigned short sect_resv; /* reserved sectors */
339 unsigned char nfats; /* # of allocation tables */
340 unsigned short nroot_dirents; /* # of root directory entries */
341 unsigned short sect_volume; /* sectors in volume */
342 unsigned char media_type; /* media descriptor */
343 unsigned short sect_fat; /* sectors per allocation table */
344 unsigned short sect_track; /* sectors per track */
345 unsigned short nheads; /* # of heads */
346 unsigned short nhsects; /* # of hidden sectors */
349 struct sgi_bsector {
350 unsigned char jmpinfo[3];
351 unsigned char manuf_name[8];
352 struct sgi_bparm_block info;
355 /* Debugging block used with SGI symmon symbolic debugger. */
356 #define SMB_DEBUG_MAGIC 0xfeeddead
357 struct linux_smonblock {
358 unsigned long magic;
359 void (*handler)(void); /* Breakpoint routine. */
360 unsigned long dtable_base; /* Base addr of dbg table. */
361 int (*printf)(const char *fmt, ...);
362 unsigned long btable_base; /* Breakpoint table. */
363 unsigned long mpflushreqs; /* SMP cache flush request list. */
364 unsigned long ntab; /* Name table. */
365 unsigned long stab; /* Symbol table. */
366 int smax; /* Max # of symbols. */
369 #endif /* !(_MIPS_SGIARCS_H) */