arcbios.h revision 1.2 1 1.2 thorpej /* $NetBSD: arcbios.h,v 1.2 2001/07/08 23:56:03 thorpej Exp $ */
2 1.1 thorpej
3 1.1 thorpej /*-
4 1.1 thorpej * Copyright (c) 2001 The NetBSD Foundation, Inc.
5 1.1 thorpej * All rights reserved.
6 1.1 thorpej *
7 1.1 thorpej * This code is derived from software contributed to The NetBSD Foundation
8 1.1 thorpej * by Jason R. Thorpe.
9 1.1 thorpej *
10 1.1 thorpej * Redistribution and use in source and binary forms, with or without
11 1.1 thorpej * modification, are permitted provided that the following conditions
12 1.1 thorpej * are met:
13 1.1 thorpej * 1. Redistributions of source code must retain the above copyright
14 1.1 thorpej * notice, this list of conditions and the following disclaimer.
15 1.1 thorpej * 2. Redistributions in binary form must reproduce the above copyright
16 1.1 thorpej * notice, this list of conditions and the following disclaimer in the
17 1.1 thorpej * documentation and/or other materials provided with the distribution.
18 1.1 thorpej * 3. All advertising materials mentioning features or use of this software
19 1.1 thorpej * must display the following acknowledgement:
20 1.1 thorpej * This product includes software developed by the NetBSD
21 1.1 thorpej * Foundation, Inc. and its contributors.
22 1.1 thorpej * 4. Neither the name of The NetBSD Foundation nor the names of its
23 1.1 thorpej * contributors may be used to endorse or promote products derived
24 1.1 thorpej * from this software without specific prior written permission.
25 1.1 thorpej *
26 1.1 thorpej * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27 1.1 thorpej * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28 1.1 thorpej * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 1.1 thorpej * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30 1.1 thorpej * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 1.1 thorpej * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 1.1 thorpej * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 1.1 thorpej * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 1.1 thorpej * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 1.1 thorpej * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 1.1 thorpej * POSSIBILITY OF SUCH DAMAGE.
37 1.1 thorpej */
38 1.1 thorpej
39 1.1 thorpej /*
40 1.1 thorpej * The ARC BIOS (which is similar, but not 100% compatible with SGI ARCS)
41 1.1 thorpej * specification can be found at:
42 1.1 thorpej *
43 1.1 thorpej * http://www.microsoft.com/hwdev/download/respec/riscspec.zip
44 1.1 thorpej */
45 1.1 thorpej
46 1.1 thorpej #define ARCBIOS_STDIN 0
47 1.1 thorpej #define ARCBIOS_STDOUT 1
48 1.1 thorpej
49 1.1 thorpej #define ARCBIOS_PAGESIZE 4096
50 1.1 thorpej
51 1.1 thorpej /* ARC BIOS status codes. */
52 1.1 thorpej #define ARCBIOS_ESUCCESS 0 /* Success */
53 1.1 thorpej #define ARCBIOS_E2BIG 1 /* argument list too long */
54 1.1 thorpej #define ARCBIOS_EACCES 2 /* permission denied */
55 1.1 thorpej #define ARCBIOS_EAGAIN 3 /* resource temporarily unavailable */
56 1.1 thorpej #define ARCBIOS_EBADF 4 /* bad file number */
57 1.1 thorpej #define ARCBIOS_EBUSY 5 /* device or resource busy */
58 1.1 thorpej #define ARCBIOS_EFAULT 6 /* bad address */
59 1.1 thorpej #define ARCBIOS_EINVAL 7 /* invalid argument */
60 1.1 thorpej #define ARCBIOS_EIO 8 /* I/O error */
61 1.1 thorpej #define ARCBIOS_EISDIR 9 /* is a directory */
62 1.1 thorpej #define ARCBIOS_EMFILE 10 /* too many open files */
63 1.1 thorpej #define ARCBIOS_EMLINK 11 /* too many links */
64 1.1 thorpej #define ARCBIOS_ENAMETOOLONG 12 /* file name too long */
65 1.1 thorpej #define ARCBIOS_ENODEV 13 /* no such device */
66 1.1 thorpej #define ARCBIOS_ENOENT 14 /* no such file or directory */
67 1.1 thorpej #define ARCBIOS_ENOEXEC 15 /* exec format error */
68 1.1 thorpej #define ARCBIOS_ENOMEM 16 /* out of memory */
69 1.1 thorpej #define ARCBIOS_ENOSPC 17 /* no space left on device */
70 1.1 thorpej #define ARCBIOS_ENOTDIR 18 /* not a directory */
71 1.1 thorpej #define ARCBIOS_ENOTTY 19 /* not a typewriter */
72 1.1 thorpej #define ARCBIOS_ENXIO 20 /* media not loaded */
73 1.1 thorpej #define ARCBIOS_EROFS 21 /* read-only file system */
74 1.1 thorpej #if defined(sgimips)
75 1.1 thorpej #define ARCBIOS_EADDRNOTAVAIL 31 /* address not available */
76 1.1 thorpej #define ARCBIOS_ETIMEDOUT 32 /* operation timed out */
77 1.1 thorpej #define ARCBIOS_ECONNABORTED 33 /* connection aborted */
78 1.1 thorpej #define ARCBIOS_ENOCONNECT 34 /* not connected */
79 1.1 thorpej #endif /* sgimips */
80 1.1 thorpej
81 1.1 thorpej /*
82 1.1 thorpej * 4.2.2: System Parameter Block
83 1.1 thorpej */
84 1.1 thorpej struct arcbios_spb {
85 1.1 thorpej uint32_t SPBSignature;
86 1.1 thorpej uint32_t SPBLength;
87 1.1 thorpej uint16_t Version;
88 1.1 thorpej uint16_t Revision;
89 1.1 thorpej void *RestartBlock;
90 1.1 thorpej void *DebugBlock;
91 1.1 thorpej void *GEVector;
92 1.1 thorpej void *UTLBMissVector;
93 1.1 thorpej uint32_t FirmwareVectorLength;
94 1.1 thorpej void *FirmwareVector;
95 1.1 thorpej uint32_t PrivateVectorLength;
96 1.1 thorpej void *PrivateVector;
97 1.1 thorpej uint32_t AdapterCount;
98 1.1 thorpej uint32_t AdapterType;
99 1.1 thorpej uint32_t AdapterVectorLength;
100 1.1 thorpej void *AdapterVector;
101 1.1 thorpej };
102 1.1 thorpej
103 1.1 thorpej #define ARCBIOS_SPB_SIGNATURE 0x53435241 /* A R C S */
104 1.1 thorpej #define ARCBIOS_SPB_SIGNATURE_1 0x41524353 /* S C R A */
105 1.1 thorpej
106 1.1 thorpej /*
107 1.1 thorpej * 4.2.5: System Configuration Data
108 1.1 thorpej */
109 1.1 thorpej struct arcbios_component {
110 1.1 thorpej uint32_t Class;
111 1.1 thorpej uint32_t Type;
112 1.1 thorpej uint32_t Flags;
113 1.1 thorpej uint16_t Version;
114 1.1 thorpej uint16_t Revision;
115 1.1 thorpej uint32_t Key;
116 1.1 thorpej uint32_t AffinityMask;
117 1.1 thorpej uint32_t ConfigurationDataSize;
118 1.1 thorpej uint32_t IdentifierLength;
119 1.1 thorpej char *Identifier;
120 1.1 thorpej };
121 1.1 thorpej
122 1.1 thorpej /* Component Class */
123 1.1 thorpej #define COMPONENT_CLASS_SystemClass 0
124 1.1 thorpej #define COMPONENT_CLASS_ProcessorClass 1
125 1.1 thorpej #define COMPONENT_CLASS_CacheClass 2
126 1.1 thorpej #define COMPONENT_CLASS_AdapterClass 3
127 1.1 thorpej #define COMPONENT_CLASS_ControllerClass 4
128 1.1 thorpej #define COMPONENT_CLASS_PeripheralClass 5
129 1.1 thorpej #define COMPONENT_CLASS_MemoryClass 6
130 1.1 thorpej
131 1.1 thorpej /* System Class */
132 1.1 thorpej #define COMPONENT_TYPE_ARC 0
133 1.1 thorpej
134 1.1 thorpej /* Processor Class */
135 1.1 thorpej #define COMPONENT_TYPE_CPU 1
136 1.1 thorpej #define COMPONENT_TYPE_FPU 2
137 1.1 thorpej
138 1.1 thorpej /* Cache Class */
139 1.1 thorpej #define COMPONENT_TYPE_PrimaryICache 3
140 1.1 thorpej #define COMPONENT_TYPE_PrimaryDCache 4
141 1.1 thorpej #define COMPONENT_TYPE_SecondaryICache 5
142 1.1 thorpej #define COMPONENT_TYPE_SecondaryDCache 6
143 1.1 thorpej #define COMPONENT_TYPE_SecondaryCache 7
144 1.1 thorpej
145 1.1 thorpej /* Adapter Class */
146 1.1 thorpej #define COMPONENT_TYPE_EISAAdapter 8
147 1.1 thorpej #define COMPONENT_TYPE_TCAdapter 9
148 1.1 thorpej #define COMPONENT_TYPE_SCSIAdapter 10
149 1.1 thorpej #define COMPONENT_TYPE_DTIAdapter 11
150 1.1 thorpej #define COMPONENT_TYPE_MultiFunctionAdapter 12
151 1.1 thorpej
152 1.1 thorpej /* Controller Class */
153 1.1 thorpej #define COMPONENT_TYPE_DiskController 13
154 1.1 thorpej #define COMPONENT_TYPE_TapeController 14
155 1.1 thorpej #define COMPONENT_TYPE_CDROMController 15
156 1.1 thorpej #define COMPONENT_TYPE_WORMController 16
157 1.1 thorpej #define COMPONENT_TYPE_SerialController 17
158 1.1 thorpej #define COMPONENT_TYPE_NetworkController 18
159 1.1 thorpej #define COMPONENT_TYPE_DisplayController 19
160 1.1 thorpej #define COMPONENT_TYPE_ParallelController 20
161 1.1 thorpej #define COMPONENT_TYPE_PointerController 21
162 1.1 thorpej #define COMPONENT_TYPE_KeyboardController 22
163 1.1 thorpej #define COMPONENT_TYPE_AudioController 23
164 1.1 thorpej #define COMPONENT_TYPE_OtherController 24
165 1.1 thorpej
166 1.1 thorpej /* Peripheral Class */
167 1.1 thorpej #define COMPONENT_TYPE_DiskPeripheral 25
168 1.1 thorpej #define COMPONENT_TYPE_FloppyDiskPeripheral 26
169 1.1 thorpej #define COMPONENT_TYPE_TapePeripheral 27
170 1.1 thorpej #define COMPONENT_TYPE_ModemPeripheral 28
171 1.1 thorpej #define COMPONENT_TYPE_MonitorPeripheral 29
172 1.1 thorpej #define COMPONENT_TYPE_PrinterPeripheral 30
173 1.1 thorpej #define COMPONENT_TYPE_PointerPeripheral 31
174 1.1 thorpej #define COMPONENT_TYPE_KeyboardPeripheral 32
175 1.1 thorpej #define COMPONENT_TYPE_TerminalPeripheral 33
176 1.1 thorpej #define COMPONENT_TYPE_OtherPeripheral 34
177 1.1 thorpej #define COMPONENT_TYPE_LinePeripheral 35
178 1.1 thorpej #define COMPONENT_TYPE_NetworkPeripheral 36
179 1.1 thorpej
180 1.1 thorpej /* Memory Class */
181 1.1 thorpej #define COMPONENT_TYPE_MemoryUnit 37
182 1.1 thorpej
183 1.1 thorpej /* Component flags */
184 1.1 thorpej #define COMPONENT_FLAG_Failed 1
185 1.1 thorpej #define COMPONENT_FLAG_ReadOnly 2
186 1.1 thorpej #define COMPONENT_FLAG_Removable 4
187 1.1 thorpej #define COMPONENT_FLAG_ConsoleIn 8
188 1.1 thorpej #define COMPONENT_FLAG_ConsoleOut 16
189 1.1 thorpej #define COMPONENT_FLAG_Input 32
190 1.1 thorpej #define COMPONENT_FLAG_Output 64
191 1.1 thorpej
192 1.1 thorpej /* Key for Cache: */
193 1.1 thorpej #define COMPONENT_KEY_Cache_CacheSize(x) \
194 1.1 thorpej (ARCBIOS_PAGESIZE << ((x) & 0xffff))
195 1.1 thorpej #define COMPONENT_KEY_Cache_LineSize(x) \
196 1.1 thorpej (1U << (((x) >> 16) & 0xff))
197 1.1 thorpej #define COMPONENT_KEY_Cache_RefillSize(x) \
198 1.1 thorpej (((x) >> 24) & 0xff)
199 1.1 thorpej
200 1.1 thorpej /*
201 1.1 thorpej * ARC system ID
202 1.1 thorpej */
203 1.2 thorpej #define ARCBIOS_SYSID_FIELDLEN 8
204 1.1 thorpej struct arcbios_sysid {
205 1.2 thorpej char VendorId[ARCBIOS_SYSID_FIELDLEN];
206 1.2 thorpej char ProductId[ARCBIOS_SYSID_FIELDLEN];
207 1.1 thorpej };
208 1.1 thorpej
209 1.1 thorpej /*
210 1.1 thorpej * ARC memory descriptor
211 1.1 thorpej */
212 1.1 thorpej struct arcbios_mem {
213 1.1 thorpej uint32_t Type;
214 1.1 thorpej uint32_t BasePage;
215 1.1 thorpej uint32_t PageCount;
216 1.1 thorpej };
217 1.1 thorpej
218 1.1 thorpej #if defined(sgimips)
219 1.1 thorpej #define ARCBIOS_MEM_ExecptionBlock 0
220 1.1 thorpej #define ARCBIOS_MEM_SystemParameterBlock 1
221 1.1 thorpej #define ARCBIOS_MEM_FreeContiguous 2
222 1.1 thorpej #define ARCBIOS_MEM_FreeMemory 3
223 1.1 thorpej #define ARCBIOS_MEM_BadMemory 4
224 1.1 thorpej #define ARCBIOS_MEM_LoadedProgram 5
225 1.1 thorpej #define ARCBIOS_MEM_FirmwareTemporary 6
226 1.1 thorpej #define ARCBIOS_MEM_FirmwarePermanent 7
227 1.1 thorpej #elif defined(arc)
228 1.1 thorpej #define ARCBIOS_MEM_ExceptionBlock 0
229 1.1 thorpej #define ARCBIOS_MEM_SystemParameterBlock 1
230 1.1 thorpej #define ARCBIOS_MEM_FreeMemory 2
231 1.1 thorpej #define ARCBIOS_MEM_BadMemory 3
232 1.1 thorpej #define ARCBIOS_MEM_LoadedProgram 4
233 1.1 thorpej #define ARCBIOS_MEM_FirmwareTemporary 5
234 1.1 thorpej #define ARCBIOS_MEM_FirmwarePermanent 6
235 1.1 thorpej #define ARCBIOS_MEM_FreeContiguous 7
236 1.1 thorpej #endif
237 1.1 thorpej
238 1.1 thorpej /*
239 1.1 thorpej * ARC display status
240 1.1 thorpej */
241 1.1 thorpej struct arcbios_dsp_stat {
242 1.1 thorpej uint16_t CursorXPosition;
243 1.1 thorpej uint16_t CursorYPosition;
244 1.1 thorpej uint16_t CursorMaxXPosition;
245 1.1 thorpej uint16_t CursorMaxYPosition;
246 1.1 thorpej uint8_t ForegroundColor;
247 1.1 thorpej uint8_t BackgroundColor;
248 1.1 thorpej uint8_t HighIntensity;
249 1.1 thorpej uint8_t Underscored;
250 1.1 thorpej uint8_t ReverseVideo;
251 1.1 thorpej };
252 1.1 thorpej
253 1.1 thorpej /*
254 1.1 thorpej * ARC firmware vector
255 1.1 thorpej */
256 1.1 thorpej struct arcbios_fv {
257 1.1 thorpej uint32_t (*Load)(
258 1.1 thorpej char *, /* image to load */
259 1.1 thorpej uint32_t, /* top address */
260 1.1 thorpej uint32_t, /* entry address */
261 1.1 thorpej uint32_t *); /* low address */
262 1.1 thorpej
263 1.1 thorpej uint32_t (*Invoke)(
264 1.1 thorpej uint32_t, /* entry address */
265 1.1 thorpej uint32_t, /* stack address */
266 1.1 thorpej uint32_t, /* argc */
267 1.1 thorpej char **, /* argv */
268 1.1 thorpej char **); /* envp */
269 1.1 thorpej
270 1.1 thorpej uint32_t (*Execute)(
271 1.1 thorpej char *, /* image path */
272 1.1 thorpej uint32_t, /* argc */
273 1.1 thorpej char **, /* argv */
274 1.1 thorpej char **); /* envp */
275 1.1 thorpej
276 1.1 thorpej void (*Halt)(void)
277 1.1 thorpej __attribute__((__noreturn__));
278 1.1 thorpej
279 1.1 thorpej void (*PowerDown)(void)
280 1.1 thorpej __attribute__((__noreturn__));
281 1.1 thorpej
282 1.1 thorpej void (*Restart)(void)
283 1.1 thorpej __attribute__((__noreturn__));
284 1.1 thorpej
285 1.1 thorpej void (*Reboot)(void)
286 1.1 thorpej __attribute__((__noreturn__));
287 1.1 thorpej
288 1.1 thorpej void (*EnterInteractiveMode)(void)
289 1.1 thorpej __attribute__((__noreturn__));
290 1.1 thorpej #if defined(sgimips)
291 1.1 thorpej void *reserved0;
292 1.1 thorpej #else
293 1.1 thorpej void (*ReturnFromMain)(void)
294 1.1 thorpej __attribute__((__noreturn__));
295 1.1 thorpej #endif
296 1.1 thorpej void *(*GetPeer)(
297 1.1 thorpej void *); /* component */
298 1.1 thorpej
299 1.1 thorpej void *(*GetChild)(
300 1.1 thorpej void *); /* component */
301 1.1 thorpej
302 1.1 thorpej void *(*GetParent)(
303 1.1 thorpej void *); /* component */
304 1.1 thorpej
305 1.1 thorpej uint32_t (*GetConfigurationData)(
306 1.1 thorpej void *, /* configuration data */
307 1.1 thorpej void *); /* component */
308 1.1 thorpej
309 1.1 thorpej void *(*AddChild)(
310 1.1 thorpej void *, /* component */
311 1.1 thorpej void *); /* new component */
312 1.1 thorpej
313 1.1 thorpej uint32_t (*DeleteComponent)(
314 1.1 thorpej void *); /* component */
315 1.1 thorpej
316 1.1 thorpej uint32_t (*GetComponent)(
317 1.1 thorpej char *); /* path */
318 1.1 thorpej
319 1.1 thorpej uint32_t (*SaveConfiguration)(void);
320 1.1 thorpej
321 1.1 thorpej void *(*GetSystemId)(void);
322 1.1 thorpej
323 1.1 thorpej void *(*GetMemoryDescriptor)(
324 1.1 thorpej void *); /* memory descriptor */
325 1.1 thorpej #if defined(sgimips)
326 1.1 thorpej void *reserved1;
327 1.1 thorpej #else
328 1.1 thorpej void (*Signal)(
329 1.1 thorpej uint32_t, /* signal number */
330 1.1 thorpej void *); /* handler */
331 1.1 thorpej #endif
332 1.1 thorpej void *(*GetTime)(void);
333 1.1 thorpej
334 1.1 thorpej uint32_t (*GetRelativeTime)(void);
335 1.1 thorpej
336 1.1 thorpej uint32_t (*GetDirectoryEntry)(
337 1.1 thorpej uint32_t, /* file ID */
338 1.1 thorpej void *, /* directory entry */
339 1.1 thorpej uint32_t, /* length */
340 1.1 thorpej uint32_t *); /* count */
341 1.1 thorpej
342 1.1 thorpej uint32_t (*Open)(
343 1.1 thorpej char *, /* path */
344 1.1 thorpej uint32_t, /* open mode */
345 1.1 thorpej uint32_t *); /* file ID */
346 1.1 thorpej
347 1.1 thorpej uint32_t (*Close)(
348 1.1 thorpej uint32_t); /* file ID */
349 1.1 thorpej
350 1.1 thorpej uint32_t (*Read)(
351 1.1 thorpej uint32_t, /* file ID */
352 1.1 thorpej void *, /* buffer */
353 1.1 thorpej uint32_t, /* length */
354 1.1 thorpej uint32_t *); /* count */
355 1.1 thorpej
356 1.1 thorpej uint32_t (*GetReadStatus)(
357 1.1 thorpej uint32_t); /* file ID */
358 1.1 thorpej
359 1.1 thorpej uint32_t (*Write)(
360 1.1 thorpej uint32_t, /* file ID */
361 1.1 thorpej void *, /* buffer */
362 1.1 thorpej uint32_t, /* length */
363 1.1 thorpej uint32_t *); /* count */
364 1.1 thorpej
365 1.1 thorpej uint32_t (*Seek)(
366 1.1 thorpej uint32_t, /* file ID */
367 1.1 thorpej int64_t *, /* offset */
368 1.1 thorpej uint32_t); /* whence */
369 1.1 thorpej
370 1.1 thorpej uint32_t (*Mount)(
371 1.1 thorpej char *, /* path */
372 1.1 thorpej uint32_t); /* operation */
373 1.1 thorpej
374 1.1 thorpej char *(*GetEnvironmentVariable)(
375 1.1 thorpej char *); /* variable */
376 1.1 thorpej
377 1.1 thorpej uint32_t (*SetEnvironmentVariable)(
378 1.1 thorpej char *, /* variable */
379 1.1 thorpej char *); /* contents */
380 1.1 thorpej
381 1.1 thorpej uint32_t (*GetFileInformation)(
382 1.1 thorpej uint32_t, /* file ID */
383 1.1 thorpej void *); /* XXX */
384 1.1 thorpej
385 1.1 thorpej uint32_t (*SetFileInformation)(
386 1.1 thorpej uint32_t, /* file ID */
387 1.1 thorpej uint32_t, /* XXX */
388 1.1 thorpej uint32_t); /* XXX */
389 1.1 thorpej
390 1.1 thorpej void (*FlushAllCaches)(void);
391 1.1 thorpej #if !defined(sgimips)
392 1.1 thorpej uint32_t (*TestUnicode)(
393 1.1 thorpej uint32_t, /* file ID */
394 1.1 thorpej uint16_t); /* unicode character */
395 1.1 thorpej
396 1.1 thorpej void *(*GetDisplayStatus)(
397 1.1 thorpej uint32_t); /* file ID */
398 1.1 thorpej #endif
399 1.1 thorpej };
400