TianoCore EDK2 master
Loading...
Searching...
No Matches
UnitTestUefiBootServicesTableLibMisc.c File Reference

Go to the source code of this file.

Functions

EFI_STATUS EFIAPI UnitTestGetNextMonotonicCount (OUT UINT64 *Count)
 
EFI_STATUS EFIAPI UnitTestStall (IN UINTN Microseconds)
 
EFI_STATUS EFIAPI UnitTestSetWatchdogTimer (IN UINTN Timeout, IN UINT64 WatchdogCode, IN UINTN DataSize, IN CHAR16 *WatchdogData OPTIONAL)
 
EFI_STATUS EFIAPI UnitTestConnectController (IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE *DriverImageHandle OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, IN BOOLEAN Recursive)
 
EFI_STATUS EFIAPI UnitTestDisconnectController (IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL)
 
EFI_STATUS EFIAPI UnitTestCalculateCrc32 (IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32)
 

Detailed Description

Implementation of miscellaneous 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 UnitTestUefiBootServicesTableLibMisc.c.

Function Documentation

◆ UnitTestCalculateCrc32()

EFI_STATUS EFIAPI UnitTestCalculateCrc32 ( IN VOID *  Data,
IN UINTN  DataSize,
OUT UINT32 *  Crc32 
)

Computes and returns a 32-bit CRC for a data buffer.

Parameters
[in]DataA pointer to the buffer on which the 32-bit CRC is to be computed.
[in]DataSizeThe number of bytes in the buffer Data.
[out]Crc32The 32-bit CRC that was computed for the data buffer specified by Data and DataSize.
Return values
EFI_SUCCESSThe 32-bit CRC was computed for the data buffer and returned in Crc32.
EFI_INVALID_PARAMETERData is NULL.
EFI_INVALID_PARAMETERCrc32 is NULL.
EFI_INVALID_PARAMETERDataSize is 0.

Definition at line 185 of file UnitTestUefiBootServicesTableLibMisc.c.

◆ UnitTestConnectController()

EFI_STATUS EFIAPI UnitTestConnectController ( IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE *DriverImageHandle  OPTIONAL,
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath  OPTIONAL,
IN BOOLEAN  Recursive 
)

Connects one or more drivers to a controller.

Parameters
ControllerHandleThe handle of the controller to which driver(s) are to be connected.
DriverImageHandleA pointer to an ordered list handles that support the EFI_DRIVER_BINDING_PROTOCOL.
RemainingDevicePathA pointer to the device path that specifies a child of the controller specified by ControllerHandle.
RecursiveIf TRUE, then ConnectController() is called recursively until the entire tree of controllers below the controller specified by ControllerHandle have been created. If FALSE, then the tree of controllers is only expanded one level.
Return values
EFI_SUCCESS1) One or more drivers were connected to ControllerHandle. 2) No drivers were connected to ControllerHandle, but RemainingDevicePath is not NULL, and it is an End Device Path Node.
EFI_INVALID_PARAMETERControllerHandle is NULL.
EFI_NOT_FOUND1) There are no EFI_DRIVER_BINDING_PROTOCOL instances present in the system. 2) No drivers were connected to ControllerHandle.
EFI_SECURITY_VIOLATIONThe user has no permission to start UEFI device drivers on the device path associated with the ControllerHandle or specified by the RemainingDevicePath.

Definition at line 115 of file UnitTestUefiBootServicesTableLibMisc.c.

◆ UnitTestDisconnectController()

EFI_STATUS EFIAPI UnitTestDisconnectController ( IN EFI_HANDLE  ControllerHandle,
IN EFI_HANDLE DriverImageHandle  OPTIONAL,
IN EFI_HANDLE ChildHandle  OPTIONAL 
)

Disconnects a controller from a driver

Parameters
ControllerHandleControllerHandle The handle of the controller from which driver(s) are to be disconnected.
DriverImageHandleDriverImageHandle The driver to disconnect from ControllerHandle.
ChildHandleChildHandle The handle of the child to destroy.
Return values
EFI_SUCCESSOne or more drivers were disconnected from the controller.
EFI_SUCCESSOn entry, no drivers are managing ControllerHandle.
EFI_SUCCESSDriverImageHandle is not NULL, and on entry DriverImageHandle is not managing ControllerHandle.
EFI_INVALID_PARAMETERControllerHandle is NULL.
EFI_INVALID_PARAMETERDriverImageHandle is not NULL, and it is not a valid EFI_HANDLE.
EFI_INVALID_PARAMETERChildHandle is not NULL, and it is not a valid EFI_HANDLE.
EFI_OUT_OF_RESOURCESThere are not enough resources available to disconnect any drivers from ControllerHandle.
EFI_DEVICE_ERRORThe controller could not be disconnected because of a device error.

Definition at line 159 of file UnitTestUefiBootServicesTableLibMisc.c.

◆ UnitTestGetNextMonotonicCount()

EFI_STATUS EFIAPI UnitTestGetNextMonotonicCount ( OUT UINT64 *  Count)

Returns a monotonically increasing count for the platform.

Parameters
[out]CountThe pointer to returned value.
Return values
EFI_SUCCESSThe next monotonic count was returned.
EFI_INVALID_PARAMETERCount is NULL.
EFI_DEVICE_ERRORThe device is not functioning properly.

Definition at line 23 of file UnitTestUefiBootServicesTableLibMisc.c.

◆ UnitTestSetWatchdogTimer()

EFI_STATUS EFIAPI UnitTestSetWatchdogTimer ( IN UINTN  Timeout,
IN UINT64  WatchdogCode,
IN UINTN  DataSize,
IN CHAR16 *WatchdogData  OPTIONAL 
)

Sets the system's watchdog timer.

Parameters
TimeoutThe number of seconds to set the watchdog timer to. A value of zero disables the timer.
WatchdogCodeThe numeric code to log on a watchdog timer timeout event. The firmware reserves codes 0x0000 to 0xFFFF. Loaders and operating systems may use other timeout codes.
DataSizeThe size, in bytes, of WatchdogData.
WatchdogDataA data buffer that includes a Null-terminated Unicode string, optionally followed by additional binary data. The string is a description that the call may use to further indicate the reason to be logged with a watchdog event.
Returns
EFI_SUCCESS Timeout has been set
EFI_NOT_AVAILABLE_YET WatchdogTimer is not available yet
EFI_UNSUPPORTED System does not have a timer (currently not used)
EFI_DEVICE_ERROR Could not complete due to hardware error

Definition at line 77 of file UnitTestUefiBootServicesTableLibMisc.c.

◆ UnitTestStall()

EFI_STATUS EFIAPI UnitTestStall ( IN UINTN  Microseconds)

Introduces a fine-grained stall.

Parameters
MicrosecondsThe number of microseconds to stall execution.
Return values
EFI_SUCCESSExecution was stalled for at least the requested amount of microseconds.
EFI_NOT_AVAILABLE_YETgMetronome is not available yet

Definition at line 46 of file UnitTestUefiBootServicesTableLibMisc.c.