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