1 /* $NetBSD: arcbios.h,v 1.11 2007/12/25 18:33:36 perry Exp $ */
4 * Copyright (c) 2001 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * The ARC BIOS (which is similar, but not 100% compatible with SGI ARCS)
34 * specification can be found at:
36 * http://www.microsoft.com/hwdev/download/respec/riscspec.zip
42 #define ARCBIOS_STDIN 0
43 #define ARCBIOS_STDOUT 1
45 #define ARCBIOS_PAGESIZE 4096
47 /* ARC BIOS status codes. */
48 #define ARCBIOS_ESUCCESS 0 /* Success */
49 #define ARCBIOS_E2BIG 1 /* argument list too long */
50 #define ARCBIOS_EACCES 2 /* permission denied */
51 #define ARCBIOS_EAGAIN 3 /* resource temporarily unavailable */
52 #define ARCBIOS_EBADF 4 /* bad file number */
53 #define ARCBIOS_EBUSY 5 /* device or resource busy */
54 #define ARCBIOS_EFAULT 6 /* bad address */
55 #define ARCBIOS_EINVAL 7 /* invalid argument */
56 #define ARCBIOS_EIO 8 /* I/O error */
57 #define ARCBIOS_EISDIR 9 /* is a directory */
58 #define ARCBIOS_EMFILE 10 /* too many open files */
59 #define ARCBIOS_EMLINK 11 /* too many links */
60 #define ARCBIOS_ENAMETOOLONG 12 /* file name too long */
61 #define ARCBIOS_ENODEV 13 /* no such device */
62 #define ARCBIOS_ENOENT 14 /* no such file or directory */
63 #define ARCBIOS_ENOEXEC 15 /* exec format error */
64 #define ARCBIOS_ENOMEM 16 /* out of memory */
65 #define ARCBIOS_ENOSPC 17 /* no space left on device */
66 #define ARCBIOS_ENOTDIR 18 /* not a directory */
67 #define ARCBIOS_ENOTTY 19 /* not a typewriter */
68 #define ARCBIOS_ENXIO 20 /* media not loaded */
69 #define ARCBIOS_EROFS 21 /* read-only file system */
71 #define ARCBIOS_EADDRNOTAVAIL 31 /* address not available */
72 #define ARCBIOS_ETIMEDOUT 32 /* operation timed out */
73 #define ARCBIOS_ECONNABORTED 33 /* connection aborted */
74 #define ARCBIOS_ENOCONNECT 34 /* not connected */
78 * 4.2.2: System Parameter Block
89 u_long FirmwareVectorLength
;
91 u_long PrivateVectorLength
;
95 u_long AdapterVectorLength
;
99 #define ARCBIOS_SPB_SIGNATURE 0x53435241 /* A R C S */
100 #define ARCBIOS_SPB_SIGNATURE_1 0x41524353 /* S C R A */
103 * 4.2.5: System Configuration Data
105 struct arcbios_component
{
113 u_long ConfigurationDataSize
;
114 u_long IdentifierLength
;
119 * SGI ARCS likes to be `special', so it moved some of the class/type
120 * numbers around from the ARC standard definitions.
123 /* Component Class */
124 #define COMPONENT_CLASS_SystemClass 0
125 #define COMPONENT_CLASS_ProcessorClass 1
126 #define COMPONENT_CLASS_CacheClass 2
127 #define COMPONENT_CLASS_MemoryClass 3
128 #define COMPONENT_CLASS_AdapterClass 4
129 #define COMPONENT_CLASS_ControllerClass 5
130 #define COMPONENT_CLASS_PeripheralClass 6
132 /* Component Class */
133 #define COMPONENT_CLASS_SystemClass 0
134 #define COMPONENT_CLASS_ProcessorClass 1
135 #define COMPONENT_CLASS_CacheClass 2
136 #define COMPONENT_CLASS_AdapterClass 3
137 #define COMPONENT_CLASS_ControllerClass 4
138 #define COMPONENT_CLASS_PeripheralClass 5
139 #define COMPONENT_CLASS_MemoryClass 6
142 /* Component Types */
145 #define COMPONENT_TYPE_ARC 0
147 /* Processor Class */
148 #define COMPONENT_TYPE_CPU 1
149 #define COMPONENT_TYPE_FPU 2
152 #define COMPONENT_TYPE_PrimaryICache 3
153 #define COMPONENT_TYPE_PrimaryDCache 4
154 #define COMPONENT_TYPE_SecondaryICache 5
155 #define COMPONENT_TYPE_SecondaryDCache 6
156 #define COMPONENT_TYPE_SecondaryCache 7
159 #define COMPONENT_TYPE_MemoryUnit 8
162 #define COMPONENT_TYPE_EISAAdapter 9
163 #define COMPONENT_TYPE_TCAdapter 10
164 #define COMPONENT_TYPE_SCSIAdapter 11
165 #define COMPONENT_TYPE_DTIAdapter 12
166 #define COMPONENT_TYPE_MultiFunctionAdapter 13
168 /* Controller Class */
169 #define COMPONENT_TYPE_DiskController 14
170 #define COMPONENT_TYPE_TapeController 15
171 #define COMPONENT_TYPE_CDROMController 16
172 #define COMPONENT_TYPE_WORMController 17
173 #define COMPONENT_TYPE_SerialController 18
174 #define COMPONENT_TYPE_NetworkController 19
175 #define COMPONENT_TYPE_DisplayController 20
176 #define COMPONENT_TYPE_ParallelController 21
177 #define COMPONENT_TYPE_PointerController 22
178 #define COMPONENT_TYPE_KeyboardController 23
179 #define COMPONENT_TYPE_AudioController 24
180 #define COMPONENT_TYPE_OtherController 25
182 /* Peripheral Class */
183 #define COMPONENT_TYPE_DiskPeripheral 26
184 #define COMPONENT_TYPE_FloppyDiskPeripheral 27
185 #define COMPONENT_TYPE_TapePeripheral 28
186 #define COMPONENT_TYPE_ModemPeripheral 29
187 #define COMPONENT_TYPE_MonitorPeripheral 30
188 #define COMPONENT_TYPE_PrinterPeripheral 31
189 #define COMPONENT_TYPE_PointerPeripheral 32
190 #define COMPONENT_TYPE_KeyboardPeripheral 33
191 #define COMPONENT_TYPE_TerminalPeripheral 34
192 #define COMPONENT_TYPE_LinePeripheral 35
193 #define COMPONENT_TYPE_NetworkPeripheral 36
194 #define COMPONENT_TYPE_OtherPeripheral 37
195 #else /* not sgimips */
197 #define COMPONENT_TYPE_ARC 0
199 /* Processor Class */
200 #define COMPONENT_TYPE_CPU 1
201 #define COMPONENT_TYPE_FPU 2
204 #define COMPONENT_TYPE_PrimaryICache 3
205 #define COMPONENT_TYPE_PrimaryDCache 4
206 #define COMPONENT_TYPE_SecondaryICache 5
207 #define COMPONENT_TYPE_SecondaryDCache 6
208 #define COMPONENT_TYPE_SecondaryCache 7
211 #define COMPONENT_TYPE_EISAAdapter 8
212 #define COMPONENT_TYPE_TCAdapter 9
213 #define COMPONENT_TYPE_SCSIAdapter 10
214 #define COMPONENT_TYPE_DTIAdapter 11
215 #define COMPONENT_TYPE_MultiFunctionAdapter 12
217 /* Controller Class */
218 #define COMPONENT_TYPE_DiskController 13
219 #define COMPONENT_TYPE_TapeController 14
220 #define COMPONENT_TYPE_CDROMController 15
221 #define COMPONENT_TYPE_WORMController 16
222 #define COMPONENT_TYPE_SerialController 17
223 #define COMPONENT_TYPE_NetworkController 18
224 #define COMPONENT_TYPE_DisplayController 19
225 #define COMPONENT_TYPE_ParallelController 20
226 #define COMPONENT_TYPE_PointerController 21
227 #define COMPONENT_TYPE_KeyboardController 22
228 #define COMPONENT_TYPE_AudioController 23
229 #define COMPONENT_TYPE_OtherController 24
231 /* Peripheral Class */
232 #define COMPONENT_TYPE_DiskPeripheral 25
233 #define COMPONENT_TYPE_FloppyDiskPeripheral 26
234 #define COMPONENT_TYPE_TapePeripheral 27
235 #define COMPONENT_TYPE_ModemPeripheral 28
236 #define COMPONENT_TYPE_MonitorPeripheral 29
237 #define COMPONENT_TYPE_PrinterPeripheral 30
238 #define COMPONENT_TYPE_PointerPeripheral 31
239 #define COMPONENT_TYPE_KeyboardPeripheral 32
240 #define COMPONENT_TYPE_TerminalPeripheral 33
241 #define COMPONENT_TYPE_OtherPeripheral 34
242 #define COMPONENT_TYPE_LinePeripheral 35
243 #define COMPONENT_TYPE_NetworkPeripheral 36
246 #define COMPONENT_TYPE_MemoryUnit 37
249 /* Component flags */
250 #define COMPONENT_FLAG_Failed 1
251 #define COMPONENT_FLAG_ReadOnly 2
252 #define COMPONENT_FLAG_Removable 4
253 #define COMPONENT_FLAG_ConsoleIn 8
254 #define COMPONENT_FLAG_ConsoleOut 16
255 #define COMPONENT_FLAG_Input 32
256 #define COMPONENT_FLAG_Output 64
259 #define COMPONENT_KEY_Cache_CacheSize(x) \
260 (ARCBIOS_PAGESIZE << ((x) & 0xffff))
261 #define COMPONENT_KEY_Cache_LineSize(x) \
262 (1U << (((x) >> 16) & 0xff))
263 #define COMPONENT_KEY_Cache_RefillSize(x) \
269 #define ARCBIOS_SYSID_FIELDLEN 8
270 struct arcbios_sysid
{
271 char VendorId
[ARCBIOS_SYSID_FIELDLEN
];
272 char ProductId
[ARCBIOS_SYSID_FIELDLEN
];
276 * ARC memory descriptor
285 #define ARCBIOS_MEM_ExceptionBlock 0
286 #define ARCBIOS_MEM_SystemParameterBlock 1
287 #define ARCBIOS_MEM_FreeContiguous 2
288 #define ARCBIOS_MEM_FreeMemory 3
289 #define ARCBIOS_MEM_BadMemory 4
290 #define ARCBIOS_MEM_LoadedProgram 5
291 #define ARCBIOS_MEM_FirmwareTemporary 6
292 #define ARCBIOS_MEM_FirmwarePermanent 7
294 #define ARCBIOS_MEM_ExceptionBlock 0
295 #define ARCBIOS_MEM_SystemParameterBlock 1
296 #define ARCBIOS_MEM_FreeMemory 2
297 #define ARCBIOS_MEM_BadMemory 3
298 #define ARCBIOS_MEM_LoadedProgram 4
299 #define ARCBIOS_MEM_FirmwareTemporary 5
300 #define ARCBIOS_MEM_FirmwarePermanent 6
301 #define ARCBIOS_MEM_FreeContiguous 7
307 struct arcbios_dsp_stat
{
308 uint16_t CursorXPosition
;
309 uint16_t CursorYPosition
;
310 uint16_t CursorMaxXPosition
;
311 uint16_t CursorMaxYPosition
;
312 uint8_t ForegroundColor
;
313 uint8_t BackgroundColor
;
314 uint8_t HighIntensity
;
316 uint8_t ReverseVideo
;
320 * ARC firmware vector
324 char *, /* image to load */
325 u_long
, /* top address */
326 u_long
, /* entry address */
327 u_long
*); /* low address */
330 u_long
, /* entry address */
331 u_long
, /* stack address */
337 char *, /* image path */
345 void (*PowerDown
)(void)
348 void (*Restart
)(void)
354 void (*EnterInteractiveMode
)(void)
359 void (*ReturnFromMain
)(void)
363 void *); /* component */
366 void *); /* component */
369 void *); /* component */
371 long (*GetConfigurationData
)(
372 void *, /* configuration data */
373 void *); /* component */
376 void *, /* component */
377 void *); /* new component */
379 long (*DeleteComponent
)(
380 void *); /* component */
382 void *(*GetComponent
)(
385 long (*SaveConfiguration
)(void);
387 void *(*GetSystemId
)(void);
389 void *(*GetMemoryDescriptor
)(
390 void *); /* memory descriptor */
395 u_long
, /* signal number */
396 void *); /* handler */
398 void *(*GetTime
)(void);
400 u_long (*GetRelativeTime
)(void);
402 long (*GetDirectoryEntry
)(
403 u_long
, /* file ID */
404 void *, /* directory entry */
406 u_long
*); /* count */
410 u_long
, /* open mode */
411 u_long
*); /* file ID */
414 u_long
); /* file ID */
417 u_long
, /* file ID */
420 u_long
*); /* count */
422 long (*GetReadStatus
)(
423 u_long
); /* file ID */
426 u_long
, /* file ID */
429 u_long
*); /* count */
432 u_long
, /* file ID */
433 int64_t *, /* offset */
434 u_long
); /* whence */
438 u_long
); /* operation */
440 const char *(*GetEnvironmentVariable
)(
441 const char *); /* variable */
443 long (*SetEnvironmentVariable
)(
444 const char *, /* variable */
445 const char *); /* contents */
447 long (*GetFileInformation
)(
448 u_long
, /* file ID */
451 long (*SetFileInformation
)(
452 u_long
, /* file ID */
456 void (*FlushAllCaches
)(void);
457 #if !defined(sgimips)
458 paddr_t (*TestUnicode
)(
459 u_long
, /* file ID */
460 uint16_t); /* unicode character */
462 void *(*GetDisplayStatus
)(
463 u_long
); /* file ID */
467 #endif /* _ARCBIOS_H_ */