efidef.h revision 1.4 1 /* $NetBSD: efidef.h,v 1.4 2019/09/13 20:56:29 tnn Exp $ */
2
3 #ifndef _EFI_DEF_H
4 #define _EFI_DEF_H
5
6 /*++
7
8 Copyright (c) 1998 Intel Corporation
9
10 Module Name:
11
12 efidef.h
13
14 Abstract:
15
16 EFI definitions
17
18
19
20
21 Revision History
22
23 --*/
24
25 typedef UINT16 CHAR16;
26 typedef UINT8 CHAR8;
27 #ifndef __ACTYPES_H__
28 typedef UINT8 BOOLEAN;
29 #endif /* __ACTYPES_H__ */
30 #ifndef CONST
31 #define CONST const
32 #endif
33 #ifndef TRUE
34 #define TRUE ((BOOLEAN) 1)
35 #define FALSE ((BOOLEAN) 0)
36 #endif
37
38 #ifndef NULL
39 #define NULL ((VOID *) 0)
40 #endif
41
42 typedef UINTN EFI_STATUS;
43 typedef UINT64 EFI_LBA;
44 typedef UINTN EFI_TPL;
45 typedef VOID *EFI_HANDLE;
46 typedef VOID *EFI_EVENT;
47
48
49 //
50 // Prototype argument decoration for EFI parameters to indicate
51 // their direction
52 //
53 // IN - argument is passed into the function
54 // OUT - argument (pointer) is returned from the function
55 // OPTIONAL - argument is optional
56 //
57
58 #ifndef IN
59 #define IN
60 #define OUT
61 #define OPTIONAL
62 #endif
63
64
65 //
66 // A GUID
67 //
68
69 typedef struct {
70 UINT32 Data1;
71 UINT16 Data2;
72 UINT16 Data3;
73 UINT8 Data4[8];
74 } EFI_GUID;
75
76
77 //
78 // Time
79 //
80
81 typedef struct {
82 UINT16 Year; // 1998 - 20XX
83 UINT8 Month; // 1 - 12
84 UINT8 Day; // 1 - 31
85 UINT8 Hour; // 0 - 23
86 UINT8 Minute; // 0 - 59
87 UINT8 Second; // 0 - 59
88 UINT8 Pad1;
89 UINT32 Nanosecond; // 0 - 999,999,999
90 INT16 TimeZone; // -1440 to 1440 or 2047
91 UINT8 Daylight;
92 UINT8 Pad2;
93 } EFI_TIME;
94
95 // Bit definitions for EFI_TIME.Daylight
96 #define EFI_TIME_ADJUST_DAYLIGHT 0x01
97 #define EFI_TIME_IN_DAYLIGHT 0x02
98
99 // Value definition for EFI_TIME.TimeZone
100 #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
101
102
103
104 //
105 // Networking
106 //
107
108 typedef struct {
109 UINT8 Addr[4];
110 } EFI_IPv4_ADDRESS;
111
112 typedef struct {
113 UINT8 Addr[16];
114 } EFI_IPv6_ADDRESS;
115
116 typedef struct {
117 UINT8 Addr[32];
118 } EFI_MAC_ADDRESS;
119
120 typedef struct {
121 UINT32 ReceivedQueueTimeoutValue;
122 UINT32 TransmitQueueTimeoutValue;
123 UINT16 ProtocolTypeFilter;
124 BOOLEAN EnableUnicastReceive;
125 BOOLEAN EnableMulticastReceive;
126 BOOLEAN EnableBroadcastReceive;
127 BOOLEAN EnablePromiscuousReceive;
128 BOOLEAN FlushQueuesOnReset;
129 BOOLEAN EnableReceiveTimestamps;
130 BOOLEAN DisableBackgroundPolling;
131 } EFI_MANAGED_NETWORK_CONFIG_DATA;
132
133 //
134 // Memory
135 //
136
137 typedef UINT64 EFI_PHYSICAL_ADDRESS;
138 typedef UINT64 EFI_VIRTUAL_ADDRESS;
139
140 typedef enum {
141 AllocateAnyPages,
142 AllocateMaxAddress,
143 AllocateAddress,
144 MaxAllocateType
145 } EFI_ALLOCATE_TYPE;
146
147 //Preseve the attr on any range supplied.
148 //ConventialMemory must have WB,SR,SW when supplied.
149 //When allocating from ConventialMemory always make it WB,SR,SW
150 //When returning to ConventialMemory always make it WB,SR,SW
151 //When getting the memory map, or on RT for runtime types
152
153
154 typedef enum {
155 EfiReservedMemoryType,
156 EfiLoaderCode,
157 EfiLoaderData,
158 EfiBootServicesCode,
159 EfiBootServicesData,
160 EfiRuntimeServicesCode,
161 EfiRuntimeServicesData,
162 EfiConventionalMemory,
163 EfiUnusableMemory,
164 EfiACPIReclaimMemory,
165 EfiACPIMemoryNVS,
166 EfiMemoryMappedIO,
167 EfiMemoryMappedIOPortSpace,
168 EfiPalCode,
169 EfiPersistentMemory,
170 EfiMaxMemoryType
171 } EFI_MEMORY_TYPE;
172
173 // possible caching types for the memory range
174 #define EFI_MEMORY_UC 0x0000000000000001
175 #define EFI_MEMORY_WC 0x0000000000000002
176 #define EFI_MEMORY_WT 0x0000000000000004
177 #define EFI_MEMORY_WB 0x0000000000000008
178 #define EFI_MEMORY_UCE 0x0000000000000010
179
180 // physical memory protection on range
181 #define EFI_MEMORY_WP 0x0000000000001000
182 #define EFI_MEMORY_RP 0x0000000000002000
183 #define EFI_MEMORY_XP 0x0000000000004000
184
185 // range requires a runtime mapping
186 #define EFI_MEMORY_RUNTIME 0x8000000000000000
187
188 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
189 typedef struct {
190 UINT32 Type; // Field size is 32 bits followed by 32 bit pad
191 UINT32 Pad;
192 EFI_PHYSICAL_ADDRESS PhysicalStart; // Field size is 64 bits
193 EFI_VIRTUAL_ADDRESS VirtualStart; // Field size is 64 bits
194 UINT64 NumberOfPages; // Field size is 64 bits
195 UINT64 Attribute; // Field size is 64 bits
196 } EFI_MEMORY_DESCRIPTOR;
197
198 //
199 // International Language
200 //
201
202 typedef UINT8 ISO_639_2;
203 #define ISO_639_2_ENTRY_SIZE 3
204
205 //
206 //
207 //
208
209 #define EFI_PAGE_SIZE 4096
210 #define EFI_PAGE_MASK 0xFFF
211 #define EFI_PAGE_SHIFT 12
212
213 #define EFI_SIZE_TO_PAGES(a) \
214 ( ((a) >> EFI_PAGE_SHIFT) + ((a) & EFI_PAGE_MASK ? 1 : 0) )
215
216 #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
217 #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
218 #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED \
219 0x0000000000000004
220 #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED \
221 0x0000000000000008
222 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED \
223 0x0000000000000010
224
225 #endif
226