TianoCore EDK2 master
|
#include "UnitTestUefiBootServicesTableLibProtocol.h"
Go to the source code of this file.
Variables | |
STATIC LIST_ENTRY | mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase) |
STATIC LIST_ENTRY | gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList) |
STATIC UINT64 | gHandleDatabaseKey = 0 |
STATIC UINTN | mEfiLocateHandleRequest = 0 |
Implementation of protocol related services in the UEFI Boot Services table for use in unit tests.
Copyright (c) Microsoft Corporation SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestCloseProtocol | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol, | ||
IN EFI_HANDLE | AgentHandle, | ||
IN EFI_HANDLE | ControllerHandle | ||
) |
Closes a protocol on a handle that was opened using OpenProtocol().
UserHandle | The handle for the protocol interface that was previously opened with OpenProtocol(), and is now being closed. |
Protocol | The published unique identifier of the protocol. It is the caller's responsibility to pass in a valid GUID. |
AgentHandle | The handle of the agent that is closing the protocol interface. |
ControllerHandle | If the agent that opened a protocol is a driver that follows the EFI Driver Model, then this parameter is the controller handle that required the protocol interface. If the agent does not follow the EFI Driver Model, then this parameter is optional and may be NULL. |
EFI_SUCCESS | The protocol instance was closed. |
EFI_INVALID_PARAMETER | Handle, AgentHandle or ControllerHandle is not a valid EFI_HANDLE. |
EFI_NOT_FOUND | Can not find the specified protocol or AgentHandle. |
Definition at line 1370 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS UnitTestDisconnectControllersUsingProtocolInterface | ( | IN EFI_HANDLE | UserHandle, |
IN PROTOCOL_INTERFACE * | Prot | ||
) |
Attempts to disconnect all drivers that are using the protocol interface being queried. If failed, reconnect all drivers disconnected. Note: This function doesn't do parameters checking, it's caller's responsibility to pass in valid parameters.
UserHandle | The handle on which the protocol is installed |
Prot | The protocol to disconnect drivers from |
EFI_SUCCESS | Drivers using the protocol interface are all disconnected |
EFI_ACCESS_DENIED | Failed to disconnect one or all of the drivers |
Definition at line 343 of file UnitTestUefiBootServicesTableLibProtocol.c.
PROTOCOL_ENTRY * UnitTestFindProtocolEntry | ( | IN EFI_GUID * | Protocol, |
IN BOOLEAN | Create | ||
) |
Finds the protocol entry for the requested protocol.
Protocol | The ID of the protocol |
Create | Create a new entry if not found |
Definition at line 61 of file UnitTestUefiBootServicesTableLibProtocol.c.
PROTOCOL_INTERFACE * UnitTestFindProtocolInterface | ( | IN IHANDLE * | Handle, |
IN EFI_GUID * | Protocol, | ||
IN VOID * | Interface | ||
) |
Finds the protocol instance for the requested handle and protocol. Note: This function doesn't do parameters checking, it's caller's responsibility to pass in valid parameters.
Handle | The handle to search the protocol on |
Protocol | GUID of the protocol |
Interface | The interface for the protocol being searched |
Definition at line 129 of file UnitTestUefiBootServicesTableLibProtocol.c.
IHANDLE * UnitTestGetNextLocateAllHandles | ( | IN OUT LOCATE_POSITION * | Position, |
OUT VOID ** | Interface | ||
) |
Routine to get the next Handle, when you are searching for all handles.
Position | Information about which Handle to seach for. |
Interface | Return the interface structure for the matching protocol. |
Definition at line 198 of file UnitTestUefiBootServicesTableLibProtocol.c.
IHANDLE * UnitTestGetNextLocateByProtocol | ( | IN OUT LOCATE_POSITION * | Position, |
OUT VOID ** | Interface | ||
) |
Routine to get the next Handle, when you are searching for a given protocol.
Position | Information about which Handle to seach for. |
Interface | Return the interface structure for the matching protocol. |
Definition at line 282 of file UnitTestUefiBootServicesTableLibProtocol.c.
IHANDLE * UnitTestGetNextLocateByRegisterNotify | ( | IN OUT LOCATE_POSITION * | Position, |
OUT VOID ** | Interface | ||
) |
Routine to get the next Handle, when you are searching for register protocol notifies.
Position | Information about which Handle to seach for. |
Interface | Return the interface structure for the matching protocol. |
Definition at line 235 of file UnitTestUefiBootServicesTableLibProtocol.c.
PROTOCOL_INTERFACE * UnitTestGetProtocolInterface | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol | ||
) |
Locate a certain GUID protocol interface in a Handle's protocols.
UserHandle | The handle to obtain the protocol interface on |
Protocol | The GUID of the protocol |
Definition at line 462 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestHandleProtocol | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol, | ||
OUT VOID ** | Interface | ||
) |
Queries a handle to determine if it supports a specified protocol.
UserHandle | The handle being queried. |
Protocol | The published unique identifier of the protocol. |
Interface | Supplies the address where a pointer to the corresponding Protocol Interface is returned. |
Definition at line 841 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestInstallConfigurationTable | ( | IN EFI_GUID * | Guid, |
IN VOID * | Table | ||
) |
Boot Service called to add, modify, or remove a system configuration table from the EFI System Table.
Guid | Pointer to the GUID for the entry to add, update, or remove |
Table | Pointer to the configuration table for the entry to add, update, or remove, may be NULL. |
Definition at line 1086 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestInstallMultipleProtocolInterfaces | ( | IN OUT EFI_HANDLE * | Handle, |
... | |||
) |
Installs a list of protocol interface into the boot services environment. This function calls InstallProtocolInterface() in a loop. If any error occurs all the protocols added by this function are removed. This is basically a lib function to save space.
Handle | The handle to install the protocol handlers on, or NULL if a new handle is to be allocated |
... | EFI_GUID followed by protocol instance. A NULL terminates the list. The pairs are the arguments to InstallProtocolInterface(). All the protocols are added to Handle. |
EFI_SUCCESS | All the protocol interface was installed. |
EFI_OUT_OF_RESOURCES | There was not enough memory in pool to install all the protocols. |
EFI_ALREADY_STARTED | A Device Path Protocol instance was passed in that is already present in the handle database. |
EFI_INVALID_PARAMETER | Handle is NULL. |
EFI_INVALID_PARAMETER | Protocol is already installed on the handle specified by Handle. |
Definition at line 1575 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestInstallProtocolInterface | ( | IN OUT EFI_HANDLE * | UserHandle, |
IN EFI_GUID * | Protocol, | ||
IN EFI_INTERFACE_TYPE | InterfaceType, | ||
IN VOID * | Interface | ||
) |
Wrapper function to UnitTestInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications
UserHandle | The handle to install the protocol handler on, or NULL if a new handle is to be allocated |
Protocol | The protocol to add to the handle |
InterfaceType | Indicates whether Interface is supplied in native form. |
Interface | The interface for the protocol being added |
Definition at line 683 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS UnitTestInstallProtocolInterfaceNotify | ( | IN OUT EFI_HANDLE * | UserHandle, |
IN EFI_GUID * | Protocol, | ||
IN EFI_INTERFACE_TYPE | InterfaceType, | ||
IN VOID * | Interface, | ||
IN BOOLEAN | Notify | ||
) |
Installs a protocol interface into the boot services environment.
UserHandle | The handle to install the protocol handler on, or NULL if a new handle is to be allocated |
Protocol | The protocol to add to the handle |
InterfaceType | Indicates whether Interface is supplied in native form. |
Interface | The interface for the protocol being added |
Notify | indicates whether notify the notification list for this protocol |
EFI_INVALID_PARAMETER | Invalid parameter |
EFI_OUT_OF_RESOURCES | No enough buffer to allocate |
EFI_SUCCESS | Protocol interface successfully installed |
Definition at line 512 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestLocateDevicePath | ( | IN EFI_GUID * | Protocol, |
IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath, | ||
OUT EFI_HANDLE * | Device | ||
) |
Locates the handle to a device on the device path that best matches the specified protocol.
Protocol | The protocol to search for. |
DevicePath | On input, a pointer to a pointer to the device path. On output, the device path pointer is modified to point to the remaining part of the devicepath. |
Device | A pointer to the returned device handle. |
EFI_SUCCESS | The resulting handle was returned. |
EFI_NOT_FOUND | No handles matched the search. |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value. |
Definition at line 1060 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestLocateHandle | ( | IN EFI_LOCATE_SEARCH_TYPE | SearchType, |
IN EFI_GUID *Protocol | OPTIONAL, | ||
IN VOID *SearchKey | OPTIONAL, | ||
IN OUT UINTN * | BufferSize, | ||
OUT EFI_HANDLE * | Buffer | ||
) |
Locates the requested handle(s) and returns them in Buffer.
SearchType | The type of search to perform to locate the handles |
Protocol | The protocol to search for |
SearchKey | Dependant on SearchType |
BufferSize | On input the size of Buffer. On output the size of data returned. |
Buffer | The buffer to return the results in |
EFI_BUFFER_TOO_SMALL | Buffer too small, required buffer size is returned in BufferSize. |
EFI_INVALID_PARAMETER | Invalid parameter |
EFI_SUCCESS | Successfully found the requested handle(s) and returns them in Buffer. |
Definition at line 901 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestLocateHandleBuffer | ( | IN EFI_LOCATE_SEARCH_TYPE | SearchType, |
IN EFI_GUID *Protocol | OPTIONAL, | ||
IN VOID *SearchKey | OPTIONAL, | ||
IN OUT UINTN * | NumberHandles, | ||
OUT EFI_HANDLE ** | Buffer | ||
) |
Function returns an array of handles that support the requested protocol in a buffer allocated from pool. This is a version of UnitTestLocateHandle() that allocates a buffer for the caller.
SearchType | Specifies which handle(s) are to be returned. |
Protocol | Provides the protocol to search by. This parameter is only valid for SearchType ByProtocol. |
SearchKey | Supplies the search key depending on the SearchType. |
NumberHandles | The number of handles returned in Buffer. |
Buffer | A pointer to the buffer to return the requested array of handles that support Protocol. |
EFI_SUCCESS | The result array of handles was returned. |
EFI_NOT_FOUND | No handles match the search. |
EFI_OUT_OF_RESOURCES | There is not enough pool memory to store the matching results. |
EFI_INVALID_PARAMETER | One or more parameters are not valid. |
Definition at line 1461 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestLocateProtocol | ( | IN EFI_GUID * | Protocol, |
IN VOID *Registration | OPTIONAL, | ||
OUT VOID ** | Interface | ||
) |
Return the first Protocol Interface that matches the Protocol GUID. If Registration is passed in, return a Protocol Instance that was just add to the system. If Registration is NULL return the first Protocol Interface you find.
Protocol | The protocol to search for |
Registration | Optional Registration Key returned from RegisterProtocolNotify() |
Interface | Return the Protocol interface (instance). |
EFI_SUCCESS | If a valid Interface is returned |
EFI_INVALID_PARAMETER | Invalid parameter |
EFI_NOT_FOUND | Protocol interface not found |
Definition at line 1543 of file UnitTestUefiBootServicesTableLibProtocol.c.
VOID UnitTestNotifyProtocolEntry | ( | IN PROTOCOL_ENTRY * | ProtEntry | ) |
Signal event for every protocol in protocol entry.
ProtEntry | Protocol entry |
Definition at line 173 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestOpenProtocol | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol, | ||
OUT VOID **Interface | OPTIONAL, | ||
IN EFI_HANDLE | ImageHandle, | ||
IN EFI_HANDLE | ControllerHandle, | ||
IN UINT32 | Attributes | ||
) |
Locates the installed protocol handler for the handle, and invokes it to obtain the protocol interface. Usage information is registered in the protocol data base.
UserHandle | The handle to obtain the protocol interface on |
Protocol | The ID of the protocol |
Interface | The location to return the protocol interface |
ImageHandle | The handle of the Image that is opening the protocol interface specified by Protocol and Interface. |
ControllerHandle | The controller handle that is requiring this interface. |
Attributes | The open mode of the protocol interface specified by Handle and Protocol. |
EFI_INVALID_PARAMETER | Protocol is NULL. |
EFI_SUCCESS | Get the protocol interface. |
Definition at line 1116 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestOpenProtocolInformation | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol, | ||
OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY ** | EntryBuffer, | ||
OUT UINTN * | EntryCount | ||
) |
Return information about Opened protocols in the system
UserHandle | The handle to close the protocol interface on |
Protocol | The ID of the protocol |
EntryBuffer | A pointer to a buffer of open protocol information in the form of EFI_OPEN_PROTOCOL_INFORMATION_ENTRY structures. |
EntryCount | Number of EntryBuffer entries |
Definition at line 1393 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestProtocolsPerHandle | ( | IN EFI_HANDLE | UserHandle, |
OUT EFI_GUID *** | ProtocolBuffer, | ||
OUT UINTN * | ProtocolBufferCount | ||
) |
Retrieves the list of protocol interface GUIDs that are installed on a handle in a buffer allocated from pool.
UserHandle | The handle from which to retrieve the list of protocol interface GUIDs. |
ProtocolBuffer | A pointer to the list of protocol interface GUID pointers that are installed on Handle. |
ProtocolBufferCount | A pointer to the number of GUID pointers present in ProtocolBuffer. |
EFI_SUCCESS | The list of protocol interface GUIDs installed on Handle was returned in ProtocolBuffer. The number of protocol interface GUIDs was returned in ProtocolBufferCount. |
EFI_INVALID_PARAMETER | Handle is NULL. |
EFI_INVALID_PARAMETER | Handle is not a valid EFI_HANDLE. |
EFI_INVALID_PARAMETER | ProtocolBuffer is NULL. |
EFI_INVALID_PARAMETER | ProtocolBufferCount is NULL. |
EFI_OUT_OF_RESOURCES | There is not enough pool memory to store the results. |
Definition at line 1428 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestRegisterProtocolNotify | ( | IN EFI_GUID * | Protocol, |
IN EFI_EVENT | Event, | ||
OUT VOID ** | Registration | ||
) |
Add a new protocol notification record for the request protocol.
Protocol | The requested protocol to add the notify registration |
Event | The event to signal |
Registration | Returns the registration record |
EFI_INVALID_PARAMETER | Invalid parameter |
EFI_SUCCESS | Successfully returned the registration record that has been added |
Definition at line 872 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestReinstallProtocolInterface | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol, | ||
IN VOID * | OldInterface, | ||
IN VOID * | NewInterface | ||
) |
Reinstall a protocol interface on a device handle. The OldInterface for Protocol is replaced by the NewInterface.
UserHandle | Handle on which the interface is to be reinstalled |
Protocol | The numeric ID of the interface |
OldInterface | A pointer to the old interface |
NewInterface | A pointer to the new interface |
EFI_SUCCESS | The protocol interface was installed |
EFI_NOT_FOUND | The OldInterface on the handle was not found |
EFI_INVALID_PARAMETER | One of the parameters has an invalid value |
Definition at line 715 of file UnitTestUefiBootServicesTableLibProtocol.c.
PROTOCOL_INTERFACE * UnitTestRemoveInterfaceFromProtocol | ( | IN IHANDLE * | Handle, |
IN EFI_GUID * | Protocol, | ||
IN VOID * | Interface | ||
) |
Removes Protocol from the protocol list (but not the handle list).
Handle | The handle to remove protocol on. |
Protocol | GUID of the protocol to be moved |
Interface | The interface of the protocol |
Definition at line 413 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestUninstallMultipleProtocolInterfaces | ( | IN EFI_HANDLE | Handle, |
... | |||
) |
Uninstalls a list of protocol interface in the boot services environment. This function calls UninstallProtocolInterface() in a loop. This is basically a lib function to save space.
Handle | The handle to uninstall the protocol |
... | EFI_GUID followed by protocol instance. A NULL terminates the list. The pairs are the arguments to UninstallProtocolInterface(). All the protocols are added to Handle. |
Definition at line 1599 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS EFIAPI UnitTestUninstallProtocolInterface | ( | IN EFI_HANDLE | UserHandle, |
IN EFI_GUID * | Protocol, | ||
IN VOID * | Interface | ||
) |
Uninstalls all instances of a protocol:interfacer from a handle. If the last protocol interface is remove from the handle, the handle is freed.
UserHandle | The handle to remove the protocol handler from |
Protocol | The protocol, of protocol:interface, to remove |
Interface | The interface, of protocol:interface, to remove |
EFI_INVALID_PARAMETER | Protocol is NULL. |
EFI_SUCCESS | Protocol interface successfully uninstalled. |
Definition at line 740 of file UnitTestUefiBootServicesTableLibProtocol.c.
EFI_STATUS UnitTestValidateHandle | ( | IN EFI_HANDLE | UserHandle | ) |
Check whether a handle is a valid EFI_HANDLE
UserHandle | The handle to check |
EFI_INVALID_PARAMETER | The handle is NULL or not a valid EFI_HANDLE. |
EFI_SUCCESS | The handle is valid EFI_HANDLE. |
Definition at line 30 of file UnitTestUefiBootServicesTableLibProtocol.c.
STATIC UINT64 gHandleDatabaseKey = 0 |
Definition at line 13 of file UnitTestUefiBootServicesTableLibProtocol.c.
STATIC LIST_ENTRY gHandleList = INITIALIZE_LIST_HEAD_VARIABLE (gHandleList) |
Definition at line 12 of file UnitTestUefiBootServicesTableLibProtocol.c.
Definition at line 14 of file UnitTestUefiBootServicesTableLibProtocol.c.
STATIC LIST_ENTRY mProtocolDatabase = INITIALIZE_LIST_HEAD_VARIABLE (mProtocolDatabase) |
Definition at line 11 of file UnitTestUefiBootServicesTableLibProtocol.c.