Annotation of sys/arch/mips64/include/arcbios.h, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: arcbios.h,v 1.7 2007/04/26 17:02:38 miod Exp $ */
2: /*-
3: * Copyright (c) 1996 M. Warner Losh. All rights reserved.
4: *
5: * Redistribution and use in source and binary forms, with or without
6: * modification, are permitted provided that the following conditions
7: * are met:
8: * 1. Redistributions of source code must retain the above copyright
9: * notice, this list of conditions and the following disclaimer.
10: * 2. Redistributions in binary form must reproduce the above copyright
11: * notice, this list of conditions and the following disclaimer in the
12: * documentation and/or other materials provided with the distribution.
13: * 3. Neither the name of the University nor the names of its contributors
14: * may be used to endorse or promote products derived from this software
15: * without specific prior written permission.
16: *
17: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27: * SUCH DAMAGE.
28: */
29:
30: #include <sys/types.h>
31:
32: typedef struct arc_sid
33: {
34: char vendor[8];
35: char prodid[8];
36: } arc_sid_t;
37:
38: typedef enum arc_config_class
39: {
40: arc_SystemClass,
41: arc_ProcessorClass,
42: arc_CacheClass,
43: arc_AdapterClass,
44: arc_ControllerClass,
45: arc_PeripheralClass,
46: arc_MemoryClass
47: } arc_config_class_t;
48:
49: typedef enum arc_config_type
50: {
51: arc_System,
52:
53: arc_CentralProcessor,
54: arc_FloatingPointProcessor,
55:
56: arc_PrimaryIcache,
57: arc_PrimaryDcache,
58: arc_SecondaryIcache,
59: arc_SecondaryDcache,
60: arc_SecondaryCache,
61:
62: arc_EisaAdapter, /* Eisa adapter */
63: arc_TcAdapter, /* Turbochannel adapter */
64: arc_ScsiAdapter, /* SCSI adapter */
65: arc_DtiAdapter, /* AccessBus adapter */
66: arc_MultiFunctionAdapter,
67:
68: arc_DiskController,
69: arc_TapeController,
70: arc_CdromController,
71: arc_WormController,
72: arc_SerialController,
73: arc_NetworkController,
74: arc_DisplayController,
75: arc_ParallelController,
76: arc_PointerController,
77: arc_KeyboardController,
78: arc_AudioController,
79: arc_OtherController, /* denotes a controller not otherwise defined */
80:
81: arc_DiskPeripheral,
82: arc_FloppyDiskPeripheral,
83: arc_TapePeripheral,
84: arc_ModemPeripheral,
85: arc_MonitorPeripheral,
86: arc_PrinterPeripheral,
87: arc_PointerPeripheral,
88: arc_KeyboardPeripheral,
89: arc_TerminalPeripheral,
90: arc_OtherPeripheral, /* denotes a peripheral not otherwise defined */
91: arc_LinePeripheral,
92: arc_NetworkPeripheral,
93:
94: arc_SystemMemory
95: } arc_config_type_t;
96:
97: typedef u_char arc_dev_flags_t;
98:
99: /* Wonder how this is aligned... */
100: typedef struct arc_config
101: {
102: arc_config_class_t class; /* Likely these three all */
103: arc_config_type_t type; /* need to be uchar to make */
104: arc_dev_flags_t flags; /* the alignment right */
105: u_int16_t version;
106: u_int16_t revision;
107: u_int32_t key;
108: u_int32_t affinity_mask;
109: u_int32_t config_data_len;
110: u_int32_t id_len;
111: int32_t id;
112: } arc_config_t;
113:
114: typedef enum arc_status
115: {
116: arc_ESUCCESS, /* Success */
117: arc_E2BIG, /* Arg list too long */
118: arc_EACCES, /* No such file or directory */
119: arc_EAGAIN, /* Try again */
120: arc_EBADF, /* Bad file number */
121: arc_EBUSY, /* Device or resource busy */
122: arc_EFAULT, /* Bad address */
123: arc_EINVAL, /* Invalid argument */
124: arc_EIO, /* I/O error */
125: arc_EISDIR, /* Is a directory */
126: arc_EMFILE, /* Too many open files */
127: arc_EMLINK, /* Too many links */
128: arc_ENAMETOOLONG, /* File name too long */
129: arc_ENODEV, /* No such device */
130: arc_ENOENT, /* No such file or directory */
131: arc_ENOEXEC, /* Exec format error */
132: arc_ENOMEM, /* Out of memory */
133: arc_ENOSPC, /* No space left on device */
134: arc_ENOTDIR, /* Not a directory */
135: arc_ENOTTY, /* Not a typewriter */
136: arc_ENXIO, /* No such device or address */
137: arc_EROFS, /* Read-only file system */
138: } arc_status_t;
139:
140: /*
141: * Oops! Arc systems and SGI's have different order of types.
142: */
143: #ifdef __arc__
144: typedef enum {
145: ExeceptionBlock, SystemParameterBlock, FreeMemory,
146: BadMemory, LoadedProgram, FirmwareTemporary,
147: FirmwarePermanent, FreeContigous
148: } MEMORYTYPE;
149: #endif
150:
151: #ifdef __sgi__
152: typedef enum {
153: ExeceptionBlock, SystemParameterBlock, FreeContigous,
154: FreeMemory, BadMemory, LoadedProgram,
155: FirmwareTemporary, FirmwarePermanent,
156: } MEMORYTYPE;
157: #endif
158:
159: typedef struct arc_mem {
160: MEMORYTYPE Type; /* Memory chunk type */
161: u_int32_t BasePage; /* Page no, first page */
162: u_int32_t PageCount; /* Number of pages */
163: } arc_mem_t;
164:
165: typedef caddr_t arc_time_t; /* XXX */
166:
167: typedef struct arc_dsp_stat {
168: u_int16_t CursorXPosition;
169: u_int16_t CursorYPosition;
170: u_int16_t CursorMaxXPosition;
171: u_int16_t CursorMaxYPosition;
172: u_char ForegroundColor;
173: u_char BackgroundColor;
174: u_char HighIntensity;
175: u_char Underscored;
176: u_char ReverseVideo;
177: } arc_dsp_stat_t;
178:
179: typedef caddr_t arc_dirent_t; /* XXX */
180: typedef u_int32_t arc_open_mode_t; /* XXX */
181: typedef u_int32_t arc_seek_mode_t; /* XXX */
182: typedef u_int32_t arc_mount_t; /* XXX */
183:
184: typedef struct arc_calls
185: {
186: arc_status_t (*load)( /* Load 1 */
187: char *, /* Image to load */
188: u_int32_t, /* top address */
189: u_int32_t *, /* Entry address */
190: u_int32_t *); /* Low address */
191:
192: arc_status_t (*invoke)( /* Invoke 2 */
193: u_int32_t, /* Entry Address */
194: u_int32_t, /* Stack Address */
195: u_int32_t, /* Argc */
196: char **, /* argv */
197: char **); /* envp */
198:
199: arc_status_t (*execute)( /* Execute 3 */
200: char *, /* Image path */
201: u_int32_t, /* Argc */
202: char **, /* argv */
203: char **); /* envp */
204:
205: volatile void (*halt)(void); /* Halt 4 */
206:
207: volatile void (*power_down)(void); /* PowerDown 5 */
208:
209: volatile void (*restart)(void); /* Restart 6 */
210:
211: volatile void (*reboot)(void); /* Reboot 7 */
212:
213: volatile void (*enter_interactive_mode)(void); /* EnterInteractiveMode 8 */
214:
215: volatile void (*return_from_main)(void); /* ReturnFromMain 9 */
216:
217: arc_config_t *(*get_peer)( /* GetPeer 10 */
218: arc_config_t *); /* Component */
219:
220: arc_config_t *(*get_child)( /* GetChild 11 */
221: arc_config_t *); /* Component */
222:
223: arc_config_t *(*get_parent)( /* GetParent 12 */
224: arc_config_t *); /* Component */
225:
226: arc_status_t (*get_config_data)( /* GetConfigurationData 13 */
227: caddr_t, /* Configuration Data */
228: arc_config_t *); /* Component */
229:
230: arc_config_t *(*add_child)( /* AddChild 14 */
231: arc_config_t *, /* Component */
232: arc_config_t *); /* New Component */
233:
234: arc_status_t (*delete_component)( /* DeleteComponent 15 */
235: arc_config_t *); /* Component */
236:
237: arc_config_t *(*get_component)( /* GetComponent 16 */
238: char *); /* Path */
239:
240: arc_status_t (*save_config)(void); /* SaveConfiguration 17 */
241:
242: arc_sid_t *(*get_system_id)(void); /* GetSystemId 18 */
243:
244: arc_mem_t *(*get_memory_descriptor)( /* GetMemoryDescriptor 19 */
245: arc_mem_t *); /* MemoryDescriptor */
246:
247: #ifdef arc
248: void (*signal)( /* Signal 20 */
249: u_int32_t, /* Signal number */
250: /**/ caddr_t); /* Handler */
251: #else
252: void *unused;
253: #endif
254:
255: arc_time_t *(*get_time)(void); /* GetTime 21 */
256:
257: u_int32_t (*get_relative_time)(void); /* GetRelativeTime 22 */
258:
259: arc_status_t (*get_dir_entry)( /* GetDirectoryEntry 23 */
260: u_int32_t, /* FileId */
261: arc_dirent_t *, /* Directory entry */
262: u_int32_t, /* Length */
263: u_int32_t *); /* Count */
264:
265: arc_status_t (*open)( /* Open 24 */
266: char *, /* Path */
267: arc_open_mode_t, /* Open mode */
268: u_int32_t *); /* FileId */
269:
270: arc_status_t (*close)( /* Close 25 */
271: u_int32_t); /* FileId */
272:
273: arc_status_t (*read)( /* Read 26 */
274: u_int32_t, /* FileId */
275: caddr_t, /* Buffer */
276: u_int32_t, /* Length */
277: u_int32_t *); /* Count */
278:
279: arc_status_t (*get_read_status)( /* GetReadStatus 27 */
280: u_int32_t); /* FileId */
281:
282: arc_status_t (*write)( /* Write 28 */
283: u_int32_t, /* FileId */
284: caddr_t, /* Buffer */
285: u_int32_t, /* Length */
286: u_int32_t *); /* Count */
287:
288: arc_status_t (*seek)( /* Seek 29 */
289: u_int32_t, /* FileId */
290: int64_t *, /* Offset */
291: arc_seek_mode_t); /* Mode */
292:
293: arc_status_t (*mount)( /* Mount 30 */
294: char *, /* Path */
295: arc_mount_t); /* Operation */
296:
297: char *(*getenv)( /* GetEnvironmentVariable 31 */
298: char *); /* Variable */
299:
300: arc_status_t (*putenv)( /* SetEnvironmentVariable 32 */
301: char *, /* Variable */
302: char *); /* Value */
303:
304: arc_status_t (*get_file_info)(void); /* GetFileInformation 33 */
305:
306: arc_status_t (*set_file_info)(void); /* SetFileInformation 34 */
307:
308: void (*flush_all_caches)(void); /* FlushAllCaches 35 */
309:
310: #ifdef arc
311: arc_status_t (*test_unicode)( /* TestUnicodeCharacter 36 */
312: u_int32_t, /* FileId */
313: u_int16_t); /* UnicodeCharacter */
314:
315: arc_dsp_stat_t *(*get_display_status)( /* GetDisplayStatus 37 */
316: u_int32_t); /* FileId */
317: #endif
318: } arc_calls_t;
319:
320: #define ARC_PARAM_BLK_MAGIC 0x53435241
321: #define ARC_PARAM_BLK_MAGIC_BUG 0x41524353 /* This is wrong... but req */
322:
323: typedef struct arc_param_blk_32
324: {
325: u_int32_t magic; /* Magic Number */
326: u_int32_t length; /* Length of parameter block */
327: u_int16_t version; /* ?? */
328: u_int16_t revision; /* ?? */
329: u_int32_t restart_block; /* ?? */
330: u_int32_t debug_block; /* Debugging info -- unused */
331: u_int32_t general_exp_vect; /* ?? */
332: u_int32_t tlb_miss_exp_vect; /* ?? */
333: u_int32_t firmware_length; /* Size of Firmware jumptable in bytes */
334: u_int32_t *firmware_vect; /* Firmware jumptable */
335: u_int32_t vendor_length; /* Size of Vendor specific jumptable */
336: u_int32_t vendor_vect; /* Vendor specific jumptable */
337: u_int32_t adapter_count; /* ?? */
338: u_int32_t adapter0_type; /* ?? */
339: u_int32_t adapter0_length; /* ?? */
340: u_int32_t adapter0_vect; /* ?? */
341: } arc_param_blk_32_t;
342:
343: typedef struct arc_param_blk_64
344: {
345: u_int64_t magic; /* Magic Number */
346: u_int64_t length; /* Length of parameter block */
347: u_int16_t version; /* ?? */
348: u_int16_t revision; /* ?? */
349: u_int64_t restart_block; /* ?? */
350: u_int64_t debug_block; /* Debugging info -- unused */
351: u_int64_t general_exp_vect; /* ?? */
352: u_int64_t tlb_miss_exp_vect; /* ?? */
353: u_int64_t firmware_length; /* Size of Firmware jumptable in bytes */
354: u_int64_t *firmware_vect; /* Firmware jumptable */
355: u_int64_t vendor_length; /* Size of Vendor specific jumptable */
356: u_int64_t vendor_vect; /* Vendor specific jumptable */
357: u_int64_t adapter_count; /* ?? */
358: u_int64_t adapter0_type; /* ?? */
359: u_int64_t adapter0_length; /* ?? */
360: u_int64_t adapter0_vect; /* ?? */
361: } arc_param_blk_64_t;
362:
363: #ifdef _LP64
364: #define ArcBiosBase32 ((arc_param_blk_32_t *) 0xffffffff80001000)
365: #define ArcBiosBase64 ((arc_param_blk_64_t *) 0xffffffff80001000)
366: #else
367: #define ArcBiosBase32 ((arc_param_blk_32_t *) 0x80001000)
368: #define ArcBiosBase64 ((arc_param_blk_64_t *) 0x80001000)
369: #endif
370: #define ArcBios (ArcBiosBase->firmware_vect)
371:
372: extern int bios_is_32bit;
373: extern char bios_enaddr[20];
374:
375: int bios_getchar(void);
376: void bios_putchar(char);
377: void bios_putstring(char *);
378: void bios_printf(const char *, ...);
379: void bios_ident(void);
380: void bios_display_info(int *, int *, int *, int *);
381:
382: /*
383: * Direct ARC-Bios calls.
384: */
385: int Bios_Load(char *, u_int32_t, u_int32_t, u_int32_t *);
386: int Bios_Invoke(uint32_t, uint32_t, uint32_t, char **, char **);
387: int Bios_Execute(char *, u_int32_t, char **, char **);
388: void Bios_Halt(void);
389: void Bios_PowerDown(void);
390: void Bios_Restart(void);
391: void Bios_Reboot(void);
392: void Bios_EnterInteractiveMode(void);
393: int Bios_GetPeer(void *);
394: arc_config_t *Bios_GetChild(void *);
395: int Bios_GetParent(void *);
396: int Bios_GetConfigurationData(void *, void *);
397: int Bios_AddChild(void *, void *);
398: int Bios_DeleteComponent(void *);
399: int Bios_GetComponent(char *);
400: int Bios_SaveConfiguration(void);
401: arc_sid_t *Bios_GetSystemId(void);
402: arc_mem_t *Bios_GetMemoryDescriptor(void *);
403: int Bios_GetTime(void);
404: int Bios_GetRelativeTime(void);
405: int Bios_GetDirectoryEntry(u_int32_t, void *, u_int32_t, u_int32_t *);
406: int Bios_Open(char *, int, u_int *);
407: int Bios_Close(u_int);
408: int Bios_Read(int, char *, int, int *);
409: int Bios_GetReadStatus(u_int);
410: int Bios_Write(int, char *, int, int *);
411: int Bios_Seek(int, int64_t *, int);
412: int Bios_Mount(char *, void *);
413: char *Bios_GetEnvironmentVariable(const char *);
414: int Bios_SetEnvironmentVariable(char *, char *);
415: int Bios_GetFileInformation(u_int32_t, u_int32_t, u_int32_t);
416: int Bios_SetFileInformation(u_int32_t, u_int32_t, u_int32_t);
417: void Bios_FlushAllCaches(void);
418: int Bios_TestUnicodeCharacter(u_int32_t, u_int16_t);
419: arc_dsp_stat_t *Bios_GetDisplayStatus(u_int32_t);
420:
421:
CVSweb