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