efiapi.h

来自「EFI BIOS是Intel提出的下一代的BIOS标准。这里上传的Edk源代码是」· C头文件 代码 · 共 1,109 行 · 第 1/3 页

H
1,109
字号
  IN UINTN                        ExitDataSize,
  IN CHAR16                       *ExitData OPTIONAL
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_IMAGE_UNLOAD) (
  IN EFI_HANDLE                   ImageHandle
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_EXIT_BOOT_SERVICES) (
  IN EFI_HANDLE                   ImageHandle,
  IN UINTN                        MapKey
  );

//
// Misc
//
typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_STALL) (
  IN UINTN                    Microseconds
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_SET_WATCHDOG_TIMER) (
  IN UINTN                    Timeout,
  IN UINT64                   WatchdogCode,
  IN UINTN                    DataSize,
  IN CHAR16                   *WatchdogData OPTIONAL
  );

typedef enum {
  EfiResetCold,
  EfiResetWarm,
  EfiResetShutdown,

#if ((TIANO_RELEASE_VERSION != 0) && (EFI_SPECIFICATION_VERSION < 0x00020000))
  EfiResetUpdate
#endif

} EFI_RESET_TYPE;

typedef
EFI_RUNTIMESERVICE
VOID
(EFIAPI *EFI_RESET_SYSTEM) (
  IN EFI_RESET_TYPE           ResetType,
  IN EFI_STATUS               ResetStatus,
  IN UINTN                    DataSize,
  IN CHAR16                   *ResetData OPTIONAL
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_MONOTONIC_COUNT) (
  OUT UINT64                  *Count
  );

typedef
EFI_RUNTIMESERVICE
EFI_STATUS
(EFIAPI *EFI_GET_NEXT_HIGH_MONO_COUNT) (
  OUT UINT32                  *HighCount
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_CALCULATE_CRC32) (
  IN  VOID                              *Data,
  IN  UINTN                             DataSize,
  OUT UINT32                            *Crc32
  );

typedef
EFI_BOOTSERVICE
VOID
(EFIAPI *EFI_COPY_MEM) (
  IN VOID     *Destination,
  IN VOID     *Source,
  IN UINTN    Length
  );

typedef
EFI_BOOTSERVICE
VOID
(EFIAPI *EFI_SET_MEM) (
  IN VOID     *Buffer,
  IN UINTN    Size,
  IN UINT8    Value
  );

//
// Protocol handler functions
//
typedef enum {
  EFI_NATIVE_INTERFACE
} EFI_INTERFACE_TYPE;

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_INSTALL_PROTOCOL_INTERFACE) (
  IN OUT EFI_HANDLE           * Handle,
  IN EFI_GUID                 * Protocol,
  IN EFI_INTERFACE_TYPE       InterfaceType,
  IN VOID                     *Interface
  );

typedef
EFI_BOOTSERVICE11
EFI_STATUS
(EFIAPI *EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
  IN OUT EFI_HANDLE           * Handle,
  ...
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_REINSTALL_PROTOCOL_INTERFACE) (
  IN EFI_HANDLE               Handle,
  IN EFI_GUID                 * Protocol,
  IN VOID                     *OldInterface,
  IN VOID                     *NewInterface
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_UNINSTALL_PROTOCOL_INTERFACE) (
  IN EFI_HANDLE               Handle,
  IN EFI_GUID                 * Protocol,
  IN VOID                     *Interface
  );

typedef
EFI_BOOTSERVICE11
EFI_STATUS
(EFIAPI *EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) (
  IN EFI_HANDLE           Handle,
  ...
  );

typedef
EFI_BOOTSERVICE
EFI_STATUS
(EFIAPI *EFI_HANDLE_PROTOCOL) (
  IN EFI_HANDLE               Handle,
  IN EFI_GUID                 * Protocol,
  OUT VOID                    **Interface
  );

#define EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL  0x00000001
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL        0x00000002
#define EFI_OPEN_PROTOCOL_TEST_PROTOCOL       0x00000004
#define EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER 0x00000008
#define EFI_OPEN_PROTOCOL_BY_DRIVER           0x00000010
#define EFI_OPEN_PROTOCOL_EXCLUSIVE           0x00000020

//
// ///////////////////////////////////////////////////////////////////////////////////////////////
// OpenProtocol() Attribute Values
/////////////////////////////////////////////////////////////////////////////////////////////////
// BY_HANDLE_PROTOCOL    - Used by EFI 1.0 Drivers and Applications
//                         May not actually add an elemnt to the open list in a production build
//
// GET_PROTOCOL          - Used by EFI 1.1 Drivers to get a protocol interface
//                         May not actually add an elemnt to the open list in a production build
//
// TEST_PROTOCOL         - Used by EFI 1.1 Drivers to test for the existence of a protocol interface
//                         The interface is not returned, and it is an optional parameter tham may be NULL.
//                         May not actually add an elemnt to the open list in a production build
//
// BY_DRIVER             - Used by EFI 1.1 Drivers that are able to share a protocol with other
//                         agents other than its children.  A driver is always able to share
//                         a protocol with its children, since the driver is in control of the
//                         parent controller's and the child controller's use of the protocol.
//
// BY_DRIVER | EXCLUSIVE - Used by EFI 1.1 Drivers that will not share a protocol with any other
//                         agents except its children.  A driver is always able to share
//                         a protocol with its children, since the driver is in control of the
//                         parent controller's and the child controller's use of the protocol.
//                         This attribute will force all other drivers to disconnect from the protocol
//                         before this driver attaches.  When this driver closes the handle, the other
//                         drivers will reconnect to the protocol.
//
//
// BY_CHILD_CONTROLLER   - Used by EFI 1.1 Driver to show that a protocol is consumed by a child
//                         of the driver.  This is information used by DisconnectController() to
//                         determine the list of children that a protocol has.  It has
//                         no affect on the OpenProtocol()/ClosePrototocol() behavior.
//
// EXCLUSIVE             - Used by EFI 1.1 Applications to gain exclusive access to a protocol.
//                         All drivers are disconnected from the handle while the application has
//                         the handle open.  These drivers are reconnected when the application
//                         closes the handle.
//
/////////////////////////////////////////////////////////////////////////////////////////////////
// OpenProtocol() behavior based on Attribute values
/////////////////////////////////////////////////////////////////////////////////////////////////
//
// OpenProtocol (Handle, Protocol, Interface, ImageHandle, DeviceHandle, Attributes)
// * EFI_UNSUPPORTED        if Protocol does not exist on Handle
// * EFI_INVALID_PARAMETER  if Handle is not a valid handle.
// * EFI_INVALID_PARAMETER  if Protocol is NULL or not a valid GUID
// * EFI_INVALID_PARAMETER  if Interface is NULL
// * EFI_INVALID_PARAMETER  if Attributes is not one of the following values:
//                            BY_HANDLE_PROTOCOL
//                            GET_PROTOCOL
//                            TEST_PROTOCOL
//                            BY_CHILD_CONTROLLER
//                            BY_DRIVER
//                            BY_DRIVER | EXCLUSIVE
//                            EXCLUSIVE
// * EFI_INVALID_PARAMETER  if Attributes BY_CHILD_CONTROLLER and ImageHandle is not a valid handle
// * EFI_INVALID_PARAMETER  if Attributes BY_CHILD_CONTROLLER and DeviceHandle is not a valid handle
// * EFI_INVALID_PARAMETER  if Attributes BY_CHILD_CONTROLLER and Handle == DeviceHandle
// * EFI_INVALID_PARAMETER  if Attributes BY_DRIVER and ImageHandle is not a valid handle
// * EFI_INVALID_PARAMETER  if Attributes BY_DRIVER and DeviceHandle is not a valid handle
// * EFI_INVALID_PARAMETER  if Attributes BY_DRIVER | EXCLUSIVE and ImageHandle is not a valid handle
// * EFI_INVALID_PARAMETER  if Attributes BY_DRIVER | EXCLUSIVE and DeviceHandle is not a valid handle
// * EFI_INVALID_PARAMETER  if Attributes EXCLUSIVE and ImageHandle is not a valid handle
//
// OpenProtocol() Attributes = BY_HANDLE_PROTOCOL, GET_PROTOCOL, TEST_PROTOCOL, BY_CHILD_CONTROLLER
// * EFI_SUCCESS      if Protocol exists on the Handle
//
// OpenProtocol() Attributes = BY_DRIVER
// * EFI_SUCCESS        if there are no items in the Open List for (Handle, Protocol)
// * EFI_SUCCESS        if there are only items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_HANDLE_PROTOCOL
//                        GET_PROTOCOL
//                        TEST_PROTOCOL
//                        BY_CHILD_CONTROLLER
// * EFI_SUCCESS        if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER
//                      AND ImageHandle != OpenListItem.IH
// * EFI_ALREADY_STARTED if there are any items in the Open List for (Handle, Protocol)
//                       that have the one of the following Attributes
//                         BY_DRIVER
//                       AND ImageHandle == OpenListItem.IH
// * EFI_ACCESS_DENIED  if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER | EXCLUSIVE
//                        EXCLUSIVE
//
// OpenProtocol() Attributes = BY_DRIVER | EXCLUSIVE
// * EFI_SUCCESS        if there are no items in the Open List for (Handle, Protocol)
// * EFI_SUCCESS        if there are only items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_HANDLE_PROTOCOL
//                        GET_PROTOCOL
//                        TEST_PROTOCOL
//                        BY_CHILD_CONTROLLER
// * EFI_SUCCESS        if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER
//                      AND the driver is removed by DisconnectController(IH,DH)
// * EFI_ALREADY_STARTED if there are any items in the Open List for (Handle, Protocol)
//                       that have the one of the following Attributes
//                         BY_DRIVER | EXCLUSIVE
//                       AND ImageHandle == OpenListItem.IH
// * EFI_ACCESS_DENIED  if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER
//                      AND the driver can not be removed by DisconnectController(IH,DH)
// * EFI_ACCESS_DENIED  if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER | EXCLUSIVE
//                        EXCLUSIVE
//
// OpenProtocol() Attributes = EXCLUSIVE
// * EFI_SUCCESS        if there are no items in the Open List for (Handle, Protocol)
// * EFI_SUCCESS        if there are only items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_HANDLE_PROTOCOL
//                        GET_PROTOCOL
//                        TEST_PROTOCOL
//                        BY_CHILD_CONTROLLER
// * EFI_SUCCESS        if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER
//                      AND the driver is removed by DisconnectController(IH,DH)
// * EFI_ACCESS_DENIED  if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER
//                      AND the driver can not be removed by DisconnectController(IH,DH)
// * EFI_ACCESS_DENIED  if there are any items in the Open List for (Handle, Protocol)
//                      that have the one of the following Attributes
//                        BY_DRIVER | EXCLUSIVE
//                        EXCLUSIVE
//
/////////////////////////////////////////////////////////////////////////////////////////////////
// CloseProtocol() Behavior based on the Attributes of the item being closed and the items
//                 remaining on the Open List
/////////////////////////////////////////////////////////////////////////////////////////////////
// CloseProtocol(Handle, Protocol, ImageHandle, DeviceHandle)
// CloseProtocol() Attributes of item = BY_HANDLE_PROTOCOL,
//                                      GET_PROTOCOL
//                                      TEST_PROTOCOL
//                                      BY_CHILD_CONTROLLER,
//                                      BY_DRIVER
//                                      BY_DRIVER | EXCLUSIVE
//                                      EXCLUSIVE
//   EFI_NOT_FOUND          if Protocol does not exist on Handle
//   EFI_INVALID_PARAMETER  if Handle is not a valid handle.
//   EFI_INVALID_PARAMETER  if Protocol is NULL or not a valid GUID
//   EFI_INVALID_PARAMETER  if ImageHandle is not a valid handle
//   EFI_INVALID_PARAMETER  if DeviceHandle is not a valid handle
//   EFI_NOT_FOUND      if (ImageHandle, DeviceHandle) is not present in the Open List
//                      for (Handle, Protocol)
//   EFI_ACCESS_DENIED  if (ImageHandle, DeviceHandle) is present in the Open List
//                      for (Handle, Protocol), but the item can not be removed.
//   EFI_SUCCESS        if (ImageHandle, DeviceHandle) is present in the Open List
//                      for (Handle, Protocol), and the item can be removed.
//
/////////////////////////////////////////////////////////////////////////////////////////////////
// UninstallProtocolInterface() behavior
/////////////////////////////////////////////////////////////////////////////////////////////////
//
// UninstallProtocolInterface (Handle, Protocol, Interface)
//
//   EFI_INVALID_PARAMETER if Handle is not a valid handle.
//   EFI_INVALID_PARAMETER if Protocol is not a vlaid GUID
//   EFI_NOT_FOUND         if Handle doe not support Protocol
//   EFI_NOT_FOUND         if the interface for (Handle, Protocol) does not match Interface
//   EFI_ACCESS_DENIED     if the list of Open Items for (Handle, Protocol) can not be removed
//   EFI_SUCCESS           if the list of Open Items is empty, and Protocol is removed from Handle
//
// Algorithm to remove Open Item List:
//
// Loop through all Open Item List entries
//   if (OpenItem.Attributes & BY_DRIVER) then
//     DisconnectController (OpenItem.IH, OpenItem.DH)
//   end if
// end loop
// Loop through all Open Item List entries
//   if (OpenItem.Attributes & BY_HANDLE_PROTOCOL or GET_PROTOCOL or TEST_PROTOCOL) then
//     CloseProtocol (Handle, Protocol, OpenItem.IH, OpenItem.DH)
//   end if
// end loop
// if Open Item List is empty then remove Protocol from Handle and return EFI_SUCCESS
// if Open Item List is not empty then return EFI_ACCESS_DENIED
//
/////////////////////////////////////////////////////////////////////////////////////////////////
typedef
EFI_BOOTSERVICE11
EFI_STATUS
(EFIAPI *EFI_OPEN_PROTOCOL) (
  IN EFI_HANDLE                 Handle,
  IN EFI_GUID                   * Protocol,
  OUT VOID                      **Interface,
  IN  EFI_HANDLE                ImageHandle,
  IN  EFI_HANDLE                ControllerHandle, OPTIONAL
  IN  UINT32                    Attributes
  );

typedef
EFI_BOOTSERVICE11

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?