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