UefiSpec.h

Go to the documentation of this file.
00001 /** @file
00002   Include file that supports UEFI.
00003 
00004   This include file must only contain things defined in the UEFI 2.1 specification.
00005   If a code construct is defined in the UEFI 2.1 specification it must be included
00006   by this include file.
00007 
00008   Copyright (c) 2006 - 2008, Intel Corporation
00009   All rights reserved. This program and the accompanying materials
00010   are licensed and made available under the terms and conditions of the BSD License
00011   which accompanies this distribution.  The full text of the license may be found at
00012   http://opensource.org/licenses/bsd-license.php
00013 
00014   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
00015   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
00016 
00017 **/
00018 
00019 #ifndef __UEFI_SPEC_H__
00020 #define __UEFI_SPEC_H__
00021 
00022 #include <gpxe/efi/Uefi/UefiMultiPhase.h>
00023 
00024 #include <gpxe/efi/Protocol/DevicePath.h>
00025 #include <gpxe/efi/Protocol/SimpleTextIn.h>
00026 #include <gpxe/efi/Protocol/SimpleTextOut.h>
00027 
00028 ///
00029 /// Enumeration of memory allocation.
00030 ///
00031 typedef enum {
00032   AllocateAnyPages,
00033   AllocateMaxAddress,
00034   AllocateAddress,
00035   MaxAllocateType
00036 } EFI_ALLOCATE_TYPE;
00037 
00038 //
00039 // Bit definitions for EFI_TIME.Daylight
00040 //
00041 #define EFI_TIME_ADJUST_DAYLIGHT  0x01
00042 #define EFI_TIME_IN_DAYLIGHT      0x02
00043 
00044 ///
00045 /// Value definition for EFI_TIME.TimeZone
00046 ///
00047 #define EFI_UNSPECIFIED_TIMEZONE  0x07FF
00048 
00049 //
00050 // Memory cacheability attributes
00051 //
00052 #define EFI_MEMORY_UC   0x0000000000000001ULL
00053 #define EFI_MEMORY_WC   0x0000000000000002ULL
00054 #define EFI_MEMORY_WT   0x0000000000000004ULL
00055 #define EFI_MEMORY_WB   0x0000000000000008ULL
00056 #define EFI_MEMORY_UCE  0x0000000000000010ULL
00057 //
00058 // Physical memory protection attributes
00059 //
00060 #define EFI_MEMORY_WP   0x0000000000001000ULL
00061 #define EFI_MEMORY_RP   0x0000000000002000ULL
00062 #define EFI_MEMORY_XP   0x0000000000004000ULL
00063 //
00064 // Runtime memory attribute
00065 //
00066 #define EFI_MEMORY_RUNTIME  0x8000000000000000ULL
00067 
00068 ///
00069 /// Memory descriptor version number
00070 ///
00071 #define EFI_MEMORY_DESCRIPTOR_VERSION 1
00072 
00073 ///
00074 /// Definition of memory descriptor
00075 ///
00076 typedef struct {
00077   UINT32                Type;
00078   EFI_PHYSICAL_ADDRESS  PhysicalStart;
00079   EFI_VIRTUAL_ADDRESS   VirtualStart;
00080   UINT64                NumberOfPages;
00081   UINT64                Attribute;
00082 } EFI_MEMORY_DESCRIPTOR;
00083 
00084 ///
00085 /// Build macros to find next EFI_MEMORY_DESCRIPTOR.
00086 ///
00087 #define NEXT_MEMORY_DESCRIPTOR(_Ptr, _Size)   ((EFI_MEMORY_DESCRIPTOR *) (((UINT8 *) (_Ptr)) + (_Size)))
00088 
00089 ///
00090 /// Declare forward referenced data structures
00091 ///
00092 typedef struct _EFI_SYSTEM_TABLE   EFI_SYSTEM_TABLE;
00093 
00094 /**
00095   Allocates memory pages from the system.
00096 
00097   @param  Type        The type of allocation to perform.
00098   @param  MemoryType  The type of memory to allocate.
00099   @param  Pages       The number of contiguous 4 KB pages to allocate.
00100   @param  Memory      Pointer to a physical address. On input, the way in which the address is
00101                       used depends on the value of Type.
00102 
00103   @retval EFI_SUCCESS           The requested pages were allocated.
00104   @retval EFI_INVALID_PARAMETER 1) Type is not AllocateAnyPages or
00105                                 AllocateMaxAddress or AllocateAddress.
00106                                 2) MemoryType is in the range
00107                                 EfiMaxMemoryType..0x7FFFFFFF.
00108   @retval EFI_OUT_OF_RESOURCES  The pages could not be allocated.
00109   @retval EFI_NOT_FOUND         The requested pages could not be found.
00110 
00111 **/
00112 typedef
00113 EFI_STATUS
00114 (EFIAPI *EFI_ALLOCATE_PAGES)(
00115   IN     EFI_ALLOCATE_TYPE            Type,
00116   IN     EFI_MEMORY_TYPE              MemoryType,
00117   IN     UINTN                        Pages,
00118   IN OUT EFI_PHYSICAL_ADDRESS         *Memory
00119   );
00120 
00121 /**
00122   Frees memory pages.
00123 
00124   @param  Memory      The base physical address of the pages to be freed.
00125   @param  Pages       The number of contiguous 4 KB pages to free.
00126 
00127   @retval EFI_SUCCESS           The requested pages were freed.
00128   @retval EFI_INVALID_PARAMETER Memory is not a page-aligned address or Pages is invalid.
00129   @retval EFI_NOT_FOUND         The requested memory pages were not allocated with
00130                                 AllocatePages().
00131 
00132 **/
00133 typedef
00134 EFI_STATUS
00135 (EFIAPI *EFI_FREE_PAGES)(
00136   IN  EFI_PHYSICAL_ADDRESS         Memory,
00137   IN  UINTN                        Pages
00138   );
00139 
00140 /**
00141   Returns the current memory map.
00142 
00143   @param  MemoryMapSize         A pointer to the size, in bytes, of the MemoryMap buffer.
00144                                 On input, this is the size of the buffer allocated by the caller.
00145                                 On output, it is the size of the buffer returned by the firmware if
00146                                 the buffer was large enough, or the size of the buffer needed to contain
00147                                 the map if the buffer was too small.
00148   @param  MemoryMap             A pointer to the buffer in which firmware places the current memory
00149                                 map.
00150   @param  MapKey                A pointer to the location in which firmware returns the key for the
00151                                 current memory map.
00152   @param  DescriptorSize        A pointer to the location in which firmware returns the size, in bytes, of
00153                                 an individual EFI_MEMORY_DESCRIPTOR.
00154   @param  DescriptorVersion     A pointer to the location in which firmware returns the version number
00155                                 associated with the EFI_MEMORY_DESCRIPTOR.
00156 
00157   @retval EFI_SUCCESS           The memory map was returned in the MemoryMap buffer.
00158   @retval EFI_BUFFER_TOO_SMALL  The MemoryMap buffer was too small. The current buffer size
00159                                 needed to hold the memory map is returned in MemoryMapSize.
00160   @retval EFI_INVALID_PARAMETER 1) MemoryMapSize is NULL.
00161                                 2) The MemoryMap buffer is not too small and MemoryMap is
00162                                    NULL.
00163 
00164 **/
00165 typedef
00166 EFI_STATUS
00167 (EFIAPI *EFI_GET_MEMORY_MAP)(
00168   IN OUT UINTN                       *MemoryMapSize,
00169   IN OUT EFI_MEMORY_DESCRIPTOR       *MemoryMap,
00170   OUT    UINTN                       *MapKey,
00171   OUT    UINTN                       *DescriptorSize,
00172   OUT    UINT32                      *DescriptorVersion
00173   );
00174 
00175 /**
00176   Allocates pool memory.
00177 
00178   @param  PoolType              The type of pool to allocate.
00179   @param  Size                  The number of bytes to allocate from the pool.
00180   @param  Buffer                A pointer to a pointer to the allocated buffer if the call succeeds;
00181                                 undefined otherwise.
00182 
00183   @retval EFI_SUCCESS           The requested number of bytes was allocated.
00184   @retval EFI_OUT_OF_RESOURCES  The pool requested could not be allocated.
00185   @retval EFI_INVALID_PARAMETER PoolType was invalid.
00186 
00187 **/
00188 typedef
00189 EFI_STATUS
00190 (EFIAPI *EFI_ALLOCATE_POOL)(
00191   IN  EFI_MEMORY_TYPE              PoolType,
00192   IN  UINTN                        Size,
00193   OUT VOID                         **Buffer
00194   );
00195 
00196 /**
00197   Returns pool memory to the system.
00198 
00199   @param  Buffer                Pointer to the buffer to free.
00200 
00201   @retval EFI_SUCCESS           The memory was returned to the system.
00202   @retval EFI_INVALID_PARAMETER Buffer was invalid.
00203 
00204 **/
00205 typedef
00206 EFI_STATUS
00207 (EFIAPI *EFI_FREE_POOL)(
00208   IN  VOID                         *Buffer
00209   );
00210 
00211 /**
00212   Changes the runtime addressing mode of EFI firmware from physical to virtual.
00213 
00214   @param  MemoryMapSize         The size in bytes of VirtualMap.
00215   @param  DescriptorSize        The size in bytes of an entry in the VirtualMap.
00216   @param  DescriptorVersion     The version of the structure entries in VirtualMap.
00217   @param  VirtualMap            An array of memory descriptors which contain new virtual
00218                                 address mapping information for all runtime ranges.
00219 
00220   @retval EFI_SUCCESS           The virtual address map has been applied.
00221   @retval EFI_UNSUPPORTED       EFI firmware is not at runtime, or the EFI firmware is already in
00222                                 virtual address mapped mode.
00223   @retval EFI_INVALID_PARAMETER DescriptorSize or DescriptorVersion is invalid.
00224   @retval EFI_NO_MAPPING        A virtual address was not supplied for a range in the memory
00225                                 map that requires a mapping.
00226   @retval EFI_NOT_FOUND         A virtual address was supplied for an address that is not found
00227                                 in the memory map.
00228 
00229 **/
00230 typedef
00231 EFI_STATUS
00232 (EFIAPI *EFI_SET_VIRTUAL_ADDRESS_MAP)(
00233   IN  UINTN                        MemoryMapSize,
00234   IN  UINTN                        DescriptorSize,
00235   IN  UINT32                       DescriptorVersion,
00236   IN  EFI_MEMORY_DESCRIPTOR        *VirtualMap
00237   );
00238 
00239 /**
00240   Connects one or more drivers to a controller.
00241 
00242   @param  ControllerHandle      The handle of the controller to which driver(s) are to be connected.
00243   @param  DriverImageHandle     A pointer to an ordered list handles that support the
00244                                 EFI_DRIVER_BINDING_PROTOCOL.
00245   @param  RemainingDevicePath   A pointer to the device path that specifies a child of the
00246                                 controller specified by ControllerHandle.
00247   @param  Recursive             If TRUE, then ConnectController() is called recursively
00248                                 until the entire tree of controllers below the controller specified
00249                                 by ControllerHandle have been created. If FALSE, then
00250                                 the tree of controllers is only expanded one level.
00251 
00252   @retval EFI_SUCCESS           1) One or more drivers were connected to ControllerHandle.
00253                                 2) No drivers were connected to ControllerHandle, but
00254                                 RemainingDevicePath is not NULL, and it is an End Device
00255                                 Path Node.
00256   @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
00257   @retval EFI_NOT_FOUND         1) There are no EFI_DRIVER_BINDING_PROTOCOL instances
00258                                 present in the system.
00259                                 2) No drivers were connected to ControllerHandle.
00260 
00261 **/
00262 typedef
00263 EFI_STATUS
00264 (EFIAPI *EFI_CONNECT_CONTROLLER)(
00265   IN  EFI_HANDLE                    ControllerHandle,
00266   IN  EFI_HANDLE                    *DriverImageHandle,   OPTIONAL
00267   IN  EFI_DEVICE_PATH_PROTOCOL      *RemainingDevicePath, OPTIONAL
00268   IN  BOOLEAN                       Recursive
00269   );
00270 
00271 /**
00272   Disconnects one or more drivers from a controller.
00273 
00274   @param  ControllerHandle      The handle of the controller from which driver(s) are to be disconnected.
00275   @param  DriverImageHandle     The driver to disconnect from ControllerHandle.
00276                                 If DriverImageHandle is NULL, then all the drivers currently managing
00277                                 ControllerHandle are disconnected from ControllerHandle.
00278   @param  ChildHandle           The handle of the child to destroy.
00279                                 If ChildHandle is NULL, then all the children of ControllerHandle are
00280                                 destroyed before the drivers are disconnected from ControllerHandle.
00281 
00282   @retval EFI_SUCCESS           1) One or more drivers were disconnected from the controller.
00283                                 2) On entry, no drivers are managing ControllerHandle.
00284                                 3) DriverImageHandle is not NULL, and on entry
00285                                    DriverImageHandle is not managing ControllerHandle.
00286   @retval EFI_INVALID_PARAMETER 1) ControllerHandle is not a valid EFI_HANDLE.
00287                                 2) DriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
00288                                 3) ChildHandle is not NULL, and it is not a valid EFI_HANDLE.
00289                                 4) DriverImageHandle does not support the EFI_DRIVER_BINDING_PROTOCOL.
00290   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to disconnect any drivers from
00291                                 ControllerHandle.
00292   @retval EFI_DEVICE_ERROR      The controller could not be disconnected because of a device error.
00293 
00294 **/
00295 typedef
00296 EFI_STATUS
00297 (EFIAPI *EFI_DISCONNECT_CONTROLLER)(
00298   IN  EFI_HANDLE                     ControllerHandle,
00299   IN  EFI_HANDLE                     DriverImageHandle, OPTIONAL
00300   IN  EFI_HANDLE                     ChildHandle        OPTIONAL
00301   );
00302 
00303 
00304 
00305 //
00306 // ConvertPointer DebugDisposition type.
00307 //
00308 #define EFI_OPTIONAL_PTR     0x00000001
00309 #define EFI_OPTIONAL_POINTER EFI_OPTIONAL_PTR
00310 
00311 /**
00312   Determines the new virtual address that is to be used on subsequent memory accesses.
00313 
00314   @param  DebugDisposition      Supplies type information for the pointer being converted.
00315   @param  Address               A pointer to a pointer that is to be fixed to be the value needed
00316                                 for the new virtual address mappings being applied.
00317 
00318   @retval EFI_SUCCESS           The pointer pointed to by Address was modified.
00319   @retval EFI_INVALID_PARAMETER 1) Address is NULL.
00320                                 2) *Address is NULL and DebugDisposition does
00321                                 not have the EFI_OPTIONAL_PTR bit set.
00322   @retval EFI_NOT_FOUND         The pointer pointed to by Address was not found to be part
00323                                 of the current memory map. This is normally fatal.
00324 
00325 **/
00326 typedef
00327 EFI_STATUS
00328 (EFIAPI *EFI_CONVERT_POINTER)(
00329   IN     UINTN                      DebugDisposition,
00330   IN OUT VOID                       **Address
00331   );
00332 
00333 
00334 //
00335 // These types can be ORed together as needed - for example,
00336 // EVT_TIMER might be Ored with EVT_NOTIFY_WAIT or
00337 // EVT_NOTIFY_SIGNAL.
00338 //
00339 #define EVT_TIMER                         0x80000000
00340 #define EVT_RUNTIME                       0x40000000
00341 #define EVT_NOTIFY_WAIT                   0x00000100
00342 #define EVT_NOTIFY_SIGNAL                 0x00000200
00343 
00344 #define EVT_SIGNAL_EXIT_BOOT_SERVICES     0x00000201
00345 #define EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE 0x60000202
00346 
00347 //
00348 // The event's NotifyContext pointer points to a runtime memory
00349 // address.
00350 // The event is deprecated in UEFI2.0 and later specifications.
00351 //
00352 #define EVT_RUNTIME_CONTEXT               0x20000000
00353 
00354 
00355 /**
00356   Invoke a notification event
00357 
00358   @param  Event                 Event whose notification function is being invoked.
00359   @param  Context               Pointer to the notification function's context,
00360                                 which is implementation-dependent.
00361 
00362 **/
00363 typedef
00364 VOID
00365 (EFIAPI *EFI_EVENT_NOTIFY)(
00366   IN  EFI_EVENT                Event,
00367   IN  VOID                     *Context
00368   );
00369 
00370 /**
00371   Creates an event.
00372 
00373   @param  Type                  The type of event to create and its mode and attributes.
00374   @param  NotifyTpl             The task priority level of event notifications, if needed.
00375   @param  NotifyFunction        Pointer to the event's notification function, if any.
00376   @param  NotifyContext         Pointer to the notification function's context; corresponds to parameter
00377                                 Context in the notification function.
00378   @param  Event                 Pointer to the newly created event if the call succeeds; undefined
00379                                 otherwise.
00380 
00381   @retval EFI_SUCCESS           The event structure was created.
00382   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00383   @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
00384 
00385 **/
00386 typedef
00387 EFI_STATUS
00388 (EFIAPI *EFI_CREATE_EVENT)(
00389   IN  UINT32                       Type,
00390   IN  EFI_TPL                      NotifyTpl,
00391   IN  EFI_EVENT_NOTIFY             NotifyFunction,
00392   IN  VOID                         *NotifyContext,
00393   OUT EFI_EVENT                    *Event
00394   );
00395 
00396 /**
00397   Creates an event in a group.
00398 
00399   @param  Type                  The type of event to create and its mode and attributes.
00400   @param  NotifyTpl             The task priority level of event notifications,if needed.
00401   @param  NotifyFunction        Pointer to the event's notification function, if any.
00402   @param  NotifyContext         Pointer to the notification function's context; corresponds to parameter
00403                                 Context in the notification function.
00404   @param  EventGroup            Pointer to the unique identifier of the group to which this event belongs.
00405                                 If this is NULL, then the function behaves as if the parameters were passed
00406                                 to CreateEvent.
00407   @param  Event                 Pointer to the newly created event if the call succeeds; undefined
00408                                 otherwise.
00409 
00410   @retval EFI_SUCCESS           The event structure was created.
00411   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
00412   @retval EFI_OUT_OF_RESOURCES  The event could not be allocated.
00413 
00414 **/
00415 typedef
00416 EFI_STATUS
00417 (EFIAPI *EFI_CREATE_EVENT_EX)(
00418   IN       UINT32                 Type,
00419   IN       EFI_TPL                NotifyTpl,
00420   IN       EFI_EVENT_NOTIFY       NotifyFunction OPTIONAL,
00421   IN CONST VOID                   *NotifyContext OPTIONAL,
00422   IN CONST EFI_GUID               *EventGroup    OPTIONAL,
00423   OUT      EFI_EVENT              *Event
00424   );
00425 
00426 ///
00427 /// Timer delay types
00428 ///
00429 typedef enum {
00430   TimerCancel,
00431   TimerPeriodic,
00432   TimerRelative
00433 } EFI_TIMER_DELAY;
00434 
00435 /**
00436   Sets the type of timer and the trigger time for a timer event.
00437 
00438   @param  Event                 The timer event that is to be signaled at the specified time.
00439   @param  Type                  The type of time that is specified in TriggerTime.
00440   @param  TriggerTime           The number of 100ns units until the timer expires.
00441                                 A TriggerTime of 0 is legal.
00442                                 If Type is TimerRelative and TriggerTime is 0, then the timer
00443                                 event will be signaled on the next timer tick.
00444                                 If Type is TimerPeriodic and TriggerTime is 0, then the timer
00445                                 event will be signaled on every timer tick.
00446 
00447   @retval EFI_SUCCESS           The event has been set to be signaled at the requested time.
00448   @retval EFI_INVALID_PARAMETER Event or Type is not valid.
00449 
00450 **/
00451 typedef
00452 EFI_STATUS
00453 (EFIAPI *EFI_SET_TIMER)(
00454   IN  EFI_EVENT                Event,
00455   IN  EFI_TIMER_DELAY          Type,
00456   IN  UINT64                   TriggerTime
00457   );
00458 
00459 /**
00460   Signals an event.
00461 
00462   @param  Event                 The event to signal.
00463 
00464   @retval EFI_SUCCESS           The event has been signaled.
00465 
00466 **/
00467 typedef
00468 EFI_STATUS
00469 (EFIAPI *EFI_SIGNAL_EVENT)(
00470   IN  EFI_EVENT                Event
00471   );
00472 
00473 /**
00474   Stops execution until an event is signaled.
00475 
00476   @param  NumberOfEvents        The number of events in the Event array.
00477   @param  Event                 An array of EFI_EVENT.
00478   @param  Index                 Pointer to the index of the event which satisfied the wait condition.
00479 
00480   @retval EFI_SUCCESS           The event indicated by Index was signaled.
00481   @retval EFI_INVALID_PARAMETER 1) NumberOfEvents is 0.
00482                                 2) The event indicated by Index is of type
00483                                    EVT_NOTIFY_SIGNAL.
00484   @retval EFI_UNSUPPORTED       The current TPL is not TPL_APPLICATION.
00485 
00486 **/
00487 typedef
00488 EFI_STATUS
00489 (EFIAPI *EFI_WAIT_FOR_EVENT)(
00490   IN  UINTN                    NumberOfEvents,
00491   IN  EFI_EVENT                *Event,
00492   OUT UINTN                    *Index
00493   );
00494 
00495 /**
00496   Closes an event.
00497 
00498   @param  Event                 The event to close.
00499 
00500   @retval EFI_SUCCESS           The event has been closed.
00501 
00502 **/
00503 typedef
00504 EFI_STATUS
00505 (EFIAPI *EFI_CLOSE_EVENT)(
00506   IN EFI_EVENT                Event
00507   );
00508 
00509 /**
00510   Checks whether an event is in the signaled state.
00511 
00512   @param  Event                 The event to check.
00513 
00514   @retval EFI_SUCCESS           The event is in the signaled state.
00515   @retval EFI_NOT_READY         The event is not in the signaled state.
00516   @retval EFI_INVALID_PARAMETER Event is of type EVT_NOTIFY_SIGNAL.
00517 
00518 **/
00519 typedef
00520 EFI_STATUS
00521 (EFIAPI *EFI_CHECK_EVENT)(
00522   IN EFI_EVENT                Event
00523   );
00524 
00525 
00526 //
00527 // Task priority level
00528 //
00529 #define TPL_APPLICATION       4
00530 #define TPL_CALLBACK          8
00531 #define TPL_NOTIFY            16
00532 #define TPL_HIGH_LEVEL        31
00533 
00534 
00535 /**
00536   Raises a task's priority level and returns its previous level.
00537 
00538   @param  NewTpl                The new task priority level.
00539 
00540   @return Previous task priority level
00541 
00542 **/
00543 typedef
00544 EFI_TPL
00545 (EFIAPI *EFI_RAISE_TPL)(
00546   IN EFI_TPL      NewTpl
00547   );
00548 
00549 /**
00550   Restores a task's priority level to its previous value.
00551 
00552   @param  OldTpl                The previous task priority level to restore.
00553 
00554 **/
00555 typedef
00556 VOID
00557 (EFIAPI *EFI_RESTORE_TPL)(
00558   IN EFI_TPL      OldTpl
00559   );
00560 
00561 /**
00562   Returns the value of a variable.
00563 
00564   @param  VariableName          A Null-terminated Unicode string that is the name of the
00565                                 vendor's variable.
00566   @param  VendorGuid            A unique identifier for the vendor.
00567   @param  Attributes            If not NULL, a pointer to the memory location to return the
00568                                 attributes bitmask for the variable.
00569   @param  DataSize              On input, the size in bytes of the return Data buffer.
00570                                 On output the size of data returned in Data.
00571   @param  Data                  The buffer to return the contents of the variable.
00572 
00573   @retval EFI_SUCCESS            The function completed successfully.
00574   @retval EFI_NOT_FOUND          The variable was not found.
00575   @retval EFI_BUFFER_TOO_SMALL   The DataSize is too small for the result.
00576   @retval EFI_INVALID_PARAMETER  VariableName is NULL.
00577   @retval EFI_INVALID_PARAMETER  VendorGuid is NULL.
00578   @retval EFI_INVALID_PARAMETER  DataSize is NULL.
00579   @retval EFI_INVALID_PARAMETER  The DataSize is not too small and Data is NULL.
00580   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
00581   @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
00582 
00583 **/
00584 typedef
00585 EFI_STATUS
00586 (EFIAPI *EFI_GET_VARIABLE)(
00587   IN     CHAR16                      *VariableName,
00588   IN     EFI_GUID                    *VendorGuid,
00589   OUT    UINT32                      *Attributes,    OPTIONAL
00590   IN OUT UINTN                       *DataSize,
00591   OUT    VOID                        *Data
00592   );
00593 
00594 /**
00595   Enumerates the current variable names.
00596 
00597   @param  VariableNameSize      The size of the VariableName buffer.
00598   @param  VariableName          On input, supplies the last VariableName that was returned
00599                                 by GetNextVariableName(). On output, returns the Nullterminated
00600                                 Unicode string of the current variable.
00601   @param  VendorGuid            On input, supplies the last VendorGuid that was returned by
00602                                 GetNextVariableName(). On output, returns the
00603                                 VendorGuid of the current variable.
00604 
00605   @retval EFI_SUCCESS           The function completed successfully.
00606   @retval EFI_NOT_FOUND         The next variable was not found.
00607   @retval EFI_BUFFER_TOO_SMALL  The VariableNameSize is too small for the result.
00608   @retval EFI_INVALID_PARAMETER VariableNameSize is NULL.
00609   @retval EFI_INVALID_PARAMETER VariableName is NULL.
00610   @retval EFI_INVALID_PARAMETER VendorGuid is NULL.
00611   @retval EFI_DEVICE_ERROR      The variable could not be retrieved due to a hardware error.
00612 
00613 **/
00614 typedef
00615 EFI_STATUS
00616 (EFIAPI *EFI_GET_NEXT_VARIABLE_NAME)(
00617   IN OUT UINTN                    *VariableNameSize,
00618   IN OUT CHAR16                   *VariableName,
00619   IN OUT EFI_GUID                 *VendorGuid
00620   );
00621 
00622 /**
00623   Sets the value of a variable.
00624 
00625   @param  VariableName          A Null-terminated Unicode string that is the name of the
00626                                 vendor's variable.
00627   @param  VendorGuid            A unique identifier for the vendor.
00628   @param  Attributes            Attributes bitmask to set for the variable.
00629   @param  DataSize              The size in bytes of the Data buffer.
00630   @param  Data                  The contents for the variable.
00631 
00632   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
00633                                  defined by the Attributes.
00634   @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits was supplied, or the
00635                                  DataSize exceeds the maximum allowed.
00636   @retval EFI_INVALID_PARAMETER  VariableName is an empty Unicode string.
00637   @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
00638   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
00639   @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
00640   @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
00641   @retval EFI_SECURITY_VIOLATION The variable could not be retrieved due to an authentication failure.
00642   @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
00643 
00644 **/
00645 typedef
00646 EFI_STATUS
00647 (EFIAPI *EFI_SET_VARIABLE)(
00648   IN  CHAR16                       *VariableName,
00649   IN  EFI_GUID                     *VendorGuid,
00650   IN  UINT32                       Attributes,
00651   IN  UINTN                        DataSize,
00652   IN  VOID                         *Data
00653   );
00654 
00655 
00656 ///
00657 /// This provides the capabilities of the
00658 /// real time clock device as exposed through the EFI interfaces.
00659 ///
00660 typedef struct {
00661   UINT32    Resolution;
00662   UINT32    Accuracy;
00663   BOOLEAN   SetsToZero;
00664 } EFI_TIME_CAPABILITIES;
00665 
00666 /**
00667   Returns the current time and date information, and the time-keeping capabilities
00668   of the hardware platform.
00669 
00670   @param  Time                  A pointer to storage to receive a snapshot of the current time.
00671   @param  Capabilities          An optional pointer to a buffer to receive the real time clock
00672                                 device's capabilities.
00673 
00674   @retval EFI_SUCCESS           The operation completed successfully.
00675   @retval EFI_INVALID_PARAMETER Time is NULL.
00676   @retval EFI_DEVICE_ERROR      The time could not be retrieved due to hardware error.
00677 
00678 **/
00679 typedef
00680 EFI_STATUS
00681 (EFIAPI *EFI_GET_TIME)(
00682   OUT  EFI_TIME                    *Time,
00683   OUT  EFI_TIME_CAPABILITIES       *Capabilities OPTIONAL
00684   );
00685 
00686 /**
00687   Sets the current local time and date information.
00688 
00689   @param  Time                  A pointer to the current time.
00690 
00691   @retval EFI_SUCCESS           The operation completed successfully.
00692   @retval EFI_INVALID_PARAMETER A time field is out of range.
00693   @retval EFI_DEVICE_ERROR      The time could not be set due due to hardware error.
00694 
00695 **/
00696 typedef
00697 EFI_STATUS
00698 (EFIAPI *EFI_SET_TIME)(
00699   IN  EFI_TIME                     *Time
00700   );
00701 
00702 /**
00703   Returns the current wakeup alarm clock setting.
00704 
00705   @param  Enabled               Indicates if the alarm is currently enabled or disabled.
00706   @param  Pending               Indicates if the alarm signal is pending and requires acknowledgement.
00707   @param  Time                  The current alarm setting.
00708 
00709   @retval EFI_SUCCESS           The alarm settings were returned.
00710   @retval EFI_INVALID_PARAMETER Enabled is NULL.
00711   @retval EFI_INVALID_PARAMETER Pending is NULL.
00712   @retval EFI_INVALID_PARAMETER Time is NULL.
00713   @retval EFI_DEVICE_ERROR      The wakeup time could not be retrieved due to a hardware error.
00714   @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.
00715 
00716 **/
00717 typedef
00718 EFI_STATUS
00719 (EFIAPI *EFI_GET_WAKEUP_TIME)(
00720   OUT BOOLEAN                     *Enabled,
00721   OUT BOOLEAN                     *Pending,
00722   OUT EFI_TIME                    *Time
00723   );
00724 
00725 /**
00726   Sets the system wakeup alarm clock time.
00727 
00728   @param  Enabled               Enable or disable the wakeup alarm.
00729   @param  Time                  If Enable is TRUE, the time to set the wakeup alarm for.
00730                                 If Enable is FALSE, then this parameter is optional, and may be NULL.
00731 
00732   @retval EFI_SUCCESS           If Enable is TRUE, then the wakeup alarm was enabled. If
00733                                 Enable is FALSE, then the wakeup alarm was disabled.
00734   @retval EFI_INVALID_PARAMETER A time field is out of range.
00735   @retval EFI_DEVICE_ERROR      The wakeup time could not be set due to a hardware error.
00736   @retval EFI_UNSUPPORTED       A wakeup timer is not supported on this platform.
00737 
00738 **/
00739 typedef
00740 EFI_STATUS
00741 (EFIAPI *EFI_SET_WAKEUP_TIME)(
00742   IN  BOOLEAN                      Enable,
00743   IN  EFI_TIME                     *Time   OPTIONAL
00744   );
00745 
00746 /**
00747   This is the declaration of an EFI image entry point. This entry point is
00748   the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including
00749   both device drivers and bus drivers.
00750 
00751   @param  ImageHandle           The firmware allocated handle for the UEFI image.
00752   @param  SystemTable           A pointer to the EFI System Table.
00753 
00754   @retval EFI_SUCCESS           The operation completed successfully.
00755   @retval EFI_OUT_OF_RESOURCES  The request could not be completed due to a lack of resources.
00756 
00757 **/
00758 typedef
00759 EFI_STATUS
00760 (EFIAPI *EFI_IMAGE_ENTRY_POINT)(
00761   IN  EFI_HANDLE                   ImageHandle,
00762   IN  EFI_SYSTEM_TABLE             *SystemTable
00763   );
00764 
00765 /**
00766   Loads an EFI image into memory.
00767 
00768   @param  BootPolicy            If TRUE, indicates that the request originates from the boot
00769                                 manager, and that the boot manager is attempting to load
00770                                 FilePath as a boot selection. Ignored if SourceBuffer is
00771                                 not NULL.
00772   @param  ParentImageHandle     The caller's image handle.
00773   @param  DevicePath            The DeviceHandle specific file path from which the image is
00774                                 loaded.
00775   @param  SourceBuffer          If not NULL, a pointer to the memory location containing a copy
00776                                 of the image to be loaded.
00777   @param  SourceSize            The size in bytes of SourceBuffer. Ignored if SourceBuffer is NULL.
00778   @param  ImageHandle           Pointer to the returned image handle that is created when the
00779                                 image is successfully loaded.
00780 
00781   @retval EFI_SUCCESS           Image was loaded into memory correctly.
00782   @retval EFI_NOT_FOUND         Both SourceBuffer and DevicePath are NULL.
00783   @retval EFI_INVALID_PARAMETER One or more parametes are invalid.
00784   @retval EFI_UNSUPPORTED       The image type is not supported.
00785   @retval EFI_OUT_OF_RESOURCES  Image was not loaded due to insufficient resources.
00786   @retval EFI_LOAD_ERROR        Image was not loaded because the image format was corrupt or not
00787                                 understood.
00788   @retval EFI_DEVICE_ERROR      Image was not loaded because the device returned a read error.
00789 
00790 **/
00791 typedef
00792 EFI_STATUS
00793 (EFIAPI *EFI_IMAGE_LOAD)(
00794   IN  BOOLEAN                      BootPolicy,
00795   IN  EFI_HANDLE                   ParentImageHandle,
00796   IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath,
00797   IN  VOID                         *SourceBuffer OPTIONAL,
00798   IN  UINTN                        SourceSize,
00799   OUT EFI_HANDLE                   *ImageHandle
00800   );
00801 
00802 /**
00803   Transfers control to a loaded image's entry point.
00804 
00805   @param  ImageHandle           Handle of image to be started.
00806   @param  ExitDataSize          Pointer to the size, in bytes, of ExitData.
00807   @param  ExitData              Pointer to a pointer to a data buffer that includes a Null-terminated
00808                                 Unicode string, optionally followed by additional binary data.
00809 
00810   @retval EFI_INVALID_PARAMETER ImageHandle is either an invalid image handle or the image
00811                                 has already been initialized with StartImage
00812   @return Exit code from image
00813 
00814 **/
00815 typedef
00816 EFI_STATUS
00817 (EFIAPI *EFI_IMAGE_START)(
00818   IN  EFI_HANDLE                  ImageHandle,
00819   OUT UINTN                       *ExitDataSize,
00820   OUT CHAR16                      **ExitData    OPTIONAL
00821   );
00822 
00823 /**
00824   Terminates a loaded EFI image and returns control to boot services.
00825 
00826   @param  ImageHandle           Handle that identifies the image.
00827   @param  ExitStatus            The image's exit code.
00828   @param  ExitDataSize          The size, in bytes, of ExitData.
00829   @param  ExitData              Pointer to a data buffer that includes a Null-terminated Unicode string,
00830                                 optionally followed by additional binary data.
00831 
00832   @retval EFI_SUCCESS           The image specified by ImageHandle was unloaded.
00833   @retval EFI_INVALID_PARAMETER The image specified by ImageHandle has been loaded and
00834                                 started with LoadImage() and StartImage(), but the
00835                                 image is not the currently executing image.
00836 
00837 **/
00838 typedef
00839 EFI_STATUS
00840 (EFIAPI *EFI_EXIT)(
00841   IN  EFI_HANDLE                   ImageHandle,
00842   IN  EFI_STATUS                   ExitStatus,
00843   IN  UINTN                        ExitDataSize,
00844   IN  CHAR16                       *ExitData     OPTIONAL
00845   );
00846 
00847 /**
00848   Unloads an image.
00849 
00850   @param  ImageHandle           Handle that identifies the image to be unloaded.
00851 
00852   @retval EFI_SUCCESS           The image has been unloaded.
00853   @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle.
00854   @retval EFI_UNSUPPORTED       The image has been started, and does not support unload.
00855   @return Exit code from the image's unload handler
00856 
00857 **/
00858 typedef
00859 EFI_STATUS
00860 (EFIAPI *EFI_IMAGE_UNLOAD)(
00861   IN  EFI_HANDLE                   ImageHandle
00862   );
00863 
00864 /**
00865   Terminates all boot services.
00866 
00867   @param  ImageHandle           Handle that identifies the exiting image.
00868   @param  MapKey                Key to the latest memory map.
00869 
00870   @retval EFI_SUCCESS           Boot services have been terminated.
00871   @retval EFI_INVALID_PARAMETER MapKey is incorrect.
00872 
00873 **/
00874 typedef
00875 EFI_STATUS
00876 (EFIAPI *EFI_EXIT_BOOT_SERVICES)(
00877   IN  EFI_HANDLE                   ImageHandle,
00878   IN  UINTN                        MapKey
00879   );
00880 
00881 /**
00882   Induces a fine-grained stall.
00883 
00884   @param  Microseconds          The number of microseconds to stall execution.
00885 
00886   @retval EFI_SUCCESS           Execution was stalled at least the requested number of
00887                                 Microseconds.
00888 
00889 **/
00890 typedef
00891 EFI_STATUS
00892 (EFIAPI *EFI_STALL)(
00893   IN  UINTN                    Microseconds
00894   );
00895 
00896 /**
00897   Sets the system's watchdog timer.
00898 
00899   @param  Timeout               The number of seconds to set the watchdog timer to.
00900   @param  WatchdogCode          The numeric code to log on a watchdog timer timeout event.
00901   @param  DataSize              The size, in bytes, of WatchdogData.
00902   @param  WatchdogData          A data buffer that includes a Null-terminated Unicode string, optionally
00903                                 followed by additional binary data.
00904 
00905   @retval EFI_SUCCESS           The timeout has been set.
00906   @retval EFI_INVALID_PARAMETER The supplied WatchdogCode is invalid.
00907   @retval EFI_UNSUPPORTED       The system does not have a watchdog timer.
00908   @retval EFI_DEVICE_ERROR      The watch dog timer could not be programmed due to a hardware
00909                                 error.
00910 
00911 **/
00912 typedef
00913 EFI_STATUS
00914 (EFIAPI *EFI_SET_WATCHDOG_TIMER)(
00915   IN UINTN                    Timeout,
00916   IN UINT64                   WatchdogCode,
00917   IN UINTN                    DataSize,
00918   IN CHAR16                   *WatchdogData OPTIONAL
00919   );
00920 
00921 ///
00922 /// Enumeration of reset types.
00923 ///
00924 typedef enum {
00925   EfiResetCold,
00926   EfiResetWarm,
00927   EfiResetShutdown,
00928   EfiResetUpdate
00929 } EFI_RESET_TYPE;
00930 
00931 /**
00932   Resets the entire platform.
00933 
00934   @param  ResetType             The type of reset to perform.
00935   @param  ResetStatus           The status code for the reset.
00936   @param  DataSize              The size, in bytes, of WatchdogData.
00937   @param  ResetData             For a ResetType of EfiResetCold, EfiResetWarm, or
00938                                 EfiResetShutdown the data buffer starts with a Null-terminated
00939                                 Unicode string, optionally followed by additional binary data.
00940 
00941 **/
00942 typedef
00943 VOID
00944 (EFIAPI *EFI_RESET_SYSTEM)(
00945   IN EFI_RESET_TYPE           ResetType,
00946   IN EFI_STATUS               ResetStatus,
00947   IN UINTN                    DataSize,
00948   IN CHAR16                   *ResetData OPTIONAL
00949   );
00950 
00951 /**
00952   Returns a monotonically increasing count for the platform.
00953 
00954   @param  Count                 Pointer to returned value.
00955 
00956   @retval EFI_SUCCESS           The next monotonic count was returned.
00957   @retval EFI_INVALID_PARAMETER Count is NULL.
00958   @retval EFI_DEVICE_ERROR      The device is not functioning properly.
00959 
00960 **/
00961 typedef
00962 EFI_STATUS
00963 (EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT)(
00964   OUT UINT64                  *Count
00965   );
00966 
00967 /**
00968   Returns the next high 32 bits of the platform's monotonic counter.
00969 
00970   @param  HighCount             Pointer to returned value.
00971 
00972   @retval EFI_SUCCESS           The next high monotonic count was returned.
00973   @retval EFI_INVALID_PARAMETER HighCount is NULL.
00974   @retval EFI_DEVICE_ERROR      The device is not functioning properly.
00975 
00976 **/
00977 typedef
00978 EFI_STATUS
00979 (EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT)(
00980   OUT UINT32                  *HighCount
00981   );
00982 
00983 /**
00984   Computes and returns a 32-bit CRC for a data buffer.
00985 
00986   @param  Data                  A pointer to the buffer on which the 32-bit CRC is to be computed.
00987   @param  DataSize              The number of bytes in the buffer Data.
00988   @param  Crc32                 The 32-bit CRC that was computed for the data buffer specified by Data
00989                                 and DataSize.
00990 
00991   @retval EFI_SUCCESS           The 32-bit CRC was computed for the data buffer and returned in
00992                                 Crc32.
00993   @retval EFI_INVALID_PARAMETER Data is NULL.
00994   @retval EFI_INVALID_PARAMETER Crc32 is NULL.
00995   @retval EFI_INVALID_PARAMETER DataSize is 0.
00996 
00997 **/
00998 typedef
00999 EFI_STATUS
01000 (EFIAPI *EFI_CALCULATE_CRC32)(
01001   IN  VOID                              *Data,
01002   IN  UINTN                             DataSize,
01003   OUT UINT32                            *Crc32
01004   );
01005 
01006 /**
01007   Copies the contents of one buffer to another buffer.
01008 
01009   @param  Destination           Pointer to the destination buffer of the memory copy.
01010   @param  Source                Pointer to the source buffer of the memory copy.
01011   @param  Length                Number of bytes to copy from Source to Destination.
01012 
01013 **/
01014 typedef
01015 VOID
01016 (EFIAPI *EFI_COPY_MEM)(
01017   IN VOID     *Destination,
01018   IN VOID     *Source,
01019   IN UINTN    Length
01020   );
01021 
01022 /**
01023   The SetMem() function fills a buffer with a specified value.
01024 
01025   @param  Buffer                Pointer to the buffer to fill.
01026   @param  Size                  Number of bytes in Buffer to fill.
01027   @param  Value                 Value to fill Buffer with.
01028 
01029 **/
01030 typedef
01031 VOID
01032 (EFIAPI *EFI_SET_MEM)(
01033   IN VOID     *Buffer,
01034   IN UINTN    Size,
01035   IN UINT8    Value
01036   );
01037 
01038 
01039 //
01040 // Protocol handler functions
01041 //
01042 typedef enum {
01043   EFI_NATIVE_INTERFACE
01044 } EFI_INTERFACE_TYPE;
01045 
01046 /**
01047   Installs a protocol interface on a device handle. If the handle does not exist, it is created and added
01048   to the list of handles in the system. InstallMultipleProtocolInterfaces() performs
01049   more error checking than InstallProtocolInterface(), so it is recommended that
01050   InstallMultipleProtocolInterfaces() be used in place of
01051   InstallProtocolInterface()
01052 
01053   @param  Handle                A pointer to the EFI_HANDLE on which the interface is to be installed.
01054   @param  Protocol              The numeric ID of the protocol interface.
01055   @param  InterfaceType         Indicates whether Interface is supplied in native form.
01056   @param  Interface             A pointer to the protocol interface.
01057 
01058   @retval EFI_SUCCESS           The protocol interface was installed.
01059   @retval EFI_OUT_OF_RESOURCES  Space for a new handle could not be allocated.
01060   @retval EFI_INVALID_PARAMETER Handle is NULL.
01061   @retval EFI_INVALID_PARAMETER Protocol is NULL.
01062   @retval EFI_INVALID_PARAMETER InterfaceType is not EFI_NATIVE_INTERFACE.
01063   @retval EFI_INVALID_PARAMETER Protocol is already installed on the handle specified by Handle.
01064 
01065 **/
01066 typedef
01067 EFI_STATUS
01068 (EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE)(
01069   IN OUT EFI_HANDLE               *Handle,
01070   IN     EFI_GUID                 *Protocol,
01071   IN     EFI_INTERFACE_TYPE       InterfaceType,
01072   IN     VOID                     *Interface
01073   );
01074 
01075 /**
01076   Installs one or more protocol interfaces into the boot services environment.
01077 
01078   @param  Handle                The handle to install the new protocol interfaces on, or NULL if a new
01079                                 handle is to be allocated.
01080   @param  ...                   A variable argument list containing pairs of protocol GUIDs and protocol
01081                                 interfaces.
01082 
01083   @retval EFI_SUCCESS           All the protocol interface was installed.
01084   @retval EFI_OUT_OF_RESOURCES  There was not enough memory in pool to install all the protocols.
01085   @retval EFI_ALREADY_STARTED   A Device Path Protocol instance was passed in that is already present in
01086                                 the handle database.
01087 
01088 **/
01089 typedef
01090 EFI_STATUS
01091 (EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
01092   IN OUT EFI_HANDLE           *Handle,
01093   ...
01094   );
01095 
01096 /**
01097   Reinstalls a protocol interface on a device handle.
01098 
01099   @param  Handle                Handle on which the interface is to be reinstalled.
01100   @param  Protocol              The numeric ID of the interface.
01101   @param  OldInterface          A pointer to the old interface. NULL can be used if a structure is not
01102                                 associated with Protocol.
01103   @param  NewInterface          A pointer to the new interface.
01104 
01105   @retval EFI_SUCCESS           The protocol interface was reinstalled.
01106   @retval EFI_NOT_FOUND         The OldInterface on the handle was not found.
01107   @retval EFI_ACCESS_DENIED     The protocol interface could not be reinstalled,
01108                                 because OldInterface is still being used by a
01109                                 driver that will not release it.
01110   @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
01111   @retval EFI_INVALID_PARAMETER Protocol is NULL.
01112 
01113 **/
01114 typedef
01115 EFI_STATUS
01116 (EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE)(
01117   IN EFI_HANDLE               Handle,
01118   IN EFI_GUID                 *Protocol,
01119   IN VOID                     *OldInterface,
01120   IN VOID                     *NewInterface
01121   );
01122 
01123 /**
01124   Removes a protocol interface from a device handle. It is recommended that
01125   UninstallMultipleProtocolInterfaces() be used in place of
01126   UninstallProtocolInterface().
01127 
01128   @param  Handle                The handle on which the interface was installed.
01129   @param  Protocol              The numeric ID of the interface.
01130   @param  Interface             A pointer to the interface.
01131 
01132   @retval EFI_SUCCESS           The interface was removed.
01133   @retval EFI_NOT_FOUND         The interface was not found.
01134   @retval EFI_ACCESS_DENIED     The interface was not removed because the interface
01135                                 is still being used by a driver.
01136   @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
01137   @retval EFI_INVALID_PARAMETER Protocol is NULL.
01138 
01139 **/
01140 typedef
01141 EFI_STATUS
01142 (EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE)(
01143   IN EFI_HANDLE               Handle,
01144   IN EFI_GUID                 *Protocol,
01145   IN VOID                     *Interface
01146   );
01147 
01148 /**
01149   Removes one or more protocol interfaces into the boot services environment.
01150 
01151   @param  Handle                The handle to remove the protocol interfaces from.
01152   @param  ...                   A variable argument list containing pairs of protocol GUIDs and
01153                                 protocol interfaces.
01154 
01155   @retval EFI_SUCCESS           All the protocol interfaces were removed.
01156   @retval EFI_INVALID_PARAMETER One of the protocol interfaces was not previously installed on Handle.
01157 
01158 **/
01159 typedef
01160 EFI_STATUS
01161 (EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(
01162   IN EFI_HANDLE           Handle,
01163   ...
01164   );
01165 
01166 /**
01167   Queries a handle to determine if it supports a specified protocol.
01168 
01169   @param  Handle                The handle being queried.
01170   @param  Protocol              The published unique identifier of the protocol.
01171   @param  Interface             Supplies the address where a pointer to the corresponding Protocol
01172                                 Interface is returned.
01173 
01174   @retval EFI_SUCCESS           The interface information for the specified protocol was returned.
01175   @retval EFI_UNSUPPORTED       The device does not support the specified protocol.
01176   @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
01177   @retval EFI_INVALID_PARAMETER Protocol is NULL.
01178   @retval EFI_INVALID_PARAMETER Interface is NULL.
01179 
01180 **/
01181 typedef
01182 EFI_STATUS
01183 (EFIAPI *EFI_HANDLE_PROTOCOL)(
01184   IN  EFI_HANDLE               Handle,
01185   IN  EFI_GUID                 *Protocol,
01186   OUT VOID                     **Interface
01187   );
01188 
01189 #define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
01190 #define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
01191 #define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
01192 #define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
01193 #define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
01194 #define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020
01195 
01196 /**
01197   Queries a handle to determine if it supports a specified protocol. If the protocol is supported by the
01198   handle, it opens the protocol on behalf of the calling agent.
01199 
01200   @param  Handle                The handle for the protocol interface that is being opened.
01201   @param  Protocol              The published unique identifier of the protocol.
01202   @param  Interface             Supplies the address where a pointer to the corresponding Protocol
01203                                 Interface is returned.
01204   @param  AgentHandle           The handle of the agent that is opening the protocol interface
01205                                 specified by Protocol and Interface.
01206   @param  ControllerHandle      If the agent that is opening a protocol is a driver that follows the
01207                                 UEFI Driver Model, then this parameter is the controller handle
01208                                 that requires the protocol interface. If the agent does not follow
01209                                 the UEFI Driver Model, then this parameter is optional and may
01210                                 be NULL.
01211   @param  Attributes            The open mode of the protocol interface specified by Handle
01212                                 and Protocol.
01213 
01214   @retval EFI_SUCCESS           An item was added to the open list for the protocol interface, and the
01215                                 protocol interface was returned in Interface.
01216   @retval EFI_UNSUPPORTED       Handle does not support Protocol.
01217   @retval EFI_INVALID_PARAMETER One or more parameters are invalid.
01218   @retval EFI_ACCESS_DENIED     Required attributes can't be supported in current environment.
01219   @retval EFI_ALREADY_STARTED   Item on the open list already has requierd attributes whose agent
01220                                 handle is the same as AgentHandle.
01221 
01222 **/
01223 typedef
01224 EFI_STATUS
01225 (EFIAPI *EFI_OPEN_PROTOCOL)(
01226   IN  EFI_HANDLE                Handle,
01227   IN  EFI_GUID                  *Protocol,
01228   OUT VOID                      **Interface, OPTIONAL
01229   IN  EFI_HANDLE                AgentHandle,
01230   IN  EFI_HANDLE                ControllerHandle,
01231   IN  UINT32                    Attributes
01232   );
01233 
01234 
01235 /**
01236   Closes a protocol on a handle that was opened using OpenProtocol().
01237 
01238   @param  Handle                The handle for the protocol interface that was previously opened
01239                                 with OpenProtocol(), and is now being closed.
01240   @param  Protocol              The published unique identifier of the protocol.
01241   @param  AgentHandle           The handle of the agent that is closing the protocol interface.
01242   @param  ControllerHandle      If the agent that opened a protocol is a driver that follows the
01243                                 UEFI Driver Model, then this parameter is the controller handle
01244                                 that required the protocol interface.
01245 
01246   @retval EFI_SUCCESS           The protocol instance was closed.
01247   @retval EFI_INVALID_PARAMETER 1) Handle is not a valid EFI_HANDLE.
01248                                 2) AgentHandle is not a valid EFI_HANDLE.
01249                                 3) ControllerHandle is not NULL and ControllerHandle is not a valid EFI_HANDLE.
01250                                 4) Protocol is NULL.
01251   @retval EFI_NOT_FOUND         1) Handle does not support the protocol specified by Protocol.
01252                                 2) The protocol interface specified by Handle and Protocol is not
01253                                    currently open by AgentHandle and ControllerHandle.
01254 
01255 **/
01256 typedef
01257 EFI_STATUS
01258 (EFIAPI *EFI_CLOSE_PROTOCOL)(
01259   IN EFI_HANDLE               Handle,
01260   IN EFI_GUID                 *Protocol,
01261   IN EFI_HANDLE               AgentHandle,
01262   IN EFI_HANDLE               ControllerHandle
01263   );
01264 
01265 
01266 typedef struct {
01267   EFI_HANDLE  AgentHandle;
01268   EFI_HANDLE  ControllerHandle;
01269   UINT32      Attributes;
01270   UINT32      OpenCount;
01271 } EFI_OPEN_PROTOCOL_INFORMATION_ENTRY;
01272 
01273 /**
01274   Retrieves the list of agents that currently have a protocol interface opened.
01275 
01276   @param  Handle                The handle for the protocol interface that is being queried.
01277   @param  Protocol              The published unique identifier of the protocol.
01278   @param  EntryBuffer           A pointer to a buffer of open protocol information in the form of
01279                                 EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures.
01280   @param  EntryCount            A pointer to the number of entries in EntryBuffer.
01281 
01282   @retval EFI_SUCCESS           The open protocol information was returned in EntryBuffer, and the
01283                                 number of entries was returned EntryCount.
01284   @retval EFI_OUT_OF_RESOURCES  There are not enough resources available to allocate EntryBuffer.
01285   @retval EFI_NOT_FOUND         Handle does not support the protocol specified by Protocol.
01286 
01287 **/
01288 typedef
01289 EFI_STATUS
01290 (EFIAPI *EFI_OPEN_PROTOCOL_INFORMATION)(
01291   IN  EFI_HANDLE                          Handle,
01292   IN  EFI_GUID                            *Protocol,
01293   OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
01294   OUT UINTN                               *EntryCount
01295   );
01296 
01297 /**
01298   Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated
01299   from pool.
01300 
01301   @param  Handle                The handle from which to retrieve the list of protocol interface
01302                                 GUIDs.
01303   @param  ProtocolBuffer        A pointer to the list of protocol interface GUID pointers that are
01304                                 installed on Handle.
01305   @param  ProtocolBufferCount   A pointer to the number of GUID pointers present in
01306                                 ProtocolBuffer.
01307 
01308   @retval EFI_SUCCESS           The list of protocol interface GUIDs installed on Handle was returned in
01309                                 ProtocolBuffer. The number of protocol interface GUIDs was
01310                                 returned in ProtocolBufferCount.
01311   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the results.
01312   @retval EFI_INVALID_PARAMETER Handle is NULL.
01313   @retval EFI_INVALID_PARAMETER Handle is not a valid EFI_HANDLE.
01314   @retval EFI_INVALID_PARAMETER ProtocolBuffer is NULL.
01315   @retval EFI_INVALID_PARAMETER ProtocolBufferCount is NULL.
01316 
01317 **/
01318 typedef
01319 EFI_STATUS
01320 (EFIAPI *EFI_PROTOCOLS_PER_HANDLE)(
01321   IN  EFI_HANDLE      Handle,
01322   OUT EFI_GUID        ***ProtocolBuffer,
01323   OUT UINTN           *ProtocolBufferCount
01324   );
01325 
01326 /**
01327   Creates an event that is to be signaled whenever an interface is installed for a specified protocol.
01328 
01329   @param  Protocol              The numeric ID of the protocol for which the event is to be registered.
01330   @param  Event                 Event that is to be signaled whenever a protocol interface is registered
01331                                 for Protocol.
01332   @param  Registration          A pointer to a memory location to receive the registration value.
01333 
01334   @retval EFI_SUCCESS           The notification event has been registered.
01335   @retval EFI_OUT_OF_RESOURCES  Space for the notification event could not be allocated.
01336   @retval EFI_INVALID_PARAMETER Protocol is NULL.
01337   @retval EFI_INVALID_PARAMETER Event is NULL.
01338   @retval EFI_INVALID_PARAMETER Registration is NULL.
01339 
01340 **/
01341 typedef
01342 EFI_STATUS
01343 (EFIAPI *EFI_REGISTER_PROTOCOL_NOTIFY)(
01344   IN  EFI_GUID                 *Protocol,
01345   IN  EFI_EVENT                Event,
01346   OUT VOID                     **Registration
01347   );
01348 
01349 
01350 typedef enum {
01351   AllHandles,
01352   ByRegisterNotify,
01353   ByProtocol
01354 } EFI_LOCATE_SEARCH_TYPE;
01355 
01356 /**
01357   Returns an array of handles that support a specified protocol.
01358 
01359   @param  SearchType            Specifies which handle(s) are to be returned.
01360   @param  Protocol              Specifies the protocol to search by.
01361   @param  SearchKey             Specifies the search key.
01362   @param  BufferSize            On input, the size in bytes of Buffer. On output, the size in bytes of
01363                                 the array returned in Buffer (if the buffer was large enough) or the
01364                                 size, in bytes, of the buffer needed to obtain the array (if the buffer was
01365                                 not large enough).
01366   @param  Buffer                The buffer in which the array is returned.
01367 
01368   @retval EFI_SUCCESS           The array of handles was returned.
01369   @retval EFI_NOT_FOUND         No handles match the search.
01370   @retval EFI_BUFFER_TOO_SMALL  The BufferSize is too small for the result.
01371   @retval EFI_INVALID_PARAMETER SearchType is not a member of EFI_LOCATE_SEARCH_TYPE.
01372   @retval EFI_INVALID_PARAMETER SearchType is ByRegisterNotify and SearchKey is NULL.
01373   @retval EFI_INVALID_PARAMETER SearchType is ByProtocol and Protocol is NULL.
01374   @retval EFI_INVALID_PARAMETER One or more matches are found and BufferSize is NULL.
01375   @retval EFI_INVALID_PARAMETER BufferSize is large enough for the result and Buffer is NULL.
01376 
01377 **/
01378 typedef
01379 EFI_STATUS
01380 (EFIAPI *EFI_LOCATE_HANDLE)(
01381   IN     EFI_LOCATE_SEARCH_TYPE   SearchType,
01382   IN     EFI_GUID                 *Protocol,    OPTIONAL
01383   IN     VOID                     *SearchKey,   OPTIONAL
01384   IN OUT UINTN                    *BufferSize,
01385   OUT    EFI_HANDLE               *Buffer
01386   );
01387 
01388 /**
01389   Locates the handle to a device on the device path that supports the specified protocol.
01390 
01391   @param  Protocol              Specifies the protocol to search for.
01392   @param  DevicePath            On input, a pointer to a pointer to the device path. On output, the device
01393                                 path pointer is modified to point to the remaining part of the device
01394                                 path.
01395   @param  Device                A pointer to the returned device handle.
01396 
01397   @retval EFI_SUCCESS           The resulting handle was returned.
01398   @retval EFI_NOT_FOUND         No handles match the search.
01399   @retval EFI_INVALID_PARAMETER Protocol is NULL.
01400   @retval EFI_INVALID_PARAMETER DevicePath is NULL.
01401   @retval EFI_INVALID_PARAMETER A handle matched the search and Device is NULL.
01402 
01403 **/
01404 typedef
01405 EFI_STATUS
01406 (EFIAPI *EFI_LOCATE_DEVICE_PATH)(
01407   IN     EFI_GUID                         *Protocol,
01408   IN OUT EFI_DEVICE_PATH_PROTOCOL         **DevicePath,
01409   OUT    EFI_HANDLE                       *Device
01410   );
01411 
01412 /**
01413   Adds, updates, or removes a configuration table entry from the EFI System Table.
01414 
01415   @param  Guid                  A pointer to the GUID for the entry to add, update, or remove.
01416   @param  Table                 A pointer to the configuration table for the entry to add, update, or
01417                                 remove. May be NULL.
01418 
01419   @retval EFI_SUCCESS           The (Guid, Table) pair was added, updated, or removed.
01420   @retval EFI_NOT_FOUND         An attempt was made to delete a nonexistent entry.
01421   @retval EFI_INVALID_PARAMETER Guid is not valid.
01422   @retval EFI_OUT_OF_RESOURCES  There is not enough memory available to complete the operation.
01423 
01424 **/
01425 typedef
01426 EFI_STATUS
01427 (EFIAPI *EFI_INSTALL_CONFIGURATION_TABLE)(
01428   IN EFI_GUID                 *Guid,
01429   IN VOID                     *Table
01430   );
01431 
01432 
01433 /**
01434   Returns an array of handles that support the requested protocol in a buffer allocated from pool.
01435 
01436   @param  SearchType            Specifies which handle(s) are to be returned.
01437   @param  Protocol              Provides the protocol to search by.
01438                                 This parameter is only valid for a SearchType of ByProtocol.
01439   @param  SearchKey             Supplies the search key depending on the SearchType.
01440   @param  NoHandles             The number of handles returned in Buffer.
01441   @param  Buffer                A pointer to the buffer to return the requested array of handles that
01442                                 support Protocol.
01443 
01444   @retval EFI_SUCCESS           The array of handles was returned in Buffer, and the number of
01445                                 handles in Buffer was returned in NoHandles.
01446   @retval EFI_NOT_FOUND         No handles match the search.
01447   @retval EFI_OUT_OF_RESOURCES  There is not enough pool memory to store the matching results.
01448   @retval EFI_INVALID_PARAMETER NoHandles is NULL.
01449   @retval EFI_INVALID_PARAMETER Buffer is NULL.
01450 
01451 **/
01452 typedef
01453 EFI_STATUS
01454 (EFIAPI *EFI_LOCATE_HANDLE_BUFFER)(
01455   IN     EFI_LOCATE_SEARCH_TYPE       SearchType,
01456   IN     EFI_GUID                     *Protocol,      OPTIONAL
01457   IN     VOID                         *SearchKey,     OPTIONAL
01458   IN OUT UINTN                        *NoHandles,
01459   OUT    EFI_HANDLE                   **Buffer
01460   );
01461 
01462 /**
01463   Returns the first protocol instance that matches the given protocol.
01464 
01465   @param  Protocol              Provides the protocol to search for.
01466   @param  Registration          Optional registration key returned from
01467                                 RegisterProtocolNotify().
01468   @param  Interface             On return, a pointer to the first interface that matches Protocol and
01469                                 Registration.
01470 
01471   @retval EFI_SUCCESS           A protocol instance matching Protocol was found and returned in
01472                                 Interface.
01473   @retval EFI_NOT_FOUND         No protocol instances were found that match Protocol and
01474                                 Registration.
01475   @retval EFI_INVALID_PARAMETER Interface is NULL.
01476 
01477 **/
01478 typedef
01479 EFI_STATUS
01480 (EFIAPI *EFI_LOCATE_PROTOCOL)(
01481   IN  EFI_GUID  *Protocol,
01482   IN  VOID      *Registration, OPTIONAL
01483   OUT VOID      **Interface
01484   );
01485 
01486 typedef struct {
01487   UINT64                            Length;
01488   union {
01489     EFI_PHYSICAL_ADDRESS  DataBlock;
01490     EFI_PHYSICAL_ADDRESS  ContinuationPointer;
01491   } Union;
01492 } EFI_CAPSULE_BLOCK_DESCRIPTOR;
01493 
01494 typedef struct {
01495   EFI_GUID          CapsuleGuid;
01496   UINT32            HeaderSize;
01497   UINT32            Flags;
01498   UINT32            CapsuleImageSize;
01499 } EFI_CAPSULE_HEADER;
01500 
01501 //
01502 // The EFI System Table entry must point to an array of capsules
01503 // that contain the same CapsuleGuid value. The array must be
01504 // prefixed by a UINT32 that represents the size of the array of capsules.
01505 //
01506 typedef struct {
01507   UINT32   CapsuleArrayNumber;
01508   VOID*    CapsulePtr[1];
01509 } EFI_CAPSULE_TABLE;
01510 
01511 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET          0x00010000
01512 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE         0x00020000
01513 
01514 /**
01515   Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended
01516   consumption, the firmware may process the capsule immediately. If the payload should persist
01517   across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must
01518   be passed into ResetSystem() and will cause the capsule to be processed by the firmware as
01519   part of the reset process.
01520 
01521   @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules
01522                                 being passed into update capsule.
01523   @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in
01524                                 CaspuleHeaderArray.
01525   @param  ScatterGatherList     Physical pointer to a set of
01526                                 EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the
01527                                 location in physical memory of a set of capsules.
01528 
01529   @retval EFI_SUCCESS           Valid capsule was passed. If
01530                                 CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the
01531                                 capsule has been successfully processed by the firmware.
01532   @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.
01533   @retval EFI_INVALID_PARAMETER CapsuleSize is NULL.
01534   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform.
01535   @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the capsule.
01536 
01537 **/
01538 typedef
01539 EFI_STATUS
01540 (EFIAPI *EFI_UPDATE_CAPSULE)(
01541   IN EFI_CAPSULE_HEADER     **CapsuleHeaderArray,
01542   IN UINTN                  CapsuleCount,
01543   IN EFI_PHYSICAL_ADDRESS   ScatterGatherList   OPTIONAL
01544   );
01545 
01546 /**
01547   Returns if the capsule can be supported via UpdateCapsule().
01548 
01549   @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules
01550                                 being passed into update capsule.
01551   @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in
01552                                 CaspuleHeaderArray.
01553   @param  MaxiumCapsuleSize     On output the maximum size that UpdateCapsule() can
01554                                 support as an argument to UpdateCapsule() via
01555                                 CapsuleHeaderArray and ScatterGatherList.
01556   @param  ResetType             Returns the type of reset required for the capsule update.
01557 
01558   @retval EFI_SUCCESS           Valid answer returned.
01559   @retval EFI_UNSUPPORTED       The capsule type is not supported on this platform, and
01560                                 MaximumCapsuleSize and ResetType are undefined.
01561   @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL.
01562   @retval EFI_OUT_OF_RESOURCES  There were insufficient resources to process the query request.
01563 
01564 **/
01565 typedef
01566 EFI_STATUS
01567 (EFIAPI *EFI_QUERY_CAPSULE_CAPABILITIES)(
01568   IN  EFI_CAPSULE_HEADER     **CapsuleHeaderArray,
01569   IN  UINTN                  CapsuleCount,
01570   OUT UINT64                 *MaximumCapsuleSize,
01571   OUT EFI_RESET_TYPE         *ResetType
01572   );
01573 
01574 /**
01575   Returns information about the EFI variables.
01576 
01577   @param  Attributes                   Attributes bitmask to specify the type of variables on
01578                                        which to return information.
01579   @param  MaximumVariableStorageSize   On output the maximum size of the storage space
01580                                        available for the EFI variables associated with the
01581                                        attributes specified.
01582   @param  RemainingVariableStorageSize Returns the remaining size of the storage space
01583                                        available for the EFI variables associated with the
01584                                        attributes specified.
01585   @param  MaximumVariableSize          Returns the maximum size of the individual EFI
01586                                        variables associated with the attributes specified.
01587 
01588   @retval EFI_SUCCESS                  Valid answer returned.
01589   @retval EFI_INVALID_PARAMETER        An invalid combination of attribute bits was supplied
01590   @retval EFI_UNSUPPORTED              The attribute is not supported on this platform, and the
01591                                        MaximumVariableStorageSize,
01592                                        RemainingVariableStorageSize, MaximumVariableSize
01593                                        are undefined.
01594 
01595 **/
01596 typedef
01597 EFI_STATUS
01598 (EFIAPI *EFI_QUERY_VARIABLE_INFO)(
01599   IN  UINT32            Attributes,
01600   OUT UINT64            *MaximumVariableStorageSize,
01601   OUT UINT64            *RemainingVariableStorageSize,
01602   OUT UINT64            *MaximumVariableSize
01603   );
01604 
01605 
01606 //
01607 // EFI Runtime Services Table
01608 //
01609 #define EFI_SYSTEM_TABLE_SIGNATURE      0x5453595320494249ULL
01610 #define EFI_SYSTEM_TABLE_REVISION       ((2<<16) | (10))
01611 #define EFI_2_10_SYSTEM_TABLE_REVISION  ((2<<16) | (10))
01612 #define EFI_2_00_SYSTEM_TABLE_REVISION  ((2<<16) | (00))
01613 #define EFI_1_10_SYSTEM_TABLE_REVISION  ((1<<16) | (10))
01614 #define EFI_1_02_SYSTEM_TABLE_REVISION  ((1<<16) | (02))
01615 
01616 #define EFI_RUNTIME_SERVICES_SIGNATURE  0x56524553544e5552ULL
01617 #define EFI_RUNTIME_SERVICES_REVISION   EFI_2_10_SYSTEM_TABLE_REVISION
01618 
01619 ///
01620 /// EFI Runtime Services Table
01621 ///
01622 typedef struct {
01623   ///
01624   /// The table header for the EFI Runtime Services Table.
01625   ///
01626   EFI_TABLE_HEADER                Hdr;
01627 
01628   //
01629   // Time Services
01630   //
01631   EFI_GET_TIME                    GetTime;
01632   EFI_SET_TIME                    SetTime;
01633   EFI_GET_WAKEUP_TIME             GetWakeupTime;
01634   EFI_SET_WAKEUP_TIME             SetWakeupTime;
01635 
01636   //
01637   // Virtual Memory Services
01638   //
01639   EFI_SET_VIRTUAL_ADDRESS_MAP     SetVirtualAddressMap;
01640   EFI_CONVERT_POINTER             ConvertPointer;
01641 
01642   //
01643   // Variable Services
01644   //
01645   EFI_GET_VARIABLE                GetVariable;
01646   EFI_GET_NEXT_VARIABLE_NAME      GetNextVariableName;
01647   EFI_SET_VARIABLE                SetVariable;
01648 
01649   //
01650   // Miscellaneous Services
01651   //
01652   EFI_GET_NEXT_HIGH_MONO_COUNT    GetNextHighMonotonicCount;
01653   EFI_RESET_SYSTEM                ResetSystem;
01654 
01655   //
01656   // UEFI 2.0 Capsule Services
01657   //
01658   EFI_UPDATE_CAPSULE              UpdateCapsule;
01659   EFI_QUERY_CAPSULE_CAPABILITIES  QueryCapsuleCapabilities;
01660 
01661   //
01662   // Miscellaneous UEFI 2.0 Service
01663   //
01664   EFI_QUERY_VARIABLE_INFO         QueryVariableInfo;
01665 } EFI_RUNTIME_SERVICES;
01666 
01667 
01668 #define EFI_BOOT_SERVICES_SIGNATURE   0x56524553544f4f42ULL
01669 #define EFI_BOOT_SERVICES_REVISION    EFI_2_10_SYSTEM_TABLE_REVISION
01670 
01671 ///
01672 /// EFI Boot Services Table
01673 ///
01674 typedef struct {
01675   ///
01676   /// The table header for the EFI Boot Services Table.
01677   ///
01678   EFI_TABLE_HEADER                Hdr;
01679 
01680   //
01681   // Task Priority Services
01682   //
01683   EFI_RAISE_TPL                   RaiseTPL;
01684   EFI_RESTORE_TPL                 RestoreTPL;
01685 
01686   //
01687   // Memory Services
01688   //
01689   EFI_ALLOCATE_PAGES              AllocatePages;
01690   EFI_FREE_PAGES                  FreePages;
01691   EFI_GET_MEMORY_MAP              GetMemoryMap;
01692   EFI_ALLOCATE_POOL               AllocatePool;
01693   EFI_FREE_POOL                   FreePool;
01694 
01695   //
01696   // Event & Timer Services
01697   //
01698   EFI_CREATE_EVENT                  CreateEvent;
01699   EFI_SET_TIMER                     SetTimer;
01700   EFI_WAIT_FOR_EVENT                WaitForEvent;
01701   EFI_SIGNAL_EVENT                  SignalEvent;
01702   EFI_CLOSE_EVENT                   CloseEvent;
01703   EFI_CHECK_EVENT                   CheckEvent;
01704 
01705   //
01706   // Protocol Handler Services
01707   //
01708   EFI_INSTALL_PROTOCOL_INTERFACE    InstallProtocolInterface;
01709   EFI_REINSTALL_PROTOCOL_INTERFACE  ReinstallProtocolInterface;
01710   EFI_UNINSTALL_PROTOCOL_INTERFACE  UninstallProtocolInterface;
01711   EFI_HANDLE_PROTOCOL               HandleProtocol;
01712   VOID                              *Reserved;
01713   EFI_REGISTER_PROTOCOL_NOTIFY      RegisterProtocolNotify;
01714   EFI_LOCATE_HANDLE                 LocateHandle;
01715   EFI_LOCATE_DEVICE_PATH            LocateDevicePath;
01716   EFI_INSTALL_CONFIGURATION_TABLE   InstallConfigurationTable;
01717 
01718   //
01719   // Image Services
01720   //
01721   EFI_IMAGE_LOAD                    LoadImage;
01722   EFI_IMAGE_START                   StartImage;
01723   EFI_EXIT                          Exit;
01724   EFI_IMAGE_UNLOAD                  UnloadImage;
01725   EFI_EXIT_BOOT_SERVICES            ExitBootServices;
01726 
01727   //
01728   // Miscellaneous Services
01729   //
01730   EFI_GET_NEXT_MONOTONIC_COUNT      GetNextMonotonicCount;
01731   EFI_STALL                         Stall;
01732   EFI_SET_WATCHDOG_TIMER            SetWatchdogTimer;
01733 
01734   //
01735   // DriverSupport Services
01736   //
01737   EFI_CONNECT_CONTROLLER            ConnectController;
01738   EFI_DISCONNECT_CONTROLLER         DisconnectController;
01739 
01740   //
01741   // Open and Close Protocol Services
01742   //
01743   EFI_OPEN_PROTOCOL                 OpenProtocol;
01744   EFI_CLOSE_PROTOCOL                CloseProtocol;
01745   EFI_OPEN_PROTOCOL_INFORMATION     OpenProtocolInformation;
01746 
01747   //
01748   // Library Services
01749   //
01750   EFI_PROTOCOLS_PER_HANDLE          ProtocolsPerHandle;
01751   EFI_LOCATE_HANDLE_BUFFER          LocateHandleBuffer;
01752   EFI_LOCATE_PROTOCOL               LocateProtocol;
01753   EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES    InstallMultipleProtocolInterfaces;
01754   EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES  UninstallMultipleProtocolInterfaces;
01755 
01756   //
01757   // 32-bit CRC Services
01758   //
01759   EFI_CALCULATE_CRC32               CalculateCrc32;
01760 
01761   //
01762   // Miscellaneous Services
01763   //
01764   EFI_COPY_MEM                      CopyMem;
01765   EFI_SET_MEM                       SetMem;
01766   EFI_CREATE_EVENT_EX               CreateEventEx;
01767 } EFI_BOOT_SERVICES;
01768 
01769 ///
01770 /// Contains a set of GUID/pointer pairs comprised of the ConfigurationTable field in the
01771 /// EFI System Table.
01772 ///
01773 typedef struct{
01774   ///
01775   /// The 128-bit GUID value that uniquely identifies the system configuration table.
01776   ///
01777   EFI_GUID                          VendorGuid;
01778   ///
01779   /// A pointer to the table associated with VendorGuid.
01780   ///
01781   VOID                              *VendorTable;
01782 } EFI_CONFIGURATION_TABLE;
01783 
01784 ///
01785 /// EFI System Table
01786 ///
01787 struct _EFI_SYSTEM_TABLE {
01788   ///
01789   /// The table header for the EFI System Table.
01790   ///
01791   EFI_TABLE_HEADER                  Hdr;
01792   ///
01793   /// A pointer to a null terminated Unicode string that identifies
01794   /// the vendor that produces the system firmware for the platform.
01795   ///
01796   CHAR16                            *FirmwareVendor;
01797   ///
01798   /// A firmware vendor specific value that identifies the revision
01799   /// of the system firmware for the platform.
01800   ///
01801   UINT32                            FirmwareRevision;
01802   ///
01803   /// The handle for the active console input device.
01804   ///
01805   EFI_HANDLE                        ConsoleInHandle;
01806   ///
01807   /// A pointer to the SIMPLE_INPUT_PROTOCOL interface that is
01808   /// associated with ConsoleInHandle.
01809   ///
01810   EFI_SIMPLE_TEXT_INPUT_PROTOCOL    *ConIn;
01811   ///
01812   /// The handle for the active console output device.
01813   ///
01814   EFI_HANDLE                        ConsoleOutHandle;
01815   ///
01816   /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface
01817   /// that is associated with ConsoleOutHandle.
01818   ///
01819   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *ConOut;
01820   ///
01821   /// The handle for the active standard error console device.
01822   ///
01823   EFI_HANDLE                        StandardErrorHandle;
01824   ///
01825   /// A pointer to the SIMPLE_TEXT_OUTPUT_PROTOCOL interface
01826   /// that is associated with StandardErrorHandle.
01827   ///
01828   EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL   *StdErr;
01829   ///
01830   /// A pointer to the EFI Runtime Services Table.
01831   ///
01832   EFI_RUNTIME_SERVICES              *RuntimeServices;
01833   ///
01834   /// A pointer to the EFI Boot Services Table.
01835   ///
01836   EFI_BOOT_SERVICES                 *BootServices;
01837   ///
01838   /// The number of system configuration tables in the buffer ConfigurationTable.
01839   ///
01840   UINTN                             NumberOfTableEntries;
01841   ///
01842   /// A pointer to the system configuration tables.
01843   /// The number of entries in the table is NumberOfTableEntries.
01844   ///
01845   EFI_CONFIGURATION_TABLE           *ConfigurationTable;
01846 };
01847 
01848 //
01849 // EFI Load Options Attributes
01850 //
01851 #define LOAD_OPTION_ACTIVE            0x00000001
01852 #define LOAD_OPTION_FORCE_RECONNECT   0x00000002
01853 #define LOAD_OPTION_HIDDEN            0x00000008
01854 #define LOAD_OPTION_CATEGORY          0x00001F00
01855 
01856 #define LOAD_OPTION_CATEGORY_BOOT     0x00000000
01857 #define LOAD_OPTION_CATEGORY_APP      0x00000100
01858 
01859 #define EFI_BOOT_OPTION_SUPPORT_KEY   0x00000001
01860 #define EFI_BOOT_OPTION_SUPPORT_APP   0x00000002
01861 #define EFI_BOOT_OPTION_SUPPORT_COUNT 0x00000300
01862 
01863 typedef union {
01864   struct {
01865     UINT32  Revision        : 8;
01866     UINT32  ShiftPressed    : 1;
01867     UINT32  ControlPressed  : 1;
01868     UINT32  AltPressed      : 1;
01869     UINT32  LogoPressed     : 1;
01870     UINT32  MenuPressed     : 1;
01871     UINT32  SysReqPessed    : 1;
01872     UINT32  Reserved        : 16;
01873     UINT32  InputKeyCount   : 2;
01874   } Options;
01875   UINT32  PackedValue;
01876 } HOT_KEY_EFI_KEY_DATA;
01877 
01878 typedef struct {
01879   HOT_KEY_EFI_KEY_DATA  KeyOptions;
01880   UINT32                BootOptionCrc;
01881   UINT16                BootOption;
01882 //EFI_INPUT_KEY         Keys[];
01883 } EFI_KEY_OPTION;
01884 
01885 #define EFI_KEY_OPTION_SHIFT     0x00000001
01886 #define EFI_KEY_OPTION_CONTROL   0x00000002
01887 #define EFI_KEY_OPTION_ALT       0x00000004
01888 #define EFI_KEY_OPTION_LOGO      0x00000008
01889 #define EFI_KEY_OPTION_MENU      0x00000010
01890 #define EFI_KEY_OPTION_SYSREQ    0x00000020
01891 #define EFI_KEY_CODE_COUNT       0x00000300
01892 
01893 
01894 //
01895 // EFI File location to boot from on removable media devices
01896 //
01897 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA32    L"\\EFI\\BOOT\\BOOTIA32.EFI"
01898 #define EFI_REMOVABLE_MEDIA_FILE_NAME_IA64    L"\\EFI\\BOOT\\BOOTIA64.EFI"
01899 #define EFI_REMOVABLE_MEDIA_FILE_NAME_X64     L"\\EFI\\BOOT\\BOOTX64.EFI"
01900 
01901 #if   defined (MDE_CPU_IA32)
01902   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA32
01903 #elif defined (MDE_CPU_IPF)
01904   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_IA64
01905 #elif defined (MDE_CPU_X64)
01906   #define EFI_REMOVABLE_MEDIA_FILE_NAME   EFI_REMOVABLE_MEDIA_FILE_NAME_X64
01907 #elif defined (MDE_CPU_EBC)
01908 #else
01909   #error Unknown Processor Type
01910 #endif
01911 
01912 #include <gpxe/efi/Uefi/UefiPxe.h>
01913 #include <gpxe/efi/Uefi/UefiGpt.h>
01914 #include <gpxe/efi/Uefi/UefiInternalFormRepresentation.h>
01915 
01916 #endif

Generated on Tue Apr 6 20:01:07 2010 for gPXE by  doxygen 1.5.7.1