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