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