/[gxemul]/upstream/0.4.4/src/include/sgi_arcbios.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /upstream/0.4.4/src/include/sgi_arcbios.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (show annotations)
Mon Oct 8 16:21:26 2007 UTC (16 years, 6 months ago) by dpavlin
File MIME type: text/plain
File size: 15993 byte(s)
0.4.4
1 /* gxemul: $Id: sgi_arcbios.h,v 1.14 2005/03/05 12:34:03 debug Exp $ */
2 /* This file has been modified from the NetBSD version, the additions
3 are mostly guesses for 64-bit SGI stuff. */
4
5 #ifndef SGI_ARCBIOS_H
6 #define SGI_ARCBIOS_H
7
8 /* It's better to not #define sgimips here, and assume generic ARC instead */
9
10 #ifdef __attribute__
11 #undef __attribute__
12 #endif
13
14 #ifdef __noreturn__
15 #undef __noreturn__
16 #endif
17
18 #define __attribute__(x) /* */
19 #define __noreturn__ /* */
20
21 /* $NetBSD: arcbios.h,v 1.3 2001/12/06 14:59:02 rafal Exp $ */
22
23 /*-
24 * Copyright (c) 2001 The NetBSD Foundation, Inc.
25 * All rights reserved.
26 *
27 * This code is derived from software contributed to The NetBSD Foundation
28 * by Jason R. Thorpe.
29 *
30 * Redistribution and use in source and binary forms, with or without
31 * modification, are permitted provided that the following conditions
32 * are met:
33 * 1. Redistributions of source code must retain the above copyright
34 * notice, this list of conditions and the following disclaimer.
35 * 2. Redistributions in binary form must reproduce the above copyright
36 * notice, this list of conditions and the following disclaimer in the
37 * documentation and/or other materials provided with the distribution.
38 * 3. All advertising materials mentioning features or use of this software
39 * must display the following acknowledgement:
40 * This product includes software developed by the NetBSD
41 * Foundation, Inc. and its contributors.
42 * 4. Neither the name of The NetBSD Foundation nor the names of its
43 * contributors may be used to endorse or promote products derived
44 * from this software without specific prior written permission.
45 *
46 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
47 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
48 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
49 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
50 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
51 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
52 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
53 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
54 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
55 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
56 * POSSIBILITY OF SUCH DAMAGE.
57 */
58
59 /*
60 * The ARC BIOS (which is similar, but not 100% compatible with SGI ARCS)
61 * specification can be found at:
62 *
63 * http://www.microsoft.com/hwdev/download/respec/riscspec.zip
64 */
65
66 #define ARCBIOS_STDIN 0
67 #define ARCBIOS_STDOUT 1
68
69 #define ARCBIOS_PAGESIZE 4096
70
71 /* ARC BIOS status codes. */
72 #define ARCBIOS_ESUCCESS 0 /* Success */
73 #define ARCBIOS_E2BIG 1 /* argument list too long */
74 #define ARCBIOS_EACCES 2 /* permission denied */
75 #define ARCBIOS_EAGAIN 3 /* resource temporarily unavailable */
76 #define ARCBIOS_EBADF 4 /* bad file number */
77 #define ARCBIOS_EBUSY 5 /* device or resource busy */
78 #define ARCBIOS_EFAULT 6 /* bad address */
79 #define ARCBIOS_EINVAL 7 /* invalid argument */
80 #define ARCBIOS_EIO 8 /* I/O error */
81 #define ARCBIOS_EISDIR 9 /* is a directory */
82 #define ARCBIOS_EMFILE 10 /* too many open files */
83 #define ARCBIOS_EMLINK 11 /* too many links */
84 #define ARCBIOS_ENAMETOOLONG 12 /* file name too long */
85 #define ARCBIOS_ENODEV 13 /* no such device */
86 #define ARCBIOS_ENOENT 14 /* no such file or directory */
87 #define ARCBIOS_ENOEXEC 15 /* exec format error */
88 #define ARCBIOS_ENOMEM 16 /* out of memory */
89 #define ARCBIOS_ENOSPC 17 /* no space left on device */
90 #define ARCBIOS_ENOTDIR 18 /* not a directory */
91 #define ARCBIOS_ENOTTY 19 /* not a typewriter */
92 #define ARCBIOS_ENXIO 20 /* media not loaded */
93 #define ARCBIOS_EROFS 21 /* read-only file system */
94 #if defined(sgimips)
95 #define ARCBIOS_EADDRNOTAVAIL 31 /* address not available */
96 #define ARCBIOS_ETIMEDOUT 32 /* operation timed out */
97 #define ARCBIOS_ECONNABORTED 33 /* connection aborted */
98 #define ARCBIOS_ENOCONNECT 34 /* not connected */
99 #endif /* sgimips */
100
101 /*
102 * 4.2.2: System Parameter Block
103 */
104 struct arcbios_spb {
105 uint32_t SPBSignature;
106 uint32_t SPBLength;
107 uint16_t Version;
108 uint16_t Revision;
109 uint32_t RestartBlock; /* was void * in netbsd */
110 uint32_t DebugBlock; /* was void * */
111 uint32_t GEVector; /* was void * */
112 uint32_t UTLBMissVector; /* was void * */
113 uint32_t FirmwareVectorLength;
114 uint32_t FirmwareVector; /* was void * */
115 uint32_t PrivateVectorLength;
116 uint32_t PrivateVector; /* was void * */
117 uint32_t AdapterCount;
118 uint32_t AdapterType;
119 uint32_t AdapterVectorLength;
120 uint32_t AdapterVector; /* was void * */
121 };
122
123 /*
124 * arcbios_spb_64 is like arcbios_spb, but with 64-bit pointers.
125 * Irix seems to want this. TODO: This is just a guess, based on the
126 * usage of void * in the NetBSD version of arcbios_spb.
127 *
128 * Linux wants a 64-bit SPBSignature?
129 */
130 struct arcbios_spb_64 {
131 uint64_t SPBSignature;
132 uint64_t SPBLength;
133 uint16_t Version;
134 uint16_t Revision;
135 uint32_t dummy;
136 uint64_t RestartBlock; /* was void * in netbsd */
137 uint64_t DebugBlock; /* was void * */
138 uint64_t GEVector; /* was void * */
139 uint64_t UTLBMissVector; /* was void * */
140 uint64_t FirmwareVectorLength;
141 uint64_t FirmwareVector; /* was void * */
142 uint64_t PrivateVectorLength;
143 uint64_t PrivateVector; /* was void * */
144 uint64_t AdapterCount;
145 uint64_t AdapterType;
146 uint64_t AdapterVectorLength;
147 uint64_t AdapterVector; /* was void * */
148 };
149
150 #define ARCBIOS_SPB_SIGNATURE 0x53435241 /* A R C S */
151 #define ARCBIOS_SPB_SIGNATURE_1 0x41524353 /* S C R A */
152
153 /*
154 * 4.2.5: System Configuration Data
155 */
156 struct arcbios_component {
157 uint32_t Class;
158 uint32_t Type;
159 uint32_t Flags;
160 uint16_t Version;
161 uint16_t Revision;
162 uint32_t Key;
163 uint32_t AffinityMask;
164 uint32_t ConfigurationDataSize;
165 uint32_t IdentifierLength;
166 uint32_t Identifier; /* was: char * */
167 };
168
169 /* gxemul addition: guess for a 64-bit version of arcbios_component: */
170 struct arcbios_component64 {
171 uint32_t Class;
172 uint32_t Type;
173 uint32_t Flags;
174 uint16_t Version;
175 uint16_t Revision;
176 uint64_t Key;
177 uint64_t AffinityMask;
178 uint64_t ConfigurationDataSize;
179 uint64_t IdentifierLength;
180 uint64_t Identifier; /* was: char * */
181 };
182
183 /*
184 * SGI ARCS likes to be `special', so it moved some of the class/type
185 * numbers around from the ARC standard definitions.
186 */
187 #if defined(sgimips)
188 /* Component Class */
189 #define COMPONENT_CLASS_SystemClass 0
190 #define COMPONENT_CLASS_ProcessorClass 1
191 #define COMPONENT_CLASS_CacheClass 2
192 #define COMPONENT_CLASS_MemoryClass 3
193 #define COMPONENT_CLASS_AdapterClass 4
194 #define COMPONENT_CLASS_ControllerClass 5
195 #define COMPONENT_CLASS_PeripheralClass 6
196 #else
197 /* Component Class */
198 #define COMPONENT_CLASS_SystemClass 0
199 #define COMPONENT_CLASS_ProcessorClass 1
200 #define COMPONENT_CLASS_CacheClass 2
201 #define COMPONENT_CLASS_AdapterClass 3
202 #define COMPONENT_CLASS_ControllerClass 4
203 #define COMPONENT_CLASS_PeripheralClass 5
204 #define COMPONENT_CLASS_MemoryClass 6
205 #endif
206
207 /* Component Types */
208 #if defined(sgimips)
209 /* System Class */
210 #define COMPONENT_TYPE_ARC 0
211
212 /* Processor Class */
213 #define COMPONENT_TYPE_CPU 1
214 #define COMPONENT_TYPE_FPU 2
215
216 /* Cache Class */
217 #define COMPONENT_TYPE_PrimaryICache 3
218 #define COMPONENT_TYPE_PrimaryDCache 4
219 #define COMPONENT_TYPE_SecondaryICache 5
220 #define COMPONENT_TYPE_SecondaryDCache 6
221 #define COMPONENT_TYPE_SecondaryCache 7
222
223 /* Memory Class */
224 #define COMPONENT_TYPE_MemoryUnit 8
225
226 /* Adapter Class */
227 #define COMPONENT_TYPE_EISAAdapter 9
228 #define COMPONENT_TYPE_TCAdapter 10
229 #define COMPONENT_TYPE_SCSIAdapter 11
230 #define COMPONENT_TYPE_DTIAdapter 12
231 #define COMPONENT_TYPE_MultiFunctionAdapter 13
232
233 /* Controller Class */
234 #define COMPONENT_TYPE_DiskController 14
235 #define COMPONENT_TYPE_TapeController 15
236 #define COMPONENT_TYPE_CDROMController 16
237 #define COMPONENT_TYPE_WORMController 17
238 #define COMPONENT_TYPE_SerialController 18
239 #define COMPONENT_TYPE_NetworkController 19
240 #define COMPONENT_TYPE_DisplayController 20
241 #define COMPONENT_TYPE_ParallelController 21
242 #define COMPONENT_TYPE_PointerController 22
243 #define COMPONENT_TYPE_KeyboardController 23
244 #define COMPONENT_TYPE_AudioController 24
245 #define COMPONENT_TYPE_OtherController 25
246
247 /* Peripheral Class */
248 #define COMPONENT_TYPE_DiskPeripheral 26
249 #define COMPONENT_TYPE_FloppyDiskPeripheral 27
250 #define COMPONENT_TYPE_TapePeripheral 28
251 #define COMPONENT_TYPE_ModemPeripheral 29
252 #define COMPONENT_TYPE_MonitorPeripheral 30
253 #define COMPONENT_TYPE_PrinterPeripheral 31
254 #define COMPONENT_TYPE_PointerPeripheral 32
255 #define COMPONENT_TYPE_KeyboardPeripheral 33
256 #define COMPONENT_TYPE_TerminalPeripheral 34
257 #define COMPONENT_TYPE_LinePeripheral 35
258 #define COMPONENT_TYPE_NetworkPeripheral 36
259 #define COMPONENT_TYPE_OtherPeripheral 37
260 #else /* not sgimips */
261 /* System Class */
262 #define COMPONENT_TYPE_ARC 0
263
264 /* Processor Class */
265 #define COMPONENT_TYPE_CPU 1
266 #define COMPONENT_TYPE_FPU 2
267
268 /* Cache Class */
269 #define COMPONENT_TYPE_PrimaryICache 3
270 #define COMPONENT_TYPE_PrimaryDCache 4
271 #define COMPONENT_TYPE_SecondaryICache 5
272 #define COMPONENT_TYPE_SecondaryDCache 6
273 #define COMPONENT_TYPE_SecondaryCache 7
274
275 /* Adapter Class */
276 #define COMPONENT_TYPE_EISAAdapter 8
277 #define COMPONENT_TYPE_TCAdapter 9
278 #define COMPONENT_TYPE_SCSIAdapter 10
279 #define COMPONENT_TYPE_DTIAdapter 11
280 #define COMPONENT_TYPE_MultiFunctionAdapter 12
281
282 /* Controller Class */
283 #define COMPONENT_TYPE_DiskController 13
284 #define COMPONENT_TYPE_TapeController 14
285 #define COMPONENT_TYPE_CDROMController 15
286 #define COMPONENT_TYPE_WORMController 16
287 #define COMPONENT_TYPE_SerialController 17
288 #define COMPONENT_TYPE_NetworkController 18
289 #define COMPONENT_TYPE_DisplayController 19
290 #define COMPONENT_TYPE_ParallelController 20
291 #define COMPONENT_TYPE_PointerController 21
292 #define COMPONENT_TYPE_KeyboardController 22
293 #define COMPONENT_TYPE_AudioController 23
294 #define COMPONENT_TYPE_OtherController 24
295
296 /* Peripheral Class */
297 #define COMPONENT_TYPE_DiskPeripheral 25
298 #define COMPONENT_TYPE_FloppyDiskPeripheral 26
299 #define COMPONENT_TYPE_TapePeripheral 27
300 #define COMPONENT_TYPE_ModemPeripheral 28
301 #define COMPONENT_TYPE_MonitorPeripheral 29
302 #define COMPONENT_TYPE_PrinterPeripheral 30
303 #define COMPONENT_TYPE_PointerPeripheral 31
304 #define COMPONENT_TYPE_KeyboardPeripheral 32
305 #define COMPONENT_TYPE_TerminalPeripheral 33
306 #define COMPONENT_TYPE_OtherPeripheral 34
307 #define COMPONENT_TYPE_LinePeripheral 35
308 #define COMPONENT_TYPE_NetworkPeripheral 36
309
310 /* Memory Class */
311 #define COMPONENT_TYPE_MemoryUnit 37
312 #endif
313
314 /* Component flags */
315 #define COMPONENT_FLAG_Failed 1
316 #define COMPONENT_FLAG_ReadOnly 2
317 #define COMPONENT_FLAG_Removable 4
318 #define COMPONENT_FLAG_ConsoleIn 8
319 #define COMPONENT_FLAG_ConsoleOut 16
320 #define COMPONENT_FLAG_Input 32
321 #define COMPONENT_FLAG_Output 64
322
323 /* Key for Cache: */
324 #define COMPONENT_KEY_Cache_CacheSize(x) \
325 (ARCBIOS_PAGESIZE << ((x) & 0xffff))
326 #define COMPONENT_KEY_Cache_LineSize(x) \
327 (1U << (((x) >> 16) & 0xff))
328 #define COMPONENT_KEY_Cache_RefillSize(x) \
329 (((x) >> 24) & 0xff)
330
331 /*
332 * ARC system ID
333 */
334 #define ARCBIOS_SYSID_FIELDLEN 8
335 struct arcbios_sysid {
336 char VendorId[ARCBIOS_SYSID_FIELDLEN];
337 char ProductId[ARCBIOS_SYSID_FIELDLEN];
338 };
339
340 /*
341 * ARC memory descriptor
342 */
343 struct arcbios_mem {
344 uint32_t Type;
345 uint32_t BasePage;
346 uint32_t PageCount;
347 };
348
349 /* gxemul: Linux/Octane reads these as 64-bit values */
350 struct arcbios_mem64 {
351 uint32_t Type;
352 uint32_t dummy; /* not used by Linux? */
353 uint64_t BasePage;
354 uint64_t PageCount;
355 };
356
357 #if defined(sgimips)
358 #define ARCBIOS_MEM_ExecptionBlock 0
359 #define ARCBIOS_MEM_SystemParameterBlock 1
360 #define ARCBIOS_MEM_FreeContiguous 2
361 #define ARCBIOS_MEM_FreeMemory 3
362 #define ARCBIOS_MEM_BadMemory 4
363 #define ARCBIOS_MEM_LoadedProgram 5
364 #define ARCBIOS_MEM_FirmwareTemporary 6
365 #define ARCBIOS_MEM_FirmwarePermanent 7
366 #else /* lif defined(arc) */
367 #define ARCBIOS_MEM_ExceptionBlock 0
368 #define ARCBIOS_MEM_SystemParameterBlock 1
369 #define ARCBIOS_MEM_FreeMemory 2
370 #define ARCBIOS_MEM_BadMemory 3
371 #define ARCBIOS_MEM_LoadedProgram 4
372 #define ARCBIOS_MEM_FirmwareTemporary 5
373 #define ARCBIOS_MEM_FirmwarePermanent 6
374 #define ARCBIOS_MEM_FreeContiguous 7
375 #endif
376
377 /*
378 * ARC display status
379 */
380 struct arcbios_dsp_stat {
381 uint16_t CursorXPosition;
382 uint16_t CursorYPosition;
383 uint16_t CursorMaxXPosition;
384 uint16_t CursorMaxYPosition;
385 uint8_t ForegroundColor;
386 uint8_t BackgroundColor;
387 uint8_t HighIntensity;
388 uint8_t Underscored;
389 uint8_t ReverseVideo;
390 };
391
392 /*
393 * ARC firmware vector
394 */
395 struct arcbios_fv {
396 uint32_t (*Load)(
397 char *, /* image to load */
398 uint32_t, /* top address */
399 uint32_t, /* entry address */
400 uint32_t *); /* low address */
401
402 uint32_t (*Invoke)(
403 uint32_t, /* entry address */
404 uint32_t, /* stack address */
405 uint32_t, /* argc */
406 char **, /* argv */
407 char **); /* envp */
408
409 uint32_t (*Execute)(
410 char *, /* image path */
411 uint32_t, /* argc */
412 char **, /* argv */
413 char **); /* envp */
414
415 void (*Halt)(void)
416 __attribute__((__noreturn__));
417
418 void (*PowerDown)(void)
419 __attribute__((__noreturn__));
420
421 void (*Restart)(void)
422 __attribute__((__noreturn__));
423
424 void (*Reboot)(void)
425 __attribute__((__noreturn__));
426
427 void (*EnterInteractiveMode)(void)
428 __attribute__((__noreturn__));
429 #if defined(sgimips)
430 void *reserved0;
431 #else
432 void (*ReturnFromMain)(void)
433 __attribute__((__noreturn__));
434 #endif
435 void *(*GetPeer)(
436 void *); /* component */
437
438 void *(*GetChild)(
439 void *); /* component */
440
441 void *(*GetParent)(
442 void *); /* component */
443
444 uint32_t (*GetConfigurationData)(
445 void *, /* configuration data */
446 void *); /* component */
447
448 void *(*AddChild)(
449 void *, /* component */
450 void *); /* new component */
451
452 uint32_t (*DeleteComponent)(
453 void *); /* component */
454
455 uint32_t (*GetComponent)(
456 char *); /* path */
457
458 uint32_t (*SaveConfiguration)(void);
459
460 void *(*GetSystemId)(void);
461
462 void *(*GetMemoryDescriptor)(
463 void *); /* memory descriptor */
464 #if defined(sgimips)
465 void *reserved1;
466 #else
467 void (*Signal)(
468 uint32_t, /* signal number */
469 void *); /* handler */
470 #endif
471 void *(*GetTime)(void);
472
473 uint32_t (*GetRelativeTime)(void);
474
475 uint32_t (*GetDirectoryEntry)(
476 uint32_t, /* file ID */
477 void *, /* directory entry */
478 uint32_t, /* length */
479 uint32_t *); /* count */
480
481 uint32_t (*Open)(
482 char *, /* path */
483 uint32_t, /* open mode */
484 uint32_t *); /* file ID */
485
486 uint32_t (*Close)(
487 uint32_t); /* file ID */
488
489 uint32_t (*Read)(
490 uint32_t, /* file ID */
491 void *, /* buffer */
492 uint32_t, /* length */
493 uint32_t *); /* count */
494
495 uint32_t (*GetReadStatus)(
496 uint32_t); /* file ID */
497
498 uint32_t (*Write)(
499 uint32_t, /* file ID */
500 void *, /* buffer */
501 uint32_t, /* length */
502 uint32_t *); /* count */
503
504 uint32_t (*Seek)(
505 uint32_t, /* file ID */
506 int64_t *, /* offset */
507 uint32_t); /* whence */
508
509 uint32_t (*Mount)(
510 char *, /* path */
511 uint32_t); /* operation */
512
513 char *(*GetEnvironmentVariable)(
514 char *); /* variable */
515
516 uint32_t (*SetEnvironmentVariable)(
517 char *, /* variable */
518 char *); /* contents */
519
520 uint32_t (*GetFileInformation)(
521 uint32_t, /* file ID */
522 void *); /* XXX */
523
524 uint32_t (*SetFileInformation)(
525 uint32_t, /* file ID */
526 uint32_t, /* XXX */
527 uint32_t); /* XXX */
528
529 void (*FlushAllCaches)(void);
530 #if !defined(sgimips)
531 uint32_t (*TestUnicode)(
532 uint32_t, /* file ID */
533 uint16_t); /* unicode character */
534
535 void *(*GetDisplayStatus)(
536 uint32_t); /* file ID */
537 #endif
538 };
539
540 #endif /* SGI_ARCBIOS_H */

  ViewVC Help
Powered by ViewVC 1.1.26