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