arcbios_other.h Source File

Back to the index.

arcbios_other.h
Go to the documentation of this file.
1 /* gxemul: $Id: arcbios_other.h,v 1.3 2005-03-05 12:34:02 debug Exp $ */
2 /* $NetBSD: arcbios.h,v 1.2 2000/01/23 21:01:50 soda Exp $ */
3 /* $OpenBSD: arcbios.h,v 1.4 1997/05/01 15:13:30 pefo Exp $ */
4 
5 #ifndef ARCBIOS_OTHER_H
6 #define ARCBIOS_OTHER_H
7 
8 /*-
9  * Copyright (c) 1996 M. Warner Losh. All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in the
18  * documentation and/or other materials provided with the distribution.
19  * 3. Neither the name of the University nor the names of its contributors
20  * may be used to endorse or promote products derived from this software
21  * without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35 
36 #include <sys/types.h>
37 
38 typedef struct arc_sid
39 {
40  char vendor[8];
41  char prodid[8];
42 } arc_sid_t;
43 
44 /* struct arc_config::class */
45 #define arc_SystemClass 0
46 #define arc_ProcessorClass 1
47 #define arc_CacheClass 2
48 #define arc_AdapterClass 3
49 #define arc_ControllerClass 4
50 #define arc_PeripheralClass 5
51 #define arc_MemoryClass 6
52 
53 /* struct arc_config::type */
54 #define arc_System
55 
56 #define arc_CentralProcessor
57 #define arc_FloatingPointProcessor
58 
59 #define arc_PrimaryIcache
60 #define arc_PrimaryDcache
61 #define arc_SecondaryIcache
62 #define arc_SecondaryDcache
63 #define arc_SecondaryCache
64 
65 #define arc_EisaAdapter /* Eisa adapter */
66 #define arc_TcAdapter /* Turbochannel adapter */
67 #define arc_ScsiAdapter /* SCSI adapter */
68 #define arc_DtiAdapter /* AccessBus adapter */
69 #define arc_MultiFunctionAdapter
70 
71 #define arc_DiskController 0
72 #define arc_TapeController 1
73 #define arc_CdromController 2
74 #define arc_WormController 3
75 #define arc_SerialController 4
76 #define arc_NetworkController 5
77 #define arc_DisplayController 6
78 #define arc_ParallelController 7
79 #define arc_PointerController 8
80 #define arc_KeyboardController 9
81 #define arc_AudioController 10
82 #define arc_OtherController 11 /* denotes a controller not otherwise defined */
83 
84 #define arc_DiskPeripheral 12
85 #define arc_FloppyDiskPeripheral 13
86 #define arc_TapePeripheral 14
87 #define arc_ModemPeripheral 15
88 #define arc_MonitorPeripheral 16
89 #define arc_PrinterPeripheral 17
90 #define arc_PointerPeripheral 18
91 #define arc_KeyboardPeripheral 19
92 #define arc_TerminalPeripheral 20
93 #define arc_OtherPeripheral 21 /* denotes a peripheral not otherwise defined */
94 #define arc_LinePeripheral 22
95 #define arc_NetworkPeripheral 23
96 
97 #define arc_SystemMemory 24
98 
99 /* struct arc_config::flag */
100 #define arc_PeripheralFailed 0x01
101 #define arc_PeripheralReadOnly 0x02
102 #define arc_PeripheralRemovable 0x04
103 #define arc_PeripheralConsoleIn 0x08
104 #define arc_PeripheralConsoleOut 0x10
105 #define arc_PeripheralInput 0x20
106 #define arc_PeripheralOutput 0x40
107 
108 /* Wonder how this is aligned... */
109 typedef struct arc_config
110 {
111  u_int32_t cclass; // class
112  u_int32_t type;
113  u_int32_t flags;
114  u_int16_t version;
115  u_int16_t revision;
116  u_int32_t key;
117  u_int32_t affinity_mask;
118  u_int32_t config_data_len;
119  u_int32_t id_len;
120  char *id;
121 } arc_config_t;
122 
123 typedef enum arc_cm_resource_type {
134 
135 /* do not use u_int64_t to avoid alignment problem */
136 typedef struct {
137  u_int32_t loword;
138  u_int32_t hiword;
139 } arc_paddr_t;
140 
141 typedef struct arc_cm_partial_resource {
142  u_int8_t type;
144  u_int16_t flags;
145 
146  union {
147  struct {
149  u_int32_t length;
150  } port;
151  struct {
152  u_int32_t level;
153  u_int32_t vector;
154  u_int32_t reserved1;
155  } interrupt;
156  struct {
157  arc_paddr_t start;
158  u_int32_t length;
159  } memory;
160  struct {
161  u_int32_t channel;
162  u_int32_t port;
163  u_int32_t reserved1;
164  } dma;
165  struct {
166  u_int8_t vendor[12];
167  } vendor;
168  struct {
169  u_int8_t product_name[12];
170  } product_name;
171  struct {
172  u_int8_t serial_number[12];
173  } serial_number;
174  struct {
175  u_int32_t data_size;
176  u_int32_t reserved1;
177  u_int32_t reserved2;
178  /* the data is followed */
179  } device_specific_data;
180  } u;
182 
184  u_int16_t version;
185  u_int16_t revision;
186  u_int32_t count;
187  arc_cm_partial_resource_t partial_descriptors[1];
189 
196 
197 /* arc_cm_partial_resource_t::flags when type == arc_CmResourceTypeInterrupt */
202 
203 /* arc_cm_partial_resource_t::flags when type == arc_CmResourceTypeMemory */
204 typedef enum arc_cm_flags_memory {
209 
210 /* arc_cm_partial_resource_t::flags when type == arc_CmResourceTypePort */
211 typedef enum arc_cm_flags_port {
215 
216 typedef enum arc_status
217 {
218  arc_ESUCCESS, /* Success */
219  arc_E2BIG, /* Arg list too long */
220  arc_EACCES, /* No such file or directory */
221  arc_EAGAIN, /* Try again */
222  arc_EBADF, /* Bad file number */
223  arc_EBUSY, /* Device or resource busy */
224  arc_EFAULT, /* Bad address */
225  arc_EINVAL, /* Invalid argument */
226  arc_EIO, /* I/O error */
227  arc_EISDIR, /* Is a directory */
228  arc_EMFILE, /* Too many open files */
229  arc_EMLINK, /* Too many links */
230  arc_ENAMETOOLONG, /* File name too long */
231  arc_ENODEV, /* No such device */
232  arc_ENOENT, /* No such file or directory */
233  arc_ENOEXEC, /* Exec format error */
234  arc_ENOMEM, /* Out of memory */
235  arc_ENOSPC, /* No space left on device */
236  arc_ENOTDIR, /* Not a directory */
237  arc_ENOTTY, /* Not a typewriter */
238  arc_ENXIO, /* No such device or address */
239  arc_EROFS, /* Read-only file system */
240 } arc_status_t;
241 
242 typedef enum {
252 
253 typedef struct arc_mem {
254  arc_mem_type_t Type; /* Memory chunk type */
255  u_int32_t BasePage; /* Page no, first page */
256  u_int32_t PageCount; /* Number of pages */
257 } arc_mem_t;
258 
259 typedef caddr_t arc_time_t; /* XXX */
260 
261 typedef struct arc_dsp_stat {
262  u_int16_t CursorXPosition;
263  u_int16_t CursorYPosition;
266  u_int8_t ForegroundColor;
267  u_int8_t BackgroundColor;
268  u_int8_t HighIntensity;
269  u_int8_t Underscored;
270  u_int8_t ReverseVideo;
272 
273 typedef caddr_t arc_dirent_t; /* XXX */
274 typedef u_int32_t arc_seek_mode_t; /* XXX */
275 typedef u_int32_t arc_mount_t; /* XXX */
276 
277 typedef enum arc_open_mode {
288 
289 typedef struct arc_calls
290 {
291  arc_status_t (*load)( /* Load 1 */
292  char *, /* Image to load */
293  u_int32_t, /* top address */
294  u_int32_t *, /* Entry address */
295  u_int32_t *); /* Low address */
296 
297  arc_status_t (*invoke)( /* Invoke 2 */
298  u_int32_t, /* Entry Address */
299  u_int32_t, /* Stack Address */
300  u_int32_t, /* Argc */
301  char **, /* argv */
302  char **); /* envp */
303 
304  arc_status_t (*execute)( /* Execute 3 */
305  char *, /* Image path */
306  u_int32_t, /* Argc */
307  char **, /* argv */
308  char **); /* envp */
309 
310  void (*halt)(void); /* Halt 4 */
311 
312  void (*power_down)(void); /* PowerDown 5 */
313 
314  void (*restart)(void); /* Restart 6 */
315 
316  void (*reboot)(void); /* Reboot 7 */
317 
318  void (*enter_interactive_mode)(void); /* EnterInteractiveMode 8 */
319 
320  void (*return_from_main)(void); /* ReturnFromMain 9 */
321 
322  arc_config_t *(*get_peer)( /* GetPeer 10 */
323  arc_config_t *); /* Component */
324 
325  arc_config_t *(*get_child)( /* GetChild 11 */
326  arc_config_t *); /* Component */
327 
328  arc_config_t *(*get_parent)( /* GetParent 12 */
329  arc_config_t *); /* Component */
330 
331  arc_status_t (*get_config_data)( /* GetConfigurationData 13 */
332  caddr_t, /* Configuration Data */
333  arc_config_t *); /* Component */
334 
335  arc_config_t *(*add_child)( /* AddChild 14 */
336  arc_config_t *, /* Component */
337  arc_config_t *); /* New Component */
338 
339  arc_status_t (*delete_component)( /* DeleteComponent 15 */
340  arc_config_t *); /* Component */
341 
342  arc_config_t *(*get_component)( /* GetComponent 16 */
343  char *); /* Path */
344 
345  arc_status_t (*save_config)(void); /* SaveConfiguration 17 */
346 
347  arc_sid_t *(*get_system_id)(void); /* GetSystemId 18 */
348 
349  arc_mem_t *(*get_memory_descriptor)( /* GetMemoryDescriptor 19 */
350  arc_mem_t *); /* MemoryDescriptor */
351 
352  void (*signal)( /* Signal 20 */
353  u_int32_t, /* Signal number */
354 /**/ caddr_t); /* Handler */
355 
356  arc_time_t *(*get_time)(void); /* GetTime 21 */
357 
358  u_int32_t (*get_relative_time)(void); /* GetRelativeTime 22 */
359 
360  arc_status_t (*get_dir_entry)( /* GetDirectoryEntry 23 */
361  u_int32_t, /* FileId */
362  arc_dirent_t *, /* Directory entry */
363  u_int32_t, /* Length */
364  u_int32_t *); /* Count */
365 
366  arc_status_t (*open)( /* Open 24 */
367  char *, /* Path */
368  arc_open_mode_t, /* Open mode */
369  u_int32_t *); /* FileId */
370 
371  arc_status_t (*close)( /* Close 25 */
372  u_int32_t); /* FileId */
373 
374  arc_status_t (*read)( /* Read 26 */
375  u_int32_t, /* FileId */
376  caddr_t, /* Buffer */
377  u_int32_t, /* Length */
378  u_int32_t *); /* Count */
379 
380  arc_status_t (*get_read_status)( /* GetReadStatus 27 */
381  u_int32_t); /* FileId */
382 
383  arc_status_t (*write)( /* Write 28 */
384  u_int32_t, /* FileId */
385  caddr_t, /* Buffer */
386  u_int32_t, /* Length */
387  u_int32_t *); /* Count */
388 
389  arc_status_t (*seek)( /* Seek 29 */
390  u_int32_t, /* FileId */
391  int64_t *, /* Offset */
392  arc_seek_mode_t); /* Mode */
393 
394  arc_status_t (*mount)( /* Mount 30 */
395  char *, /* Path */
396  arc_mount_t); /* Operation */
397 
398  char *(*getenv)( /* GetEnvironmentVariable 31 */
399  char *); /* Variable */
400 
401  arc_status_t (*putenv)( /* SetEnvironmentVariable 32 */
402  char *, /* Variable */
403  char *); /* Value */
404 
405  arc_status_t (*get_file_info)(void); /* GetFileInformation 33 */
406 
407  arc_status_t (*set_file_info)(void); /* SetFileInformation 34 */
408 
409  void (*flush_all_caches)(void); /* FlushAllCaches 35 */
410 
411  arc_status_t (*test_unicode)( /* TestUnicodeCharacter 36 */
412  u_int32_t, /* FileId */
413  u_int16_t); /* UnicodeCharacter */
414 
415  arc_dsp_stat_t *(*get_display_status)( /* GetDisplayStatus 37 */
416  u_int32_t); /* FileId */
417 } arc_calls_t;
418 
419 #define ARC_PARAM_BLK_MAGIC 0x53435241 /* "ARCS" in little endian */
420 #define ARC_PARAM_BLK_MAGIC_BUG 0x41524353 /* This is wrong... but req */
421 
422 typedef struct arc_param_blk
423 {
424  u_int32_t magic; /* Magic Number */
425  u_int32_t length; /* Length of parameter block */
426  u_int16_t version; /* ?? */
427  u_int16_t revision; /* ?? */
428 /**/ caddr_t restart_block; /* ?? */
429 /**/ caddr_t debug_block; /* Debugging info -- unused */
430 /**/ caddr_t general_exp_vect; /* ?? */
431 /**/ caddr_t tlb_miss_exp_vect; /* ?? */
432  u_int32_t firmware_length; /* Size of Firmware jumptable in bytes */
433  arc_calls_t *firmware_vect; /* Firmware jumptable */
434  u_int32_t vendor_length; /* Size of Vendor specific jumptable */
435 /**/ caddr_t vendor_vect; /* Vendor specific jumptable */
436  u_int32_t adapter_count; /* ?? */
438  u_int32_t adapter_type; /* ?? */
439  u_int32_t adapter_length; /* ?? */
440 /**/ caddr_t adapter_vect; /* ?? */
441  } adapters[1];
443 
444 #define ArcBiosBase ((arc_param_blk_t *) 0x80001000)
445 #define ArcBios (ArcBiosBase->firmware_vect)
446 
447 #if 0
448 arc_status_t Bios_Read __P((int, void *, int, int *));
449 arc_status_t Bios_Write __P((int, void *, int, int *));
450 arc_status_t Bios_Open __P((char *, int, u_int *));
451 arc_status_t Bios_Close __P((u_int));
452 arc_mem_t *Bios_GetMemoryDescriptor __P((arc_mem_t *));
453 arc_sid_t *Bios_GetSystemId __P((void));
454 arc_config_t *Bios_GetChild __P((arc_config_t *));
455 arc_config_t *Bios_GetPeer __P((arc_config_t *));
456 int Bios_GetConfigurationData __P((void *, arc_config_t *));
457 arc_dsp_stat_t *Bios_GetDisplayStatus __P((int));
458 
459 const char *const arc_strerror __P((int error));
460 
461 int biosgetc __P((dev_t));
462 void biosputc __P((dev_t, int));
463 #endif
464 
465 #endif /* ARCBIOS_OTHER_H */
466 
caddr_t arc_dirent_t
arc_cm_resource_type
u_int32_t length
u_int32_t key
u_int16_t CursorMaxXPosition
u_int32_t loword
u_int32_t arc_mount_t
u_int16_t version
caddr_t debug_block
char vendor[8]
Definition: arcbios_other.h:40
arc_mem_type_t Type
caddr_t general_exp_vect
u_int32_t vendor_length
arc_calls_t * firmware_vect
u_int32_t arc_seek_mode_t
u_int32_t adapter_count
u_int32_t magic
char prodid[8]
Definition: arcbios_other.h:41
struct arc_calls arc_calls_t
enum arc_cm_resource_type arc_cm_resource_type_t
struct arc_cm_partial_resource_list arc_cm_partial_resource_list_t
arc_cm_flags_memory
enum arc_status arc_status_t
u_int32_t type
arc_cm_share_disposition
struct arc_cm_partial_resource arc_cm_partial_resource_t
u_int8_t Underscored
arc_mem_type_t
u_int16_t CursorYPosition
arc_cm_flags_interrupt
struct arc_dsp_stat arc_dsp_stat_t
u_int32_t hiword
enum arc_cm_share_disposition arc_cm_share_disposition_t
u_int32_t affinity_mask
struct arc_config arc_config_t
caddr_t vendor_vect
#define __P(x)
Definition: dec_prom.h:6
struct arc_sid arc_sid_t
u_int16_t revision
enum arc_open_mode arc_open_mode_t
arc_status
u_int32_t BasePage
struct arc_param_blk arc_param_blk_t
arc_cm_flags_port
u_int32_t flags
void load(FILE *fh, unsigned char *ptr, unsigned long sz)
u_int8_t BackgroundColor
caddr_t tlb_miss_exp_vect
u_int8_t ReverseVideo
enum arc_cm_flags_interrupt arc_cm_flags_interrupt_t
u_int16_t version
enum arc_cm_flags_memory arc_cm_flags_memory_t
u_int16_t revision
caddr_t arc_time_t
Definition: memory.h:75
u_int32_t PageCount
u_int32_t firmware_length
u_int32_t cclass
u_int8_t ForegroundColor
u_int16_t CursorMaxYPosition
u_int16_t CursorXPosition
u_int32_t id_len
struct arc_mem arc_mem_t
u_int32_t config_data_len
caddr_t restart_block
u_int8_t HighIntensity
arc_open_mode

Generated on Sun Sep 30 2018 16:05:18 for GXemul by doxygen 1.8.13