]> git.proxmox.com Git - mirror_edk2.git/blob - MdePkg/Include/Uefi/UefiSpec.h
MdePkg: Update comments for GetNextVariableName to follow UEFI 2.7
[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.6 specification.
5 If a code construct is defined in the UEFI 2.6 specification it must be included
6 by this include file.
7
8 Copyright (c) 2006 - 2017, 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,
705 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
706 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
707 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
708 set, then a SetVariable() call with a DataSize of zero will not cause any change to
709 the variable value (the timestamp associated with the variable may be updated however
710 even if no new data value is provided,see the description of the
711 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
712 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
713 @param[in] Data The contents for the variable.
714
715 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as
716 defined by the Attributes.
717 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the
718 DataSize exceeds the maximum allowed.
719 @retval EFI_INVALID_PARAMETER VariableName is an empty string.
720 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.
721 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.
722 @retval EFI_WRITE_PROTECTED The variable in question is read-only.
723 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.
724 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
725 or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
726 does NOT pass the validation check carried out by the firmware.
727
728 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.
729
730 **/
731 typedef
732 EFI_STATUS
733 (EFIAPI *EFI_SET_VARIABLE)(
734 IN CHAR16 *VariableName,
735 IN EFI_GUID *VendorGuid,
736 IN UINT32 Attributes,
737 IN UINTN DataSize,
738 IN VOID *Data
739 );
740
741
742 ///
743 /// This provides the capabilities of the
744 /// real time clock device as exposed through the EFI interfaces.
745 ///
746 typedef struct {
747 ///
748 /// Provides the reporting resolution of the real-time clock device in
749 /// counts per second. For a normal PC-AT CMOS RTC device, this
750 /// value would be 1 Hz, or 1, to indicate that the device only reports
751 /// the time to the resolution of 1 second.
752 ///
753 UINT32 Resolution;
754 ///
755 /// Provides the timekeeping accuracy of the real-time clock in an
756 /// error rate of 1E-6 parts per million. For a clock with an accuracy
757 /// of 50 parts per million, the value in this field would be
758 /// 50,000,000.
759 ///
760 UINT32 Accuracy;
761 ///
762 /// A TRUE indicates that a time set operation clears the device's
763 /// time below the Resolution reporting level. A FALSE
764 /// indicates that the state below the Resolution level of the
765 /// device is not cleared when the time is set. Normal PC-AT CMOS
766 /// RTC devices set this value to FALSE.
767 ///
768 BOOLEAN SetsToZero;
769 } EFI_TIME_CAPABILITIES;
770
771 /**
772 Returns the current time and date information, and the time-keeping capabilities
773 of the hardware platform.
774
775 @param[out] Time A pointer to storage to receive a snapshot of the current time.
776 @param[out] Capabilities An optional pointer to a buffer to receive the real time clock
777 device's capabilities.
778
779 @retval EFI_SUCCESS The operation completed successfully.
780 @retval EFI_INVALID_PARAMETER Time is NULL.
781 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.
782
783 **/
784 typedef
785 EFI_STATUS
786 (EFIAPI *EFI_GET_TIME)(
787 OUT EFI_TIME *Time,
788 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
789 );
790
791 /**
792 Sets the current local time and date information.
793
794 @param[in] Time A pointer to the current time.
795
796 @retval EFI_SUCCESS The operation completed successfully.
797 @retval EFI_INVALID_PARAMETER A time field is out of range.
798 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.
799
800 **/
801 typedef
802 EFI_STATUS
803 (EFIAPI *EFI_SET_TIME)(
804 IN EFI_TIME *Time
805 );
806
807 /**
808 Returns the current wakeup alarm clock setting.
809
810 @param[out] Enabled Indicates if the alarm is currently enabled or disabled.
811 @param[out] Pending Indicates if the alarm signal is pending and requires acknowledgement.
812 @param[out] Time The current alarm setting.
813
814 @retval EFI_SUCCESS The alarm settings were returned.
815 @retval EFI_INVALID_PARAMETER Enabled is NULL.
816 @retval EFI_INVALID_PARAMETER Pending is NULL.
817 @retval EFI_INVALID_PARAMETER Time is NULL.
818 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.
819 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
820
821 **/
822 typedef
823 EFI_STATUS
824 (EFIAPI *EFI_GET_WAKEUP_TIME)(
825 OUT BOOLEAN *Enabled,
826 OUT BOOLEAN *Pending,
827 OUT EFI_TIME *Time
828 );
829
830 /**
831 Sets the system wakeup alarm clock time.
832
833 @param[in] Enable Enable or disable the wakeup alarm.
834 @param[in] Time If Enable is TRUE, the time to set the wakeup alarm for.
835 If Enable is FALSE, then this parameter is optional, and may be NULL.
836
837 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If
838 Enable is FALSE, then the wakeup alarm was disabled.
839 @retval EFI_INVALID_PARAMETER A time field is out of range.
840 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.
841 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.
842
843 **/
844 typedef
845 EFI_STATUS
846 (EFIAPI *EFI_SET_WAKEUP_TIME)(
847 IN BOOLEAN Enable,
848 IN EFI_TIME *Time OPTIONAL
849 );
850
851 /**
852 Loads an EFI image into memory.
853
854 @param[in] BootPolicy If TRUE, indicates that the request originates from the boot
855 manager, and that the boot manager is attempting to load
856 FilePath as a boot selection. Ignored if SourceBuffer is
857 not NULL.
858 @param[in] ParentImageHandle The caller's image handle.
859 @param[in] DevicePath The DeviceHandle specific file path from which the image is
860 loaded.
861 @param[in] SourceBuffer If not NULL, a pointer to the memory location containing a copy
862 of the image to be loaded.
863 @param[in] SourceSize The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
864 @param[out] ImageHandle The pointer to the returned image handle that is created when the
865 image is successfully loaded.
866
867 @retval EFI_SUCCESS Image was loaded into memory correctly.
868 @retval EFI_NOT_FOUND Both SourceBuffer and DevicePath are NULL.
869 @retval EFI_INVALID_PARAMETER One or more parametes are invalid.
870 @retval EFI_UNSUPPORTED The image type is not supported.
871 @retval EFI_OUT_OF_RESOURCES Image was not loaded due to insufficient resources.
872 @retval EFI_LOAD_ERROR Image was not loaded because the image format was corrupt or not
873 understood.
874 @retval EFI_DEVICE_ERROR Image was not loaded because the device returned a read error.
875 @retval EFI_ACCESS_DENIED Image was not loaded because the platform policy prohibits the
876 image from being loaded. NULL is returned in *ImageHandle.
877 @retval EFI_SECURITY_VIOLATION Image was loaded and an ImageHandle was created with a
878 valid EFI_LOADED_IMAGE_PROTOCOL. However, the current
879 platform policy specifies that the image should not be started.
880 **/
881 typedef
882 EFI_STATUS
883 (EFIAPI *EFI_IMAGE_LOAD)(
884 IN BOOLEAN BootPolicy,
885 IN EFI_HANDLE ParentImageHandle,
886 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
887 IN VOID *SourceBuffer OPTIONAL,
888 IN UINTN SourceSize,
889 OUT EFI_HANDLE *ImageHandle
890 );
891
892 /**
893 Transfers control to a loaded image's entry point.
894
895 @param[in] ImageHandle Handle of image to be started.
896 @param[out] ExitDataSize The pointer to the size, in bytes, of ExitData.
897 @param[out] ExitData The pointer to a pointer to a data buffer that includes a Null-terminated
898 string, optionally followed by additional binary data.
899
900 @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
901 has already been initialized with StartImage.
902 @retval EFI_SECURITY_VIOLATION The current platform policy specifies that the image should not be started.
903 @return Exit code from image
904
905 **/
906 typedef
907 EFI_STATUS
908 (EFIAPI *EFI_IMAGE_START)(
909 IN EFI_HANDLE ImageHandle,
910 OUT UINTN *ExitDataSize,
911 OUT CHAR16 **ExitData OPTIONAL
912 );
913
914 /**
915 Terminates a loaded EFI image and returns control to boot services.
916
917 @param[in] ImageHandle Handle that identifies the image. This parameter is passed to the
918 image on entry.
919 @param[in] ExitStatus The image's exit code.
920 @param[in] ExitDataSize The size, in bytes, of ExitData. Ignored if ExitStatus is EFI_SUCCESS.
921 @param[in] ExitData The pointer to a data buffer that includes a Null-terminated string,
922 optionally followed by additional binary data. The string is a
923 description that the caller may use to further indicate the reason
924 for the image's exit. ExitData is only valid if ExitStatus
925 is something other than EFI_SUCCESS. The ExitData buffer
926 must be allocated by calling AllocatePool().
927
928 @retval EFI_SUCCESS The image specified by ImageHandle was unloaded.
929 @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and
930 started with LoadImage() and StartImage(), but the
931 image is not the currently executing image.
932
933 **/
934 typedef
935 EFI_STATUS
936 (EFIAPI *EFI_EXIT)(
937 IN EFI_HANDLE ImageHandle,
938 IN EFI_STATUS ExitStatus,
939 IN UINTN ExitDataSize,
940 IN CHAR16 *ExitData OPTIONAL
941 );
942
943 /**
944 Unloads an image.
945
946 @param[in] ImageHandle Handle that identifies the image to be unloaded.
947
948 @retval EFI_SUCCESS The image has been unloaded.
949 @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
950
951 **/
952 typedef
953 EFI_STATUS
954 (EFIAPI *EFI_IMAGE_UNLOAD)(
955 IN EFI_HANDLE ImageHandle
956 );
957
958 /**
959 Terminates all boot services.
960
961 @param[in] ImageHandle Handle that identifies the exiting image.
962 @param[in] MapKey Key to the latest memory map.
963
964 @retval EFI_SUCCESS Boot services have been terminated.
965 @retval EFI_INVALID_PARAMETER MapKey is incorrect.
966
967 **/
968 typedef
969 EFI_STATUS
970 (EFIAPI *EFI_EXIT_BOOT_SERVICES)(
971 IN EFI_HANDLE ImageHandle,
972 IN UINTN MapKey
973 );
974
975 /**
976 Induces a fine-grained stall.
977
978 @param[in] Microseconds The number of microseconds to stall execution.
979
980 @retval EFI_SUCCESS Execution was stalled at least the requested number of
981 Microseconds.
982
983 **/
984 typedef
985 EFI_STATUS
986 (EFIAPI *EFI_STALL)(
987 IN UINTN Microseconds
988 );
989
990 /**
991 Sets the system's watchdog timer.
992
993 @param[in] Timeout The number of seconds to set the watchdog timer to.
994 @param[in] WatchdogCode The numeric code to log on a watchdog timer timeout event.
995 @param[in] DataSize The size, in bytes, of WatchdogData.
996 @param[in] WatchdogData A data buffer that includes a Null-terminated string, optionally
997 followed by additional binary data.
998
999 @retval EFI_SUCCESS The timeout has been set.
1000 @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.
1001 @retval EFI_UNSUPPORTED The system does not have a watchdog timer.
1002 @retval EFI_DEVICE_ERROR The watchdog timer could not be programmed due to a hardware
1003 error.
1004
1005 **/
1006 typedef
1007 EFI_STATUS
1008 (EFIAPI *EFI_SET_WATCHDOG_TIMER)(
1009 IN UINTN Timeout,
1010 IN UINT64 WatchdogCode,
1011 IN UINTN DataSize,
1012 IN CHAR16 *WatchdogData OPTIONAL
1013 );
1014
1015 /**
1016 Resets the entire platform.
1017
1018 @param[in] ResetType The type of reset to perform.
1019 @param[in] ResetStatus The status code for the reset.
1020 @param[in] DataSize The size, in bytes, of ResetData.
1021 @param[in] ResetData For a ResetType of EfiResetCold, EfiResetWarm, or
1022 EfiResetShutdown the data buffer starts with a Null-terminated
1023 string, optionally followed by additional binary data.
1024 The string is a description that the caller may use to further
1025 indicate the reason for the system reset. ResetData is only
1026 valid if ResetStatus is something other than EFI_SUCCESS
1027 unless the ResetType is EfiResetPlatformSpecific
1028 where a minimum amount of ResetData is always required.
1029 For a ResetType of EfiResetPlatformSpecific the data buffer
1030 also starts with a Null-terminated string that is followed
1031 by an EFI_GUID that describes the specific type of reset to perform.
1032 **/
1033 typedef
1034 VOID
1035 (EFIAPI *EFI_RESET_SYSTEM)(
1036 IN EFI_RESET_TYPE ResetType,
1037 IN EFI_STATUS ResetStatus,
1038 IN UINTN DataSize,
1039 IN VOID *ResetData OPTIONAL
1040 );
1041
1042 /**
1043 Returns a monotonically increasing count for the platform.
1044
1045 @param[out] Count The pointer to returned value.
1046
1047 @retval EFI_SUCCESS The next monotonic count was returned.
1048 @retval EFI_INVALID_PARAMETER Count is NULL.
1049 @retval EFI_DEVICE_ERROR The device is not functioning properly.
1050
1051 **/
1052 typedef
1053 EFI_STATUS
1054 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)(
1055 OUT UINT64 *Count
1056 );
1057
1058 /**
1059 Returns the next high 32 bits of the platform's monotonic counter.
1060
1061 @param[out] HighCount The pointer to returned value.
1062
1063 @retval EFI_SUCCESS The next high monotonic count was returned.
1064 @retval EFI_INVALID_PARAMETER HighCount is NULL.
1065 @retval EFI_DEVICE_ERROR The device is not functioning properly.
1066
1067 **/
1068 typedef
1069 EFI_STATUS
1070 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)(
1071 OUT UINT32 *HighCount
1072 );
1073
1074 /**
1075 Computes and returns a 32-bit CRC for a data buffer.
1076
1077 @param[in] Data A pointer to the buffer on which the 32-bit CRC is to be computed.
1078 @param[in] DataSize The number of bytes in the buffer Data.
1079 @param[out] Crc32 The 32-bit CRC that was computed for the data buffer specified by Data
1080 and DataSize.
1081
1082 @retval EFI_SUCCESS The 32-bit CRC was computed for the data buffer and returned in
1083 Crc32.
1084 @retval EFI_INVALID_PARAMETER Data is NULL.
1085 @retval EFI_INVALID_PARAMETER Crc32 is NULL.
1086 @retval EFI_INVALID_PARAMETER DataSize is 0.
1087
1088 **/
1089 typedef
1090 EFI_STATUS
1091 (EFIAPI *EFI_CALCULATE_CRC32)(
1092 IN VOID *Data,
1093 IN UINTN DataSize,
1094 OUT UINT32 *Crc32
1095 );
1096
1097 /**
1098 Copies the contents of one buffer to another buffer.
1099
1100 @param[in] Destination The pointer to the destination buffer of the memory copy.
1101 @param[in] Source The pointer to the source buffer of the memory copy.
1102 @param[in] Length Number of bytes to copy from Source to Destination.
1103
1104 **/
1105 typedef
1106 VOID
1107 (EFIAPI *EFI_COPY_MEM)(
1108 IN VOID *Destination,
1109 IN VOID *Source,
1110 IN UINTN Length
1111 );
1112
1113 /**
1114 The SetMem() function fills a buffer with a specified value.
1115
1116 @param[in] Buffer The pointer to the buffer to fill.
1117 @param[in] Size Number of bytes in Buffer to fill.
1118 @param[in] Value Value to fill Buffer with.
1119
1120 **/
1121 typedef
1122 VOID
1123 (EFIAPI *EFI_SET_MEM)(
1124 IN VOID *Buffer,
1125 IN UINTN Size,
1126 IN UINT8 Value
1127 );
1128
1129 ///
1130 /// Enumeration of EFI Interface Types
1131 ///
1132 typedef enum {
1133 ///
1134 /// Indicates that the supplied protocol interface is supplied in native form.
1135 ///
1136 EFI_NATIVE_INTERFACE
1137 } EFI_INTERFACE_TYPE;
1138
1139 /**
1140 Installs a protocol interface on a device handle. If the handle does not exist, it is created and added
1141 to the list of handles in the system. InstallMultipleProtocolInterfaces() performs
1142 more error checking than InstallProtocolInterface(), so it is recommended that
1143 InstallMultipleProtocolInterfaces() be used in place of
1144 InstallProtocolInterface()
1145
1146 @param[in, out] Handle A pointer to the EFI_HANDLE on which the interface is to be installed.
1147 @param[in] Protocol The numeric ID of the protocol interface.
1148 @param[in] InterfaceType Indicates whether Interface is supplied in native form.
1149 @param[in] Interface A pointer to the protocol interface.
1150
1151 @retval EFI_SUCCESS The protocol interface was installed.
1152 @retval EFI_OUT_OF_RESOURCES Space for a new handle could not be allocated.
1153 @retval EFI_INVALID_PARAMETER Handle is NULL.
1154 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1155 @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.
1156 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1157
1158 **/
1159 typedef
1160 EFI_STATUS
1161 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)(
1162 IN OUT EFI_HANDLE *Handle,
1163 IN EFI_GUID *Protocol,
1164 IN EFI_INTERFACE_TYPE InterfaceType,
1165 IN VOID *Interface
1166 );
1167
1168 /**
1169 Installs one or more protocol interfaces into the boot services environment.
1170
1171 @param[in, out] Handle The pointer to a handle to install the new protocol interfaces on,
1172 or a pointer to NULL if a new handle is to be allocated.
1173 @param ... A variable argument list containing pairs of protocol GUIDs and protocol
1174 interfaces.
1175
1176 @retval EFI_SUCCESS All the protocol interface was installed.
1177 @retval EFI_OUT_OF_RESOURCES There was not enough memory in pool to install all the protocols.
1178 @retval EFI_ALREADY_STARTED A Device Path Protocol instance was passed in that is already present in
1179 the handle database.
1180 @retval EFI_INVALID_PARAMETER Handle is NULL.
1181 @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
1182
1183 **/
1184 typedef
1185 EFI_STATUS
1186 (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
1187 IN OUT EFI_HANDLE *Handle,
1188 ...
1189 );
1190
1191 /**
1192 Reinstalls a protocol interface on a device handle.
1193
1194 @param[in] Handle Handle on which the interface is to be reinstalled.
1195 @param[in] Protocol The numeric ID of the interface.
1196 @param[in] OldInterface A pointer to the old interface. NULL can be used if a structure is not
1197 associated with Protocol.
1198 @param[in] NewInterface A pointer to the new interface.
1199
1200 @retval EFI_SUCCESS The protocol interface was reinstalled.
1201 @retval EFI_NOT_FOUND The OldInterface on the handle was not found.
1202 @retval EFI_ACCESS_DENIED The protocol interface could not be reinstalled,
1203 because OldInterface is still being used by a
1204 driver that will not release it.
1205 @retval EFI_INVALID_PARAMETER Handle is NULL.
1206 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1207
1208 **/
1209 typedef
1210 EFI_STATUS
1211 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)(
1212 IN EFI_HANDLE Handle,
1213 IN EFI_GUID *Protocol,
1214 IN VOID *OldInterface,
1215 IN VOID *NewInterface
1216 );
1217
1218 /**
1219 Removes a protocol interface from a device handle. It is recommended that
1220 UninstallMultipleProtocolInterfaces() be used in place of
1221 UninstallProtocolInterface().
1222
1223 @param[in] Handle The handle on which the interface was installed.
1224 @param[in] Protocol The numeric ID of the interface.
1225 @param[in] Interface A pointer to the interface.
1226
1227 @retval EFI_SUCCESS The interface was removed.
1228 @retval EFI_NOT_FOUND The interface was not found.
1229 @retval EFI_ACCESS_DENIED The interface was not removed because the interface
1230 is still being used by a driver.
1231 @retval EFI_INVALID_PARAMETER Handle is NULL.
1232 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1233
1234 **/
1235 typedef
1236 EFI_STATUS
1237 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)(
1238 IN EFI_HANDLE Handle,
1239 IN EFI_GUID *Protocol,
1240 IN VOID *Interface
1241 );
1242
1243 /**
1244 Removes one or more protocol interfaces into the boot services environment.
1245
1246 @param[in] Handle The handle to remove the protocol interfaces from.
1247 @param ... A variable argument list containing pairs of protocol GUIDs and
1248 protocol interfaces.
1249
1250 @retval EFI_SUCCESS All the protocol interfaces were removed.
1251 @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.
1252
1253 **/
1254 typedef
1255 EFI_STATUS
1256 (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
1257 IN EFI_HANDLE Handle,
1258 ...
1259 );
1260
1261 /**
1262 Queries a handle to determine if it supports a specified protocol.
1263
1264 @param[in] Handle The handle being queried.
1265 @param[in] Protocol The published unique identifier of the protocol.
1266 @param[out] Interface Supplies the address where a pointer to the corresponding Protocol
1267 Interface is returned.
1268
1269 @retval EFI_SUCCESS The interface information for the specified protocol was returned.
1270 @retval EFI_UNSUPPORTED The device does not support the specified protocol.
1271 @retval EFI_INVALID_PARAMETER Handle is NULL.
1272 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1273 @retval EFI_INVALID_PARAMETER Interface is NULL.
1274
1275 **/
1276 typedef
1277 EFI_STATUS
1278 (EFIAPI *EFI_HANDLE_PROTOCOL)(
1279 IN EFI_HANDLE Handle,
1280 IN EFI_GUID *Protocol,
1281 OUT VOID **Interface
1282 );
1283
1284 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL 0x00000001
1285 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL 0x00000002
1286 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL 0x00000004
1287 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
1288 #define EFI_OPEN_PROTOCOL_BY_DRIVER 0x00000010
1289 #define EFI_OPEN_PROTOCOL_EXCLUSIVE 0x00000020
1290
1291 /**
1292 Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the
1293 handle, it opens the protocol on behalf of the calling agent.
1294
1295 @param[in] Handle The handle for the protocol interface that is being opened.
1296 @param[in] Protocol The published unique identifier of the protocol.
1297 @param[out] Interface Supplies the address where a pointer to the corresponding Protocol
1298 Interface is returned.
1299 @param[in] AgentHandle The handle of the agent that is opening the protocol interface
1300 specified by Protocol and Interface.
1301 @param[in] ControllerHandle If the agent that is opening a protocol is a driver that follows the
1302 UEFI Driver Model, then this parameter is the controller handle
1303 that requires the protocol interface. If the agent does not follow
1304 the UEFI Driver Model, then this parameter is optional and may
1305 be NULL.
1306 @param[in] Attributes The open mode of the protocol interface specified by Handle
1307 and Protocol.
1308
1309 @retval EFI_SUCCESS An item was added to the open list for the protocol interface, and the
1310 protocol interface was returned in Interface.
1311 @retval EFI_UNSUPPORTED Handle does not support Protocol.
1312 @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
1313 @retval EFI_ACCESS_DENIED Required attributes can't be supported in current environment.
1314 @retval EFI_ALREADY_STARTED Item on the open list already has requierd attributes whose agent
1315 handle is the same as AgentHandle.
1316
1317 **/
1318 typedef
1319 EFI_STATUS
1320 (EFIAPI *EFI_OPEN_PROTOCOL)(
1321 IN EFI_HANDLE Handle,
1322 IN EFI_GUID *Protocol,
1323 OUT VOID **Interface, OPTIONAL
1324 IN EFI_HANDLE AgentHandle,
1325 IN EFI_HANDLE ControllerHandle,
1326 IN UINT32 Attributes
1327 );
1328
1329
1330 /**
1331 Closes a protocol on a handle that was opened using OpenProtocol().
1332
1333 @param[in] Handle The handle for the protocol interface that was previously opened
1334 with OpenProtocol(), and is now being closed.
1335 @param[in] Protocol The published unique identifier of the protocol.
1336 @param[in] AgentHandle The handle of the agent that is closing the protocol interface.
1337 @param[in] ControllerHandle If the agent that opened a protocol is a driver that follows the
1338 UEFI Driver Model, then this parameter is the controller handle
1339 that required the protocol interface.
1340
1341 @retval EFI_SUCCESS The protocol instance was closed.
1342 @retval EFI_INVALID_PARAMETER 1) Handle is NULL.
1343 2) AgentHandle is NULL.
1344 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.
1345 4) Protocol is NULL.
1346 @retval EFI_NOT_FOUND 1) Handle does not support the protocol specified by Protocol.
1347 2) The protocol interface specified by Handle and Protocol is not
1348 currently open by AgentHandle and ControllerHandle.
1349
1350 **/
1351 typedef
1352 EFI_STATUS
1353 (EFIAPI *EFI_CLOSE_PROTOCOL)(
1354 IN EFI_HANDLE Handle,
1355 IN EFI_GUID *Protocol,
1356 IN EFI_HANDLE AgentHandle,
1357 IN EFI_HANDLE ControllerHandle
1358 );
1359
1360 ///
1361 /// EFI Oprn Protocol Information Entry
1362 ///
1363 typedef struct {
1364 EFI_HANDLE AgentHandle;
1365 EFI_HANDLE ControllerHandle;
1366 UINT32 Attributes;
1367 UINT32 OpenCount;
1368 } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
1369
1370 /**
1371 Retrieves the list of agents that currently have a protocol interface opened.
1372
1373 @param[in] Handle The handle for the protocol interface that is being queried.
1374 @param[in] Protocol The published unique identifier of the protocol.
1375 @param[out] EntryBuffer A pointer to a buffer of open protocol information in the form of
1376 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
1377 @param[out] EntryCount A pointer to the number of entries in EntryBuffer.
1378
1379 @retval EFI_SUCCESS The open protocol information was returned in EntryBuffer, and the
1380 number of entries was returned EntryCount.
1381 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to allocate EntryBuffer.
1382 @retval EFI_NOT_FOUND Handle does not support the protocol specified by Protocol.
1383
1384 **/
1385 typedef
1386 EFI_STATUS
1387 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(
1388 IN EFI_HANDLE Handle,
1389 IN EFI_GUID *Protocol,
1390 OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
1391 OUT UINTN *EntryCount
1392 );
1393
1394 /**
1395 Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
1396 from pool.
1397
1398 @param[in] Handle The handle from which to retrieve the list of protocol interface
1399 GUIDs.
1400 @param[out] ProtocolBuffer A pointer to the list of protocol interface GUID pointers that are
1401 installed on Handle.
1402 @param[out] ProtocolBufferCount A pointer to the number of GUID pointers present in
1403 ProtocolBuffer.
1404
1405 @retval EFI_SUCCESS The list of protocol interface GUIDs installed on Handle was returned in
1406 ProtocolBuffer. The number of protocol interface GUIDs was
1407 returned in ProtocolBufferCount.
1408 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the results.
1409 @retval EFI_INVALID_PARAMETER Handle is NULL.
1410 @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
1411 @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
1412 @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
1413
1414 **/
1415 typedef
1416 EFI_STATUS
1417 (EFIAPI *EFI_PROTOCOLS_PER_HANDLE)(
1418 IN EFI_HANDLE Handle,
1419 OUT EFI_GUID ***ProtocolBuffer,
1420 OUT UINTN *ProtocolBufferCount
1421 );
1422
1423 /**
1424 Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
1425
1426 @param[in] Protocol The numeric ID of the protocol for which the event is to be registered.
1427 @param[in] Event Event that is to be signaled whenever a protocol interface is registered
1428 for Protocol.
1429 @param[out] Registration A pointer to a memory location to receive the registration value.
1430
1431 @retval EFI_SUCCESS The notification event has been registered.
1432 @retval EFI_OUT_OF_RESOURCES Space for the notification event could not be allocated.
1433 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1434 @retval EFI_INVALID_PARAMETER Event is NULL.
1435 @retval EFI_INVALID_PARAMETER Registration is NULL.
1436
1437 **/
1438 typedef
1439 EFI_STATUS
1440 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)(
1441 IN EFI_GUID *Protocol,
1442 IN EFI_EVENT Event,
1443 OUT VOID **Registration
1444 );
1445
1446 ///
1447 /// Enumeration of EFI Locate Search Types
1448 ///
1449 typedef enum {
1450 ///
1451 /// Retrieve all the handles in the handle database.
1452 ///
1453 AllHandles,
1454 ///
1455 /// Retrieve the next handle fron a RegisterProtocolNotify() event.
1456 ///
1457 ByRegisterNotify,
1458 ///
1459 /// Retrieve the set of handles from the handle database that support a
1460 /// specified protocol.
1461 ///
1462 ByProtocol
1463 } EFI_LOCATE_SEARCH_TYPE;
1464
1465 /**
1466 Returns an array of handles that support a specified protocol.
1467
1468 @param[in] SearchType Specifies which handle(s) are to be returned.
1469 @param[in] Protocol Specifies the protocol to search by.
1470 @param[in] SearchKey Specifies the search key.
1471 @param[in, out] BufferSize On input, the size in bytes of Buffer. On output, the size in bytes of
1472 the array returned in Buffer (if the buffer was large enough) or the
1473 size, in bytes, of the buffer needed to obtain the array (if the buffer was
1474 not large enough).
1475 @param[out] Buffer The buffer in which the array is returned.
1476
1477 @retval EFI_SUCCESS The array of handles was returned.
1478 @retval EFI_NOT_FOUND No handles match the search.
1479 @retval EFI_BUFFER_TOO_SMALL The BufferSize is too small for the result.
1480 @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.
1481 @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.
1482 @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.
1483 @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.
1484 @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.
1485
1486 **/
1487 typedef
1488 EFI_STATUS
1489 (EFIAPI *EFI_LOCATE_HANDLE)(
1490 IN EFI_LOCATE_SEARCH_TYPE SearchType,
1491 IN EFI_GUID *Protocol, OPTIONAL
1492 IN VOID *SearchKey, OPTIONAL
1493 IN OUT UINTN *BufferSize,
1494 OUT EFI_HANDLE *Buffer
1495 );
1496
1497 /**
1498 Locates the handle to a device on the device path that supports the specified protocol.
1499
1500 @param[in] Protocol Specifies the protocol to search for.
1501 @param[in, out] DevicePath On input, a pointer to a pointer to the device path. On output, the device
1502 path pointer is modified to point to the remaining part of the device
1503 path.
1504 @param[out] Device A pointer to the returned device handle.
1505
1506 @retval EFI_SUCCESS The resulting handle was returned.
1507 @retval EFI_NOT_FOUND No handles match the search.
1508 @retval EFI_INVALID_PARAMETER Protocol is NULL.
1509 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
1510 @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.
1511
1512 **/
1513 typedef
1514 EFI_STATUS
1515 (EFIAPI *EFI_LOCATE_DEVICE_PATH)(
1516 IN EFI_GUID *Protocol,
1517 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
1518 OUT EFI_HANDLE *Device
1519 );
1520
1521 /**
1522 Adds, updates, or removes a configuration table entry from the EFI System Table.
1523
1524 @param[in] Guid A pointer to the GUID for the entry to add, update, or remove.
1525 @param[in] Table A pointer to the configuration table for the entry to add, update, or
1526 remove. May be NULL.
1527
1528 @retval EFI_SUCCESS The (Guid, Table) pair was added, updated, or removed.
1529 @retval EFI_NOT_FOUND An attempt was made to delete a nonexistent entry.
1530 @retval EFI_INVALID_PARAMETER Guid is NULL.
1531 @retval EFI_OUT_OF_RESOURCES There is not enough memory available to complete the operation.
1532
1533 **/
1534 typedef
1535 EFI_STATUS
1536 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)(
1537 IN EFI_GUID *Guid,
1538 IN VOID *Table
1539 );
1540
1541 /**
1542 Returns an array of handles that support the requested protocol in a buffer allocated from pool.
1543
1544 @param[in] SearchType Specifies which handle(s) are to be returned.
1545 @param[in] Protocol Provides the protocol to search by.
1546 This parameter is only valid for a SearchType of ByProtocol.
1547 @param[in] SearchKey Supplies the search key depending on the SearchType.
1548 @param[in, out] NoHandles The number of handles returned in Buffer.
1549 @param[out] Buffer A pointer to the buffer to return the requested array of handles that
1550 support Protocol.
1551
1552 @retval EFI_SUCCESS The array of handles was returned in Buffer, and the number of
1553 handles in Buffer was returned in NoHandles.
1554 @retval EFI_NOT_FOUND No handles match the search.
1555 @retval EFI_OUT_OF_RESOURCES There is not enough pool memory to store the matching results.
1556 @retval EFI_INVALID_PARAMETER NoHandles is NULL.
1557 @retval EFI_INVALID_PARAMETER Buffer is NULL.
1558
1559 **/
1560 typedef
1561 EFI_STATUS
1562 (EFIAPI *EFI_LOCATE_HANDLE_BUFFER)(
1563 IN EFI_LOCATE_SEARCH_TYPE SearchType,
1564 IN EFI_GUID *Protocol, OPTIONAL
1565 IN VOID *SearchKey, OPTIONAL
1566 IN OUT UINTN *NoHandles,
1567 OUT EFI_HANDLE **Buffer
1568 );
1569
1570 /**
1571 Returns the first protocol instance that matches the given protocol.
1572
1573 @param[in] Protocol Provides the protocol to search for.
1574 @param[in] Registration Optional registration key returned from
1575 RegisterProtocolNotify().
1576 @param[out] Interface On return, a pointer to the first interface that matches Protocol and
1577 Registration.
1578
1579 @retval EFI_SUCCESS A protocol instance matching Protocol was found and returned in
1580 Interface.
1581 @retval EFI_NOT_FOUND No protocol instances were found that match Protocol and
1582 Registration.
1583 @retval EFI_INVALID_PARAMETER Interface is NULL.
1584 Protocol is NULL.
1585
1586 **/
1587 typedef
1588 EFI_STATUS
1589 (EFIAPI *EFI_LOCATE_PROTOCOL)(
1590 IN EFI_GUID *Protocol,
1591 IN VOID *Registration, OPTIONAL
1592 OUT VOID **Interface
1593 );
1594
1595 ///
1596 /// EFI Capsule Block Descriptor
1597 ///
1598 typedef struct {
1599 ///
1600 /// Length in bytes of the data pointed to by DataBlock/ContinuationPointer.
1601 ///
1602 UINT64 Length;
1603 union {
1604 ///
1605 /// Physical address of the data block. This member of the union is
1606 /// used if Length is not equal to zero.
1607 ///
1608 EFI_PHYSICAL_ADDRESS DataBlock;
1609 ///
1610 /// Physical address of another block of
1611 /// EFI_CAPSULE_BLOCK_DESCRIPTOR structures. This
1612 /// member of the union is used if Length is equal to zero. If
1613 /// ContinuationPointer is zero this entry represents the end of the list.
1614 ///
1615 EFI_PHYSICAL_ADDRESS ContinuationPointer;
1616 } Union;
1617 } EFI_CAPSULE_BLOCK_DESCRIPTOR;
1618
1619 ///
1620 /// EFI Capsule Header.
1621 ///
1622 typedef struct {
1623 ///
1624 /// A GUID that defines the contents of a capsule.
1625 ///
1626 EFI_GUID CapsuleGuid;
1627 ///
1628 /// The size of the capsule header. This may be larger than the size of
1629 /// the EFI_CAPSULE_HEADER since CapsuleGuid may imply
1630 /// extended header entries
1631 ///
1632 UINT32 HeaderSize;
1633 ///
1634 /// Bit-mapped list describing the capsule attributes. The Flag values
1635 /// of 0x0000 - 0xFFFF are defined by CapsuleGuid. Flag values
1636 /// of 0x10000 - 0xFFFFFFFF are defined by this specification
1637 ///
1638 UINT32 Flags;
1639 ///
1640 /// Size in bytes of the capsule.
1641 ///
1642 UINT32 CapsuleImageSize;
1643 } EFI_CAPSULE_HEADER;
1644
1645 ///
1646 /// The EFI System Table entry must point to an array of capsules
1647 /// that contain the same CapsuleGuid value. The array must be
1648 /// prefixed by a UINT32 that represents the size of the array of capsules.
1649 ///
1650 typedef struct {
1651 ///
1652 /// the size of the array of capsules.
1653 ///
1654 UINT32 CapsuleArrayNumber;
1655 ///
1656 /// Point to an array of capsules that contain the same CapsuleGuid value.
1657 ///
1658 VOID* CapsulePtr[1];
1659 } EFI_CAPSULE_TABLE;
1660
1661 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
1662 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
1663 #define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
1664
1665 /**
1666 Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
1667 consumption, the firmware may process the capsule immediately. If the payload should persist
1668 across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
1669 be passed into ResetSystem() and will cause the capsule to be processed by the firmware as
1670 part of the reset process.
1671
1672 @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
1673 being passed into update capsule.
1674 @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
1675 CaspuleHeaderArray.
1676 @param[in] ScatterGatherList Physical pointer to a set of
1677 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
1678 location in physical memory of a set of capsules.
1679
1680 @retval EFI_SUCCESS Valid capsule was passed. If
1681 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
1682 capsule has been successfully processed by the firmware.
1683 @retval EFI_INVALID_PARAMETER CapsuleSize is NULL, or an incompatible set of flags were
1684 set in the capsule header.
1685 @retval EFI_INVALID_PARAMETER CapsuleCount is 0.
1686 @retval EFI_DEVICE_ERROR The capsule update was started, but failed due to a device error.
1687 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform.
1688 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule
1689 is compatible with this platform but is not capable of being submitted or processed
1690 in runtime. The caller may resubmit the capsule prior to ExitBootServices().
1691 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates
1692 the capsule is compatible with this platform but there are insufficient resources to process.
1693
1694 **/
1695 typedef
1696 EFI_STATUS
1697 (EFIAPI *EFI_UPDATE_CAPSULE)(
1698 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
1699 IN UINTN CapsuleCount,
1700 IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
1701 );
1702
1703 /**
1704 Returns if the capsule can be supported via UpdateCapsule().
1705
1706 @param[in] CapsuleHeaderArray Virtual pointer to an array of virtual pointers to the capsules
1707 being passed into update capsule.
1708 @param[in] CapsuleCount Number of pointers to EFI_CAPSULE_HEADER in
1709 CaspuleHeaderArray.
1710 @param[out] MaxiumCapsuleSize On output the maximum size that UpdateCapsule() can
1711 support as an argument to UpdateCapsule() via
1712 CapsuleHeaderArray and ScatterGatherList.
1713 @param[out] ResetType Returns the type of reset required for the capsule update.
1714
1715 @retval EFI_SUCCESS Valid answer returned.
1716 @retval EFI_UNSUPPORTED The capsule type is not supported on this platform, and
1717 MaximumCapsuleSize and ResetType are undefined.
1718 @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
1719 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has been previously called this error indicates the capsule
1720 is compatible with this platform but is not capable of being submitted or processed
1721 in runtime. The caller may resubmit the capsule prior to ExitBootServices().
1722 @retval EFI_OUT_OF_RESOURCES When ExitBootServices() has not been previously called then this error indicates
1723 the capsule is compatible with this platform but there are insufficient resources to process.
1724
1725 **/
1726 typedef
1727 EFI_STATUS
1728 (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
1729 IN EFI_CAPSULE_HEADER **CapsuleHeaderArray,
1730 IN UINTN CapsuleCount,
1731 OUT UINT64 *MaximumCapsuleSize,
1732 OUT EFI_RESET_TYPE *ResetType
1733 );
1734
1735 /**
1736 Returns information about the EFI variables.
1737
1738 @param[in] Attributes Attributes bitmask to specify the type of variables on
1739 which to return information.
1740 @param[out] MaximumVariableStorageSize On output the maximum size of the storage space
1741 available for the EFI variables associated with the
1742 attributes specified.
1743 @param[out] RemainingVariableStorageSize Returns the remaining size of the storage space
1744 available for the EFI variables associated with the
1745 attributes specified.
1746 @param[out] MaximumVariableSize Returns the maximum size of the individual EFI
1747 variables associated with the attributes specified.
1748
1749 @retval EFI_SUCCESS Valid answer returned.
1750 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits was supplied
1751 @retval EFI_UNSUPPORTED The attribute is not supported on this platform, and the
1752 MaximumVariableStorageSize,
1753 RemainingVariableStorageSize, MaximumVariableSize
1754 are undefined.
1755
1756 **/
1757 typedef
1758 EFI_STATUS
1759 (EFIAPI *EFI_QUERY_VARIABLE_INFO)(
1760 IN UINT32 Attributes,
1761 OUT UINT64 *MaximumVariableStorageSize,
1762 OUT UINT64 *RemainingVariableStorageSize,
1763 OUT UINT64 *MaximumVariableSize
1764 );
1765
1766 //
1767 // Firmware should stop at a firmware user interface on next boot
1768 //
1769 #define EFI_OS_INDICATIONS_BOOT_TO_FW_UI 0x0000000000000001
1770 #define EFI_OS_INDICATIONS_TIMESTAMP_REVOCATION 0x0000000000000002
1771 #define EFI_OS_INDICATIONS_FILE_CAPSULE_DELIVERY_SUPPORTED 0x0000000000000004
1772 #define EFI_OS_INDICATIONS_FMP_CAPSULE_SUPPORTED 0x0000000000000008
1773 #define EFI_OS_INDICATIONS_CAPSULE_RESULT_VAR_SUPPORTED 0x0000000000000010
1774 #define EFI_OS_INDICATIONS_START_PLATFORM_RECOVERY 0x0000000000000040
1775
1776 //
1777 // EFI Runtime Services Table
1778 //
1779 #define EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
1780 #define EFI_2_60_SYSTEM_TABLE_REVISION ((2 << 16) | (60))
1781 #define EFI_2_50_SYSTEM_TABLE_REVISION ((2 << 16) | (50))
1782 #define EFI_2_40_SYSTEM_TABLE_REVISION ((2 << 16) | (40))
1783 #define EFI_2_31_SYSTEM_TABLE_REVISION ((2 << 16) | (31))
1784 #define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
1785 #define EFI_2_20_SYSTEM_TABLE_REVISION ((2 << 16) | (20))
1786 #define EFI_2_10_SYSTEM_TABLE_REVISION ((2 << 16) | (10))
1787 #define EFI_2_00_SYSTEM_TABLE_REVISION ((2 << 16) | (00))
1788 #define EFI_1_10_SYSTEM_TABLE_REVISION ((1 << 16) | (10))
1789 #define EFI_1_02_SYSTEM_TABLE_REVISION ((1 << 16) | (02))
1790 #define EFI_SYSTEM_TABLE_REVISION EFI_2_60_SYSTEM_TABLE_REVISION
1791 #define EFI_SPECIFICATION_VERSION EFI_SYSTEM_TABLE_REVISION
1792
1793 #define EFI_RUNTIME_SERVICES_SIGNATURE SIGNATURE_64 ('R','U','N','T','S','E','R','V')
1794 #define EFI_RUNTIME_SERVICES_REVISION EFI_SPECIFICATION_VERSION
1795
1796 ///
1797 /// EFI Runtime Services Table.
1798 ///
1799 typedef struct {
1800 ///
1801 /// The table header for the EFI Runtime Services Table.
1802 ///
1803 EFI_TABLE_HEADER Hdr;
1804
1805 //
1806 // Time Services
1807 //
1808 EFI_GET_TIME GetTime;
1809 EFI_SET_TIME SetTime;
1810 EFI_GET_WAKEUP_TIME GetWakeupTime;
1811 EFI_SET_WAKEUP_TIME SetWakeupTime;
1812
1813 //
1814 // Virtual Memory Services
1815 //
1816 EFI_SET_VIRTUAL_ADDRESS_MAP SetVirtualAddressMap;
1817 EFI_CONVERT_POINTER ConvertPointer;
1818
1819 //
1820 // Variable Services
1821 //
1822 EFI_GET_VARIABLE GetVariable;
1823 EFI_GET_NEXT_VARIABLE_NAME GetNextVariableName;
1824 EFI_SET_VARIABLE SetVariable;
1825
1826 //
1827 // Miscellaneous Services
1828 //
1829 EFI_GET_NEXT_HIGH_MONO_COUNT GetNextHighMonotonicCount;
1830 EFI_RESET_SYSTEM ResetSystem;
1831
1832 //
1833 // UEFI 2.0 Capsule Services
1834 //
1835 EFI_UPDATE_CAPSULE UpdateCapsule;
1836 EFI_QUERY_CAPSULE_CAPABILITIES QueryCapsuleCapabilities;
1837
1838 //
1839 // Miscellaneous UEFI 2.0 Service
1840 //
1841 EFI_QUERY_VARIABLE_INFO QueryVariableInfo;
1842 } EFI_RUNTIME_SERVICES;
1843
1844
1845 #define EFI_BOOT_SERVICES_SIGNATURE SIGNATURE_64 ('B','O','O','T','S','E','R','V')
1846 #define EFI_BOOT_SERVICES_REVISION EFI_SPECIFICATION_VERSION
1847
1848 ///
1849 /// EFI Boot Services Table.
1850 ///
1851 typedef struct {
1852 ///
1853 /// The table header for the EFI Boot Services Table.
1854 ///
1855 EFI_TABLE_HEADER Hdr;
1856
1857 //
1858 // Task Priority Services
1859 //
1860 EFI_RAISE_TPL RaiseTPL;
1861 EFI_RESTORE_TPL RestoreTPL;
1862
1863 //
1864 // Memory Services
1865 //
1866 EFI_ALLOCATE_PAGES AllocatePages;
1867 EFI_FREE_PAGES FreePages;
1868 EFI_GET_MEMORY_MAP GetMemoryMap;
1869 EFI_ALLOCATE_POOL AllocatePool;
1870 EFI_FREE_POOL FreePool;
1871
1872 //
1873 // Event & Timer Services
1874 //
1875 EFI_CREATE_EVENT CreateEvent;
1876 EFI_SET_TIMER SetTimer;
1877 EFI_WAIT_FOR_EVENT WaitForEvent;
1878 EFI_SIGNAL_EVENT SignalEvent;
1879 EFI_CLOSE_EVENT CloseEvent;
1880 EFI_CHECK_EVENT CheckEvent;
1881
1882 //
1883 // Protocol Handler Services
1884 //
1885 EFI_INSTALL_PROTOCOL_INTERFACE InstallProtocolInterface;
1886 EFI_REINSTALL_PROTOCOL_INTERFACE ReinstallProtocolInterface;
1887 EFI_UNINSTALL_PROTOCOL_INTERFACE UninstallProtocolInterface;
1888 EFI_HANDLE_PROTOCOL HandleProtocol;
1889 VOID *Reserved;
1890 EFI_REGISTER_PROTOCOL_NOTIFY RegisterProtocolNotify;
1891 EFI_LOCATE_HANDLE LocateHandle;
1892 EFI_LOCATE_DEVICE_PATH LocateDevicePath;
1893 EFI_INSTALL_CONFIGURATION_TABLE InstallConfigurationTable;
1894
1895 //
1896 // Image Services
1897 //
1898 EFI_IMAGE_LOAD LoadImage;
1899 EFI_IMAGE_START StartImage;
1900 EFI_EXIT Exit;
1901 EFI_IMAGE_UNLOAD UnloadImage;
1902 EFI_EXIT_BOOT_SERVICES ExitBootServices;
1903
1904 //
1905 // Miscellaneous Services
1906 //
1907 EFI_GET_NEXT_MONOTONIC_COUNT GetNextMonotonicCount;
1908 EFI_STALL Stall;
1909 EFI_SET_WATCHDOG_TIMER SetWatchdogTimer;
1910
1911 //
1912 // DriverSupport Services
1913 //
1914 EFI_CONNECT_CONTROLLER ConnectController;
1915 EFI_DISCONNECT_CONTROLLER DisconnectController;
1916
1917 //
1918 // Open and Close Protocol Services
1919 //
1920 EFI_OPEN_PROTOCOL OpenProtocol;
1921 EFI_CLOSE_PROTOCOL CloseProtocol;
1922 EFI_OPEN_PROTOCOL_INFORMATION OpenProtocolInformation;
1923
1924 //
1925 // Library Services
1926 //
1927 EFI_PROTOCOLS_PER_HANDLE ProtocolsPerHandle;
1928 EFI_LOCATE_HANDLE_BUFFER LocateHandleBuffer;
1929 EFI_LOCATE_PROTOCOL LocateProtocol;
1930 EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES InstallMultipleProtocolInterfaces;
1931 EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES UninstallMultipleProtocolInterfaces;
1932
1933 //
1934 // 32-bit CRC Services
1935 //
1936 EFI_CALCULATE_CRC32 CalculateCrc32;
1937
1938 //
1939 // Miscellaneous Services
1940 //
1941 EFI_COPY_MEM CopyMem;
1942 EFI_SET_MEM SetMem;
1943 EFI_CREATE_EVENT_EX CreateEventEx;
1944 } EFI_BOOT_SERVICES;
1945
1946 ///
1947 /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
1948 /// EFI System Table.
1949 ///
1950 typedef struct {
1951 ///
1952 /// The 128-bit GUID value that uniquely identifies the system configuration table.
1953 ///
1954 EFI_GUID VendorGuid;
1955 ///
1956 /// A pointer to the table associated with VendorGuid.
1957 ///
1958 VOID *VendorTable;
1959 } EFI_CONFIGURATION_TABLE;
1960
1961 ///
1962 /// EFI System Table
1963 ///
1964 typedef struct {
1965 ///
1966 /// The table header for the EFI System Table.
1967 ///
1968 EFI_TABLE_HEADER Hdr;
1969 ///
1970 /// A pointer to a null terminated string that identifies the vendor
1971 /// that produces the system firmware for the platform.
1972 ///
1973 CHAR16 *FirmwareVendor;
1974 ///
1975 /// A firmware vendor specific value that identifies the revision
1976 /// of the system firmware for the platform.
1977 ///
1978 UINT32 FirmwareRevision;
1979 ///
1980 /// The handle for the active console input device. This handle must support
1981 /// EFI_SIMPLE_TEXT_INPUT_PROTOCOL and EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.
1982 ///
1983 EFI_HANDLE ConsoleInHandle;
1984 ///
1985 /// A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is
1986 /// associated with ConsoleInHandle.
1987 ///
1988 EFI_SIMPLE_TEXT_INPUT_PROTOCOL *ConIn;
1989 ///
1990 /// The handle for the active console output device.
1991 ///
1992 EFI_HANDLE ConsoleOutHandle;
1993 ///
1994 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
1995 /// that is associated with ConsoleOutHandle.
1996 ///
1997 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *ConOut;
1998 ///
1999 /// The handle for the active standard error console device.
2000 /// This handle must support the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.
2001 ///
2002 EFI_HANDLE StandardErrorHandle;
2003 ///
2004 /// A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface
2005 /// that is associated with StandardErrorHandle.
2006 ///
2007 EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *StdErr;
2008 ///
2009 /// A pointer to the EFI Runtime Services Table.
2010 ///
2011 EFI_RUNTIME_SERVICES *RuntimeServices;
2012 ///
2013 /// A pointer to the EFI Boot Services Table.
2014 ///
2015 EFI_BOOT_SERVICES *BootServices;
2016 ///
2017 /// The number of system configuration tables in the buffer ConfigurationTable.
2018 ///
2019 UINTN NumberOfTableEntries;
2020 ///
2021 /// A pointer to the system configuration tables.
2022 /// The number of entries in the table is NumberOfTableEntries.
2023 ///
2024 EFI_CONFIGURATION_TABLE *ConfigurationTable;
2025 } EFI_SYSTEM_TABLE;
2026
2027 /**
2028 This is the declaration of an EFI image entry point. This entry point is
2029 the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
2030 both device drivers and bus drivers.
2031
2032 @param[in] ImageHandle The firmware allocated handle for the UEFI image.
2033 @param[in] SystemTable A pointer to the EFI System Table.
2034
2035 @retval EFI_SUCCESS The operation completed successfully.
2036 @retval Others An unexpected error occurred.
2037 **/
2038 typedef
2039 EFI_STATUS
2040 (EFIAPI *EFI_IMAGE_ENTRY_POINT)(
2041 IN EFI_HANDLE ImageHandle,
2042 IN EFI_SYSTEM_TABLE *SystemTable
2043 );
2044
2045 //
2046 // EFI Load Option. This data structure describes format of UEFI boot option variables.
2047 //
2048 // NOTE: EFI Load Option is a byte packed buffer of variable length fields.
2049 // The first two fields have fixed length. They are declared as members of the
2050 // EFI_LOAD_OPTION structure. All the other fields are variable length fields.
2051 // They are listed in the comment block below for reference purposes.
2052 //
2053 #pragma pack(1)
2054 typedef struct _EFI_LOAD_OPTION {
2055 ///
2056 /// The attributes for this load option entry. All unused bits must be zero
2057 /// and are reserved by the UEFI specification for future growth.
2058 ///
2059 UINT32 Attributes;
2060 ///
2061 /// Length in bytes of the FilePathList. OptionalData starts at offset
2062 /// sizeof(UINT32) + sizeof(UINT16) + StrSize(Description) + FilePathListLength
2063 /// of the EFI_LOAD_OPTION descriptor.
2064 ///
2065 UINT16 FilePathListLength;
2066 ///
2067 /// The user readable description for the load option.
2068 /// This field ends with a Null character.
2069 ///
2070 // CHAR16 Description[];
2071 ///
2072 /// A packed array of UEFI device paths. The first element of the array is a
2073 /// device path that describes the device and location of the Image for this
2074 /// load option. The FilePathList[0] is specific to the device type. Other
2075 /// device paths may optionally exist in the FilePathList, but their usage is
2076 /// OSV specific. Each element in the array is variable length, and ends at
2077 /// the device path end structure. Because the size of Description is
2078 /// arbitrary, this data structure is not guaranteed to be aligned on a
2079 /// natural boundary. This data structure may have to be copied to an aligned
2080 /// natural boundary before it is used.
2081 ///
2082 // EFI_DEVICE_PATH_PROTOCOL FilePathList[];
2083 ///
2084 /// The remaining bytes in the load option descriptor are a binary data buffer
2085 /// that is passed to the loaded image. If the field is zero bytes long, a
2086 /// NULL pointer is passed to the loaded image. The number of bytes in
2087 /// OptionalData can be computed by subtracting the starting offset of
2088 /// OptionalData from total size in bytes of the EFI_LOAD_OPTION.
2089 ///
2090 // UINT8 OptionalData[];
2091 } EFI_LOAD_OPTION;
2092 #pragma pack()
2093
2094 //
2095 // EFI Load Options Attributes
2096 //
2097 #define LOAD_OPTION_ACTIVE 0x00000001
2098 #define LOAD_OPTION_FORCE_RECONNECT 0x00000002
2099 #define LOAD_OPTION_HIDDEN 0x00000008
2100 #define LOAD_OPTION_CATEGORY 0x00001F00
2101
2102 #define LOAD_OPTION_CATEGORY_BOOT 0x00000000
2103 #define LOAD_OPTION_CATEGORY_APP 0x00000100
2104
2105 #define EFI_BOOT_OPTION_SUPPORT_KEY 0x00000001
2106 #define EFI_BOOT_OPTION_SUPPORT_APP 0x00000002
2107 #define EFI_BOOT_OPTION_SUPPORT_SYSPREP 0x00000010
2108 #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300
2109
2110 ///
2111 /// EFI Boot Key Data
2112 ///
2113 typedef union {
2114 struct {
2115 ///
2116 /// Indicates the revision of the EFI_KEY_OPTION structure. This revision level should be 0.
2117 ///
2118 UINT32 Revision : 8;
2119 ///
2120 /// Either the left or right Shift keys must be pressed (1) or must not be pressed (0).
2121 ///
2122 UINT32 ShiftPressed : 1;
2123 ///
2124 /// Either the left or right Control keys must be pressed (1) or must not be pressed (0).
2125 ///
2126 UINT32 ControlPressed : 1;
2127 ///
2128 /// Either the left or right Alt keys must be pressed (1) or must not be pressed (0).
2129 ///
2130 UINT32 AltPressed : 1;
2131 ///
2132 /// Either the left or right Logo keys must be pressed (1) or must not be pressed (0).
2133 ///
2134 UINT32 LogoPressed : 1;
2135 ///
2136 /// The Menu key must be pressed (1) or must not be pressed (0).
2137 ///
2138 UINT32 MenuPressed : 1;
2139 ///
2140 /// The SysReq key must be pressed (1) or must not be pressed (0).
2141 ///
2142 UINT32 SysReqPressed : 1;
2143 UINT32 Reserved : 16;
2144 ///
2145 /// Specifies the actual number of entries in EFI_KEY_OPTION.Keys, from 0-3. If
2146 /// zero, then only the shift state is considered. If more than one, then the boot option will
2147 /// only be launched if all of the specified keys are pressed with the same shift state.
2148 ///
2149 UINT32 InputKeyCount : 2;
2150 } Options;
2151 UINT32 PackedValue;
2152 } EFI_BOOT_KEY_DATA;
2153
2154 ///
2155 /// EFI Key Option.
2156 ///
2157 #pragma pack(1)
2158 typedef struct {
2159 ///
2160 /// Specifies options about how the key will be processed.
2161 ///
2162 EFI_BOOT_KEY_DATA KeyData;
2163 ///
2164 /// The CRC-32 which should match the CRC-32 of the entire EFI_LOAD_OPTION to
2165 /// which BootOption refers. If the CRC-32s do not match this value, then this key
2166 /// option is ignored.
2167 ///
2168 UINT32 BootOptionCrc;
2169 ///
2170 /// The Boot#### option which will be invoked if this key is pressed and the boot option
2171 /// is active (LOAD_OPTION_ACTIVE is set).
2172 ///
2173 UINT16 BootOption;
2174 ///
2175 /// The key codes to compare against those returned by the
2176 /// EFI_SIMPLE_TEXT_INPUT and EFI_SIMPLE_TEXT_INPUT_EX protocols.
2177 /// The number of key codes (0-3) is specified by the EFI_KEY_CODE_COUNT field in KeyOptions.
2178 ///
2179 //EFI_INPUT_KEY Keys[];
2180 } EFI_KEY_OPTION;
2181 #pragma pack()
2182
2183 //
2184 // EFI File location to boot from on removable media devices
2185 //
2186 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32 L"\\EFI\\BOOT\\BOOTIA32.EFI"
2187 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64 L"\\EFI\\BOOT\\BOOTIA64.EFI"
2188 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64 L"\\EFI\\BOOT\\BOOTX64.EFI"
2189 #define EFI_REMOVABLE_MEDIA_FILE_NAME_ARM L"\\EFI\\BOOT\\BOOTARM.EFI"
2190 #define EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64 L"\\EFI\\BOOT\\BOOTAA64.EFI"
2191
2192 #if defined (MDE_CPU_IA32)
2193 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
2194 #elif defined (MDE_CPU_IPF)
2195 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_IA64
2196 #elif defined (MDE_CPU_X64)
2197 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_X64
2198 #elif defined (MDE_CPU_EBC)
2199 #elif defined (MDE_CPU_ARM)
2200 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_ARM
2201 #elif defined (MDE_CPU_AARCH64)
2202 #define EFI_REMOVABLE_MEDIA_FILE_NAME EFI_REMOVABLE_MEDIA_FILE_NAME_AARCH64
2203 #else
2204 #error Unknown Processor Type
2205 #endif
2206
2207 #include <Uefi/UefiPxe.h>
2208 #include <Uefi/UefiGpt.h>
2209 #include <Uefi/UefiInternalFormRepresentation.h>
2210
2211 #endif