xref: /DragonStub/inc/efiapi.h (revision 1ba13fdfd0c188a8ced74f4459bb35542018728e)
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
232530d68baSNigel Croxon 
233530d68baSNigel Croxon // Variable size limitation
234530d68baSNigel Croxon #define EFI_MAXIMUM_VARIABLE_SIZE           1024
235530d68baSNigel Croxon 
236530d68baSNigel Croxon typedef
237530d68baSNigel Croxon EFI_STATUS
238530d68baSNigel Croxon (EFIAPI *EFI_GET_VARIABLE) (
239530d68baSNigel Croxon     IN CHAR16                       *VariableName,
240530d68baSNigel Croxon     IN EFI_GUID                     *VendorGuid,
241530d68baSNigel Croxon     OUT UINT32                      *Attributes OPTIONAL,
242530d68baSNigel Croxon     IN OUT UINTN                    *DataSize,
243530d68baSNigel Croxon     OUT VOID                        *Data
244530d68baSNigel Croxon     );
245530d68baSNigel Croxon 
246530d68baSNigel Croxon typedef
247530d68baSNigel Croxon EFI_STATUS
248530d68baSNigel Croxon (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME) (
249530d68baSNigel Croxon     IN OUT UINTN                    *VariableNameSize,
250530d68baSNigel Croxon     IN OUT CHAR16                   *VariableName,
251530d68baSNigel Croxon     IN OUT EFI_GUID                 *VendorGuid
252530d68baSNigel Croxon     );
253530d68baSNigel Croxon 
254530d68baSNigel Croxon 
255530d68baSNigel Croxon typedef
256530d68baSNigel Croxon EFI_STATUS
257530d68baSNigel Croxon (EFIAPI *EFI_SET_VARIABLE) (
258530d68baSNigel Croxon     IN CHAR16                       *VariableName,
259530d68baSNigel Croxon     IN EFI_GUID                     *VendorGuid,
260530d68baSNigel Croxon     IN UINT32                       Attributes,
261530d68baSNigel Croxon     IN UINTN                        DataSize,
262530d68baSNigel Croxon     IN VOID                         *Data
263530d68baSNigel Croxon     );
264530d68baSNigel Croxon 
265530d68baSNigel Croxon 
266530d68baSNigel Croxon //
267530d68baSNigel Croxon // EFI Time
268530d68baSNigel Croxon //
269530d68baSNigel Croxon 
270530d68baSNigel Croxon typedef struct {
271530d68baSNigel Croxon         UINT32                      Resolution;     // 1e-6 parts per million
272530d68baSNigel Croxon         UINT32                      Accuracy;       // hertz
273530d68baSNigel Croxon         BOOLEAN                     SetsToZero;     // Set clears sub-second time
274530d68baSNigel Croxon } EFI_TIME_CAPABILITIES;
275530d68baSNigel Croxon 
276530d68baSNigel Croxon 
277530d68baSNigel Croxon typedef
278530d68baSNigel Croxon EFI_STATUS
279530d68baSNigel Croxon (EFIAPI *EFI_GET_TIME) (
280530d68baSNigel Croxon     OUT EFI_TIME                    *Time,
281530d68baSNigel Croxon     OUT EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
282530d68baSNigel Croxon     );
283530d68baSNigel Croxon 
284530d68baSNigel Croxon typedef
285530d68baSNigel Croxon EFI_STATUS
286530d68baSNigel Croxon (EFIAPI *EFI_SET_TIME) (
287530d68baSNigel Croxon     IN EFI_TIME                     *Time
288530d68baSNigel Croxon     );
289530d68baSNigel Croxon 
290530d68baSNigel Croxon typedef
291530d68baSNigel Croxon EFI_STATUS
292530d68baSNigel Croxon (EFIAPI *EFI_GET_WAKEUP_TIME) (
293530d68baSNigel Croxon     OUT BOOLEAN                     *Enabled,
294530d68baSNigel Croxon     OUT BOOLEAN                     *Pending,
295530d68baSNigel Croxon     OUT EFI_TIME                    *Time
296530d68baSNigel Croxon     );
297530d68baSNigel Croxon 
298530d68baSNigel Croxon typedef
299530d68baSNigel Croxon EFI_STATUS
300530d68baSNigel Croxon (EFIAPI *EFI_SET_WAKEUP_TIME) (
301530d68baSNigel Croxon     IN BOOLEAN                      Enable,
302530d68baSNigel Croxon     IN EFI_TIME                     *Time OPTIONAL
303530d68baSNigel Croxon     );
304530d68baSNigel Croxon 
305530d68baSNigel Croxon 
306530d68baSNigel Croxon //
307530d68baSNigel Croxon // Image functions
308530d68baSNigel Croxon //
309530d68baSNigel Croxon 
310530d68baSNigel Croxon 
311530d68baSNigel Croxon // PE32+ Subsystem type for EFI images
312530d68baSNigel Croxon 
313530d68baSNigel Croxon #if !defined(IMAGE_SUBSYSTEM_EFI_APPLICATION)
314530d68baSNigel Croxon #define IMAGE_SUBSYSTEM_EFI_APPLICATION             10
315530d68baSNigel Croxon #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER     11
316530d68baSNigel Croxon #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER          12
317530d68baSNigel Croxon #endif
318530d68baSNigel Croxon 
319530d68baSNigel Croxon // PE32+ Machine type for EFI images
320530d68baSNigel Croxon 
321530d68baSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_IA32)
322530d68baSNigel Croxon #define EFI_IMAGE_MACHINE_IA32      0x014c
323530d68baSNigel Croxon #endif
324530d68baSNigel Croxon 
325530d68baSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_IA64)
326530d68baSNigel Croxon #define EFI_IMAGE_MACHINE_IA64      0x0200
327530d68baSNigel Croxon #endif
328530d68baSNigel Croxon 
3299cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_EBC)
3309cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_EBC      0x0EBC
3319cdd67daSNigel Croxon #endif
3329cdd67daSNigel Croxon 
3339cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_X64)
3349cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_X64       0x8664
3359cdd67daSNigel Croxon #endif
3369cdd67daSNigel Croxon 
3379cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_ARMTHUMB_MIXED)
3389cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_ARMTHUMB_MIXED 0x01C2
3399cdd67daSNigel Croxon #endif
3409cdd67daSNigel Croxon 
3419cdd67daSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_AARCH64)
3429cdd67daSNigel Croxon #define EFI_IMAGE_MACHINE_AARCH64   0xAA64
3439cdd67daSNigel Croxon #endif
3449cdd67daSNigel Croxon 
345860b1c8cSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_RISCV32)
346860b1c8cSNigel Croxon #define EFI_IMAGE_MACHINE_RISCV32   0x5032
347860b1c8cSNigel Croxon #endif
348860b1c8cSNigel Croxon 
349860b1c8cSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_RISCV64)
350860b1c8cSNigel Croxon #define EFI_IMAGE_MACHINE_RISCV64   0x5064
351860b1c8cSNigel Croxon #endif
352860b1c8cSNigel Croxon 
353860b1c8cSNigel Croxon #if !defined(EFI_IMAGE_MACHINE_RISCV128)
354860b1c8cSNigel Croxon #define EFI_IMAGE_MACHINE_RISCV128  0x5128
355860b1c8cSNigel Croxon #endif
356860b1c8cSNigel Croxon 
357*1ba13fdfSXiaotian Wu #if !defined(EFI_IMAGE_MACHINE_LOONGARCH32)
358*1ba13fdfSXiaotian Wu #define EFI_IMAGE_MACHINE_LOONGARCH32   0x6232
359*1ba13fdfSXiaotian Wu #endif
360*1ba13fdfSXiaotian Wu 
361*1ba13fdfSXiaotian Wu #if !defined(EFI_IMAGE_MACHINE_LOONGARCH64)
362*1ba13fdfSXiaotian Wu #define EFI_IMAGE_MACHINE_LOONGARCH64   0x6264
363*1ba13fdfSXiaotian Wu #endif
364*1ba13fdfSXiaotian Wu 
365530d68baSNigel Croxon // Image Entry prototype
366530d68baSNigel Croxon 
367530d68baSNigel Croxon typedef
368530d68baSNigel Croxon EFI_STATUS
369530d68baSNigel Croxon (EFIAPI *EFI_IMAGE_ENTRY_POINT) (
370530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
371530d68baSNigel Croxon     IN struct _EFI_SYSTEM_TABLE     *SystemTable
372530d68baSNigel Croxon     );
373530d68baSNigel Croxon 
374530d68baSNigel Croxon typedef
375530d68baSNigel Croxon EFI_STATUS
376530d68baSNigel Croxon (EFIAPI *EFI_IMAGE_LOAD) (
377530d68baSNigel Croxon     IN BOOLEAN                      BootPolicy,
378530d68baSNigel Croxon     IN EFI_HANDLE                   ParentImageHandle,
379530d68baSNigel Croxon     IN EFI_DEVICE_PATH              *FilePath,
380530d68baSNigel Croxon     IN VOID                         *SourceBuffer   OPTIONAL,
381530d68baSNigel Croxon     IN UINTN                        SourceSize,
382530d68baSNigel Croxon     OUT EFI_HANDLE                  *ImageHandle
383530d68baSNigel Croxon     );
384530d68baSNigel Croxon 
385530d68baSNigel Croxon typedef
386530d68baSNigel Croxon EFI_STATUS
387530d68baSNigel Croxon (EFIAPI *EFI_IMAGE_START) (
388530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
389530d68baSNigel Croxon     OUT UINTN                       *ExitDataSize,
390530d68baSNigel Croxon     OUT CHAR16                      **ExitData  OPTIONAL
391530d68baSNigel Croxon     );
392530d68baSNigel Croxon 
393530d68baSNigel Croxon typedef
394530d68baSNigel Croxon EFI_STATUS
395530d68baSNigel Croxon (EFIAPI *EFI_EXIT) (
396530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
397530d68baSNigel Croxon     IN EFI_STATUS                   ExitStatus,
398530d68baSNigel Croxon     IN UINTN                        ExitDataSize,
399530d68baSNigel Croxon     IN CHAR16                       *ExitData OPTIONAL
400530d68baSNigel Croxon     );
401530d68baSNigel Croxon 
402530d68baSNigel Croxon 
403530d68baSNigel Croxon // Image handle
4043b31a5e3SNigel Croxon /*#define LOADED_IMAGE_PROTOCOL      \
405530d68baSNigel Croxon     { 0x5B1B31A1, 0x9562, 0x11d2, {0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B} }
406530d68baSNigel Croxon 
407530d68baSNigel Croxon #define EFI_IMAGE_INFORMATION_REVISION      0x1000
408530d68baSNigel Croxon typedef struct {
409530d68baSNigel Croxon     UINT32                          Revision;
410530d68baSNigel Croxon     EFI_HANDLE                      ParentHandle;
411530d68baSNigel Croxon     struct _EFI_SYSTEM_TABLE        *SystemTable;
412530d68baSNigel Croxon 
413530d68baSNigel Croxon     // Source location of image
414530d68baSNigel Croxon     EFI_HANDLE                      DeviceHandle;
415530d68baSNigel Croxon     EFI_DEVICE_PATH                 *FilePath;
416530d68baSNigel Croxon     VOID                            *Reserved;
417530d68baSNigel Croxon 
418530d68baSNigel Croxon     // Images load options
419530d68baSNigel Croxon     UINT32                          LoadOptionsSize;
420530d68baSNigel Croxon     VOID                            *LoadOptions;
421530d68baSNigel Croxon 
422530d68baSNigel Croxon     // Location of where image was loaded
423530d68baSNigel Croxon     VOID                            *ImageBase;
424530d68baSNigel Croxon     UINT64                          ImageSize;
425530d68baSNigel Croxon     EFI_MEMORY_TYPE                 ImageCodeType;
426530d68baSNigel Croxon     EFI_MEMORY_TYPE                 ImageDataType;
427530d68baSNigel Croxon 
428530d68baSNigel Croxon     // If the driver image supports a dynamic unload request
429530d68baSNigel Croxon     EFI_IMAGE_UNLOAD                Unload;
430530d68baSNigel Croxon 
4313b31a5e3SNigel Croxon } EFI_LOADED_IMAGE;*/
432530d68baSNigel Croxon 
433530d68baSNigel Croxon 
434530d68baSNigel Croxon typedef
435530d68baSNigel Croxon EFI_STATUS
436530d68baSNigel Croxon (EFIAPI *EFI_EXIT_BOOT_SERVICES) (
437530d68baSNigel Croxon     IN EFI_HANDLE                   ImageHandle,
438530d68baSNigel Croxon     IN UINTN                        MapKey
439530d68baSNigel Croxon     );
440530d68baSNigel Croxon 
441530d68baSNigel Croxon //
442530d68baSNigel Croxon // Misc
443530d68baSNigel Croxon //
444530d68baSNigel Croxon 
445530d68baSNigel Croxon 
446530d68baSNigel Croxon typedef
447530d68baSNigel Croxon EFI_STATUS
448530d68baSNigel Croxon (EFIAPI *EFI_STALL) (
449530d68baSNigel Croxon     IN UINTN                    Microseconds
450530d68baSNigel Croxon     );
451530d68baSNigel Croxon 
452530d68baSNigel Croxon typedef
453530d68baSNigel Croxon EFI_STATUS
454530d68baSNigel Croxon (EFIAPI *EFI_SET_WATCHDOG_TIMER) (
455530d68baSNigel Croxon     IN UINTN                    Timeout,
456530d68baSNigel Croxon     IN UINT64                   WatchdogCode,
457530d68baSNigel Croxon     IN UINTN                    DataSize,
458530d68baSNigel Croxon     IN CHAR16                   *WatchdogData OPTIONAL
459530d68baSNigel Croxon     );
460530d68baSNigel Croxon 
461530d68baSNigel Croxon typedef
462530d68baSNigel Croxon EFI_STATUS
463530d68baSNigel Croxon (EFIAPI *EFI_CONNECT_CONTROLLER) (
464530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle,
465530d68baSNigel Croxon     IN EFI_HANDLE               *DriverImageHandle OPTIONAL,
466530d68baSNigel Croxon     IN EFI_DEVICE_PATH          *RemainingDevicePath OPTIONAL,
467530d68baSNigel Croxon     IN BOOLEAN                  Recursive
468530d68baSNigel Croxon     );
469530d68baSNigel Croxon 
470530d68baSNigel Croxon typedef
471530d68baSNigel Croxon EFI_STATUS
472530d68baSNigel Croxon (EFIAPI *EFI_DISCONNECT_CONTROLLER) (
473530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle,
474530d68baSNigel Croxon     IN EFI_HANDLE               DriverImageHandle OPTIONAL,
475530d68baSNigel Croxon     IN EFI_HANDLE               ChildHandle OPTIONAL
476530d68baSNigel Croxon     );
477530d68baSNigel Croxon 
478530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
479530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
480530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
481530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
482530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
483530d68baSNigel Croxon #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
484530d68baSNigel Croxon 
485530d68baSNigel Croxon typedef
486530d68baSNigel Croxon EFI_STATUS
487530d68baSNigel Croxon (EFIAPI *EFI_OPEN_PROTOCOL) (
488530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
489530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
490530d68baSNigel Croxon     OUT VOID                    **Interface OPTIONAL,
491530d68baSNigel Croxon     IN EFI_HANDLE               AgentHandle,
492530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle,
493530d68baSNigel Croxon     IN UINT32                   Attributes
494530d68baSNigel Croxon     );
495530d68baSNigel Croxon 
496530d68baSNigel Croxon typedef
497530d68baSNigel Croxon EFI_STATUS
498530d68baSNigel Croxon (EFIAPI *EFI_CLOSE_PROTOCOL) (
499530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
500530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
501530d68baSNigel Croxon     IN EFI_HANDLE               AgentHandle,
502530d68baSNigel Croxon     IN EFI_HANDLE               ControllerHandle
503530d68baSNigel Croxon     );
504530d68baSNigel Croxon 
505530d68baSNigel Croxon typedef struct {
506530d68baSNigel Croxon     EFI_HANDLE                  AgentHandle;
507530d68baSNigel Croxon     EFI_HANDLE                  ControllerHandle;
508530d68baSNigel Croxon     UINT32                      Attributes;
509530d68baSNigel Croxon     UINT32                      OpenCount;
510530d68baSNigel Croxon } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
511530d68baSNigel Croxon 
512530d68baSNigel Croxon typedef
513530d68baSNigel Croxon EFI_STATUS
514530d68baSNigel Croxon (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION) (
515530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
516530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
517530d68baSNigel Croxon     OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
518530d68baSNigel Croxon     OUT UINTN                   *EntryCount
519530d68baSNigel Croxon     );
520530d68baSNigel Croxon 
521530d68baSNigel Croxon typedef
522530d68baSNigel Croxon EFI_STATUS
523530d68baSNigel Croxon (EFIAPI *EFI_PROTOCOLS_PER_HANDLE) (
524530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
525530d68baSNigel Croxon     OUT EFI_GUID                ***ProtocolBuffer,
526530d68baSNigel Croxon     OUT UINTN                   *ProtocolBufferCount
527530d68baSNigel Croxon     );
528530d68baSNigel Croxon 
529530d68baSNigel Croxon typedef enum {
530530d68baSNigel Croxon     AllHandles,
531530d68baSNigel Croxon     ByRegisterNotify,
532530d68baSNigel Croxon     ByProtocol
533530d68baSNigel Croxon } EFI_LOCATE_SEARCH_TYPE;
534530d68baSNigel Croxon 
535530d68baSNigel Croxon typedef
536530d68baSNigel Croxon EFI_STATUS
537530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_HANDLE_BUFFER) (
538530d68baSNigel Croxon     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
539530d68baSNigel Croxon     IN EFI_GUID                 *Protocol OPTIONAL,
540530d68baSNigel Croxon     IN VOID                     *SearchKey OPTIONAL,
541530d68baSNigel Croxon     IN OUT UINTN                *NoHandles,
542530d68baSNigel Croxon     OUT EFI_HANDLE              **Buffer
543530d68baSNigel Croxon     );
544530d68baSNigel Croxon 
545530d68baSNigel Croxon typedef
546530d68baSNigel Croxon EFI_STATUS
547530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_PROTOCOL) (
548530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
549530d68baSNigel Croxon     IN VOID                     *Registration OPTIONAL,
550530d68baSNigel Croxon     OUT VOID                    **Interface
551530d68baSNigel Croxon     );
552530d68baSNigel Croxon 
553530d68baSNigel Croxon typedef
554530d68baSNigel Croxon EFI_STATUS
555530d68baSNigel Croxon (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
556530d68baSNigel Croxon     IN OUT EFI_HANDLE           *Handle,
557530d68baSNigel Croxon     ...
558530d68baSNigel Croxon     );
559530d68baSNigel Croxon 
560530d68baSNigel Croxon typedef
561530d68baSNigel Croxon EFI_STATUS
562530d68baSNigel Croxon (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
563530d68baSNigel Croxon     IN OUT EFI_HANDLE           Handle,
564530d68baSNigel Croxon     ...
565530d68baSNigel Croxon     );
566530d68baSNigel Croxon 
567530d68baSNigel Croxon typedef
568530d68baSNigel Croxon EFI_STATUS
569530d68baSNigel Croxon (EFIAPI *EFI_CALCULATE_CRC32) (
570530d68baSNigel Croxon     IN VOID                     *Data,
571530d68baSNigel Croxon     IN UINTN                    DataSize,
572530d68baSNigel Croxon     OUT UINT32                  *Crc32
573530d68baSNigel Croxon     );
574530d68baSNigel Croxon 
575530d68baSNigel Croxon typedef
576530d68baSNigel Croxon VOID
577530d68baSNigel Croxon (EFIAPI *EFI_COPY_MEM) (
578530d68baSNigel Croxon     IN VOID                     *Destination,
579530d68baSNigel Croxon     IN VOID                     *Source,
580530d68baSNigel Croxon     IN UINTN                    Length
581530d68baSNigel Croxon     );
582530d68baSNigel Croxon 
583530d68baSNigel Croxon typedef
584530d68baSNigel Croxon VOID
585530d68baSNigel Croxon (EFIAPI *EFI_SET_MEM) (
586530d68baSNigel Croxon     IN VOID                     *Buffer,
587530d68baSNigel Croxon     IN UINTN                    Size,
588530d68baSNigel Croxon     IN UINT8                    Value
589530d68baSNigel Croxon     );
590530d68baSNigel Croxon 
591530d68baSNigel Croxon 
592530d68baSNigel Croxon typedef
593530d68baSNigel Croxon EFI_STATUS
594530d68baSNigel Croxon (EFIAPI *EFI_CREATE_EVENT_EX) (
595530d68baSNigel Croxon     IN UINT32                   Type,
596530d68baSNigel Croxon     IN EFI_TPL                  NotifyTpl,
597530d68baSNigel Croxon     IN EFI_EVENT_NOTIFY         NotifyFunction OPTIONAL,
598530d68baSNigel Croxon     IN const VOID               *NotifyContext OPTIONAL,
599238358c6Sleo     IN const EFI_GUID           *EventGroup OPTIONAL,
600530d68baSNigel Croxon     OUT EFI_EVENT               *Event
601530d68baSNigel Croxon     );
602530d68baSNigel Croxon 
603530d68baSNigel Croxon typedef enum {
604530d68baSNigel Croxon     EfiResetCold,
605530d68baSNigel Croxon     EfiResetWarm,
606530d68baSNigel Croxon     EfiResetShutdown
607530d68baSNigel Croxon } EFI_RESET_TYPE;
608530d68baSNigel Croxon 
609530d68baSNigel Croxon typedef
610530d68baSNigel Croxon EFI_STATUS
611530d68baSNigel Croxon (EFIAPI *EFI_RESET_SYSTEM) (
612530d68baSNigel Croxon     IN EFI_RESET_TYPE           ResetType,
613530d68baSNigel Croxon     IN EFI_STATUS               ResetStatus,
614530d68baSNigel Croxon     IN UINTN                    DataSize,
615530d68baSNigel Croxon     IN CHAR16                   *ResetData OPTIONAL
616530d68baSNigel Croxon     );
617530d68baSNigel Croxon 
618530d68baSNigel Croxon typedef
619530d68baSNigel Croxon EFI_STATUS
620530d68baSNigel Croxon (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
621530d68baSNigel Croxon     OUT UINT64                  *Count
622530d68baSNigel Croxon     );
623530d68baSNigel Croxon 
624530d68baSNigel Croxon typedef
625530d68baSNigel Croxon EFI_STATUS
626530d68baSNigel Croxon (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
627530d68baSNigel Croxon     OUT UINT32                  *HighCount
628530d68baSNigel Croxon     );
629530d68baSNigel Croxon 
630530d68baSNigel Croxon typedef struct {
631530d68baSNigel Croxon     UINT64                      Length;
632530d68baSNigel Croxon     union {
633530d68baSNigel Croxon         EFI_PHYSICAL_ADDRESS    DataBlock;
634530d68baSNigel Croxon        EFI_PHYSICAL_ADDRESS    ContinuationPointer;
635530d68baSNigel Croxon     } Union;
636530d68baSNigel Croxon } EFI_CAPSULE_BLOCK_DESCRIPTOR;
637530d68baSNigel Croxon 
638530d68baSNigel Croxon typedef struct {
639530d68baSNigel Croxon     EFI_GUID                    CapsuleGuid;
640530d68baSNigel Croxon     UINT32                      HeaderSize;
641530d68baSNigel Croxon     UINT32                      Flags;
642530d68baSNigel Croxon     UINT32                      CapsuleImageSize;
643530d68baSNigel Croxon } EFI_CAPSULE_HEADER;
644530d68baSNigel Croxon 
645530d68baSNigel Croxon #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET    0x00010000
646530d68baSNigel Croxon #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE   0x00020000
647530d68baSNigel Croxon #define CAPSULE_FLAGS_INITIATE_RESET          0x00040000
648530d68baSNigel Croxon 
649530d68baSNigel Croxon typedef
650530d68baSNigel Croxon EFI_STATUS
651530d68baSNigel Croxon (EFIAPI *EFI_UPDATE_CAPSULE) (
652530d68baSNigel Croxon     IN EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
653530d68baSNigel Croxon     IN UINTN                    CapsuleCount,
654530d68baSNigel Croxon     IN EFI_PHYSICAL_ADDRESS     ScatterGatherList OPTIONAL
655530d68baSNigel Croxon     );
656530d68baSNigel Croxon 
657530d68baSNigel Croxon typedef
658530d68baSNigel Croxon EFI_STATUS
659530d68baSNigel Croxon (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES) (
660530d68baSNigel Croxon     IN  EFI_CAPSULE_HEADER       **CapsuleHeaderArray,
661530d68baSNigel Croxon     IN  UINTN                    CapsuleCount,
662530d68baSNigel Croxon     OUT UINT64                   *MaximumCapsuleSize,
663530d68baSNigel Croxon     OUT EFI_RESET_TYPE           *ResetType
664530d68baSNigel Croxon     );
665530d68baSNigel Croxon 
666530d68baSNigel Croxon typedef
667530d68baSNigel Croxon EFI_STATUS
668530d68baSNigel Croxon (EFIAPI *EFI_QUERY_VARIABLE_INFO) (
669530d68baSNigel Croxon     IN  UINT32                  Attributes,
670530d68baSNigel Croxon     OUT UINT64                  *MaximumVariableStorageSize,
671530d68baSNigel Croxon     OUT UINT64                  *RemainingVariableStorageSize,
672530d68baSNigel Croxon     OUT UINT64                  *MaximumVariableSize
673530d68baSNigel Croxon     );
674530d68baSNigel Croxon 
675530d68baSNigel Croxon //
676530d68baSNigel Croxon // Protocol handler functions
677530d68baSNigel Croxon //
678530d68baSNigel Croxon 
679530d68baSNigel Croxon typedef enum {
680530d68baSNigel Croxon     EFI_NATIVE_INTERFACE,
681530d68baSNigel Croxon     EFI_PCODE_INTERFACE
682530d68baSNigel Croxon } EFI_INTERFACE_TYPE;
683530d68baSNigel Croxon 
684530d68baSNigel Croxon typedef
685530d68baSNigel Croxon EFI_STATUS
686530d68baSNigel Croxon (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
687530d68baSNigel Croxon     IN OUT EFI_HANDLE           *Handle,
688530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
689530d68baSNigel Croxon     IN EFI_INTERFACE_TYPE       InterfaceType,
690530d68baSNigel Croxon     IN VOID                     *Interface
691530d68baSNigel Croxon     );
692530d68baSNigel Croxon 
693530d68baSNigel Croxon typedef
694530d68baSNigel Croxon EFI_STATUS
695530d68baSNigel Croxon (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
696530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
697530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
698530d68baSNigel Croxon     IN VOID                     *OldInterface,
699530d68baSNigel Croxon     IN VOID                     *NewInterface
700530d68baSNigel Croxon     );
701530d68baSNigel Croxon 
702530d68baSNigel Croxon typedef
703530d68baSNigel Croxon EFI_STATUS
704530d68baSNigel Croxon (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
705530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
706530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
707530d68baSNigel Croxon     IN VOID                     *Interface
708530d68baSNigel Croxon     );
709530d68baSNigel Croxon 
710530d68baSNigel Croxon typedef
711530d68baSNigel Croxon EFI_STATUS
712530d68baSNigel Croxon (EFIAPI *EFI_HANDLE_PROTOCOL) (
713530d68baSNigel Croxon     IN EFI_HANDLE               Handle,
714530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
715530d68baSNigel Croxon     OUT VOID                    **Interface
716530d68baSNigel Croxon     );
717530d68baSNigel Croxon 
718530d68baSNigel Croxon typedef
719530d68baSNigel Croxon EFI_STATUS
720530d68baSNigel Croxon (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY) (
721530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
722530d68baSNigel Croxon     IN EFI_EVENT                Event,
723530d68baSNigel Croxon     OUT VOID                    **Registration
724530d68baSNigel Croxon     );
725530d68baSNigel Croxon 
726530d68baSNigel Croxon typedef
727530d68baSNigel Croxon EFI_STATUS
728530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_HANDLE) (
729530d68baSNigel Croxon     IN EFI_LOCATE_SEARCH_TYPE   SearchType,
730530d68baSNigel Croxon     IN EFI_GUID                 *Protocol OPTIONAL,
731530d68baSNigel Croxon     IN VOID                     *SearchKey OPTIONAL,
732530d68baSNigel Croxon     IN OUT UINTN                *BufferSize,
733530d68baSNigel Croxon     OUT EFI_HANDLE              *Buffer
734530d68baSNigel Croxon     );
735530d68baSNigel Croxon 
736530d68baSNigel Croxon typedef
737530d68baSNigel Croxon EFI_STATUS
738530d68baSNigel Croxon (EFIAPI *EFI_LOCATE_DEVICE_PATH) (
739530d68baSNigel Croxon     IN EFI_GUID                 *Protocol,
740530d68baSNigel Croxon     IN OUT EFI_DEVICE_PATH      **DevicePath,
741530d68baSNigel Croxon     OUT EFI_HANDLE              *Device
742530d68baSNigel Croxon     );
743530d68baSNigel Croxon 
744530d68baSNigel Croxon typedef
745530d68baSNigel Croxon EFI_STATUS
746530d68baSNigel Croxon (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE) (
747530d68baSNigel Croxon     IN EFI_GUID                 *Guid,
748530d68baSNigel Croxon     IN VOID                     *Table
749530d68baSNigel Croxon     );
750530d68baSNigel Croxon 
751530d68baSNigel Croxon typedef
752530d68baSNigel Croxon EFI_STATUS
753530d68baSNigel Croxon (EFIAPI *EFI_RESERVED_SERVICE) (
754530d68baSNigel Croxon     );
755530d68baSNigel Croxon 
756530d68baSNigel Croxon //
757530d68baSNigel Croxon // Standard EFI table header
758530d68baSNigel Croxon //
759530d68baSNigel Croxon 
760530d68baSNigel Croxon typedef struct _EFI_TABLE_HEADER {
761530d68baSNigel Croxon     UINT64                      Signature;
762530d68baSNigel Croxon     UINT32                      Revision;
763530d68baSNigel Croxon     UINT32                      HeaderSize;
764530d68baSNigel Croxon     UINT32                      CRC32;
765530d68baSNigel Croxon     UINT32                      Reserved;
766530d68baSNigel Croxon } EFI_TABLE_HEADER;
767530d68baSNigel Croxon 
768530d68baSNigel Croxon 
769530d68baSNigel Croxon //
770530d68baSNigel Croxon // EFI Runtime Serivces Table
771530d68baSNigel Croxon //
772530d68baSNigel Croxon 
773530d68baSNigel Croxon #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552
774530d68baSNigel Croxon #define EFI_RUNTIME_SERVICES_REVISION   (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
775530d68baSNigel Croxon 
776530d68baSNigel Croxon typedef struct  {
777530d68baSNigel Croxon     EFI_TABLE_HEADER                Hdr;
778530d68baSNigel Croxon 
779530d68baSNigel Croxon     //
780530d68baSNigel Croxon     // Time services
781530d68baSNigel Croxon     //
782530d68baSNigel Croxon 
783530d68baSNigel Croxon     EFI_GET_TIME                    GetTime;
784530d68baSNigel Croxon     EFI_SET_TIME                    SetTime;
785530d68baSNigel Croxon     EFI_GET_WAKEUP_TIME             GetWakeupTime;
786530d68baSNigel Croxon     EFI_SET_WAKEUP_TIME             SetWakeupTime;
787530d68baSNigel Croxon 
788530d68baSNigel Croxon     //
789530d68baSNigel Croxon     // Virtual memory services
790530d68baSNigel Croxon     //
791530d68baSNigel Croxon 
792530d68baSNigel Croxon     EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
793530d68baSNigel Croxon     EFI_CONVERT_POINTER             ConvertPointer;
794530d68baSNigel Croxon 
795530d68baSNigel Croxon     //
796530d68baSNigel Croxon     // Variable serviers
797530d68baSNigel Croxon     //
798530d68baSNigel Croxon 
799530d68baSNigel Croxon     EFI_GET_VARIABLE                GetVariable;
800530d68baSNigel Croxon     EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
801530d68baSNigel Croxon     EFI_SET_VARIABLE                SetVariable;
802530d68baSNigel Croxon 
803530d68baSNigel Croxon     //
804530d68baSNigel Croxon     // Misc
805530d68baSNigel Croxon     //
806530d68baSNigel Croxon 
807530d68baSNigel Croxon     EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
808530d68baSNigel Croxon     EFI_RESET_SYSTEM                ResetSystem;
809530d68baSNigel Croxon 
810530d68baSNigel Croxon     EFI_UPDATE_CAPSULE              UpdateCapsule;
811530d68baSNigel Croxon     EFI_QUERY_CAPSULE_CAPABILITIES  QueryCapsuleCapabilities;
812530d68baSNigel Croxon     EFI_QUERY_VARIABLE_INFO         QueryVariableInfo;
813530d68baSNigel Croxon } EFI_RUNTIME_SERVICES;
814530d68baSNigel Croxon 
815530d68baSNigel Croxon 
816530d68baSNigel Croxon //
817530d68baSNigel Croxon // EFI Boot Services Table
818530d68baSNigel Croxon //
819530d68baSNigel Croxon 
820530d68baSNigel Croxon #define EFI_BOOT_SERVICES_SIGNATURE     0x56524553544f4f42
821530d68baSNigel Croxon #define EFI_BOOT_SERVICES_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
822530d68baSNigel Croxon 
823530d68baSNigel Croxon typedef struct _EFI_BOOT_SERVICES {
824530d68baSNigel Croxon 
825530d68baSNigel Croxon     EFI_TABLE_HEADER                Hdr;
826530d68baSNigel Croxon 
827530d68baSNigel Croxon     //
828530d68baSNigel Croxon     // Task priority functions
829530d68baSNigel Croxon     //
830530d68baSNigel Croxon 
831530d68baSNigel Croxon     EFI_RAISE_TPL                   RaiseTPL;
832530d68baSNigel Croxon     EFI_RESTORE_TPL                 RestoreTPL;
833530d68baSNigel Croxon 
834530d68baSNigel Croxon     //
835530d68baSNigel Croxon     // Memory functions
836530d68baSNigel Croxon     //
837530d68baSNigel Croxon 
838530d68baSNigel Croxon     EFI_ALLOCATE_PAGES              AllocatePages;
839530d68baSNigel Croxon     EFI_FREE_PAGES                  FreePages;
840530d68baSNigel Croxon     EFI_GET_MEMORY_MAP              GetMemoryMap;
841530d68baSNigel Croxon     EFI_ALLOCATE_POOL               AllocatePool;
842530d68baSNigel Croxon     EFI_FREE_POOL                   FreePool;
843530d68baSNigel Croxon 
844530d68baSNigel Croxon     //
845530d68baSNigel Croxon     // Event & timer functions
846530d68baSNigel Croxon     //
847530d68baSNigel Croxon 
848530d68baSNigel Croxon     EFI_CREATE_EVENT                CreateEvent;
849530d68baSNigel Croxon     EFI_SET_TIMER                   SetTimer;
850530d68baSNigel Croxon     EFI_WAIT_FOR_EVENT              WaitForEvent;
851530d68baSNigel Croxon     EFI_SIGNAL_EVENT                SignalEvent;
852530d68baSNigel Croxon     EFI_CLOSE_EVENT                 CloseEvent;
853530d68baSNigel Croxon     EFI_CHECK_EVENT                 CheckEvent;
854530d68baSNigel Croxon 
855530d68baSNigel Croxon     //
856530d68baSNigel Croxon     // Protocol handler functions
857530d68baSNigel Croxon     //
858530d68baSNigel Croxon 
859530d68baSNigel Croxon     EFI_INSTALL_PROTOCOL_INTERFACE  InstallProtocolInterface;
860530d68baSNigel Croxon     EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
861530d68baSNigel Croxon     EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
862530d68baSNigel Croxon     EFI_HANDLE_PROTOCOL             HandleProtocol;
863530d68baSNigel Croxon     EFI_HANDLE_PROTOCOL             PCHandleProtocol;
864530d68baSNigel Croxon     EFI_REGISTER_PROTOCOL_NOTIFY    RegisterProtocolNotify;
865530d68baSNigel Croxon     EFI_LOCATE_HANDLE               LocateHandle;
866530d68baSNigel Croxon     EFI_LOCATE_DEVICE_PATH          LocateDevicePath;
867530d68baSNigel Croxon     EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
868530d68baSNigel Croxon 
869530d68baSNigel Croxon     //
870530d68baSNigel Croxon     // Image functions
871530d68baSNigel Croxon     //
872530d68baSNigel Croxon 
873530d68baSNigel Croxon     EFI_IMAGE_LOAD                  LoadImage;
874530d68baSNigel Croxon     EFI_IMAGE_START                 StartImage;
875530d68baSNigel Croxon     EFI_EXIT                        Exit;
876530d68baSNigel Croxon     EFI_IMAGE_UNLOAD                UnloadImage;
877530d68baSNigel Croxon     EFI_EXIT_BOOT_SERVICES          ExitBootServices;
878530d68baSNigel Croxon 
879530d68baSNigel Croxon     //
880530d68baSNigel Croxon     // Misc functions
881530d68baSNigel Croxon     //
882530d68baSNigel Croxon 
883530d68baSNigel Croxon     EFI_GET_NEXT_MONOTONIC_COUNT    GetNextMonotonicCount;
884530d68baSNigel Croxon     EFI_STALL                       Stall;
885530d68baSNigel Croxon     EFI_SET_WATCHDOG_TIMER          SetWatchdogTimer;
886530d68baSNigel Croxon 
887530d68baSNigel Croxon     //
888530d68baSNigel Croxon     // DriverSupport Services
889530d68baSNigel Croxon     //
890530d68baSNigel Croxon 
891530d68baSNigel Croxon     EFI_CONNECT_CONTROLLER          ConnectController;
892530d68baSNigel Croxon     EFI_DISCONNECT_CONTROLLER       DisconnectController;
893530d68baSNigel Croxon 
894530d68baSNigel Croxon     //
895530d68baSNigel Croxon     // Open and Close Protocol Services
896530d68baSNigel Croxon     //
897530d68baSNigel Croxon     EFI_OPEN_PROTOCOL               OpenProtocol;
898530d68baSNigel Croxon     EFI_CLOSE_PROTOCOL              CloseProtocol;
899530d68baSNigel Croxon     EFI_OPEN_PROTOCOL_INFORMATION   OpenProtocolInformation;
900530d68baSNigel Croxon 
901530d68baSNigel Croxon     //
902530d68baSNigel Croxon     // Library Services
903530d68baSNigel Croxon     //
904530d68baSNigel Croxon     EFI_PROTOCOLS_PER_HANDLE        ProtocolsPerHandle;
905530d68baSNigel Croxon     EFI_LOCATE_HANDLE_BUFFER        LocateHandleBuffer;
906530d68baSNigel Croxon     EFI_LOCATE_PROTOCOL             LocateProtocol;
907530d68baSNigel Croxon     EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
908530d68baSNigel Croxon     EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
909530d68baSNigel Croxon 
910530d68baSNigel Croxon     //
911530d68baSNigel Croxon     // 32-bit CRC Services
912530d68baSNigel Croxon     //
913530d68baSNigel Croxon     EFI_CALCULATE_CRC32             CalculateCrc32;
914530d68baSNigel Croxon 
915530d68baSNigel Croxon     //
916530d68baSNigel Croxon     // Misc Services
917530d68baSNigel Croxon     //
918530d68baSNigel Croxon     EFI_COPY_MEM                    CopyMem;
919530d68baSNigel Croxon     EFI_SET_MEM                     SetMem;
920530d68baSNigel Croxon     EFI_CREATE_EVENT_EX             CreateEventEx;
921530d68baSNigel Croxon } EFI_BOOT_SERVICES;
922530d68baSNigel Croxon 
923530d68baSNigel Croxon 
924530d68baSNigel Croxon //
925530d68baSNigel Croxon // EFI Configuration Table and GUID definitions
926530d68baSNigel Croxon //
927530d68baSNigel Croxon 
928530d68baSNigel Croxon #define MPS_TABLE_GUID    \
929530d68baSNigel Croxon     { 0xeb9d2d2f, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
930530d68baSNigel Croxon 
931530d68baSNigel Croxon #define ACPI_TABLE_GUID    \
932530d68baSNigel Croxon     { 0xeb9d2d30, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
933530d68baSNigel Croxon 
934530d68baSNigel Croxon #define ACPI_20_TABLE_GUID  \
935530d68baSNigel Croxon     { 0x8868e871, 0xe4f1, 0x11d3, {0xbc, 0x22, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} }
936530d68baSNigel Croxon 
937530d68baSNigel Croxon #define SMBIOS_TABLE_GUID    \
938530d68baSNigel Croxon     { 0xeb9d2d31, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
939530d68baSNigel Croxon 
940ef81c051SNigel Croxon #define SMBIOS3_TABLE_GUID    \
941ef81c051SNigel Croxon     { 0xf2fd1544, 0x9794, 0x4a2c, {0x99, 0x2e, 0xe5, 0xbb, 0xcf, 0x20, 0xe3, 0x94} }
942ef81c051SNigel Croxon 
943530d68baSNigel Croxon #define SAL_SYSTEM_TABLE_GUID    \
944530d68baSNigel Croxon     { 0xeb9d2d32, 0x2d88, 0x11d3, {0x9a, 0x16, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} }
945530d68baSNigel Croxon 
946fbbbf47eSAlfonso Sánchez-Beato #define EFI_DTB_TABLE_GUID \
947fbbbf47eSAlfonso Sánchez-Beato     { 0xb1b621d5, 0xf19c, 0x41a5, {0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0} }
948530d68baSNigel Croxon 
949530d68baSNigel Croxon typedef struct _EFI_CONFIGURATION_TABLE {
950530d68baSNigel Croxon     EFI_GUID                VendorGuid;
951530d68baSNigel Croxon     VOID                    *VendorTable;
952530d68baSNigel Croxon } EFI_CONFIGURATION_TABLE;
953530d68baSNigel Croxon 
954530d68baSNigel Croxon 
955530d68baSNigel Croxon //
956530d68baSNigel Croxon // EFI System Table
957530d68baSNigel Croxon //
958530d68baSNigel Croxon 
959530d68baSNigel Croxon 
960530d68baSNigel Croxon 
961530d68baSNigel Croxon 
962530d68baSNigel Croxon #define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249
963530d68baSNigel Croxon #define EFI_SYSTEM_TABLE_REVISION      (EFI_SPECIFICATION_MAJOR_REVISION<<16) | (EFI_SPECIFICATION_MINOR_REVISION)
964530d68baSNigel Croxon 
965530d68baSNigel Croxon typedef struct _EFI_SYSTEM_TABLE {
966530d68baSNigel Croxon     EFI_TABLE_HEADER                Hdr;
967530d68baSNigel Croxon 
968530d68baSNigel Croxon     CHAR16                          *FirmwareVendor;
969530d68baSNigel Croxon     UINT32                          FirmwareRevision;
970530d68baSNigel Croxon 
971530d68baSNigel Croxon     EFI_HANDLE                      ConsoleInHandle;
972530d68baSNigel Croxon     SIMPLE_INPUT_INTERFACE          *ConIn;
973530d68baSNigel Croxon 
974530d68baSNigel Croxon     EFI_HANDLE                      ConsoleOutHandle;
975530d68baSNigel Croxon     SIMPLE_TEXT_OUTPUT_INTERFACE    *ConOut;
976530d68baSNigel Croxon 
977530d68baSNigel Croxon     EFI_HANDLE                      StandardErrorHandle;
978530d68baSNigel Croxon     SIMPLE_TEXT_OUTPUT_INTERFACE    *StdErr;
979530d68baSNigel Croxon 
980530d68baSNigel Croxon     EFI_RUNTIME_SERVICES            *RuntimeServices;
981530d68baSNigel Croxon     EFI_BOOT_SERVICES               *BootServices;
982530d68baSNigel Croxon 
983530d68baSNigel Croxon     UINTN                           NumberOfTableEntries;
984530d68baSNigel Croxon     EFI_CONFIGURATION_TABLE         *ConfigurationTable;
985530d68baSNigel Croxon 
986530d68baSNigel Croxon } EFI_SYSTEM_TABLE;
987530d68baSNigel Croxon 
988530d68baSNigel Croxon #endif
989530d68baSNigel Croxon 
990