xref: /DragonStub/inc/efiapi.h (revision 6ba063ff00b77ac1d3451e46f200ff6826efa5ac)
1530d68baSNigel Croxon #ifndef _EFI_API_H
2530d68baSNigel Croxon #define _EFI_API_H
3530d68baSNigel Croxon 
4530d68baSNigel Croxon /*++
5530d68baSNigel Croxon 
6530d68baSNigel Croxon Copyright (c) 1998  Intel Corporation
7530d68baSNigel Croxon 
8530d68baSNigel Croxon Module Name:
9530d68baSNigel Croxon 
10530d68baSNigel Croxon     efiapi.h
11530d68baSNigel Croxon 
12530d68baSNigel Croxon Abstract:
13530d68baSNigel Croxon 
14530d68baSNigel Croxon     Global EFI runtime & boot service interfaces
15530d68baSNigel Croxon 
16530d68baSNigel Croxon 
17530d68baSNigel Croxon 
18530d68baSNigel Croxon 
19530d68baSNigel Croxon Revision History
20530d68baSNigel Croxon 
21530d68baSNigel Croxon --*/
22530d68baSNigel Croxon 
23530d68baSNigel Croxon //
24530d68baSNigel Croxon // EFI Specification Revision
25530d68baSNigel Croxon //
26530d68baSNigel Croxon 
27530d68baSNigel Croxon #define EFI_SPECIFICATION_MAJOR_REVISION 1
28530d68baSNigel Croxon #define EFI_SPECIFICATION_MINOR_REVISION 02
29530d68baSNigel Croxon 
30530d68baSNigel Croxon //
31530d68baSNigel Croxon // Declare forward referenced data structures
32530d68baSNigel Croxon //
33530d68baSNigel Croxon 
34530d68baSNigel Croxon INTERFACE_DECL(_EFI_SYSTEM_TABLE);
35530d68baSNigel Croxon 
36530d68baSNigel Croxon //
37530d68baSNigel Croxon // EFI Memory
38530d68baSNigel Croxon //
39530d68baSNigel Croxon 
40530d68baSNigel Croxon typedef
41530d68baSNigel Croxon EFI_STATUS
42530d68baSNigel Croxon (EFIAPI *EFI_ALLOCATE_PAGES) (
43530d68baSNigel Croxon     IN EFI_ALLOCATE_TYPE            Type,
44530d68baSNigel Croxon     IN EFI_MEMORY_TYPE              MemoryType,
45530d68baSNigel Croxon     IN UINTN                        NoPages,
46530d68baSNigel Croxon     OUT EFI_PHYSICAL_ADDRESS        *Memory
47530d68baSNigel Croxon     );
48530d68baSNigel Croxon 
49530d68baSNigel Croxon typedef
50530d68baSNigel Croxon EFI_STATUS
51530d68baSNigel Croxon (EFIAPI *EFI_FREE_PAGES) (
52530d68baSNigel Croxon     IN EFI_PHYSICAL_ADDRESS         Memory,
53530d68baSNigel Croxon     IN UINTN                        NoPages
54530d68baSNigel Croxon     );
55530d68baSNigel Croxon 
56530d68baSNigel Croxon typedef
57530d68baSNigel Croxon EFI_STATUS
58530d68baSNigel Croxon (EFIAPI *EFI_GET_MEMORY_MAP) (
59530d68baSNigel Croxon     IN OUT UINTN                    *MemoryMapSize,
60530d68baSNigel Croxon     IN OUT EFI_MEMORY_DESCRIPTOR    *MemoryMap,
61530d68baSNigel Croxon     OUT UINTN                       *MapKey,
62530d68baSNigel Croxon     OUT UINTN                       *DescriptorSize,
63530d68baSNigel Croxon     OUT UINT32                      *DescriptorVersion
64530d68baSNigel Croxon     );
65530d68baSNigel Croxon 
66530d68baSNigel Croxon #define NextMemoryDescriptor(Ptr,Size)  ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) Ptr) + Size))
67530d68baSNigel Croxon 
68530d68baSNigel Croxon 
69530d68baSNigel Croxon typedef
70530d68baSNigel Croxon EFI_STATUS
71530d68baSNigel Croxon (EFIAPI *EFI_ALLOCATE_POOL) (
72530d68baSNigel Croxon     IN EFI_MEMORY_TYPE              PoolType,
73530d68baSNigel Croxon     IN UINTN                        Size,
74530d68baSNigel Croxon     OUT VOID                        **Buffer
75530d68baSNigel Croxon     );
76530d68baSNigel Croxon 
77530d68baSNigel Croxon typedef
78530d68baSNigel Croxon EFI_STATUS
79530d68baSNigel Croxon (EFIAPI *EFI_FREE_POOL) (
80530d68baSNigel Croxon     IN VOID                         *Buffer
81530d68baSNigel Croxon     );
82530d68baSNigel Croxon 
83530d68baSNigel Croxon typedef
84530d68baSNigel Croxon EFI_STATUS
85530d68baSNigel Croxon (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP) (
86530d68baSNigel Croxon     IN UINTN                        MemoryMapSize,
87530d68baSNigel Croxon     IN UINTN                        DescriptorSize,
88530d68baSNigel Croxon     IN UINT32                       DescriptorVersion,
89530d68baSNigel Croxon     IN EFI_MEMORY_DESCRIPTOR        *VirtualMap
90530d68baSNigel Croxon     );
91530d68baSNigel Croxon 
92530d68baSNigel Croxon 
93530d68baSNigel Croxon #define EFI_OPTIONAL_PTR            0x00000001
94530d68baSNigel Croxon #define EFI_INTERNAL_FNC            0x00000002      // Pointer to internal runtime fnc
95530d68baSNigel Croxon #define EFI_INTERNAL_PTR            0x00000004      // Pointer to internal runtime data
96530d68baSNigel Croxon 
97530d68baSNigel Croxon 
98530d68baSNigel Croxon typedef
99530d68baSNigel Croxon EFI_STATUS
100530d68baSNigel Croxon (EFIAPI *EFI_CONVERT_POINTER) (
101530d68baSNigel Croxon     IN UINTN                        DebugDisposition,
102530d68baSNigel Croxon     IN OUT VOID                     **Address
103530d68baSNigel Croxon     );
104530d68baSNigel Croxon 
105530d68baSNigel Croxon 
106530d68baSNigel Croxon //
107530d68baSNigel Croxon // EFI Events
108530d68baSNigel Croxon //
109530d68baSNigel Croxon 
110530d68baSNigel Croxon #define EVT_TIMER                           0x80000000
111530d68baSNigel Croxon #define EVT_RUNTIME                         0x40000000
112530d68baSNigel Croxon #define EVT_RUNTIME_CONTEXT                 0x20000000
113530d68baSNigel Croxon 
114530d68baSNigel Croxon #define EVT_NOTIFY_WAIT                     0x00000100
115530d68baSNigel Croxon #define EVT_NOTIFY_SIGNAL                   0x00000200
116530d68baSNigel Croxon 
117530d68baSNigel Croxon #define EVT_SIGNAL_EXIT_BOOT_SERVICES       0x00000201
118530d68baSNigel Croxon #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE   0x60000202
119530d68baSNigel Croxon 
120530d68baSNigel Croxon #define EVT_EFI_SIGNAL_MASK                 0x000000FF
1219cdd67daSNigel Croxon #define EVT_EFI_SIGNAL_MAX                  4
1229cdd67daSNigel Croxon 
1239cdd67daSNigel Croxon #define EFI_EVENT_TIMER                         EVT_TIMER
1249cdd67daSNigel Croxon #define EFI_EVENT_RUNTIME                       EVT_RUNTIME
1259cdd67daSNigel Croxon #define EFI_EVENT_RUNTIME_CONTEXT               EVT_RUNTIME_CONTEXT
1269cdd67daSNigel Croxon #define EFI_EVENT_NOTIFY_WAIT                   EVT_NOTIFY_WAIT
1279cdd67daSNigel Croxon #define EFI_EVENT_NOTIFY_SIGNAL                 EVT_NOTIFY_SIGNAL
1289cdd67daSNigel Croxon #define EFI_EVENT_SIGNAL_EXIT_BOOT_SERVICES     EVT_SIGNAL_EXIT_BOOT_SERVICES
1299cdd67daSNigel Croxon #define EFI_EVENT_SIGNAL_VIRTUAL_ADDRESS_CHANGE EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE
1309cdd67daSNigel Croxon #define EFI_EVENT_EFI_SIGNAL_MASK               EVT_EFI_SIGNAL_MASK
1319cdd67daSNigel Croxon #define EFI_EVENT_EFI_SIGNAL_MAX                EVT_EFI_SIGNAL_MAX
1329cdd67daSNigel Croxon 
133530d68baSNigel Croxon 
134530d68baSNigel Croxon typedef
135530d68baSNigel Croxon VOID
136530d68baSNigel Croxon (EFIAPI *EFI_EVENT_NOTIFY) (
137530d68baSNigel Croxon     IN EFI_EVENT                Event,
138530d68baSNigel Croxon     IN VOID                     *Context
139530d68baSNigel Croxon     );
140530d68baSNigel Croxon 
141530d68baSNigel Croxon typedef
142530d68baSNigel Croxon EFI_STATUS
143530d68baSNigel Croxon (EFIAPI *EFI_CREATE_EVENT) (
144530d68baSNigel Croxon     IN UINT32                       Type,
145530d68baSNigel Croxon     IN EFI_TPL                      NotifyTpl,
146530d68baSNigel Croxon     IN EFI_EVENT_NOTIFY             NotifyFunction,
147530d68baSNigel Croxon     IN VOID                         *NotifyContext,
148530d68baSNigel Croxon     OUT EFI_EVENT                   *Event
149530d68baSNigel Croxon     );
150530d68baSNigel Croxon 
151530d68baSNigel Croxon typedef enum {
152530d68baSNigel Croxon     TimerCancel,
153530d68baSNigel Croxon     TimerPeriodic,
154530d68baSNigel Croxon     TimerRelative,
155530d68baSNigel Croxon     TimerTypeMax
156530d68baSNigel Croxon } EFI_TIMER_DELAY;
157530d68baSNigel Croxon 
158530d68baSNigel Croxon typedef
159530d68baSNigel Croxon EFI_STATUS
160530d68baSNigel Croxon (EFIAPI *EFI_SET_TIMER) (
161530d68baSNigel Croxon     IN EFI_EVENT                Event,
162530d68baSNigel Croxon     IN EFI_TIMER_DELAY          Type,
163530d68baSNigel Croxon     IN UINT64                   TriggerTime
164530d68baSNigel Croxon     );
165530d68baSNigel Croxon 
166530d68baSNigel Croxon typedef
167530d68baSNigel Croxon EFI_STATUS
168530d68baSNigel Croxon (EFIAPI *EFI_SIGNAL_EVENT) (
169530d68baSNigel Croxon     IN EFI_EVENT                Event
170530d68baSNigel Croxon     );
171530d68baSNigel Croxon 
172530d68baSNigel Croxon typedef
173530d68baSNigel Croxon EFI_STATUS
174530d68baSNigel Croxon (EFIAPI *EFI_WAIT_FOR_EVENT) (
175530d68baSNigel Croxon     IN UINTN                    NumberOfEvents,
176530d68baSNigel Croxon     IN EFI_EVENT                *Event,
177530d68baSNigel Croxon     OUT UINTN                   *Index
178530d68baSNigel Croxon     );
179530d68baSNigel Croxon 
180530d68baSNigel Croxon typedef
181530d68baSNigel Croxon EFI_STATUS
182530d68baSNigel Croxon (EFIAPI *EFI_CLOSE_EVENT) (
183530d68baSNigel Croxon     IN EFI_EVENT                Event
184530d68baSNigel Croxon     );
185530d68baSNigel Croxon 
186530d68baSNigel Croxon typedef
187530d68baSNigel Croxon EFI_STATUS
188530d68baSNigel Croxon (EFIAPI *EFI_CHECK_EVENT) (
189530d68baSNigel Croxon     IN EFI_EVENT                Event
190530d68baSNigel Croxon     );
191530d68baSNigel Croxon 
192530d68baSNigel Croxon //
193530d68baSNigel Croxon // Task priority level
194530d68baSNigel Croxon //
195530d68baSNigel Croxon 
196530d68baSNigel Croxon #define TPL_APPLICATION       4
197530d68baSNigel Croxon #define TPL_CALLBACK          8
198530d68baSNigel Croxon #define TPL_NOTIFY           16
199530d68baSNigel Croxon #define TPL_HIGH_LEVEL       31
2009cdd67daSNigel Croxon #define EFI_TPL_APPLICATION  TPL_APPLICATION
2019cdd67daSNigel Croxon #define EFI_TPL_CALLBACK     TPL_CALLBACK
2029cdd67daSNigel Croxon #define EFI_TPL_NOTIFY       TPL_NOTIFY
2039cdd67daSNigel Croxon #define EFI_TPL_HIGH_LEVEL   TPL_HIGH_LEVEL
204530d68baSNigel Croxon typedef
205530d68baSNigel Croxon EFI_TPL
206530d68baSNigel Croxon (EFIAPI *EFI_RAISE_TPL) (
207530d68baSNigel Croxon     IN EFI_TPL      NewTpl
208530d68baSNigel Croxon     );
209530d68baSNigel Croxon 
210530d68baSNigel Croxon typedef
211530d68baSNigel Croxon VOID
212530d68baSNigel Croxon (EFIAPI *EFI_RESTORE_TPL) (
213530d68baSNigel Croxon     IN EFI_TPL      OldTpl
214530d68baSNigel Croxon     );
215530d68baSNigel Croxon 
216530d68baSNigel Croxon 
217530d68baSNigel Croxon //
218530d68baSNigel Croxon // EFI platform varibles
219530d68baSNigel Croxon //
220530d68baSNigel Croxon 
221530d68baSNigel Croxon #define EFI_GLOBAL_VARIABLE     \
222530d68baSNigel Croxon     { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} }
223530d68baSNigel Croxon 
224530d68baSNigel Croxon // Variable attributes
225530d68baSNigel Croxon #define EFI_VARIABLE_NON_VOLATILE                          0x00000001
226530d68baSNigel Croxon #define EFI_VARIABLE_BOOTSERVICE_ACCESS                    0x00000002
227530d68baSNigel Croxon #define EFI_VARIABLE_RUNTIME_ACCESS                        0x00000004
228530d68baSNigel Croxon #define EFI_VARIABLE_HARDWARE_ERROR_RECORD                 0x00000008
229530d68baSNigel Croxon #define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS            0x00000010
230530d68baSNigel Croxon #define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020
231530d68baSNigel Croxon #define EFI_VARIABLE_APPEND_WRITE                          0x00000040
232*6ba063ffSPeter Jones #define EFI_VARIABLE_ENHANCED_AUTHENTICATED_ACCESS	   0x00000080
233530d68baSNigel Croxon 
234530d68baSNigel Croxon // Variable size limitation
235530d68baSNigel Croxon #define EFI_MAXIMUM_VARIABLE_SIZE           1024
236530d68baSNigel Croxon 
237530d68baSNigel Croxon typedef
238530d68baSNigel Croxon EFI_STATUS
239530d68baSNigel Croxon (EFIAPI *EFI_GET_VARIABLE) (
240530d68baSNigel Croxon     IN CHAR16                       *VariableName,
241530d68baSNigel Croxon     IN EFI_GUID                     *VendorGuid,
242530d68baSNigel Croxon     OUT UINT32                      *Attributes OPTIONAL,
243530d68baSNigel Croxon     IN OUT UINTN                    *DataSize,
244530d68baSNigel Croxon     OUT VOID                        *Data
245530d68baSNigel Croxon     );
246530d68baSNigel Croxon 
247530d68baSNigel Croxon typedef
248530d68baSNigel Croxon EFI_STATUS
249530d68baSNigel Croxon (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
250530d68baSNigel Croxon     IN OUT UINTN                    *VariableNameSize,
251530d68baSNigel Croxon     IN OUT CHAR16                   *VariableName,
252530d68baSNigel Croxon     IN OUT EFI_GUID                 *VendorGuid
253530d68baSNigel Croxon     );
254530d68baSNigel Croxon 
255530d68baSNigel Croxon 
256530d68baSNigel Croxon typedef
257530d68baSNigel Croxon EFI_STATUS
258530d68baSNigel Croxon (EFIAPI *EFI_SET_VARIABLE) (
259530d68baSNigel Croxon     IN CHAR16                       *VariableName,
260530d68baSNigel Croxon     IN EFI_GUID                     *VendorGuid,
261530d68baSNigel Croxon     IN UINT32                       Attributes,
262530d68baSNigel Croxon     IN UINTN                        DataSize,
263530d68baSNigel Croxon     IN VOID                         *Data
264530d68baSNigel Croxon     );
265530d68baSNigel Croxon 
266530d68baSNigel Croxon 
267530d68baSNigel Croxon //
268530d68baSNigel Croxon // EFI Time
269530d68baSNigel Croxon //
270530d68baSNigel Croxon 
271530d68baSNigel Croxon typedef struct {
272530d68baSNigel Croxon         UINT32                      Resolution;     // 1e-6 parts per million
273530d68baSNigel Croxon         UINT32                      Accuracy;       // hertz
274530d68baSNigel Croxon         BOOLEAN                     SetsToZero;     // Set clears sub-second time
275530d68baSNigel Croxon } EFI_TIME_CAPABILITIES;
276530d68baSNigel Croxon 
277530d68baSNigel Croxon 
278530d68baSNigel Croxon typedef
279530d68baSNigel Croxon EFI_STATUS
280530d68baSNigel Croxon (EFIAPI *EFI_GET_TIME) (
281530d68baSNigel Croxon     OUT EFI_TIME                    *Time,
282530d68baSNigel Croxon     OUT EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
283530d68baSNigel Croxon     );
284530d68baSNigel Croxon 
285530d68baSNigel Croxon typedef
286530d68baSNigel Croxon EFI_STATUS
287530d68baSNigel Croxon (EFIAPI *EFI_SET_TIME) (
288530d68baSNigel Croxon     IN EFI_TIME                     *Time
289530d68baSNigel Croxon     );
290530d68baSNigel Croxon 
291530d68baSNigel Croxon typedef
292530d68baSNigel Croxon EFI_STATUS
293530d68baSNigel Croxon (EFIAPI *EFI_GET_WAKEUP_TIME) (
294530d68baSNigel Croxon     OUT BOOLEAN                     *Enabled,
295530d68baSNigel Croxon     OUT BOOLEAN                     *Pending,
296530d68baSNigel Croxon     OUT EFI_TIME                    *Time
297530d68baSNigel Croxon     );
298530d68baSNigel Croxon 
299530d68baSNigel Croxon typedef
300530d68baSNigel Croxon EFI_STATUS
301530d68baSNigel Croxon (EFIAPI *EFI_SET_WAKEUP_TIME) (
302530d68baSNigel Croxon     IN BOOLEAN                      Enable,
303530d68baSNigel Croxon     IN EFI_TIME                     *Time OPTIONAL
304530d68baSNigel Croxon     );
305530d68baSNigel Croxon 
306530d68baSNigel Croxon 
307530d68baSNigel Croxon //
308530d68baSNigel Croxon // Image functions
309530d68baSNigel Croxon //
310530d68baSNigel Croxon 
311530d68baSNigel Croxon 
312530d68baSNigel Croxon // PE32+ Subsystem type for EFI images
313530d68baSNigel Croxon 
314530d68baSNigel Croxon #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
315530d68baSNigel Croxon #define IMAGE_SUBSYSTEM_EFI_APPLICATION             10
316530d68baSNigel Croxon #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER     11
317530d68baSNigel Croxon #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER          12
318530d68baSNigel Croxon #endif
319530d68baSNigel Croxon 
320530d68baSNigel Croxon // PE32+ Machine type for EFI images
321530d68baSNigel Croxon 
322530d68baSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_IA32)
323530d68baSNigel Croxon #define EFI_IMAGE_MACHINE_IA32      0x014c
324530d68baSNigel Croxon #endif
325530d68baSNigel Croxon 
326530d68baSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_IA64)
327530d68baSNigel Croxon #define EFI_IMAGE_MACHINE_IA64      0x0200
328530d68baSNigel Croxon #endif
329530d68baSNigel Croxon 
3309cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_EBC)
3319cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_EBC      0x0EBC
3329cdd67daSNigel Croxon #endif
3339cdd67daSNigel Croxon 
3349cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_X64)
3359cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_X64       0x8664
3369cdd67daSNigel Croxon #endif
3379cdd67daSNigel Croxon 
3389cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
3399cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
3409cdd67daSNigel Croxon #endif
3419cdd67daSNigel Croxon 
3429cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_AARCH64)
3439cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_AARCH64   0xAA64
3449cdd67daSNigel Croxon #endif
3459cdd67daSNigel Croxon 
346860b1c8cSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_RISCV32)
347860b1c8cSNigel Croxon #define EFI_IMAGE_MACHINE_RISCV32   0x5032
348860b1c8cSNigel Croxon #endif
349860b1c8cSNigel Croxon 
350860b1c8cSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_RISCV64)
351860b1c8cSNigel Croxon #define EFI_IMAGE_MACHINE_RISCV64   0x5064
352860b1c8cSNigel Croxon #endif
353860b1c8cSNigel Croxon 
354860b1c8cSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_RISCV128)
355860b1c8cSNigel Croxon #define EFI_IMAGE_MACHINE_RISCV128  0x5128
356860b1c8cSNigel Croxon #endif
357860b1c8cSNigel Croxon 
3581ba13fdfSXiaotian Wu #if !defined(EFI_IMAGE_MACHINE_LOONGARCH32)
3591ba13fdfSXiaotian Wu #define EFI_IMAGE_MACHINE_LOONGARCH32   0x6232
3601ba13fdfSXiaotian Wu #endif
3611ba13fdfSXiaotian Wu 
3621ba13fdfSXiaotian Wu #if !defined(EFI_IMAGE_MACHINE_LOONGARCH64)
3631ba13fdfSXiaotian Wu #define EFI_IMAGE_MACHINE_LOONGARCH64   0x6264
3641ba13fdfSXiaotian Wu #endif
3651ba13fdfSXiaotian Wu 
366530d68baSNigel Croxon // Image Entry prototype
367530d68baSNigel Croxon 
368530d68baSNigel Croxon typedef
369530d68baSNigel Croxon EFI_STATUS
370530d68baSNigel Croxon (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
371530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
372530d68baSNigel Croxon     IN struct _EFI_SYSTEM_TABLE     *SystemTable
373530d68baSNigel Croxon     );
374530d68baSNigel Croxon 
375530d68baSNigel Croxon typedef
376530d68baSNigel Croxon EFI_STATUS
377530d68baSNigel Croxon (EFIAPI *EFI_IMAGE_LOAD) (
378530d68baSNigel Croxon     IN BOOLEAN                      BootPolicy,
379530d68baSNigel Croxon     IN EFI_HANDLE                   ParentImageHandle,
380530d68baSNigel Croxon     IN EFI_DEVICE_PATH              *FilePath,
381530d68baSNigel Croxon     IN VOID                         *SourceBuffer   OPTIONAL,
382530d68baSNigel Croxon     IN UINTN                        SourceSize,
383530d68baSNigel Croxon     OUT EFI_HANDLE                  *ImageHandle
384530d68baSNigel Croxon     );
385530d68baSNigel Croxon 
386530d68baSNigel Croxon typedef
387530d68baSNigel Croxon EFI_STATUS
388530d68baSNigel Croxon (EFIAPI *EFI_IMAGE_START) (
389530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
390530d68baSNigel Croxon     OUT UINTN                       *ExitDataSize,
391530d68baSNigel Croxon     OUT CHAR16                      **ExitData  OPTIONAL
392530d68baSNigel Croxon     );
393530d68baSNigel Croxon 
394530d68baSNigel Croxon typedef
395530d68baSNigel Croxon EFI_STATUS
396530d68baSNigel Croxon (EFIAPI *EFI_EXIT) (
397530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
398530d68baSNigel Croxon     IN EFI_STATUS                   ExitStatus,
399530d68baSNigel Croxon     IN UINTN                        ExitDataSize,
400530d68baSNigel Croxon     IN CHAR16                       *ExitData OPTIONAL
401530d68baSNigel Croxon     );
402530d68baSNigel Croxon 
403530d68baSNigel Croxon 
404530d68baSNigel Croxon // Image handle
4053b31a5e3SNigel Croxon /*#define LOADED_IMAGE_PROTOCOL      \
406530d68baSNigel Croxon     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
407530d68baSNigel Croxon 
408530d68baSNigel Croxon #define EFI_IMAGE_INFORMATION_REVISION      0x1000
409530d68baSNigel Croxon typedef struct {
410530d68baSNigel Croxon     UINT32                          Revision;
411530d68baSNigel Croxon     EFI_HANDLE                      ParentHandle;
412530d68baSNigel Croxon     struct _EFI_SYSTEM_TABLE        *SystemTable;
413530d68baSNigel Croxon 
414530d68baSNigel Croxon     // Source location of image
415530d68baSNigel Croxon     EFI_HANDLE                      DeviceHandle;
416530d68baSNigel Croxon     EFI_DEVICE_PATH                 *FilePath;
417530d68baSNigel Croxon     VOID                            *Reserved;
418530d68baSNigel Croxon 
419530d68baSNigel Croxon     // Images load options
420530d68baSNigel Croxon     UINT32                          LoadOptionsSize;
421530d68baSNigel Croxon     VOID                            *LoadOptions;
422530d68baSNigel Croxon 
423530d68baSNigel Croxon     // Location of where image was loaded
424530d68baSNigel Croxon     VOID                            *ImageBase;
425530d68baSNigel Croxon     UINT64                          ImageSize;
426530d68baSNigel Croxon     EFI_MEMORY_TYPE                 ImageCodeType;
427530d68baSNigel Croxon     EFI_MEMORY_TYPE                 ImageDataType;
428530d68baSNigel Croxon 
429530d68baSNigel Croxon     // If the driver image supports a dynamic unload request
430530d68baSNigel Croxon     EFI_IMAGE_UNLOAD                Unload;
431530d68baSNigel Croxon 
4323b31a5e3SNigel Croxon } EFI_LOADED_IMAGE;*/
433530d68baSNigel Croxon 
434530d68baSNigel Croxon 
435530d68baSNigel Croxon typedef
436530d68baSNigel Croxon EFI_STATUS
437530d68baSNigel Croxon (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
438530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
439530d68baSNigel Croxon     IN UINTN                        MapKey
440530d68baSNigel Croxon     );
441530d68baSNigel Croxon 
442530d68baSNigel Croxon //
443530d68baSNigel Croxon // Misc
444530d68baSNigel Croxon //
445530d68baSNigel Croxon 
446530d68baSNigel Croxon 
447530d68baSNigel Croxon typedef
448530d68baSNigel Croxon EFI_STATUS
449530d68baSNigel Croxon (EFIAPI *EFI_STALL) (
450530d68baSNigel Croxon     IN UINTN                    Microseconds
451530d68baSNigel Croxon     );
452530d68baSNigel Croxon 
453530d68baSNigel Croxon typedef
454530d68baSNigel Croxon EFI_STATUS
455530d68baSNigel Croxon (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
456530d68baSNigel Croxon     IN UINTN                    Timeout,
457530d68baSNigel Croxon     IN UINT64                   WatchdogCode,
458530d68baSNigel Croxon     IN UINTN                    DataSize,
459530d68baSNigel Croxon     IN CHAR16                   *WatchdogData OPTIONAL
460530d68baSNigel Croxon     );
461530d68baSNigel Croxon 
462530d68baSNigel Croxon typedef
463530d68baSNigel Croxon EFI_STATUS
464530d68baSNigel Croxon (EFIAPI *EFI_CONNECT_CONTROLLER) (
465530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle,
466530d68baSNigel Croxon     IN EFI_HANDLE               *DriverImageHandle OPTIONAL,
467530d68baSNigel Croxon     IN EFI_DEVICE_PATH          *RemainingDevicePath OPTIONAL,
468530d68baSNigel Croxon     IN BOOLEAN                  Recursive
469530d68baSNigel Croxon     );
470530d68baSNigel Croxon 
471530d68baSNigel Croxon typedef
472530d68baSNigel Croxon EFI_STATUS
473530d68baSNigel Croxon (EFIAPI *EFI_DISCONNECT_CONTROLLER) (
474530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle,
475530d68baSNigel Croxon     IN EFI_HANDLE               DriverImageHandle OPTIONAL,
476530d68baSNigel Croxon     IN EFI_HANDLE               ChildHandle OPTIONAL
477530d68baSNigel Croxon     );
478530d68baSNigel Croxon 
479530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
480530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
481530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
482530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
483530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
484530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
485530d68baSNigel Croxon 
486530d68baSNigel Croxon typedef
487530d68baSNigel Croxon EFI_STATUS
488530d68baSNigel Croxon (EFIAPI *EFI_OPEN_PROTOCOL) (
489530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
490530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
491530d68baSNigel Croxon     OUT VOID                    **Interface OPTIONAL,
492530d68baSNigel Croxon     IN EFI_HANDLE               AgentHandle,
493530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle,
494530d68baSNigel Croxon     IN UINT32                   Attributes
495530d68baSNigel Croxon     );
496530d68baSNigel Croxon 
497530d68baSNigel Croxon typedef
498530d68baSNigel Croxon EFI_STATUS
499530d68baSNigel Croxon (EFIAPI *EFI_CLOSE_PROTOCOL) (
500530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
501530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
502530d68baSNigel Croxon     IN EFI_HANDLE               AgentHandle,
503530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle
504530d68baSNigel Croxon     );
505530d68baSNigel Croxon 
506530d68baSNigel Croxon typedef struct {
507530d68baSNigel Croxon     EFI_HANDLE                  AgentHandle;
508530d68baSNigel Croxon     EFI_HANDLE                  ControllerHandle;
509530d68baSNigel Croxon     UINT32                      Attributes;
510530d68baSNigel Croxon     UINT32                      OpenCount;
511530d68baSNigel Croxon } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
512530d68baSNigel Croxon 
513530d68baSNigel Croxon typedef
514530d68baSNigel Croxon EFI_STATUS
515530d68baSNigel Croxon (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
516530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
517530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
518530d68baSNigel Croxon     OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
519530d68baSNigel Croxon     OUT UINTN                   *EntryCount
520530d68baSNigel Croxon     );
521530d68baSNigel Croxon 
522530d68baSNigel Croxon typedef
523530d68baSNigel Croxon EFI_STATUS
524530d68baSNigel Croxon (EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
525530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
526530d68baSNigel Croxon     OUT EFI_GUID                ***ProtocolBuffer,
527530d68baSNigel Croxon     OUT UINTN                   *ProtocolBufferCount
528530d68baSNigel Croxon     );
529530d68baSNigel Croxon 
530530d68baSNigel Croxon typedef enum {
531530d68baSNigel Croxon     AllHandles,
532530d68baSNigel Croxon     ByRegisterNotify,
533530d68baSNigel Croxon     ByProtocol
534530d68baSNigel Croxon } EFI_LOCATE_SEARCH_TYPE;
535530d68baSNigel Croxon 
536530d68baSNigel Croxon typedef
537530d68baSNigel Croxon EFI_STATUS
538530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
539530d68baSNigel Croxon     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
540530d68baSNigel Croxon     IN EFI_GUID                 *Protocol OPTIONAL,
541530d68baSNigel Croxon     IN VOID                     *SearchKey OPTIONAL,
542530d68baSNigel Croxon     IN OUT UINTN                *NoHandles,
543530d68baSNigel Croxon     OUT EFI_HANDLE              **Buffer
544530d68baSNigel Croxon     );
545530d68baSNigel Croxon 
546530d68baSNigel Croxon typedef
547530d68baSNigel Croxon EFI_STATUS
548530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_PROTOCOL) (
549530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
550530d68baSNigel Croxon     IN VOID                     *Registration OPTIONAL,
551530d68baSNigel Croxon     OUT VOID                    **Interface
552530d68baSNigel Croxon     );
553530d68baSNigel Croxon 
554530d68baSNigel Croxon typedef
555530d68baSNigel Croxon EFI_STATUS
556530d68baSNigel Croxon (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
557530d68baSNigel Croxon     IN OUT EFI_HANDLE           *Handle,
558530d68baSNigel Croxon     ...
559530d68baSNigel Croxon     );
560530d68baSNigel Croxon 
561530d68baSNigel Croxon typedef
562530d68baSNigel Croxon EFI_STATUS
563530d68baSNigel Croxon (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
564530d68baSNigel Croxon     IN OUT EFI_HANDLE           Handle,
565530d68baSNigel Croxon     ...
566530d68baSNigel Croxon     );
567530d68baSNigel Croxon 
568530d68baSNigel Croxon typedef
569530d68baSNigel Croxon EFI_STATUS
570530d68baSNigel Croxon (EFIAPI *EFI_CALCULATE_CRC32) (
571530d68baSNigel Croxon     IN VOID                     *Data,
572530d68baSNigel Croxon     IN UINTN                    DataSize,
573530d68baSNigel Croxon     OUT UINT32                  *Crc32
574530d68baSNigel Croxon     );
575530d68baSNigel Croxon 
576530d68baSNigel Croxon typedef
577530d68baSNigel Croxon VOID
578530d68baSNigel Croxon (EFIAPI *EFI_COPY_MEM) (
579530d68baSNigel Croxon     IN VOID                     *Destination,
580530d68baSNigel Croxon     IN VOID                     *Source,
581530d68baSNigel Croxon     IN UINTN                    Length
582530d68baSNigel Croxon     );
583530d68baSNigel Croxon 
584530d68baSNigel Croxon typedef
585530d68baSNigel Croxon VOID
586530d68baSNigel Croxon (EFIAPI *EFI_SET_MEM) (
587530d68baSNigel Croxon     IN VOID                     *Buffer,
588530d68baSNigel Croxon     IN UINTN                    Size,
589530d68baSNigel Croxon     IN UINT8                    Value
590530d68baSNigel Croxon     );
591530d68baSNigel Croxon 
592530d68baSNigel Croxon 
593530d68baSNigel Croxon typedef
594530d68baSNigel Croxon EFI_STATUS
595530d68baSNigel Croxon (EFIAPI *EFI_CREATE_EVENT_EX) (
596530d68baSNigel Croxon     IN UINT32                   Type,
597530d68baSNigel Croxon     IN EFI_TPL                  NotifyTpl,
598530d68baSNigel Croxon     IN EFI_EVENT_NOTIFY         NotifyFunction OPTIONAL,
599530d68baSNigel Croxon     IN const VOID               *NotifyContext OPTIONAL,
600238358c6Sleo     IN const EFI_GUID           *EventGroup OPTIONAL,
601530d68baSNigel Croxon     OUT EFI_EVENT               *Event
602530d68baSNigel Croxon     );
603530d68baSNigel Croxon 
604530d68baSNigel Croxon typedef enum {
605530d68baSNigel Croxon     EfiResetCold,
606530d68baSNigel Croxon     EfiResetWarm,
607530d68baSNigel Croxon     EfiResetShutdown
608530d68baSNigel Croxon } EFI_RESET_TYPE;
609530d68baSNigel Croxon 
610530d68baSNigel Croxon typedef
611530d68baSNigel Croxon EFI_STATUS
612530d68baSNigel Croxon (EFIAPI *EFI_RESET_SYSTEM) (
613530d68baSNigel Croxon     IN EFI_RESET_TYPE           ResetType,
614530d68baSNigel Croxon     IN EFI_STATUS               ResetStatus,
615530d68baSNigel Croxon     IN UINTN                    DataSize,
616530d68baSNigel Croxon     IN CHAR16                   *ResetData OPTIONAL
617530d68baSNigel Croxon     );
618530d68baSNigel Croxon 
619530d68baSNigel Croxon typedef
620530d68baSNigel Croxon EFI_STATUS
621530d68baSNigel Croxon (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
622530d68baSNigel Croxon     OUT UINT64                  *Count
623530d68baSNigel Croxon     );
624530d68baSNigel Croxon 
625530d68baSNigel Croxon typedef
626530d68baSNigel Croxon EFI_STATUS
627530d68baSNigel Croxon (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
628530d68baSNigel Croxon     OUT UINT32                  *HighCount
629530d68baSNigel Croxon     );
630530d68baSNigel Croxon 
631530d68baSNigel Croxon typedef struct {
632530d68baSNigel Croxon     UINT64                      Length;
633530d68baSNigel Croxon     union {
634530d68baSNigel Croxon         EFI_PHYSICAL_ADDRESS    DataBlock;
635530d68baSNigel Croxon        EFI_PHYSICAL_ADDRESS    ContinuationPointer;
636530d68baSNigel Croxon     } Union;
637530d68baSNigel Croxon } EFI_CAPSULE_BLOCK_DESCRIPTOR;
638530d68baSNigel Croxon 
639530d68baSNigel Croxon typedef struct {
640530d68baSNigel Croxon     EFI_GUID                    CapsuleGuid;
641530d68baSNigel Croxon     UINT32                      HeaderSize;
642530d68baSNigel Croxon     UINT32                      Flags;
643530d68baSNigel Croxon     UINT32                      CapsuleImageSize;
644530d68baSNigel Croxon } EFI_CAPSULE_HEADER;
645530d68baSNigel Croxon 
646530d68baSNigel Croxon #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET    0x00010000
647530d68baSNigel Croxon #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE   0x00020000
648530d68baSNigel Croxon #define CAPSULE_FLAGS_INITIATE_RESET          0x00040000
649530d68baSNigel Croxon 
650530d68baSNigel Croxon typedef
651530d68baSNigel Croxon EFI_STATUS
652530d68baSNigel Croxon (EFIAPI *EFI_UPDATE_CAPSULE) (
653530d68baSNigel Croxon     IN EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
654530d68baSNigel Croxon     IN UINTN                    CapsuleCount,
655530d68baSNigel Croxon     IN EFI_PHYSICAL_ADDRESS     ScatterGatherList OPTIONAL
656530d68baSNigel Croxon     );
657530d68baSNigel Croxon 
658530d68baSNigel Croxon typedef
659530d68baSNigel Croxon EFI_STATUS
660530d68baSNigel Croxon (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (
661530d68baSNigel Croxon     IN  EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
662530d68baSNigel Croxon     IN  UINTN                    CapsuleCount,
663530d68baSNigel Croxon     OUT UINT64                   *MaximumCapsuleSize,
664530d68baSNigel Croxon     OUT EFI_RESET_TYPE           *ResetType
665530d68baSNigel Croxon     );
666530d68baSNigel Croxon 
667530d68baSNigel Croxon typedef
668530d68baSNigel Croxon EFI_STATUS
669530d68baSNigel Croxon (EFIAPI *EFI_QUERY_VARIABLE_INFO) (
670530d68baSNigel Croxon     IN  UINT32                  Attributes,
671530d68baSNigel Croxon     OUT UINT64                  *MaximumVariableStorageSize,
672530d68baSNigel Croxon     OUT UINT64                  *RemainingVariableStorageSize,
673530d68baSNigel Croxon     OUT UINT64                  *MaximumVariableSize
674530d68baSNigel Croxon     );
675530d68baSNigel Croxon 
676530d68baSNigel Croxon //
677530d68baSNigel Croxon // Protocol handler functions
678530d68baSNigel Croxon //
679530d68baSNigel Croxon 
680530d68baSNigel Croxon typedef enum {
681530d68baSNigel Croxon     EFI_NATIVE_INTERFACE,
682530d68baSNigel Croxon     EFI_PCODE_INTERFACE
683530d68baSNigel Croxon } EFI_INTERFACE_TYPE;
684530d68baSNigel Croxon 
685530d68baSNigel Croxon typedef
686530d68baSNigel Croxon EFI_STATUS
687530d68baSNigel Croxon (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
688530d68baSNigel Croxon     IN OUT EFI_HANDLE           *Handle,
689530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
690530d68baSNigel Croxon     IN EFI_INTERFACE_TYPE       InterfaceType,
691530d68baSNigel Croxon     IN VOID                     *Interface
692530d68baSNigel Croxon     );
693530d68baSNigel Croxon 
694530d68baSNigel Croxon typedef
695530d68baSNigel Croxon EFI_STATUS
696530d68baSNigel Croxon (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
697530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
698530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
699530d68baSNigel Croxon     IN VOID                     *OldInterface,
700530d68baSNigel Croxon     IN VOID                     *NewInterface
701530d68baSNigel Croxon     );
702530d68baSNigel Croxon 
703530d68baSNigel Croxon typedef
704530d68baSNigel Croxon EFI_STATUS
705530d68baSNigel Croxon (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
706530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
707530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
708530d68baSNigel Croxon     IN VOID                     *Interface
709530d68baSNigel Croxon     );
710530d68baSNigel Croxon 
711530d68baSNigel Croxon typedef
712530d68baSNigel Croxon EFI_STATUS
713530d68baSNigel Croxon (EFIAPI *EFI_HANDLE_PROTOCOL) (
714530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
715530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
716530d68baSNigel Croxon     OUT VOID                    **Interface
717530d68baSNigel Croxon     );
718530d68baSNigel Croxon 
719530d68baSNigel Croxon typedef
720530d68baSNigel Croxon EFI_STATUS
721530d68baSNigel Croxon (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
722530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
723530d68baSNigel Croxon     IN EFI_EVENT                Event,
724530d68baSNigel Croxon     OUT VOID                    **Registration
725530d68baSNigel Croxon     );
726530d68baSNigel Croxon 
727530d68baSNigel Croxon typedef
728530d68baSNigel Croxon EFI_STATUS
729530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_HANDLE) (
730530d68baSNigel Croxon     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
731530d68baSNigel Croxon     IN EFI_GUID                 *Protocol OPTIONAL,
732530d68baSNigel Croxon     IN VOID                     *SearchKey OPTIONAL,
733530d68baSNigel Croxon     IN OUT UINTN                *BufferSize,
734530d68baSNigel Croxon     OUT EFI_HANDLE              *Buffer
735530d68baSNigel Croxon     );
736530d68baSNigel Croxon 
737530d68baSNigel Croxon typedef
738530d68baSNigel Croxon EFI_STATUS
739530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
740530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
741530d68baSNigel Croxon     IN OUT EFI_DEVICE_PATH      **DevicePath,
742530d68baSNigel Croxon     OUT EFI_HANDLE              *Device
743530d68baSNigel Croxon     );
744530d68baSNigel Croxon 
745530d68baSNigel Croxon typedef
746530d68baSNigel Croxon EFI_STATUS
747530d68baSNigel Croxon (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
748530d68baSNigel Croxon     IN EFI_GUID                 *Guid,
749530d68baSNigel Croxon     IN VOID                     *Table
750530d68baSNigel Croxon     );
751530d68baSNigel Croxon 
752530d68baSNigel Croxon typedef
753530d68baSNigel Croxon EFI_STATUS
754530d68baSNigel Croxon (EFIAPI *EFI_RESERVED_SERVICE) (
755530d68baSNigel Croxon     );
756530d68baSNigel Croxon 
757530d68baSNigel Croxon //
758530d68baSNigel Croxon // Standard EFI table header
759530d68baSNigel Croxon //
760530d68baSNigel Croxon 
761530d68baSNigel Croxon typedef struct _EFI_TABLE_HEADER {
762530d68baSNigel Croxon     UINT64                      Signature;
763530d68baSNigel Croxon     UINT32                      Revision;
764530d68baSNigel Croxon     UINT32                      HeaderSize;
765530d68baSNigel Croxon     UINT32                      CRC32;
766530d68baSNigel Croxon     UINT32                      Reserved;
767530d68baSNigel Croxon } EFI_TABLE_HEADER;
768530d68baSNigel Croxon 
769530d68baSNigel Croxon 
770530d68baSNigel Croxon //
771530d68baSNigel Croxon // EFI Runtime Serivces Table
772530d68baSNigel Croxon //
773530d68baSNigel Croxon 
774530d68baSNigel Croxon #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
77593b2524aSPeter Jones #define EFI_1_10_RUNTIME_SERVICES_REVISION ((1<<16) | (10))
77693b2524aSPeter Jones #define EFI_2_00_RUNTIME_SERVICES_REVISION ((2<<16) | (0))
777530d68baSNigel Croxon #define EFI_RUNTIME_SERVICES_REVISION   (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
778530d68baSNigel Croxon 
779530d68baSNigel Croxon typedef struct  {
780530d68baSNigel Croxon     EFI_TABLE_HEADER                Hdr;
781530d68baSNigel Croxon 
782530d68baSNigel Croxon     //
783530d68baSNigel Croxon     // Time services
784530d68baSNigel Croxon     //
785530d68baSNigel Croxon 
786530d68baSNigel Croxon     EFI_GET_TIME                    GetTime;
787530d68baSNigel Croxon     EFI_SET_TIME                    SetTime;
788530d68baSNigel Croxon     EFI_GET_WAKEUP_TIME             GetWakeupTime;
789530d68baSNigel Croxon     EFI_SET_WAKEUP_TIME             SetWakeupTime;
790530d68baSNigel Croxon 
791530d68baSNigel Croxon     //
792530d68baSNigel Croxon     // Virtual memory services
793530d68baSNigel Croxon     //
794530d68baSNigel Croxon 
795530d68baSNigel Croxon     EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
796530d68baSNigel Croxon     EFI_CONVERT_POINTER             ConvertPointer;
797530d68baSNigel Croxon 
798530d68baSNigel Croxon     //
799530d68baSNigel Croxon     // Variable serviers
800530d68baSNigel Croxon     //
801530d68baSNigel Croxon 
802530d68baSNigel Croxon     EFI_GET_VARIABLE                GetVariable;
803530d68baSNigel Croxon     EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
804530d68baSNigel Croxon     EFI_SET_VARIABLE                SetVariable;
805530d68baSNigel Croxon 
806530d68baSNigel Croxon     //
807530d68baSNigel Croxon     // Misc
808530d68baSNigel Croxon     //
809530d68baSNigel Croxon 
810530d68baSNigel Croxon     EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
811530d68baSNigel Croxon     EFI_RESET_SYSTEM                ResetSystem;
812530d68baSNigel Croxon 
813530d68baSNigel Croxon     EFI_UPDATE_CAPSULE              UpdateCapsule;
814530d68baSNigel Croxon     EFI_QUERY_CAPSULE_CAPABILITIES  QueryCapsuleCapabilities;
815530d68baSNigel Croxon     EFI_QUERY_VARIABLE_INFO         QueryVariableInfo;
816530d68baSNigel Croxon } EFI_RUNTIME_SERVICES;
817530d68baSNigel Croxon 
818530d68baSNigel Croxon 
819530d68baSNigel Croxon //
820530d68baSNigel Croxon // EFI Boot Services Table
821530d68baSNigel Croxon //
822530d68baSNigel Croxon 
823530d68baSNigel Croxon #define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
82493b2524aSPeter Jones #define EFI_1_10_BOOT_SERVICES_REVISION ((1<<16) | (10))
82593b2524aSPeter Jones #define EFI_2_00_BOOT_SERVICES_REVISION ((2<<16) | (0))
826530d68baSNigel Croxon #define EFI_BOOT_SERVICES_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
827530d68baSNigel Croxon 
828530d68baSNigel Croxon typedef struct _EFI_BOOT_SERVICES {
829530d68baSNigel Croxon 
830530d68baSNigel Croxon     EFI_TABLE_HEADER                Hdr;
831530d68baSNigel Croxon 
832530d68baSNigel Croxon     //
833530d68baSNigel Croxon     // Task priority functions
834530d68baSNigel Croxon     //
835530d68baSNigel Croxon 
836530d68baSNigel Croxon     EFI_RAISE_TPL                   RaiseTPL;
837530d68baSNigel Croxon     EFI_RESTORE_TPL                 RestoreTPL;
838530d68baSNigel Croxon 
839530d68baSNigel Croxon     //
840530d68baSNigel Croxon     // Memory functions
841530d68baSNigel Croxon     //
842530d68baSNigel Croxon 
843530d68baSNigel Croxon     EFI_ALLOCATE_PAGES              AllocatePages;
844530d68baSNigel Croxon     EFI_FREE_PAGES                  FreePages;
845530d68baSNigel Croxon     EFI_GET_MEMORY_MAP              GetMemoryMap;
846530d68baSNigel Croxon     EFI_ALLOCATE_POOL               AllocatePool;
847530d68baSNigel Croxon     EFI_FREE_POOL                   FreePool;
848530d68baSNigel Croxon 
849530d68baSNigel Croxon     //
850530d68baSNigel Croxon     // Event & timer functions
851530d68baSNigel Croxon     //
852530d68baSNigel Croxon 
853530d68baSNigel Croxon     EFI_CREATE_EVENT                CreateEvent;
854530d68baSNigel Croxon     EFI_SET_TIMER                   SetTimer;
855530d68baSNigel Croxon     EFI_WAIT_FOR_EVENT              WaitForEvent;
856530d68baSNigel Croxon     EFI_SIGNAL_EVENT                SignalEvent;
857530d68baSNigel Croxon     EFI_CLOSE_EVENT                 CloseEvent;
858530d68baSNigel Croxon     EFI_CHECK_EVENT                 CheckEvent;
859530d68baSNigel Croxon 
860530d68baSNigel Croxon     //
861530d68baSNigel Croxon     // Protocol handler functions
862530d68baSNigel Croxon     //
863530d68baSNigel Croxon 
864530d68baSNigel Croxon     EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
865530d68baSNigel Croxon     EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
866530d68baSNigel Croxon     EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
867530d68baSNigel Croxon     EFI_HANDLE_PROTOCOL             HandleProtocol;
868530d68baSNigel Croxon     EFI_HANDLE_PROTOCOL             PCHandleProtocol;
869530d68baSNigel Croxon     EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
870530d68baSNigel Croxon     EFI_LOCATE_HANDLE               LocateHandle;
871530d68baSNigel Croxon     EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
872530d68baSNigel Croxon     EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
873530d68baSNigel Croxon 
874530d68baSNigel Croxon     //
875530d68baSNigel Croxon     // Image functions
876530d68baSNigel Croxon     //
877530d68baSNigel Croxon 
878530d68baSNigel Croxon     EFI_IMAGE_LOAD                  LoadImage;
879530d68baSNigel Croxon     EFI_IMAGE_START                 StartImage;
880530d68baSNigel Croxon     EFI_EXIT                        Exit;
881530d68baSNigel Croxon     EFI_IMAGE_UNLOAD                UnloadImage;
882530d68baSNigel Croxon     EFI_EXIT_BOOT_SERVICES          ExitBootServices;
883530d68baSNigel Croxon 
884530d68baSNigel Croxon     //
885530d68baSNigel Croxon     // Misc functions
886530d68baSNigel Croxon     //
887530d68baSNigel Croxon 
888530d68baSNigel Croxon     EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
889530d68baSNigel Croxon     EFI_STALL                       Stall;
890530d68baSNigel Croxon     EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
891530d68baSNigel Croxon 
892530d68baSNigel Croxon     //
893530d68baSNigel Croxon     // DriverSupport Services
894530d68baSNigel Croxon     //
895530d68baSNigel Croxon 
896530d68baSNigel Croxon     EFI_CONNECT_CONTROLLER          ConnectController;
897530d68baSNigel Croxon     EFI_DISCONNECT_CONTROLLER       DisconnectController;
898530d68baSNigel Croxon 
899530d68baSNigel Croxon     //
900530d68baSNigel Croxon     // Open and Close Protocol Services
901530d68baSNigel Croxon     //
902530d68baSNigel Croxon     EFI_OPEN_PROTOCOL               OpenProtocol;
903530d68baSNigel Croxon     EFI_CLOSE_PROTOCOL              CloseProtocol;
904530d68baSNigel Croxon     EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
905530d68baSNigel Croxon 
906530d68baSNigel Croxon     //
907530d68baSNigel Croxon     // Library Services
908530d68baSNigel Croxon     //
909530d68baSNigel Croxon     EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
910530d68baSNigel Croxon     EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
911530d68baSNigel Croxon     EFI_LOCATE_PROTOCOL             LocateProtocol;
912530d68baSNigel Croxon     EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
913530d68baSNigel Croxon     EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
914530d68baSNigel Croxon 
915530d68baSNigel Croxon     //
916530d68baSNigel Croxon     // 32-bit CRC Services
917530d68baSNigel Croxon     //
918530d68baSNigel Croxon     EFI_CALCULATE_CRC32             CalculateCrc32;
919530d68baSNigel Croxon 
920530d68baSNigel Croxon     //
921530d68baSNigel Croxon     // Misc Services
922530d68baSNigel Croxon     //
923530d68baSNigel Croxon     EFI_COPY_MEM                    CopyMem;
924530d68baSNigel Croxon     EFI_SET_MEM                     SetMem;
925530d68baSNigel Croxon     EFI_CREATE_EVENT_EX             CreateEventEx;
926530d68baSNigel Croxon } EFI_BOOT_SERVICES;
927530d68baSNigel Croxon 
928530d68baSNigel Croxon 
929530d68baSNigel Croxon //
930530d68baSNigel Croxon // EFI Configuration Table and GUID definitions
931530d68baSNigel Croxon //
932530d68baSNigel Croxon 
933530d68baSNigel Croxon #define MPS_TABLE_GUID    \
934530d68baSNigel Croxon     { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
935530d68baSNigel Croxon 
936530d68baSNigel Croxon #define ACPI_TABLE_GUID    \
937530d68baSNigel Croxon     { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
938530d68baSNigel Croxon 
939530d68baSNigel Croxon #define ACPI_20_TABLE_GUID  \
940530d68baSNigel Croxon     { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
941530d68baSNigel Croxon 
942530d68baSNigel Croxon #define SMBIOS_TABLE_GUID    \
943530d68baSNigel Croxon     { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
944530d68baSNigel Croxon 
945ef81c051SNigel Croxon #define SMBIOS3_TABLE_GUID    \
946ef81c051SNigel Croxon     { 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
947ef81c051SNigel Croxon 
948530d68baSNigel Croxon #define SAL_SYSTEM_TABLE_GUID    \
949530d68baSNigel Croxon     { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
950530d68baSNigel Croxon 
951fbbbf47eSAlfonso Sánchez-Beato #define EFI_DTB_TABLE_GUID \
952fbbbf47eSAlfonso Sánchez-Beato     { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
953530d68baSNigel Croxon 
954530d68baSNigel Croxon typedef struct _EFI_CONFIGURATION_TABLE {
955530d68baSNigel Croxon     EFI_GUID                VendorGuid;
956530d68baSNigel Croxon     VOID                    *VendorTable;
957530d68baSNigel Croxon } EFI_CONFIGURATION_TABLE;
958530d68baSNigel Croxon 
959530d68baSNigel Croxon 
960530d68baSNigel Croxon //
961530d68baSNigel Croxon // EFI System Table
962530d68baSNigel Croxon //
963530d68baSNigel Croxon 
964530d68baSNigel Croxon 
965530d68baSNigel Croxon 
966530d68baSNigel Croxon 
967530d68baSNigel Croxon #define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
96893b2524aSPeter Jones #define EFI_1_02_SYSTEM_TABLE_REVISION ((1<<16) | (02))
96993b2524aSPeter Jones #define EFI_1_10_SYSTEM_TABLE_REVISION ((1<<16) | (10))
97093b2524aSPeter Jones #define EFI_2_00_SYSTEM_TABLE_REVISION ((2<<16) | (0))
971530d68baSNigel Croxon #define EFI_SYSTEM_TABLE_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
972530d68baSNigel Croxon 
973530d68baSNigel Croxon typedef struct _EFI_SYSTEM_TABLE {
974530d68baSNigel Croxon     EFI_TABLE_HEADER                Hdr;
975530d68baSNigel Croxon 
976530d68baSNigel Croxon     CHAR16                          *FirmwareVendor;
977530d68baSNigel Croxon     UINT32                          FirmwareRevision;
978530d68baSNigel Croxon 
979530d68baSNigel Croxon     EFI_HANDLE                      ConsoleInHandle;
980530d68baSNigel Croxon     SIMPLE_INPUT_INTERFACE          *ConIn;
981530d68baSNigel Croxon 
982530d68baSNigel Croxon     EFI_HANDLE                      ConsoleOutHandle;
983530d68baSNigel Croxon     SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
984530d68baSNigel Croxon 
985530d68baSNigel Croxon     EFI_HANDLE                      StandardErrorHandle;
986530d68baSNigel Croxon     SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
987530d68baSNigel Croxon 
988530d68baSNigel Croxon     EFI_RUNTIME_SERVICES            *RuntimeServices;
989530d68baSNigel Croxon     EFI_BOOT_SERVICES               *BootServices;
990530d68baSNigel Croxon 
991530d68baSNigel Croxon     UINTN                           NumberOfTableEntries;
992530d68baSNigel Croxon     EFI_CONFIGURATION_TABLE         *ConfigurationTable;
993530d68baSNigel Croxon 
994530d68baSNigel Croxon } EFI_SYSTEM_TABLE;
995530d68baSNigel Croxon 
996530d68baSNigel Croxon #endif
997530d68baSNigel Croxon 
998