]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Uefi/UefiSpec.h
MdePkg: Clean up source files
[mirror_edk2.git] / MdePkg / Include / Uefi / UefiSpec.h
1 /** @file
2 Include file that supports UEFI.
3
4 This include file must contain things defined in the UEFI 2.7 specification.
5 If a code construct is defined in the UEFI 2.7 specification it must be included
6 by this include file.
7
8 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
9 This program and the accompanying materials are licensed and made available under
10 the terms and conditions of the BSD License that accompanies this distribution.
11 The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php.
13
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16
17 **/
18
19 #ifndef __UEFI_SPEC_H__
20 #define __UEFI_SPEC_H__
21
22 #include <Uefi/UefiMultiPhase.h>
23
24 #include <Protocol/DevicePath.h>
25 #include <Protocol/SimpleTextIn.h>
26 #include <Protocol/SimpleTextInEx.h>
27 #include <Protocol/SimpleTextOut.h>
28
29 ///
30 /// Enumeration of EFI memory allocation types.
31 ///
32 typedef enum {
33 ///
34 /// Allocate any available range of pages that satisfies the request.
35 ///
36 AllocateAnyPages,
37 ///
38 /// Allocate any available range of pages whose uppermost address is less than
39 /// or equal to a specified maximum address.
40 ///
41 AllocateMaxAddress,
42 ///
43 /// Allocate pages at a specified address.
44 ///
45 AllocateAddress,
46 ///
47 /// Maximum enumeration value that may be used for bounds checking.
48 ///
49 MaxAllocateType
50 } EFI_ALLOCATE_TYPE;
51
52 //
53 // Bit definitions for EFI_TIME.Daylight
54 //
55 #define EFI_TIME_ADJUST_DAYLIGHT 0x01
56 #define EFI_TIME_IN_DAYLIGHT 0x02
57
58 ///
59 /// Value definition for EFI_TIME.TimeZone.
60 ///
61 #define EFI_UNSPECIFIED_TIMEZONE 0x07FF
62
63 //
64 // Memory cacheability attributes
65 //
66 #define EFI_MEMORY_UC 0x0000000000000001ULL
67 #define EFI_MEMORY_WC 0x0000000000000002ULL
68 #define EFI_MEMORY_WT 0x0000000000000004ULL
69 #define EFI_MEMORY_WB 0x0000000000000008ULL
70 #define EFI_MEMORY_UCE 0x0000000000000010ULL
71 //
72 // Physical memory protection attributes
73 //
74 // Note: UEFI spec 2.5 and following: use EFI_MEMORY_RO as write-protected physical memory
75 // protection attribute. Also, EFI_MEMORY_WP means cacheability attribute.
76 //
77 #define EFI_MEMORY_WP 0x0000000000001000ULL
78 #define EFI_MEMORY_RP 0x0000000000002000ULL
79 #define EFI_MEMORY_XP 0x0000000000004000ULL
80 #define EFI_MEMORY_RO 0x0000000000020000ULL
81 //
82 // Physical memory persistence attribute.
83 // The memory region supports byte-addressable non-volatility.
84 //
85 #define EFI_MEMORY_NV 0x0000000000008000ULL
86 //
87 // The memory region provides higher reliability relative to other memory in the system.
88 // If all memory has the same reliability, then this bit is not used.
89 //
90 #define EFI_MEMORY_MORE_RELIABLE 0x0000000000010000ULL
91 //
92 // Runtime memory attribute
93 //
94 #define EFI_MEMORY_RUNTIME 0x8000000000000000ULL
95
96 ///
97 /// Memory descriptor version number.
98 ///
99 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
100
101 ///
102 /// Definition of an EFI memory descriptor.
103 ///
104 typedef struct {
105 ///
106 /// Type of the memory region.
107 /// Type EFI_MEMORY_TYPE is defined in the
108 /// AllocatePages() function description.
109 ///
110 UINT32 Type;
111 ///
112 /// Physical address of the first byte in the memory region. PhysicalStart must be
113 /// aligned on a 4 KiB boundary, and must not be above 0xfffffffffffff000. Type
114 /// EFI_PHYSICAL_ADDRESS is defined in the AllocatePages() function description
115 ///
116 EFI_PHYSICAL_ADDRESS PhysicalStart;
117 ///
118 /// Virtual address of the first byte in the memory region.
119 /// VirtualStart must be aligned on a 4 KiB boundary,
120 /// and must not be above 0xfffffffffffff000.
121 ///
122 EFI_VIRTUAL_ADDRESS VirtualStart;
123 ///
124 /// NumberOfPagesNumber of 4 KiB pages in the memory region.
125 /// NumberOfPages must not be 0, and must not be any value
126 /// that would represent a memory page with a start address,
127 /// either physical or virtual, above 0xfffffffffffff000.
128 ///
129 UINT64 NumberOfPages;
130 ///
131 /// Attributes of the memory region that describe the bit mask of capabilities
132 /// for that memory region, and not necessarily the current settings for that
133 /// memory region.
134 ///
135 UINT64 Attribute;
136 } EFI_MEMORY_DESCRIPTOR;
137
138 /**
139 Allocates memory pages from the system.
140
141 @param[in] Type The type of allocation to perform.
142 @param[in] MemoryType The type of memory to allocate.
143 MemoryType values in the range 0x70000000..0x7FFFFFFF
144 are reserved for OEM use. MemoryType values in the range
145 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders
146 that are provided by operating system vendors.
147 @param[in] Pages The number of contiguous 4 KB pages to allocate.
148 @param[in, out] Memory The pointer to a physical address. On input, the way in which the address is
149 used depends on the value of Type.
150
151 @retval EFI_SUCCESS The requested pages were allocated.
152 @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or
153 AllocateMaxAddress or AllocateAddress.
154 2) MemoryType is in the range
155 EfiMaxMemoryType..0x6FFFFFFF.
156 3) Memory is NULL.
157 4) MemoryType is EfiPersistentMemory.
158 @retval EFI_OUT_OF_RESOURCES The pages could not be allocated.
159 @retval EFI_NOT_FOUND The requested pages could not be found.
160
161 **/
162 typedef
163 EFI_STATUS
164 (EFIAPI *EFI_ALLOCATE_PAGES)(
165 IN EFI_ALLOCATE_TYPE Type,
166 IN EFI_MEMORY_TYPE MemoryType,
167 IN UINTN Pages,
168 IN OUT EFI_PHYSICAL_ADDRESS *Memory
169 );
170
171 /**
172 Frees memory pages.
173
174 @param[in] Memory The base physical address of the pages to be freed.
175 @param[in] Pages The number of contiguous 4 KB pages to free.
176
177 @retval EFI_SUCCESS The requested pages were freed.
178 @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
179 @retval EFI_NOT_FOUND The requested memory pages were not allocated with
180 AllocatePages().
181
182 **/
183 typedef
184 EFI_STATUS
185 (EFIAPI *EFI_FREE_PAGES)(
186 IN EFI_PHYSICAL_ADDRESS Memory,
187 IN UINTN Pages
188 );
189
190 /**
191 Returns the current memory map.
192
193 @param[in, out] MemoryMapSize A pointer to the size, in bytes, of the MemoryMap buffer.
194 On input, this is the size of the buffer allocated by the caller.
195 On output, it is the size of the buffer returned by the firmware if
196 the buffer was large enough, or the size of the buffer needed to contain
197 the map if the buffer was too small.
198 @param[in, out] MemoryMap A pointer to the buffer in which firmware places the current memory
199 map.
200 @param[out] MapKey A pointer to the location in which firmware returns the key for the
201 current memory map.
202 @param[out] DescriptorSize A pointer to the location in which firmware returns the size, in bytes, of
203 an individual EFI_MEMORY_DESCRIPTOR.
204 @param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
205 associated with the EFI_MEMORY_DESCRIPTOR.
206
207 @retval EFI_SUCCESS The memory map was returned in the MemoryMap buffer.
208 @retval EFI_BUFFER_TOO_SMALL The MemoryMap buffer was too small. The current buffer size
209 needed to hold the memory map is returned in MemoryMapSize.
210 @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.
211 2) The MemoryMap buffer is not too small and MemoryMap is
212 NULL.
213
214 **/
215 typedef
216 EFI_STATUS
217 (EFIAPI *EFI_GET_MEMORY_MAP)(
218 IN OUT UINTN *MemoryMapSize,
219 IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap,
220 OUT UINTN *MapKey,
221 OUT UINTN *DescriptorSize,
222 OUT UINT32 *DescriptorVersion
223 );
224
225 /**
226 Allocates pool memory.
227
228 @param[in] PoolType The type of pool to allocate.
229 MemoryType values in the range 0x70000000..0x7FFFFFFF
230 are reserved for OEM use. MemoryType values in the range
231 0x80000000..0xFFFFFFFF are reserved for use by UEFI OS loaders
232 that are provided by operating system vendors.
233 @param[in] Size The number of bytes to allocate from the pool.
234 @param[out] Buffer A pointer to a pointer to the allocated buffer if the call succeeds;
235 undefined otherwise.
236
237 @retval EFI_SUCCESS The requested number of bytes was allocated.
238 @retval EFI_OUT_OF_RESOURCES The pool requested could not be allocated.
239 @retval EFI_INVALID_PARAMETER Buffer is NULL.
240 PoolType is in the range EfiMaxMemoryType..0x6FFFFFFF.
241 PoolType is EfiPersistentMemory.
242
243 **/
244 typedef
245 EFI_STATUS
246 (EFIAPI *EFI_ALLOCATE_POOL)(
247 IN EFI_MEMORY_TYPE PoolType,
248 IN UINTN Size,
249 OUT VOID **Buffer
250 );
251
252 /**
253 Returns pool memory to the system.
254
255 @param[in] Buffer The pointer to the buffer to free.
256
257 @retval EFI_SUCCESS The memory was returned to the system.
258 @retval EFI_INVALID_PARAMETER Buffer was invalid.
259
260 **/
261 typedef
262 EFI_STATUS
263 (EFIAPI *EFI_FREE_POOL)(
264 IN VOID *Buffer
265 );
266
267 /**
268 Changes the runtime addressing mode of EFI firmware from physical to virtual.
269
270 @param[in] MemoryMapSize The size in bytes of VirtualMap.
271 @param[in] DescriptorSize The size in bytes of an entry in the VirtualMap.
272 @param[in] DescriptorVersion The version of the structure entries in VirtualMap.
273 @param[in] VirtualMap An array of memory descriptors which contain new virtual
274 address mapping information for all runtime ranges.
275
276 @retval EFI_SUCCESS The virtual address map has been applied.
277 @retval EFI_UNSUPPORTED EFI firmware is not at runtime, or the EFI firmware is already in
278 virtual address mapped mode.
279 @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.
280 @retval EFI_NO_MAPPING A virtual address was not supplied for a range in the memory
281 map that requires a mapping.
282 @retval EFI_NOT_FOUND A virtual address was supplied for an address that is not found
283 in the memory map.
284
285 **/
286 typedef
287 EFI_STATUS
288 (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP)(
289 IN UINTN MemoryMapSize,
290 IN UINTN DescriptorSize,
291 IN UINT32 DescriptorVersion,
292 IN EFI_MEMORY_DESCRIPTOR *VirtualMap
293 );
294
295 /**
296 Connects one or more drivers to a controller.
297
298 @param[in] ControllerHandle The handle of the controller to which driver(s) are to be connected.
299 @param[in] DriverImageHandle A pointer to an ordered list handles that support the
300 EFI_DRIVER_BINDING_PROTOCOL.
301 @param[in] RemainingDevicePath A pointer to the device path that specifies a child of the
302 controller specified by ControllerHandle.
303 @param[in] Recursive If TRUE, then ConnectController() is called recursively
304 until the entire tree of controllers below the controller specified
305 by ControllerHandle have been created. If FALSE, then
306 the tree of controllers is only expanded one level.
307
308 @retval EFI_SUCCESS 1) One or more drivers were connected to ControllerHandle.
309 2) No drivers were connected to ControllerHandle, but
310 RemainingDevicePath is not NULL, and it is an End Device
311 Path Node.
312 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.
313 @retval EFI_NOT_FOUND 1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
314 present in the system.
315 2) No drivers were connected to ControllerHandle.
316 @retval EFI_SECURITY_VIOLATION
317 The user has no permission to start UEFI device drivers on the device path
318 associated with the ControllerHandle or specified by the RemainingDevicePath.
319 **/
320 typedef
321 EFI_STATUS
322 (EFIAPI *EFI_CONNECT_CONTROLLER)(
323 IN EFI_HANDLE ControllerHandle,
324 IN EFI_HANDLE *DriverImageHandle, OPTIONAL
325 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath, OPTIONAL
326 IN BOOLEAN Recursive
327 );
328
329 /**
330 Disconnects one or more drivers from a controller.
331
332 @param[in] ControllerHandle The handle of the controller from which driver(s) are to be disconnected.
333 @param[in] DriverImageHandle The driver to disconnect from ControllerHandle.
334 If DriverImageHandle is NULL, then all the drivers currently managing
335 ControllerHandle are disconnected from ControllerHandle.
336 @param[in] ChildHandle The handle of the child to destroy.
337 If ChildHandle is NULL, then all the children of ControllerHandle are
338 destroyed before the drivers are disconnected from ControllerHandle.
339
340 @retval EFI_SUCCESS 1) One or more drivers were disconnected from the controller.
341 2) On entry, no drivers are managing ControllerHandle.
342 3) DriverImageHandle is not NULL, and on entry
343 DriverImageHandle is not managing ControllerHandle.
344 @retval EFI_INVALID_PARAMETER 1) ControllerHandle is NULL.
345 2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
346 3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
347 4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.
348 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to disconnect any drivers from
349 ControllerHandle.
350 @retval EFI_DEVICE_ERROR The controller could not be disconnected because of a device error.
351
352 **/
353 typedef
354 EFI_STATUS
355 (EFIAPI *EFI_DISCONNECT_CONTROLLER)(
356 IN EFI_HANDLE ControllerHandle,
357 IN EFI_HANDLE DriverImageHandle, OPTIONAL
358 IN EFI_HANDLE ChildHandle OPTIONAL
359 );
360
361
362
363 //
364 // ConvertPointer DebugDisposition type.
365 //
366 #define EFI_OPTIONAL_PTR 0x00000001
367
368 /**
369 Determines the new virtual address that is to be used on subsequent memory accesses.
370
371 @param[in] DebugDisposition Supplies type information for the pointer being converted.
372 @param[in, out] Address A pointer to a pointer that is to be fixed to be the value needed
373 for the new virtual address mappings being applied.
374
375 @retval EFI_SUCCESS The pointer pointed to by Address was modified.
376 @retval EFI_INVALID_PARAMETER 1) Address is NULL.
377 2) *Address is NULL and DebugDisposition does
378 not have the EFI_OPTIONAL_PTR bit set.
379 @retval EFI_NOT_FOUND The pointer pointed to by Address was not found to be part
380 of the current memory map. This is normally fatal.
381
382 **/
383 typedef
384 EFI_STATUS
385 (EFIAPI *EFI_CONVERT_POINTER)(
386 IN UINTN DebugDisposition,
387 IN OUT VOID **Address
388 );
389
390
391 //
392 // These types can be ORed together as needed - for example,
393 // EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or
394 // EVT_NOTIFY_SIGNAL.
395 //
396 #define EVT_TIMER 0x80000000
397 #define EVT_RUNTIME 0x40000000
398 #define EVT_NOTIFY_WAIT 0x00000100
399 #define EVT_NOTIFY_SIGNAL 0x00000200
400
401 #define EVT_SIGNAL_EXIT_BOOT_SERVICES 0x00000201
402 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
403
404 //
405 // The event's NotifyContext pointer points to a runtime memory
406 // address.
407 // The event is deprecated in UEFI2.0 and later specifications.
408 //
409 #define EVT_RUNTIME_CONTEXT 0x20000000
410
411
412 /**
413 Invoke a notification event
414
415 @param[in] Event Event whose notification function is being invoked.
416 @param[in] Context The pointer to the notification function's context,
417 which is implementation-dependent.
418
419 **/
420 typedef
421 VOID
422 (EFIAPI *EFI_EVENT_NOTIFY)(
423 IN EFI_EVENT Event,
424 IN VOID *Context
425 );
426
427 /**
428 Creates an event.
429
430 @param[in] Type The type of event to create and its mode and attributes.
431 @param[in] NotifyTpl The task priority level of event notifications, if needed.
432 @param[in] NotifyFunction The pointer to the event's notification function, if any.
433 @param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter
434 Context in the notification function.
435 @param[out] Event The pointer to the newly created event if the call succeeds; undefined
436 otherwise.
437
438 @retval EFI_SUCCESS The event structure was created.
439 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
440 @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
441
442 **/
443 typedef
444 EFI_STATUS
445 (EFIAPI *EFI_CREATE_EVENT)(
446 IN UINT32 Type,
447 IN EFI_TPL NotifyTpl,
448 IN EFI_EVENT_NOTIFY NotifyFunction,
449 IN VOID *NotifyContext,
450 OUT EFI_EVENT *Event
451 );
452
453 /**
454 Creates an event in a group.
455
456 @param[in] Type The type of event to create and its mode and attributes.
457 @param[in] NotifyTpl The task priority level of event notifications,if needed.
458 @param[in] NotifyFunction The pointer to the event's notification function, if any.
459 @param[in] NotifyContext The pointer to the notification function's context; corresponds to parameter
460 Context in the notification function.
461 @param[in] EventGroup The pointer to the unique identifier of the group to which this event belongs.
462 If this is NULL, then the function behaves as if the parameters were passed
463 to CreateEvent.
464 @param[out] Event The pointer to the newly created event if the call succeeds; undefined
465 otherwise.
466
467 @retval EFI_SUCCESS The event structure was created.
468 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
469 @retval EFI_OUT_OF_RESOURCES The event could not be allocated.
470
471 **/
472 typedef
473 EFI_STATUS
474 (EFIAPI *EFI_CREATE_EVENT_EX)(
475 IN UINT32 Type,
476 IN EFI_TPL NotifyTpl,
477 IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL,
478 IN CONST VOID *NotifyContext OPTIONAL,
479 IN CONST EFI_GUID *EventGroup OPTIONAL,
480 OUT EFI_EVENT *Event
481 );
482
483 ///
484 /// Timer delay types
485 ///
486 typedef enum {
487 ///
488 /// An event's timer settings is to be cancelled and not trigger time is to be set/
489 ///
490 TimerCancel,
491 ///
492 /// An event is to be signaled periodically at a specified interval from the current time.
493 ///
494 TimerPeriodic,
495 ///
496 /// An event is to be signaled once at a specified interval from the current time.
497 ///
498 TimerRelative
499 } EFI_TIMER_DELAY;
500
501 /**
502 Sets the type of timer and the trigger time for a timer event.
503
504 @param[in] Event The timer event that is to be signaled at the specified time.
505 @param[in] Type The type of time that is specified in TriggerTime.
506 @param[in] TriggerTime The number of 100ns units until the timer expires.
507 A TriggerTime of 0 is legal.
508 If Type is TimerRelative and TriggerTime is 0, then the timer
509 event will be signaled on the next timer tick.
510 If Type is TimerPeriodic and TriggerTime is 0, then the timer
511 event will be signaled on every timer tick.
512
513 @retval EFI_SUCCESS The event has been set to be signaled at the requested time.
514 @retval EFI_INVALID_PARAMETER Event or Type is not valid.
515
516 **/
517 typedef
518 EFI_STATUS
519 (EFIAPI *EFI_SET_TIMER)(
520 IN EFI_EVENT Event,
521 IN EFI_TIMER_DELAY Type,
522 IN UINT64 TriggerTime
523 );
524
525 /**
526 Signals an event.
527
528 @param[in] Event The event to signal.
529
530 @retval EFI_SUCCESS The event has been signaled.
531
532 **/
533 typedef
534 EFI_STATUS
535 (EFIAPI *EFI_SIGNAL_EVENT)(
536 IN EFI_EVENT Event
537 );
538
539 /**
540 Stops execution until an event is signaled.
541
542 @param[in] NumberOfEvents The number of events in the Event array.
543 @param[in] Event An array of EFI_EVENT.
544 @param[out] Index The pointer to the index of the event which satisfied the wait condition.
545
546 @retval EFI_SUCCESS The event indicated by Index was signaled.
547 @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.
548 2) The event indicated by Index is of type
549 EVT_NOTIFY_SIGNAL.
550 @retval EFI_UNSUPPORTED The current TPL is not TPL_APPLICATION.
551
552 **/
553 typedef
554 EFI_STATUS
555 (EFIAPI *EFI_WAIT_FOR_EVENT)(
556 IN UINTN NumberOfEvents,
557 IN EFI_EVENT *Event,
558 OUT UINTN *Index
559 );
560
561 /**
562 Closes an event.
563
564 @param[in] Event The event to close.
565
566 @retval EFI_SUCCESS The event has been closed.
567
568 **/
569 typedef
570 EFI_STATUS
571 (EFIAPI *EFI_CLOSE_EVENT)(
572 IN EFI_EVENT Event
573 );
574
575 /**
576 Checks whether an event is in the signaled state.
577
578 @param[in] Event The event to check.
579
580 @retval EFI_SUCCESS The event is in the signaled state.
581 @retval EFI_NOT_READY The event is not in the signaled state.
582 @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.
583
584 **/
585 typedef
586 EFI_STATUS
587 (EFIAPI *EFI_CHECK_EVENT)(
588 IN EFI_EVENT Event
589 );
590
591
592 //
593 // Task priority level
594 //
595 #define TPL_APPLICATION 4
596 #define TPL_CALLBACK 8
597 #define TPL_NOTIFY 16
598 #define TPL_HIGH_LEVEL 31
599
600
601 /**
602 Raises a task's priority level and returns its previous level.
603
604 @param[in] NewTpl The new task priority level.
605
606 @return Previous task priority level
607
608 **/
609 typedef
610 EFI_TPL
611 (EFIAPI *EFI_RAISE_TPL)(
612 IN EFI_TPL NewTpl
613 );
614
615 /**
616 Restores a task's priority level to its previous value.
617
618 @param[in] OldTpl The previous task priority level to restore.
619
620 **/
621 typedef
622 VOID
623 (EFIAPI *EFI_RESTORE_TPL)(
624 IN EFI_TPL OldTpl
625 );
626
627 /**
628 Returns the value of a variable.
629
630 @param[in] VariableName A Null-terminated string that is the name of the vendor's
631 variable.
632 @param[in] VendorGuid A unique identifier for the vendor.
633 @param[out] Attributes If not NULL, a pointer to the memory location to return the
634 attributes bitmask for the variable.
635 @param[in, out] DataSize On input, the size in bytes of the return Data buffer.
636 On output the size of data returned in Data.
637 @param[out] Data The buffer to return the contents of the variable. May be NULL
638 with a zero DataSize in order to determine the size buffer needed.
639
640 @retval EFI_SUCCESS The function completed successfully.
641 @retval EFI_NOT_FOUND The variable was not found.
642 @retval EFI_BUFFER_TOO_SMALL The DataSize is too small for the result.
643 @retval EFI_INVALID_PARAMETER VariableName is NULL.
644 @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
645 @retval EFI_INVALID_PARAMETER DataSize is NULL.
646 @retval EFI_INVALID_PARAMETER The DataSize is not too small and Data is NULL.
647 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
648 @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
649
650 **/
651 typedef
652 EFI_STATUS
653 (EFIAPI *EFI_GET_VARIABLE)(
654 IN CHAR16 *VariableName,
655 IN EFI_GUID *VendorGuid,
656 OUT UINT32 *Attributes, OPTIONAL
657 IN OUT UINTN *DataSize,
658 OUT VOID *Data OPTIONAL
659 );
660
661 /**
662 Enumerates the current variable names.
663
664 @param[in, out] VariableNameSize The size of the VariableName buffer. The size must be large
665 enough to fit input string supplied in VariableName buffer.
666 @param[in, out] VariableName On input, supplies the last VariableName that was returned
667 by GetNextVariableName(). On output, returns the Nullterminated
668 string of the current variable.
669 @param[in, out] VendorGuid On input, supplies the last VendorGuid that was returned by
670 GetNextVariableName(). On output, returns the
671 VendorGuid of the current variable.
672
673 @retval EFI_SUCCESS The function completed successfully.
674 @retval EFI_NOT_FOUND The next variable was not found.
675 @retval EFI_BUFFER_TOO_SMALL The VariableNameSize is too small for the result.
676 VariableNameSize has been updated with the size needed to complete the request.
677 @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
678 @retval EFI_INVALID_PARAMETER VariableName is NULL.
679 @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
680 @retval EFI_INVALID_PARAMETER The input values of VariableName and VendorGuid are not a name and
681 GUID of an existing variable.
682 @retval EFI_INVALID_PARAMETER Null-terminator is not found in the first VariableNameSize bytes of
683 the input VariableName buffer.
684 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
685
686 **/
687 typedef
688 EFI_STATUS
689 (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME)(
690 IN OUT UINTN *VariableNameSize,
691 IN OUT CHAR16 *VariableName,
692 IN OUT EFI_GUID *VendorGuid
693 );
694
695 /**
696 Sets the value of a variable.
697
698 @param[in] VariableName A Null-terminated string that is the name of the vendor's variable.
699 Each VariableName is unique for each VendorGuid. VariableName must
700 contain 1 or more characters. If VariableName is an empty string,
701 then EFI_INVALID_PARAMETER is returned.
702 @param[in] VendorGuid A unique identifier for the vendor.
703 @param[in] Attributes Attributes bitmask to set for the variable.
704 @param[in] DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE or
705 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
706 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
707 set, then a SetVariable() call with a DataSize of zero will not cause any change to
708 the variable value (the timestamp associated with the variable may be updated however
709 even if no new data value is provided,see the description of the
710 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
711 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
712 @param[in] Data The contents for the variable.
713
714 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
715 defined by the Attributes.
716 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
717 DataSize exceeds the maximum allowed.
718 @retval EFI_INVALID_PARAMETER VariableName is an empty string.
719 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
720 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
721 @retval EFI_WRITE_PROTECTED The variable in question is read-only.
722 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
723 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set,
724 but the AuthInfo does NOT pass the validation check carried out by the firmware.
725
726 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
727
728 **/
729 typedef
730 EFI_STATUS
731 (EFIAPI *EFI_SET_VARIABLE)(
732 IN CHAR16 *VariableName,
733 IN EFI_GUID *VendorGuid,
734 IN UINT32 Attributes,
735 IN UINTN DataSize,
736 IN VOID *Data
737 );
738
739
740 ///
741 /// This provides the capabilities of the
742 /// real time clock device as exposed through the EFI interfaces.
743 ///
744 typedef struct {
745 ///
746 /// Provides the reporting resolution of the real-time clock device in
747 /// counts per second. For a normal PC-AT CMOS RTC device, this
748 /// value would be 1 Hz, or 1, to indicate that the device only reports
749 /// the time to the resolution of 1 second.
750 ///
751 UINT32 Resolution;
752 ///
753 /// Provides the timekeeping accuracy of the real-time clock in an
754 /// error rate of 1E-6 parts per million. For a clock with an accuracy
755 /// of 50 parts per million, the value in this field would be
756 /// 50,000,000.
757 ///
758 UINT32 Accuracy;
759 ///
760 /// A TRUE indicates that a time set operation clears the device's
761 /// time below the Resolution reporting level. A FALSE
762 /// indicates that the state below the Resolution level of the
763 /// device is not cleared when the time is set. Normal PC-AT CMOS
764 /// RTC devices set this value to FALSE.
765 ///
766 BOOLEAN SetsToZero;
767 } EFI_TIME_CAPABILITIES;
768
769 /**
770 Returns the current time and date information, and the time-keeping capabilities
771 of the hardware platform.
772
773 @param[out] Time A pointer to storage to receive a snapshot of the current time.
774 @param[out] Capabilities An optional pointer to a buffer to receive the real time clock
775 device's capabilities.
776
777 @retval EFI_SUCCESS The operation completed successfully.
778 @retval EFI_INVALID_PARAMETER Time is NULL.
779 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
780
781 **/
782 typedef
783 EFI_STATUS
784 (EFIAPI *EFI_GET_TIME)(
785 OUT EFI_TIME *Time,
786 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
787 );
788
789 /**
790 Sets the current local time and date information.
791
792 @param[in] Time A pointer to the current time.
793
794 @retval EFI_SUCCESS The operation completed successfully.
795 @retval EFI_INVALID_PARAMETER A time field is out of range.
796 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
797
798 **/
799 typedef
800 EFI_STATUS
801 (EFIAPI *EFI_SET_TIME)(
802 IN EFI_TIME *Time
803 );
804
805 /**
806 Returns the current wakeup alarm clock setting.
807
808 @param[out] Enabled Indicates if the alarm is currently enabled or disabled.
809 @param[out] Pending Indicates if the alarm signal is pending and requires acknowledgement.
810 @param[out] Time The current alarm setting.
811
812 @retval EFI_SUCCESS The alarm settings were returned.
813 @retval EFI_INVALID_PARAMETER Enabled is NULL.
814 @retval EFI_INVALID_PARAMETER Pending is NULL.
815 @retval EFI_INVALID_PARAMETER Time is NULL.
816 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
817 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
818
819 **/
820 typedef
821 EFI_STATUS
822 (EFIAPI *EFI_GET_WAKEUP_TIME)(
823 OUT BOOLEAN *Enabled,
824 OUT BOOLEAN *Pending,
825 OUT EFI_TIME *Time
826 );
827
828 /**
829 Sets the system wakeup alarm clock time.
830
831 @param[in] Enable Enable or disable the wakeup alarm.
832 @param[in] Time If Enable is TRUE, the time to set the wakeup alarm for.
833 If Enable is FALSE, then this parameter is optional, and may be NULL.
834
835 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
836 Enable is FALSE, then the wakeup alarm was disabled.
837 @retval EFI_INVALID_PARAMETER A time field is out of range.
838 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
839 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
840
841 **/
842 typedef
843 EFI_STATUS
844 (EFIAPI *EFI_SET_WAKEUP_TIME)(
845 IN BOOLEAN Enable,
846 IN EFI_TIME *Time OPTIONAL
847 );
848
849 /**
850 Loads an EFI image into memory.
851
852 @param[in] BootPolicy If TRUE, indicates that the request originates from the boot
853 manager, and that the boot manager is attempting to load
854 FilePath as a boot selection. Ignored if SourceBuffer is
855 not NULL.
856 @param[in] ParentImageHandle The caller's image handle.
857 @param[in] DevicePath The DeviceHandle specific file path from which the image is
858 loaded.
859 @param[in] SourceBuffer If not NULL, a pointer to the memory location containing a copy
860 of the image to be loaded.
861 @param[in] SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
862 @param[out] ImageHandle The pointer to the returned image handle that is created when the
863 image is successfully loaded.
864
865 @retval EFI_SUCCESS Image was loaded into memory correctly.
866 @retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL.
867 @retval EFI_INVALID_PARAMETER One or more parametes are invalid.
868 @retval EFI_UNSUPPORTED The image type is not supported.
869 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources.
870 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
871 understood.
872 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
873 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
874 image from being loaded. NULL is returned in *ImageHandle.
875 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
876 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
877 platform policy specifies that the image should not be started.
878 **/
879 typedef
880 EFI_STATUS
881 (EFIAPI *EFI_IMAGE_LOAD)(
882 IN BOOLEAN BootPolicy,
883 IN EFI_HANDLE ParentImageHandle,
884 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
885 IN VOID *SourceBuffer OPTIONAL,
886 IN UINTN SourceSize,
887 OUT EFI_HANDLE *ImageHandle
888 );
889
890 /**
891 Transfers control to a loaded image's entry point.
892
893 @param[in] ImageHandle Handle of image to be started.
894 @param[out] ExitDataSize The pointer to the size, in bytes, of ExitData.
895 @param[out] ExitData The pointer to a pointer to a data buffer that includes a Null-terminated
896 string, optionally followed by additional binary data.
897
898 @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
899 has already been initialized with StartImage.
900 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
901 @return Exit code from image
902
903 **/
904 typedef
905 EFI_STATUS
906 (EFIAPI *EFI_IMAGE_START)(
907 IN EFI_HANDLE ImageHandle,
908 OUT UINTN *ExitDataSize,
909 OUT CHAR16 **ExitData OPTIONAL
910 );
911
912 /**
913 Terminates a loaded EFI image and returns control to boot services.
914
915 @param[in] ImageHandle Handle that identifies the image. This parameter is passed to the
916 image on entry.
917 @param[in] ExitStatus The image's exit code.
918 @param[in] ExitDataSize The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.
919 @param[in] ExitData The pointer to a data buffer that includes a Null-terminated string,
920 optionally followed by additional binary data. The string is a
921 description that the caller may use to further indicate the reason
922 for the image's exit. ExitData is only valid if ExitStatus
923 is something other than EFI_SUCCESS. The ExitData buffer
924 must be allocated by calling AllocatePool().
925
926 @retval EFI_SUCCESS The image specified by ImageHandle was unloaded.
927 @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and
928 started with LoadImage() and StartImage(), but the
929 image is not the currently executing image.
930
931 **/
932 typedef
933 EFI_STATUS
934 (EFIAPI *EFI_EXIT)(
935 IN EFI_HANDLE ImageHandle,
936 IN EFI_STATUS ExitStatus,
937 IN UINTN ExitDataSize,
938 IN CHAR16 *ExitData OPTIONAL
939 );
940
941 /**
942 Unloads an image.
943
944 @param[in] ImageHandle Handle that identifies the image to be unloaded.
945
946 @retval EFI_SUCCESS The image has been unloaded.
947 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
948
949 **/
950 typedef
951 EFI_STATUS
952 (EFIAPI *EFI_IMAGE_UNLOAD)(
953 IN EFI_HANDLE ImageHandle
954 );
955
956 /**
957 Terminates all boot services.
958
959 @param[in] ImageHandle Handle that identifies the exiting image.
960 @param[in] MapKey Key to the latest memory map.
961
962 @retval EFI_SUCCESS Boot services have been terminated.
963 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
964
965 **/
966 typedef
967 EFI_STATUS
968 (EFIAPI *EFI_EXIT_BOOT_SERVICES)(
969 IN EFI_HANDLE ImageHandle,
970 IN UINTN MapKey
971 );
972
973 /**
974 Induces a fine-grained stall.
975
976 @param[in] Microseconds The number of microseconds to stall execution.
977
978 @retval EFI_SUCCESS Execution was stalled at least the requested number of
979 Microseconds.
980
981 **/
982 typedef
983 EFI_STATUS
984 (EFIAPI *EFI_STALL)(
985 IN UINTN Microseconds
986 );
987
988 /**
989 Sets the system's watchdog timer.
990
991 @param[in] Timeout The number of seconds to set the watchdog timer to.
992 @param[in] WatchdogCode The numeric code to log on a watchdog timer timeout event.
993 @param[in] DataSize The size, in bytes, of WatchdogData.
994 @param[in] WatchdogData A data buffer that includes a Null-terminated string, optionally
995 followed by additional binary data.
996
997 @retval EFI_SUCCESS The timeout has been set.
998 @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.
999 @retval EFI_UNSUPPORTED The system does not have a watchdog timer.
1000 @retval EFI_DEVICE_ERROR The watchdog timer could not be programmed due to a hardware
1001 error.
1002
1003 **/
1004 typedef
1005 EFI_STATUS
1006 (EFIAPI *EFI_SET_WATCHDOG_TIMER)(
1007 IN UINTN Timeout,
1008 IN UINT64 WatchdogCode,
1009 IN UINTN DataSize,
1010 IN CHAR16 *WatchdogData OPTIONAL
1011 );
1012
1013 /**
1014 Resets the entire platform.
1015
1016 @param[in] ResetType The type of reset to perform.
1017 @param[in] ResetStatus The status code for the reset.
1018 @param[in] DataSize The size, in bytes, of ResetData.
1019 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
1020 EfiResetShutdown the data buffer starts with a Null-terminated
1021 string, optionally followed by additional binary data.
1022 The string is a description that the caller may use to further
1023 indicate the reason for the system reset. ResetData is only
1024 valid if ResetStatus is something other than EFI_SUCCESS
1025 unless the ResetType is EfiResetPlatformSpecific
1026 where a minimum amount of ResetData is always required.
1027 For a ResetType of EfiResetPlatformSpecific the data buffer
1028 also starts with a Null-terminated string that is followed
1029 by an EFI_GUID that describes the specific type of reset to perform.
1030 **/
1031 typedef
1032 VOID
1033 (EFIAPI *EFI_RESET_SYSTEM)(
1034 IN EFI_RESET_TYPE ResetType,
1035 IN EFI_STATUS ResetStatus,
1036 IN UINTN DataSize,
1037 IN VOID *ResetData OPTIONAL
1038 );
1039
1040 /**
1041 Returns a monotonically increasing count for the platform.
1042
1043 @param[out] Count The pointer to returned value.
1044
1045 @retval EFI_SUCCESS The next monotonic count was returned.
1046 @retval EFI_INVALID_PARAMETER Count is NULL.
1047 @retval EFI_DEVICE_ERROR The device is not functioning properly.
1048
1049 **/
1050 typedef
1051 EFI_STATUS
1052 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)(
1053 OUT UINT64 *Count
1054 );
1055
1056 /**
1057 Returns the next high 32 bits of the platform's monotonic counter.
1058
1059 @param[out] HighCount The pointer to returned value.
1060
1061 @retval EFI_SUCCESS The next high monotonic count was returned.
1062 @retval EFI_INVALID_PARAMETER HighCount is NULL.
1063 @retval EFI_DEVICE_ERROR The device is not functioning properly.
1064
1065 **/
1066 typedef
1067 EFI_STATUS
1068 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)(
1069 OUT UINT32 *HighCount
1070 );
1071
1072 /**
1073 Computes and returns a 32-bit CRC for a data buffer.
1074
1075 @param[in] Data A pointer to the buffer on which the 32-bit CRC is to be computed.
1076 @param[in] DataSize The number of bytes in the buffer Data.
1077 @param[out] Crc32 The 32-bit CRC that was computed for the data buffer specified by Data
1078 and DataSize.
1079
1080 @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in
1081 Crc32.
1082 @retval EFI_INVALID_PARAMETER Data is NULL.
1083 @retval EFI_INVALID_PARAMETER Crc32 is NULL.
1084 @retval EFI_INVALID_PARAMETER DataSize is 0.
1085
1086 **/
1087 typedef
1088 EFI_STATUS
1089 (EFIAPI *EFI_CALCULATE_CRC32)(
1090 IN VOID *Data,
1091 IN UINTN DataSize,
1092 OUT UINT32 *Crc32
1093 );
1094
1095 /**
1096 Copies the contents of one buffer to another buffer.
1097
1098 @param[in] Destination The pointer to the destination buffer of the memory copy.
1099 @param[in] Source The pointer to the source buffer of the memory copy.
1100 @param[in] Length Number of bytes to copy from Source to Destination.
1101
1102 **/
1103 typedef
1104 VOID
1105 (EFIAPI *EFI_COPY_MEM)(
1106 IN VOID *Destination,
1107 IN VOID *Source,
1108 IN UINTN Length
1109 );
1110
1111 /**
1112 The SetMem() function fills a buffer with a specified value.
1113
1114 @param[in] Buffer The pointer to the buffer to fill.
1115 @param[in] Size Number of bytes in Buffer to fill.
1116 @param[in] Value Value to fill Buffer with.
1117
1118 **/
1119 typedef
1120 VOID
1121 (EFIAPI *EFI_SET_MEM)(
1122 IN VOID *Buffer,
1123 IN UINTN Size,
1124 IN UINT8 Value
1125 );
1126
1127 ///
1128 /// Enumeration of EFI Interface Types
1129 ///
1130 typedef enum {
1131 ///
1132 /// Indicates that the supplied protocol interface is supplied in native form.
1133 ///
1134 EFI_NATIVE_INTERFACE
1135 } EFI_INTERFACE_TYPE;
1136
1137 /**
1138 Installs a protocol interface on a device handle. If the handle does not exist, it is created and added
1139 to the list of handles in the system. InstallMultipleProtocolInterfaces() performs
1140 more error checking than InstallProtocolInterface(), so it is recommended that
1141 InstallMultipleProtocolInterfaces() be used in place of
1142 InstallProtocolInterface()
1143
1144 @param[in, out] Handle A pointer to the EFI_HANDLE on which the interface is to be installed.
1145 @param[in] Protocol The numeric ID of the protocol interface.
1146 @param[in] InterfaceType Indicates whether Interface is supplied in native form.
1147 @param[in] Interface A pointer to the protocol interface.
1148
1149 @retval EFI_SUCCESS The protocol interface was installed.
1150 @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated.
1151 @retval EFI_INVALID_PARAMETER Handle is NULL.
1152 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1153 @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.
1154 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1155
1156 **/
1157 typedef
1158 EFI_STATUS
1159 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)(
1160 IN OUT EFI_HANDLE *Handle,
1161 IN EFI_GUID *Protocol,
1162 IN EFI_INTERFACE_TYPE InterfaceType,
1163 IN VOID *Interface
1164 );
1165
1166 /**
1167 Installs one or more protocol interfaces into the boot services environment.
1168
1169 @param[in, out] Handle The pointer to a handle to install the new protocol interfaces on,
1170 or a pointer to NULL if a new handle is to be allocated.
1171 @param ... A variable argument list containing pairs of protocol GUIDs and protocol
1172 interfaces.
1173
1174 @retval EFI_SUCCESS All the protocol interface was installed.
1175 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1176 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
1177 the handle database.
1178 @retval EFI_INVALID_PARAMETER Handle is NULL.
1179 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1180
1181 **/
1182 typedef
1183 EFI_STATUS
1184 (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
1185 IN OUT EFI_HANDLE *Handle,
1186 ...
1187 );
1188
1189 /**
1190 Reinstalls a protocol interface on a device handle.
1191
1192 @param[in] Handle Handle on which the interface is to be reinstalled.
1193 @param[in] Protocol The numeric ID of the interface.
1194 @param[in] OldInterface A pointer to the old interface. NULL can be used if a structure is not
1195 associated with Protocol.
1196 @param[in] NewInterface A pointer to the new interface.
1197
1198 @retval EFI_SUCCESS The protocol interface was reinstalled.
1199 @retval EFI_NOT_FOUND The OldInterface on the handle was not found.
1200 @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled,
1201 because OldInterface is still being used by a
1202 driver that will not release it.
1203 @retval EFI_INVALID_PARAMETER Handle is NULL.
1204 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1205
1206 **/
1207 typedef
1208 EFI_STATUS
1209 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)(
1210 IN EFI_HANDLE Handle,
1211 IN EFI_GUID *Protocol,
1212 IN VOID *OldInterface,
1213 IN VOID *NewInterface
1214 );
1215
1216 /**
1217 Removes a protocol interface from a device handle. It is recommended that
1218 UninstallMultipleProtocolInterfaces() be used in place of
1219 UninstallProtocolInterface().
1220
1221 @param[in] Handle The handle on which the interface was installed.
1222 @param[in] Protocol The numeric ID of the interface.
1223 @param[in] Interface A pointer to the interface.
1224
1225 @retval EFI_SUCCESS The interface was removed.
1226 @retval EFI_NOT_FOUND The interface was not found.
1227 @retval EFI_ACCESS_DENIED The interface was not removed because the interface
1228 is still being used by a driver.
1229 @retval EFI_INVALID_PARAMETER Handle is NULL.
1230 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1231
1232 **/
1233 typedef
1234 EFI_STATUS
1235 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)(
1236 IN EFI_HANDLE Handle,
1237 IN EFI_GUID *Protocol,
1238 IN VOID *Interface
1239 );
1240
1241 /**
1242 Removes one or more protocol interfaces into the boot services environment.
1243
1244 @param[in] Handle The handle to remove the protocol interfaces from.
1245 @param ... A variable argument list containing pairs of protocol GUIDs and
1246 protocol interfaces.
1247
1248 @retval EFI_SUCCESS All the protocol interfaces were removed.
1249 @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.
1250
1251 **/
1252 typedef
1253 EFI_STATUS
1254 (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
1255 IN EFI_HANDLE Handle,
1256 ...
1257 );
1258
1259 /**
1260 Queries a handle to determine if it supports a specified protocol.
1261
1262 @param[in] Handle The handle being queried.
1263 @param[in] Protocol The published unique identifier of the protocol.
1264 @param[out] Interface Supplies the address where a pointer to the corresponding Protocol
1265 Interface is returned.
1266
1267 @retval EFI_SUCCESS The interface information for the specified protocol was returned.
1268 @retval EFI_UNSUPPORTED The device does not support the specified protocol.
1269 @retval EFI_INVALID_PARAMETER Handle is NULL.
1270 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1271 @retval EFI_INVALID_PARAMETER Interface is NULL.
1272
1273 **/
1274 typedef
1275 EFI_STATUS
1276 (EFIAPI *EFI_HANDLE_PROTOCOL)(
1277 IN EFI_HANDLE Handle,
1278 IN EFI_GUID *Protocol,
1279 OUT VOID **Interface
1280 );
1281
1282 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
1283 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
1284 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
1285 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
1286 #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
1287 #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
1288
1289 /**
1290 Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the
1291 handle, it opens the protocol on behalf of the calling agent.
1292
1293 @param[in] Handle The handle for the protocol interface that is being opened.
1294 @param[in] Protocol The published unique identifier of the protocol.
1295 @param[out] Interface Supplies the address where a pointer to the corresponding Protocol
1296 Interface is returned.
1297 @param[in] AgentHandle The handle of the agent that is opening the protocol interface
1298 specified by Protocol and Interface.
1299 @param[in] ControllerHandle If the agent that is opening a protocol is a driver that follows the
1300 UEFI Driver Model, then this parameter is the controller handle
1301 that requires the protocol interface. If the agent does not follow
1302 the UEFI Driver Model, then this parameter is optional and may
1303 be NULL.
1304 @param[in] Attributes The open mode of the protocol interface specified by Handle
1305 and Protocol.
1306
1307 @retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the
1308 protocol interface was returned in Interface.
1309 @retval EFI_UNSUPPORTED Handle does not support Protocol.
1310 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1311 @retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment.
1312 @retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent
1313 handle is the same as AgentHandle.
1314
1315 **/
1316 typedef
1317 EFI_STATUS
1318 (EFIAPI *EFI_OPEN_PROTOCOL)(
1319 IN EFI_HANDLE Handle,
1320 IN EFI_GUID *Protocol,
1321 OUT VOID **Interface, OPTIONAL
1322 IN EFI_HANDLE AgentHandle,
1323 IN EFI_HANDLE ControllerHandle,
1324 IN UINT32 Attributes
1325 );
1326
1327
1328 /**
1329 Closes a protocol on a handle that was opened using OpenProtocol().
1330
1331 @param[in] Handle The handle for the protocol interface that was previously opened
1332 with OpenProtocol(), and is now being closed.
1333 @param[in] Protocol The published unique identifier of the protocol.
1334 @param[in] AgentHandle The handle of the agent that is closing the protocol interface.
1335 @param[in] ControllerHandle If the agent that opened a protocol is a driver that follows the
1336 UEFI Driver Model, then this parameter is the controller handle
1337 that required the protocol interface.
1338
1339 @retval EFI_SUCCESS The protocol instance was closed.
1340 @retval EFI_INVALID_PARAMETER 1) Handle is NULL.
1341 2) AgentHandle is NULL.
1342 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.
1343 4) Protocol is NULL.
1344 @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol.
1345 2) The protocol interface specified by Handle and Protocol is not
1346 currently open by AgentHandle and ControllerHandle.
1347
1348 **/
1349 typedef
1350 EFI_STATUS
1351 (EFIAPI *EFI_CLOSE_PROTOCOL)(
1352 IN EFI_HANDLE Handle,
1353 IN EFI_GUID *Protocol,
1354 IN EFI_HANDLE AgentHandle,
1355 IN EFI_HANDLE ControllerHandle
1356 );
1357
1358 ///
1359 /// EFI Oprn Protocol Information Entry
1360 ///
1361 typedef struct {
1362 EFI_HANDLE AgentHandle;
1363 EFI_HANDLE ControllerHandle;
1364 UINT32 Attributes;
1365 UINT32 OpenCount;
1366 } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
1367
1368 /**
1369 Retrieves the list of agents that currently have a protocol interface opened.
1370
1371 @param[in] Handle The handle for the protocol interface that is being queried.
1372 @param[in] Protocol The published unique identifier of the protocol.
1373 @param[out] EntryBuffer A pointer to a buffer of open protocol information in the form of
1374 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
1375 @param[out] EntryCount A pointer to the number of entries in EntryBuffer.
1376
1377 @retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the
1378 number of entries was returned EntryCount.
1379 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer.
1380 @retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol.
1381
1382 **/
1383 typedef
1384 EFI_STATUS
1385 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(
1386 IN EFI_HANDLE Handle,
1387 IN EFI_GUID *Protocol,
1388 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
1389 OUT UINTN *EntryCount
1390 );
1391
1392 /**
1393 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
1394 from pool.
1395
1396 @param[in] Handle The handle from which to retrieve the list of protocol interface
1397 GUIDs.
1398 @param[out] ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are
1399 installed on Handle.
1400 @param[out] ProtocolBufferCount A pointer to the number of GUID pointers present in
1401 ProtocolBuffer.
1402
1403 @retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in
1404 ProtocolBuffer. The number of protocol interface GUIDs was
1405 returned in ProtocolBufferCount.
1406 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.
1407 @retval EFI_INVALID_PARAMETER Handle is NULL.
1408 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1409 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
1410 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
1411
1412 **/
1413 typedef
1414 EFI_STATUS
1415 (EFIAPI *EFI_PROTOCOLS_PER_HANDLE)(
1416 IN EFI_HANDLE Handle,
1417 OUT EFI_GUID ***ProtocolBuffer,
1418 OUT UINTN *ProtocolBufferCount
1419 );
1420
1421 /**
1422 Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
1423
1424 @param[in] Protocol The numeric ID of the protocol for which the event is to be registered.
1425 @param[in] Event Event that is to be signaled whenever a protocol interface is registered
1426 for Protocol.
1427 @param[out] Registration A pointer to a memory location to receive the registration value.
1428
1429 @retval EFI_SUCCESS The notification event has been registered.
1430 @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated.
1431 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1432 @retval EFI_INVALID_PARAMETER Event is NULL.
1433 @retval EFI_INVALID_PARAMETER Registration is NULL.
1434
1435 **/
1436 typedef
1437 EFI_STATUS
1438 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)(
1439 IN EFI_GUID *Protocol,
1440 IN EFI_EVENT Event,
1441 OUT VOID **Registration
1442 );
1443
1444 ///
1445 /// Enumeration of EFI Locate Search Types
1446 ///
1447 typedef enum {
1448 ///
1449 /// Retrieve all the handles in the handle database.
1450 ///
1451 AllHandles,
1452 ///
1453 /// Retrieve the next handle fron a RegisterProtocolNotify() event.
1454 ///
1455 ByRegisterNotify,
1456 ///
1457 /// Retrieve the set of handles from the handle database that support a
1458 /// specified protocol.
1459 ///
1460 ByProtocol
1461 } EFI_LOCATE_SEARCH_TYPE;
1462
1463 /**
1464 Returns an array of handles that support a specified protocol.
1465
1466 @param[in] SearchType Specifies which handle(s) are to be returned.
1467 @param[in] Protocol Specifies the protocol to search by.
1468 @param[in] SearchKey Specifies the search key.
1469 @param[in, out] BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of
1470 the array returned in Buffer (if the buffer was large enough) or the
1471 size, in bytes, of the buffer needed to obtain the array (if the buffer was
1472 not large enough).
1473 @param[out] Buffer The buffer in which the array is returned.
1474
1475 @retval EFI_SUCCESS The array of handles was returned.
1476 @retval EFI_NOT_FOUND No handles match the search.
1477 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.
1478 @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.
1479 @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.
1480 @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.
1481 @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.
1482 @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.
1483
1484 **/
1485 typedef
1486 EFI_STATUS
1487 (EFIAPI *EFI_LOCATE_HANDLE)(
1488 IN EFI_LOCATE_SEARCH_TYPE SearchType,
1489 IN EFI_GUID *Protocol, OPTIONAL
1490 IN VOID *SearchKey, OPTIONAL
1491 IN OUT UINTN *BufferSize,
1492 OUT EFI_HANDLE *Buffer
1493 );
1494
1495 /**
1496 Locates the handle to a device on the device path that supports the specified protocol.
1497
1498 @param[in] Protocol Specifies the protocol to search for.
1499 @param[in, out] DevicePath On input, a pointer to a pointer to the device path. On output, the device
1500 path pointer is modified to point to the remaining part of the device
1501 path.
1502 @param[out] Device A pointer to the returned device handle.
1503
1504 @retval EFI_SUCCESS The resulting handle was returned.
1505 @retval EFI_NOT_FOUND No handles match the search.
1506 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1507 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
1508 @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.
1509
1510 **/
1511 typedef
1512 EFI_STATUS
1513 (EFIAPI *EFI_LOCATE_DEVICE_PATH)(
1514 IN EFI_GUID *Protocol,
1515 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
1516 OUT EFI_HANDLE *Device
1517 );
1518
1519 /**
1520 Adds, updates, or removes a configuration table entry from the EFI System Table.
1521
1522 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
1523 @param[in] Table A pointer to the configuration table for the entry to add, update, or
1524 remove. May be NULL.
1525
1526 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
1527 @retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry.
1528 @retval EFI_INVALID_PARAMETER Guid is NULL.
1529 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
1530
1531 **/
1532 typedef
1533 EFI_STATUS
1534 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)(
1535 IN EFI_GUID *Guid,
1536 IN VOID *Table
1537 );
1538
1539 /**
1540 Returns an array of handles that support the requested protocol in a buffer allocated from pool.
1541
1542 @param[in] SearchType Specifies which handle(s) are to be returned.
1543 @param[in] Protocol Provides the protocol to search by.
1544 This parameter is only valid for a SearchType of ByProtocol.
1545 @param[in] SearchKey Supplies the search key depending on the SearchType.
1546 @param[in, out] NoHandles The number of handles returned in Buffer.
1547 @param[out] Buffer A pointer to the buffer to return the requested array of handles that
1548 support Protocol.
1549
1550 @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of
1551 handles in Buffer was returned in NoHandles.
1552 @retval EFI_NOT_FOUND No handles match the search.
1553 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.
1554 @retval EFI_INVALID_PARAMETER NoHandles is NULL.
1555 @retval EFI_INVALID_PARAMETER Buffer is NULL.
1556
1557 **/
1558 typedef
1559 EFI_STATUS
1560 (EFIAPI *EFI_LOCATE_HANDLE_BUFFER)(
1561 IN EFI_LOCATE_SEARCH_TYPE SearchType,
1562 IN EFI_GUID *Protocol, OPTIONAL
1563 IN VOID *SearchKey, OPTIONAL
1564 IN OUT UINTN *NoHandles,
1565 OUT EFI_HANDLE **Buffer
1566 );
1567
1568 /**
1569 Returns the first protocol instance that matches the given protocol.
1570
1571 @param[in] Protocol Provides the protocol to search for.
1572 @param[in] Registration Optional registration key returned from
1573 RegisterProtocolNotify().
1574 @param[out] Interface On return, a pointer to the first interface that matches Protocol and
1575 Registration.
1576
1577 @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in
1578 Interface.
1579 @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and
1580 Registration.
1581 @retval EFI_INVALID_PARAMETER Interface is NULL.
1582 Protocol is NULL.
1583
1584 **/
1585 typedef
1586 EFI_STATUS
1587 (EFIAPI *EFI_LOCATE_PROTOCOL)(
1588 IN EFI_GUID *Protocol,
1589 IN VOID *Registration, OPTIONAL
1590 OUT VOID **Interface
1591 );
1592
1593 ///
1594 /// EFI Capsule Block Descriptor
1595 ///
1596 typedef struct {
1597 ///
1598 /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.
1599 ///
1600 UINT64 Length;
1601 union {
1602 ///
1603 /// Physical address of the data block. This member of the union is
1604 /// used if Length is not equal to zero.
1605 ///
1606 EFI_PHYSICAL_ADDRESS DataBlock;
1607 ///
1608 /// Physical address of another block of
1609 /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This
1610 /// member of the union is used if Length is equal to zero. If
1611 /// ContinuationPointer is zero this entry represents the end of the list.
1612 ///
1613 EFI_PHYSICAL_ADDRESS ContinuationPointer;
1614 } Union;
1615 } EFI_CAPSULE_BLOCK_DESCRIPTOR;
1616
1617 ///
1618 /// EFI Capsule Header.
1619 ///
1620 typedef struct {
1621 ///
1622 /// A GUID that defines the contents of a capsule.
1623 ///
1624 EFI_GUID CapsuleGuid;
1625 ///
1626 /// The size of the capsule header. This may be larger than the size of
1627 /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
1628 /// extended header entries
1629 ///
1630 UINT32 HeaderSize;
1631 ///
1632 /// Bit-mapped list describing the capsule attributes. The Flag values
1633 /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values
1634 /// of 0x10000 - 0xFFFFFFFF are defined by this specification
1635 ///
1636 UINT32 Flags;
1637 ///
1638 /// Size in bytes of the capsule.
1639 ///
1640 UINT32 CapsuleImageSize;
1641 } EFI_CAPSULE_HEADER;
1642
1643 ///
1644 /// The EFI System Table entry must point to an array of capsules
1645 /// that contain the same CapsuleGuid value. The array must be
1646 /// prefixed by a UINT32 that represents the size of the array of capsules.
1647 ///
1648 typedef struct {
1649 ///
1650 /// the size of the array of capsules.
1651 ///
1652 UINT32 CapsuleArrayNumber;
1653 ///
1654 /// Point to an array of capsules that contain the same CapsuleGuid value.
1655 ///
1656 VOID* CapsulePtr[1];
1657 } EFI_CAPSULE_TABLE;
1658
1659 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
1660 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
1661 #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
1662
1663 /**
1664 Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
1665 consumption, the firmware may process the capsule immediately. If the payload should persist
1666 across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
1667 be passed into ResetSystem() and will cause the capsule to be processed by the firmware as
1668 part of the reset process.
1669
1670 @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
1671 being passed into update capsule.
1672 @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
1673 CaspuleHeaderArray.
1674 @param[in] ScatterGatherList Physical pointer to a set of
1675 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
1676 location in physical memory of a set of capsules.
1677
1678 @retval EFI_SUCCESS Valid capsule was passed. If
1679 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
1680 capsule has been successfully processed by the firmware.
1681 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were
1682 set in the capsule header.
1683 @retval EFI_INVALID_PARAMETER CapsuleCount is 0.
1684 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.
1685 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform.
1686 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule
1687 is compatible with this platform but is not capable of being submitted or processed
1688 in runtime. The caller may resubmit the capsule prior to ExitBootServices().
1689 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates
1690 the capsule is compatible with this platform but there are insufficient resources to process.
1691
1692 **/
1693 typedef
1694 EFI_STATUS
1695 (EFIAPI *EFI_UPDATE_CAPSULE)(
1696 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
1697 IN UINTN CapsuleCount,
1698 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
1699 );
1700
1701 /**
1702 Returns if the capsule can be supported via UpdateCapsule().
1703
1704 @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
1705 being passed into update capsule.
1706 @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
1707 CaspuleHeaderArray.
1708 @param[out] MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can
1709 support as an argument to UpdateCapsule() via
1710 CapsuleHeaderArray and ScatterGatherList.
1711 @param[out] ResetType Returns the type of reset required for the capsule update.
1712
1713 @retval EFI_SUCCESS Valid answer returned.
1714 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and
1715 MaximumCapsuleSize and ResetType are undefined.
1716 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
1717 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule
1718 is compatible with this platform but is not capable of being submitted or processed
1719 in runtime. The caller may resubmit the capsule prior to ExitBootServices().
1720 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates
1721 the capsule is compatible with this platform but there are insufficient resources to process.
1722
1723 **/
1724 typedef
1725 EFI_STATUS
1726 (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
1727 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
1728 IN UINTN CapsuleCount,
1729 OUT UINT64 *MaximumCapsuleSize,
1730 OUT EFI_RESET_TYPE *ResetType
1731 );
1732
1733 /**
1734 Returns information about the EFI variables.
1735
1736 @param[in] Attributes Attributes bitmask to specify the type of variables on
1737 which to return information.
1738 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space
1739 available for the EFI variables associated with the
1740 attributes specified.
1741 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space
1742 available for the EFI variables associated with the
1743 attributes specified.
1744 @param[out] MaximumVariableSize Returns the maximum size of the individual EFI
1745 variables associated with the attributes specified.
1746
1747 @retval EFI_SUCCESS Valid answer returned.
1748 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied
1749 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
1750 MaximumVariableStorageSize,
1751 RemainingVariableStorageSize, MaximumVariableSize
1752 are undefined.
1753
1754 **/
1755 typedef
1756 EFI_STATUS
1757 (EFIAPI *EFI_QUERY_VARIABLE_INFO)(
1758 IN UINT32 Attributes,
1759 OUT UINT64 *MaximumVariableStorageSize,
1760 OUT UINT64 *RemainingVariableStorageSize,
1761 OUT UINT64 *MaximumVariableSize
1762 );
1763
1764 //
1765 // Firmware should stop at a firmware user interface on next boot
1766 //
1767 #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
1768 #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
1769 #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004
1770 #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
1771 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
1772 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
1773
1774 //
1775 // EFI Runtime Services Table
1776 //
1777 #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
1778 #define EFI_2_70_SYSTEM_TABLE_REVISION ((2 << 16) | (70))
1779 #define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60))
1780 #define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50))
1781 #define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))
1782 #define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))
1783 #define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
1784 #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))
1785 #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))
1786 #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))
1787 #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))
1788 #define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))
1789 #define EFI_SYSTEM_TABLE_REVISION EFI_2_70_SYSTEM_TABLE_REVISION
1790 #define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
1791
1792 #define EFI_RUNTIME_SERVICES_SIGNATURE SIGNATURE_64 ('R','U','N','T','S','E','R','V')
1793 #define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION
1794
1795 ///
1796 /// EFI Runtime Services Table.
1797 ///
1798 typedef struct {
1799 ///
1800 /// The table header for the EFI Runtime Services Table.
1801 ///
1802 EFI_TABLE_HEADER Hdr;
1803
1804 //
1805 // Time Services
1806 //
1807 EFI_GET_TIME GetTime;
1808 EFI_SET_TIME SetTime;
1809 EFI_GET_WAKEUP_TIME GetWakeupTime;
1810 EFI_SET_WAKEUP_TIME SetWakeupTime;
1811
1812 //
1813 // Virtual Memory Services
1814 //
1815 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
1816 EFI_CONVERT_POINTER ConvertPointer;
1817
1818 //
1819 // Variable Services
1820 //
1821 EFI_GET_VARIABLE GetVariable;
1822 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
1823 EFI_SET_VARIABLE SetVariable;
1824
1825 //
1826 // Miscellaneous Services
1827 //
1828 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
1829 EFI_RESET_SYSTEM ResetSystem;
1830
1831 //
1832 // UEFI 2.0 Capsule Services
1833 //
1834 EFI_UPDATE_CAPSULE UpdateCapsule;
1835 EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;
1836
1837 //
1838 // Miscellaneous UEFI 2.0 Service
1839 //
1840 EFI_QUERY_VARIABLE_INFO QueryVariableInfo;
1841 } EFI_RUNTIME_SERVICES;
1842
1843
1844 #define EFI_BOOT_SERVICES_SIGNATURE SIGNATURE_64 ('B','O','O','T','S','E','R','V')
1845 #define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION
1846
1847 ///
1848 /// EFI Boot Services Table.
1849 ///
1850 typedef struct {
1851 ///
1852 /// The table header for the EFI Boot Services Table.
1853 ///
1854 EFI_TABLE_HEADER Hdr;
1855
1856 //
1857 // Task Priority Services
1858 //
1859 EFI_RAISE_TPL RaiseTPL;
1860 EFI_RESTORE_TPL RestoreTPL;
1861
1862 //
1863 // Memory Services
1864 //
1865 EFI_ALLOCATE_PAGES AllocatePages;
1866 EFI_FREE_PAGES FreePages;
1867 EFI_GET_MEMORY_MAP GetMemoryMap;
1868 EFI_ALLOCATE_POOL AllocatePool;
1869 EFI_FREE_POOL FreePool;
1870
1871 //
1872 // Event & Timer Services
1873 //
1874 EFI_CREATE_EVENT CreateEvent;
1875 EFI_SET_TIMER SetTimer;
1876 EFI_WAIT_FOR_EVENT WaitForEvent;
1877 EFI_SIGNAL_EVENT SignalEvent;
1878 EFI_CLOSE_EVENT CloseEvent;
1879 EFI_CHECK_EVENT CheckEvent;
1880
1881 //
1882 // Protocol Handler Services
1883 //
1884 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
1885 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
1886 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
1887 EFI_HANDLE_PROTOCOL HandleProtocol;
1888 VOID *Reserved;
1889 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
1890 EFI_LOCATE_HANDLE LocateHandle;
1891 EFI_LOCATE_DEVICE_PATH LocateDevicePath;
1892 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
1893
1894 //
1895 // Image Services
1896 //
1897 EFI_IMAGE_LOAD LoadImage;
1898 EFI_IMAGE_START StartImage;
1899 EFI_EXIT Exit;
1900 EFI_IMAGE_UNLOAD UnloadImage;
1901 EFI_EXIT_BOOT_SERVICES ExitBootServices;
1902
1903 //
1904 // Miscellaneous Services
1905 //
1906 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
1907 EFI_STALL Stall;
1908 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
1909
1910 //
1911 // DriverSupport Services
1912 //
1913 EFI_CONNECT_CONTROLLER ConnectController;
1914 EFI_DISCONNECT_CONTROLLER DisconnectController;
1915
1916 //
1917 // Open and Close Protocol Services
1918 //
1919 EFI_OPEN_PROTOCOL OpenProtocol;
1920 EFI_CLOSE_PROTOCOL CloseProtocol;
1921 EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
1922
1923 //
1924 // Library Services
1925 //
1926 EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
1927 EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
1928 EFI_LOCATE_PROTOCOL LocateProtocol;
1929 EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
1930 EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
1931
1932 //
1933 // 32-bit CRC Services
1934 //
1935 EFI_CALCULATE_CRC32 CalculateCrc32;
1936
1937 //
1938 // Miscellaneous Services
1939 //
1940 EFI_COPY_MEM CopyMem;
1941 EFI_SET_MEM SetMem;
1942 EFI_CREATE_EVENT_EX CreateEventEx;
1943 } EFI_BOOT_SERVICES;
1944
1945 ///
1946 /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
1947 /// EFI System Table.
1948 ///
1949 typedef struct {
1950 ///
1951 /// The 128-bit GUID value that uniquely identifies the system configuration table.
1952 ///
1953 EFI_GUID VendorGuid;
1954 ///
1955 /// A pointer to the table associated with VendorGuid.
1956 ///
1957 VOID *VendorTable;
1958 } EFI_CONFIGURATION_TABLE;
1959
1960 ///
1961 /// EFI System Table
1962 ///
1963 typedef struct {
1964 ///
1965 /// The table header for the EFI System Table.
1966 ///
1967 EFI_TABLE_HEADER Hdr;
1968 ///
1969 /// A pointer to a null terminated string that identifies the vendor
1970 /// that produces the system firmware for the platform.
1971 ///
1972 CHAR16 *FirmwareVendor;
1973 ///
1974 /// A firmware vendor specific value that identifies the revision
1975 /// of the system firmware for the platform.
1976 ///
1977 UINT32 FirmwareRevision;
1978 ///
1979 /// The handle for the active console input device. This handle must support
1980 /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
1981 ///
1982 EFI_HANDLE ConsoleInHandle;
1983 ///
1984 /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
1985 /// associated with ConsoleInHandle.
1986 ///
1987 EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
1988 ///
1989 /// The handle for the active console output device.
1990 ///
1991 EFI_HANDLE ConsoleOutHandle;
1992 ///
1993 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1994 /// that is associated with ConsoleOutHandle.
1995 ///
1996 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
1997 ///
1998 /// The handle for the active standard error console device.
1999 /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
2000 ///
2001 EFI_HANDLE StandardErrorHandle;
2002 ///
2003 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
2004 /// that is associated with StandardErrorHandle.
2005 ///
2006 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;
2007 ///
2008 /// A pointer to the EFI Runtime Services Table.
2009 ///
2010 EFI_RUNTIME_SERVICES *RuntimeServices;
2011 ///
2012 /// A pointer to the EFI Boot Services Table.
2013 ///
2014 EFI_BOOT_SERVICES *BootServices;
2015 ///
2016 /// The number of system configuration tables in the buffer ConfigurationTable.
2017 ///
2018 UINTN NumberOfTableEntries;
2019 ///
2020 /// A pointer to the system configuration tables.
2021 /// The number of entries in the table is NumberOfTableEntries.
2022 ///
2023 EFI_CONFIGURATION_TABLE *ConfigurationTable;
2024 } EFI_SYSTEM_TABLE;
2025
2026 /**
2027 This is the declaration of an EFI image entry point. This entry point is
2028 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
2029 both device drivers and bus drivers.
2030
2031 @param[in] ImageHandle The firmware allocated handle for the UEFI image.
2032 @param[in] SystemTable A pointer to the EFI System Table.
2033
2034 @retval EFI_SUCCESS The operation completed successfully.
2035 @retval Others An unexpected error occurred.
2036 **/
2037 typedef
2038 EFI_STATUS
2039 (EFIAPI *EFI_IMAGE_ENTRY_POINT)(
2040 IN EFI_HANDLE ImageHandle,
2041 IN EFI_SYSTEM_TABLE *SystemTable
2042 );
2043
2044 //
2045 // EFI Load Option. This data structure describes format of UEFI boot option variables.
2046 //
2047 // NOTE: EFI Load Option is a byte packed buffer of variable length fields.
2048 // The first two fields have fixed length. They are declared as members of the
2049 // EFI_LOAD_OPTION structure. All the other fields are variable length fields.
2050 // They are listed in the comment block below for reference purposes.
2051 //
2052 #pragma pack(1)
2053 typedef struct _EFI_LOAD_OPTION {
2054 ///
2055 /// The attributes for this load option entry. All unused bits must be zero
2056 /// and are reserved by the UEFI specification for future growth.
2057 ///
2058 UINT32 Attributes;
2059 ///
2060 /// Length in bytes of the FilePathList. OptionalData starts at offset
2061 /// sizeof(UINT32) + sizeof(UINT16) + StrSize(Description) + FilePathListLength
2062 /// of the EFI_LOAD_OPTION descriptor.
2063 ///
2064 UINT16 FilePathListLength;
2065 ///
2066 /// The user readable description for the load option.
2067 /// This field ends with a Null character.
2068 ///
2069 // CHAR16 Description[];
2070 ///
2071 /// A packed array of UEFI device paths. The first element of the array is a
2072 /// device path that describes the device and location of the Image for this
2073 /// load option. The FilePathList[0] is specific to the device type. Other
2074 /// device paths may optionally exist in the FilePathList, but their usage is
2075 /// OSV specific. Each element in the array is variable length, and ends at
2076 /// the device path end structure. Because the size of Description is
2077 /// arbitrary, this data structure is not guaranteed to be aligned on a
2078 /// natural boundary. This data structure may have to be copied to an aligned
2079 /// natural boundary before it is used.
2080 ///
2081 // EFI_DEVICE_PATH_PROTOCOL FilePathList[];
2082 ///
2083 /// The remaining bytes in the load option descriptor are a binary data buffer
2084 /// that is passed to the loaded image. If the field is zero bytes long, a
2085 /// NULL pointer is passed to the loaded image. The number of bytes in
2086 /// OptionalData can be computed by subtracting the starting offset of
2087 /// OptionalData from total size in bytes of the EFI_LOAD_OPTION.
2088 ///
2089 // UINT8 OptionalData[];
2090 } EFI_LOAD_OPTION;
2091 #pragma pack()
2092
2093 //
2094 // EFI Load Options Attributes
2095 //
2096 #define LOAD_OPTION_ACTIVE 0x00000001
2097 #define LOAD_OPTION_FORCE_RECONNECT 0x00000002
2098 #define LOAD_OPTION_HIDDEN 0x00000008
2099 #define LOAD_OPTION_CATEGORY 0x00001F00
2100
2101 #define LOAD_OPTION_CATEGORY_BOOT 0x00000000
2102 #define LOAD_OPTION_CATEGORY_APP 0x00000100
2103
2104 #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
2105 #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
2106 #define EFI_BOOT_OPTION_SUPPORT_SYSPREP 0x00000010
2107 #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300
2108
2109 ///
2110 /// EFI Boot Key Data
2111 ///
2112 typedef union {
2113 struct {
2114 ///
2115 /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.
2116 ///
2117 UINT32 Revision : 8;
2118 ///
2119 /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).
2120 ///
2121 UINT32 ShiftPressed : 1;
2122 ///
2123 /// Either the left or right Control keys must be pressed (1) or must not be pressed (0).
2124 ///
2125 UINT32 ControlPressed : 1;
2126 ///
2127 /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).
2128 ///
2129 UINT32 AltPressed : 1;
2130 ///
2131 /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).
2132 ///
2133 UINT32 LogoPressed : 1;
2134 ///
2135 /// The Menu key must be pressed (1) or must not be pressed (0).
2136 ///
2137 UINT32 MenuPressed : 1;
2138 ///
2139 /// The SysReq key must be pressed (1) or must not be pressed (0).
2140 ///
2141 UINT32 SysReqPressed : 1;
2142 UINT32 Reserved : 16;
2143 ///
2144 /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If
2145 /// zero, then only the shift state is considered. If more than one, then the boot option will
2146 /// only be launched if all of the specified keys are pressed with the same shift state.
2147 ///
2148 UINT32 InputKeyCount : 2;
2149 } Options;
2150 UINT32 PackedValue;
2151 } EFI_BOOT_KEY_DATA;
2152
2153 ///
2154 /// EFI Key Option.
2155 ///
2156 #pragma pack(1)
2157 typedef struct {
2158 ///
2159 /// Specifies options about how the key will be processed.
2160 ///
2161 EFI_BOOT_KEY_DATA KeyData;
2162 ///
2163 /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
2164 /// which BootOption refers. If the CRC-32s do not match this value, then this key
2165 /// option is ignored.
2166 ///
2167 UINT32 BootOptionCrc;
2168 ///
2169 /// The Boot#### option which will be invoked if this key is pressed and the boot option
2170 /// is active (LOAD_OPTION_ACTIVE is set).
2171 ///
2172 UINT16 BootOption;
2173 ///
2174 /// The key codes to compare against those returned by the
2175 /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
2176 /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
2177 ///
2178 //EFI_INPUT_KEY Keys[];
2179 } EFI_KEY_OPTION;
2180 #pragma pack()
2181
2182 //
2183 // EFI File location to boot from on removable media devices
2184 //
2185 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
2186 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
2187 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
2188 #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
2189 #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
2190
2191 #if defined (MDE_CPU_IA32)
2192 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
2193 #elif defined (MDE_CPU_IPF)
2194 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA64
2195 #elif defined (MDE_CPU_X64)
2196 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64
2197 #elif defined (MDE_CPU_EBC)
2198 #elif defined (MDE_CPU_ARM)
2199 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
2200 #elif defined (MDE_CPU_AARCH64)
2201 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
2202 #else
2203 #error Unknown Processor Type
2204 #endif
2205
2206 #include <Uefi/UefiPxe.h>
2207 #include <Uefi/UefiGpt.h>
2208 #include <Uefi/UefiInternalFormRepresentation.h>
2209
2210 #endif