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