Initial import from FreeBSD RELENG_4:
[dragonfly.git] / sys / boot / arc / include / arctypes.h
1 /*
2  * Copyright (c) 1999, Stefan Esser <se@freebsd.org>
3  * 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 unmodified, this list of conditions, and the following
10  *    disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  *    notice, this list of conditions and the following disclaimer in the
13  *    documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  *
26  * $FreeBSD: src/sys/boot/arc/include/arctypes.h,v 1.2 1999/08/28 00:39:34 peter Exp $
27  *
28  */
29
30 #ifndef _ARC_TYPES_H_
31 #define _ARC_TYPES_H_
32
33 #define ESUCCESS 0
34
35 typedef u_int8_t        BOOLEAN;        
36 typedef u_int16_t       WCHAR;
37
38 typedef int64_t         fpos_t;
39
40 /* XXX the following types are defined in ARC but are not currently used */
41
42 #if 0
43
44 typedef void            VOID;
45
46 typedef int8_t          CHAR;
47 typedef int16_t         SHORT;
48 typedef int32_t         LONG;
49 typedef int64_t         LONGLONG;
50
51 typedef u_int8_t        UCHAR;
52 typedef u_int16_t       USHORT;
53 typedef u_int32_t       ULONG;
54 typedef u_int64_t       ULONGLONG;
55
56 /*
57  * The following ARC types conflict with <sys/types.h> !
58  * They are not used in the ARC wrapper functions or ARC structs
59  * currently, and thus may be left alone for now. In case the 
60  * wrappers or structs are converted to use them, it is suggested
61  * to prefix them with "arc" to avoid type clashes (if linking
62  * against libstand.a which expects the FreeBSD declarations).
63  */
64
65 typedef u_int32_t       size_t;
66 typedef int64_t         clock_t;
67 typedef int64_t         off_t;
68 typedef int32_t         time_t;
69
70 #endif /* 0 */
71
72 typedef struct {
73    int32_t adr;
74 } arcptr;
75
76 typedef struct {
77    u_int32_t    SPBSignature;
78    u_int32_t    SPBLength;
79    u_int16_t    Version;
80    u_int16_t    Revision;
81    arcptr       RestartBlockP;
82    arcptr       DebugBlockP;
83    arcptr       GEVectorP;
84    arcptr       ULTBMissVectorP;
85    u_int32_t    FirmwareVectorLength;
86    arcptr       FirmwareVectorP;
87    u_int32_t    PrivateVectorLength;
88    arcptr       PrivateVectorP;
89    u_int32_t    AdapterCount;
90    struct {
91       u_int32_t AdapterType;
92       u_int32_t AdapterVectorLength;
93       arcptr    AdapterVectorP;
94    } Adapters[1];
95 } SPB;
96
97 /* ARC function specific data types */
98
99 typedef enum{
100     SystemClass,
101     ProcessorClass,
102     CacheClass,
103     AdapterClass,
104     ControllerClass,
105     PeripheralClass,
106     MemoryClass,
107     MaximumClass
108 } CONFIGURATION_CLASS;
109
110 typedef enum {
111     ArcSystem,
112     CentralProcessor,
113     FloatingPointProcessor,
114     PrimaryIcache,
115     PrimaryDcache,
116     SecondaryIcache,
117     SecondaryDcache,
118     SecondaryCache,
119     EisaAdapter,
120     TcAdapter,
121     ScsiAdapter,
122     DtiAdapter,
123     MultiFunctionAdapter,
124     DiskController,
125     TapeController,
126     CdromController,
127     WormController,
128     SerialController,
129     NetworkController,
130     DisplayController,
131     ParallelController,
132     PointerController,
133     KeyboardController,
134     AudioController,
135     OtherController,
136     DiskPeripheral,
137     FloppyDiskPeripheral,
138     TapePeripheral,
139     ModemPeripheral,
140     MonitorPeripheral,
141     PrinterPeripheral,
142     PointerPeripheral,
143     KeyboardPeripheral,
144     TerminalPeripheral,
145     OtherPeripheral,
146     LinePeripheral,
147     NetworkPeripheral,
148     SystemMemory,
149     MaximumType
150 } CONFIGURATION_TYPE, *PCONFIGURATION_TYPE;
151
152 typedef enum {
153     Failed =            0x01,
154     ReadOnly =          0x02,
155     Removable =         0x04,
156     ConsoleIn =         0x08,
157     ConsoleOut =        0x10,
158     Input =             0x20,
159     Output =            0x40
160 } IDENTIFIERFLAG;
161
162 typedef struct {
163     CONFIGURATION_CLASS Class;
164     CONFIGURATION_TYPE  Type;
165     IDENTIFIERFLAG      Flags;
166     u_int16_t           Version;
167     u_int16_t           Revision;
168     u_int32_t           Key;
169     u_int32_t           AffinityMask;
170     u_int32_t           ConfigurationDataLength;
171     u_int32_t           IdentifierLength;
172     arcptr              Identifier;
173 } CONFIGURATION_COMPONENT, *PCONFIGURATION_COMPONENT;
174
175 typedef struct {
176     int8_t              VendorId[8];
177     int8_t              ProductId[8];
178 } SYSTEM_ID;
179
180 typedef enum {
181     MemoryExceptionBlock,
182     MemorySystemBlock,
183     MemoryFree,
184     MemoryBad,
185     MemoryLoadedProgram,
186     MemoryFirmwareTemporary,
187     MemoryFirmwarePermanent,
188     MemoryFreeContiguous,
189     MemorySpecialMemory,
190     MemoryMaximum
191 } MEMORY_TYPE;
192
193 typedef struct {
194     MEMORY_TYPE Type;
195     u_int32_t           BasePage;
196     u_int32_t           PageCount;
197 } MEMORY_DESCRIPTOR;
198
199 typedef struct _TIME_FIELDS{
200     u_int16_t           Year;           /* 1601 .. */
201     u_int16_t           Month;          /* 1 .. 12 */
202     u_int16_t           Day;            /* 1 .. 31 */
203     u_int16_t           Hour;           /* 0 .. 23 */
204     u_int16_t           Minute;         /* 0 .. 59 */
205     u_int16_t           Second;         /* 0 .. 59 */
206     u_int16_t           Milliseconds;   /* 0 .. 999 */
207     u_int16_t           Weekday;        /* 0 .. 6 = Sunday .. Saturday  */
208 } TIME_FIELDS, *PTIME_FIELDS;
209
210 #define StandardIn      0
211 #define StandardOut     1
212
213 #define ReadOnlyFile    0x01
214 #define HiddenFile      0x02
215 #define SystemFile      0x04
216 #define ArchiveFile     0x08
217 #define DirectoryFile   0x10
218 #define DeleteFile      0x20
219
220 typedef struct {
221     u_int32_t           FileNameLength;
222     u_int8_t            FileAttribute;
223     int8_t              FileName[32];
224 } DIRECTORY_ENTRY;
225
226 typedef enum {
227     OpenReadOnly,
228     OpenWriteOnly,
229     OpenReadWrite,
230     CreateWriteOnly,
231     CreateReadWrite,
232     SupersedeWriteOnly,
233     SupersedeReadWrite,
234     OpenDirectory,
235     CreateDirectory,
236     OpenMaximumMode
237 } OPEN_MODE;
238
239 typedef enum {
240     SeekAbsolute,
241     SeekRelative,
242     SeekMaximum
243 } SEEK_MODE;
244
245 typedef enum {
246     MountLoadMedia,
247     MountUnloadMedia,
248     MountMaximum
249 } MOUNT_OPERATION;
250
251 typedef struct {
252     fpos_t              StartingAddress;
253     fpos_t              EndingAddress;
254     fpos_t              CurrentAddress;
255     CONFIGURATION_TYPE  Type;
256     u_int32_t           FileNameLength;
257     u_int8_t            Attributes;
258     int8_t              FileName[32];
259 } FILE_INFORMATION;
260
261 typedef struct {
262     u_int16_t           CursorXPosition;
263     u_int16_t           CursorYPosition;
264     u_int16_t           CursorMaxXPosition;
265     u_int16_t           CursorMaxYPosition;
266     u_int8_t            ForegroundColor;
267     u_int8_t            BackgroundColor;
268     BOOLEAN             HighIntensity;
269     BOOLEAN             Underscored;
270     BOOLEAN             ReverseVideo;
271 } ARC_DISPLAY_STATUS;
272
273 /* vendor function specific data types */
274
275 typedef struct {
276     u_int32_t   ProcessorId;
277     u_int32_t   ProcessorRevision;
278     u_int32_t   ProcessorPageSize;
279     u_int32_t   NumberOfPhysicalAddressBits;
280     u_int32_t   MaximumAddressSpaceNumber;
281     u_int32_t   ProcessorCycleCounterPeriod;
282     u_int32_t   SystemRevision;
283     u_int8_t    SystemSerialNumber[16];
284     u_int8_t    FirmwareVersion[16];
285     u_int8_t    FirmwareBuildTimeStamp[12];
286 } EXTENDED_SYSTEM_INFORMATION, *PEXTENDED_SYSTEM_INFORMATION; 
287
288 #endif /* _ARC_TYPES_H_ */