TianoCore EDK2 master
Loading...
Searching...
No Matches
UnitTestUefiBootServicesTableLib.c
Go to the documentation of this file.
1
18
21
22STATIC EFI_BOOT_SERVICES mBootServices = {
23 {
24 EFI_BOOT_SERVICES_SIGNATURE, // Signature
25 EFI_BOOT_SERVICES_REVISION, // Revision
26 sizeof (EFI_BOOT_SERVICES), // HeaderSize
27 0, // CRC32
28 0 // Reserved
29 },
47 (VOID *)NULL, // Reserved
54 (EFI_EXIT)UnitTestExit, // Exit
58 (EFI_STALL)UnitTestStall, // Stall
71 (EFI_COPY_MEM)CopyMem, // CopyMem
72 (EFI_SET_MEM)SetMem, // SetMem
74};
75
76EFI_BOOT_SERVICES *gBS = &mBootServices;
77
93EFIAPI
95 IN EFI_HANDLE ImageHandle,
96 IN EFI_SYSTEM_TABLE *SystemTable
97 )
98{
99 //
100 // Cache the Image Handle
101 //
102 gImageHandle = ImageHandle;
103 ASSERT (gImageHandle != NULL);
104
105 //
106 // Cache pointer to the EFI System Table
107 //
108
109 // Note: The system table is not implemented
110 gST = NULL;
111
112 //
113 // Cache pointer to the EFI Boot Services Table
114 //
115 gBS = SystemTable->BootServices;
116 ASSERT (gBS != NULL);
117
118 return EFI_SUCCESS;
119}
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI SetMem(OUT VOID *Buffer, IN UINTN Length, IN UINT8 Value)
Definition: SetMemWrapper.c:38
#define NULL
Definition: Base.h:319
#define STATIC
Definition: Base.h:264
#define IN
Definition: Base.h:279
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_STATUS(EFIAPI * EFI_CLOSE_PROTOCOL)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle)
Definition: UefiSpec.h:1409
EFI_STATUS(EFIAPI * EFI_OPEN_PROTOCOL_INFORMATION)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, OUT UINTN *EntryCount)
Definition: UefiSpec.h:1443
EFI_STATUS(EFIAPI * EFI_CONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE *DriverImageHandle OPTIONAL, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL, IN BOOLEAN Recursive)
Definition: UefiSpec.h:364
EFI_STATUS(EFIAPI * EFI_IMAGE_START)(IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL)
Definition: UefiSpec.h:965
EFI_STATUS(EFIAPI * EFI_CALCULATE_CRC32)(IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32)
Definition: UefiSpec.h:1148
EFI_STATUS(EFIAPI * EFI_ALLOCATE_POOL)(IN EFI_MEMORY_TYPE PoolType, IN UINTN Size, OUT VOID **Buffer)
Definition: UefiSpec.h:285
EFI_STATUS(EFIAPI * EFI_IMAGE_LOAD)(IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle)
Definition: UefiSpec.h:940
EFI_STATUS(EFIAPI * EFI_LOCATE_DEVICE_PATH)(IN EFI_GUID *Protocol, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *Device)
Definition: UefiSpec.h:1571
EFI_STATUS(EFIAPI * EFI_IMAGE_UNLOAD)(IN EFI_HANDLE ImageHandle)
Definition: UefiSpec.h:1011
EFI_STATUS(EFIAPI * EFI_EXIT)(IN EFI_HANDLE ImageHandle, IN EFI_STATUS ExitStatus, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL)
Definition: UefiSpec.h:993
VOID(EFIAPI * EFI_RESTORE_TPL)(IN EFI_TPL OldTpl)
Definition: UefiSpec.h:662
EFI_STATUS(EFIAPI * EFI_INSTALL_CONFIGURATION_TABLE)(IN EFI_GUID *Guid, IN VOID *Table)
Definition: UefiSpec.h:1592
EFI_STATUS(EFIAPI * EFI_PROTOCOLS_PER_HANDLE)(IN EFI_HANDLE Handle, OUT EFI_GUID ***ProtocolBuffer, OUT UINTN *ProtocolBufferCount)
Definition: UefiSpec.h:1473
EFI_STATUS(EFIAPI * EFI_GET_MEMORY_MAP)(IN OUT UINTN *MemoryMapSize, OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion)
Definition: UefiSpec.h:256
EFI_STATUS(EFIAPI * EFI_CREATE_EVENT)(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN VOID *NotifyContext OPTIONAL, OUT EFI_EVENT *Event)
Definition: UefiSpec.h:486
EFI_STATUS(EFIAPI * EFI_DISCONNECT_CONTROLLER)(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL)
Definition: UefiSpec.h:397
EFI_STATUS(EFIAPI * EFI_STALL)(IN UINTN Microseconds)
Definition: UefiSpec.h:1043
EFI_STATUS(EFIAPI * EFI_CREATE_EVENT_EX)(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction OPTIONAL, IN CONST VOID *NotifyContext OPTIONAL, IN CONST EFI_GUID *EventGroup OPTIONAL, OUT EFI_EVENT *Event)
Definition: UefiSpec.h:515
EFI_STATUS(EFIAPI * EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)(IN EFI_HANDLE Handle,...)
Definition: UefiSpec.h:1313
EFI_STATUS(EFIAPI * EFI_INSTALL_PROTOCOL_INTERFACE)(IN OUT EFI_HANDLE *Handle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
Definition: UefiSpec.h:1218
VOID(EFIAPI * EFI_COPY_MEM)(IN VOID *Destination, IN VOID *Source, IN UINTN Length)
Definition: UefiSpec.h:1164
EFI_STATUS(EFIAPI * EFI_LOCATE_PROTOCOL)(IN EFI_GUID *Protocol, IN VOID *Registration OPTIONAL, OUT VOID **Interface)
Definition: UefiSpec.h:1645
EFI_STATUS(EFIAPI * EFI_HANDLE_PROTOCOL)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface)
Definition: UefiSpec.h:1335
EFI_STATUS(EFIAPI * EFI_EXIT_BOOT_SERVICES)(IN EFI_HANDLE ImageHandle, IN UINTN MapKey)
Definition: UefiSpec.h:1027
EFI_STATUS(EFIAPI * EFI_LOCATE_HANDLE)(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
Definition: UefiSpec.h:1545
EFI_STATUS(EFIAPI * EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)(IN OUT EFI_HANDLE *Handle,...)
Definition: UefiSpec.h:1243
EFI_STATUS(EFIAPI * EFI_GET_NEXT_MONOTONIC_COUNT)(OUT UINT64 *Count)
Definition: UefiSpec.h:1108
EFI_TPL(EFIAPI * EFI_RAISE_TPL)(IN EFI_TPL NewTpl)
Definition: UefiSpec.h:650
EFI_STATUS(EFIAPI * EFI_REINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *OldInterface, IN VOID *NewInterface)
Definition: UefiSpec.h:1268
EFI_STATUS(EFIAPI * EFI_SET_WATCHDOG_TIMER)(IN UINTN Timeout, IN UINT64 WatchdogCode, IN UINTN DataSize, IN CHAR16 *WatchdogData OPTIONAL)
Definition: UefiSpec.h:1065
EFI_STATUS(EFIAPI * EFI_SIGNAL_EVENT)(IN EFI_EVENT Event)
Definition: UefiSpec.h:576
EFI_STATUS(EFIAPI * EFI_WAIT_FOR_EVENT)(IN UINTN NumberOfEvents, IN EFI_EVENT *Event, OUT UINTN *Index)
Definition: UefiSpec.h:596
VOID(EFIAPI * EFI_SET_MEM)(IN VOID *Buffer, IN UINTN Size, IN UINT8 Value)
Definition: UefiSpec.h:1180
EFI_STATUS(EFIAPI * EFI_UNINSTALL_PROTOCOL_INTERFACE)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, IN VOID *Interface)
Definition: UefiSpec.h:1294
EFI_STATUS(EFIAPI * EFI_FREE_PAGES)(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN Pages)
Definition: UefiSpec.h:224
EFI_STATUS(EFIAPI * EFI_CLOSE_EVENT)(IN EFI_EVENT Event)
Definition: UefiSpec.h:612
EFI_STATUS(EFIAPI * EFI_ALLOCATE_PAGES)(IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *Memory)
Definition: UefiSpec.h:203
EFI_STATUS(EFIAPI * EFI_FREE_POOL)(IN VOID *Buffer)
Definition: UefiSpec.h:302
EFI_STATUS(EFIAPI * EFI_CHECK_EVENT)(IN EFI_EVENT Event)
Definition: UefiSpec.h:628
EFI_STATUS(EFIAPI * EFI_LOCATE_HANDLE_BUFFER)(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, OUT UINTN *NoHandles, OUT EFI_HANDLE **Buffer)
Definition: UefiSpec.h:1618
EFI_STATUS(EFIAPI * EFI_OPEN_PROTOCOL)(IN EFI_HANDLE Handle, IN EFI_GUID *Protocol, OUT VOID **Interface OPTIONAL, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle, IN UINT32 Attributes)
Definition: UefiSpec.h:1377
EFI_STATUS(EFIAPI * EFI_SET_TIMER)(IN EFI_EVENT Event, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime)
Definition: UefiSpec.h:560
EFI_STATUS(EFIAPI * EFI_REGISTER_PROTOCOL_NOTIFY)(IN EFI_GUID *Protocol, IN EFI_EVENT Event, OUT VOID **Registration)
Definition: UefiSpec.h:1496
EFI_STATUS EFIAPI UnitTestFreePages(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN Pages)
EFI_STATUS EFIAPI UnitTestAllocatePool(IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Size, OUT VOID **Buffer)
EFI_STATUS EFIAPI UnitTestAllocatePages(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT EFI_PHYSICAL_ADDRESS *Memory)
EFI_SYSTEM_TABLE * gST
EFI_STATUS EFIAPI UnitTestUefiBootServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_HANDLE gImageHandle
EFI_BOOT_SERVICES * gBS
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)
EFI_STATUS EFIAPI UnitTestCloseProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, IN EFI_HANDLE AgentHandle, IN EFI_HANDLE ControllerHandle)
EFI_STATUS EFIAPI UnitTestRegisterProtocolNotify(IN EFI_GUID *Protocol, IN EFI_EVENT Event, OUT VOID **Registration)
EFI_TPL EFIAPI UnitTestRaiseTpl(IN EFI_TPL NewTpl)
EFI_STATUS EFIAPI UnitTestUnloadImage(IN EFI_HANDLE ImageHandle)
EFI_STATUS EFIAPI UnitTestLocateDevicePath(IN EFI_GUID *Protocol, IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, OUT EFI_HANDLE *Device)
EFI_STATUS EFIAPI UnitTestCalculateCrc32(IN VOID *Data, IN UINTN DataSize, OUT UINT32 *Crc32)
EFI_STATUS EFIAPI UnitTestGetMemoryMap(IN OUT UINTN *MemoryMapSize, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, OUT UINTN *MapKey, OUT UINTN *DescriptorSize, OUT UINT32 *DescriptorVersion)
EFI_STATUS EFIAPI UnitTestInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface)
EFI_STATUS EFIAPI UnitTestSignalEvent(IN EFI_EVENT UserEvent)
EFI_STATUS EFIAPI UnitTestSetWatchdogTimer(IN UINTN Timeout, IN UINT64 WatchdogCode, IN UINTN DataSize, IN CHAR16 *WatchdogData OPTIONAL)
EFI_STATUS EFIAPI UnitTestWaitForEvent(IN UINTN NumberOfEvents, IN EFI_EVENT *UserEvents, OUT UINTN *UserIndex)
EFI_STATUS EFIAPI UnitTestCloseEvent(IN EFI_EVENT UserEvent)
EFI_STATUS EFIAPI UnitTestExit(IN EFI_HANDLE ImageHandle, IN EFI_STATUS Status, IN UINTN ExitDataSize, IN CHAR16 *ExitData OPTIONAL)
EFI_STATUS EFIAPI UnitTestCheckEvent(IN EFI_EVENT UserEvent)
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)
EFI_STATUS EFIAPI UnitTestLoadImage(IN BOOLEAN BootPolicy, IN EFI_HANDLE ParentImageHandle, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN VOID *SourceBuffer OPTIONAL, IN UINTN SourceSize, OUT EFI_HANDLE *ImageHandle)
VOID EFIAPI UnitTestRestoreTpl(IN EFI_TPL NewTpl)
EFI_STATUS EFIAPI UnitTestCreateEventEx(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL IN CONST VOID *NotifyContext, OPTIONAL IN CONST EFI_GUID *EventGroup, OPTIONAL OUT EFI_EVENT *Event)
EFI_STATUS EFIAPI UnitTestStall(IN UINTN Microseconds)
EFI_STATUS EFIAPI UnitTestDisconnectController(IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE DriverImageHandle OPTIONAL, IN EFI_HANDLE ChildHandle OPTIONAL)
EFI_STATUS EFIAPI UnitTestStartImage(IN EFI_HANDLE ImageHandle, OUT UINTN *ExitDataSize, OUT CHAR16 **ExitData OPTIONAL)
EFI_STATUS EFIAPI UnitTestUninstallMultipleProtocolInterfaces(IN EFI_HANDLE Handle,...)
EFI_STATUS EFIAPI UnitTestReinstallProtocolInterface(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, IN VOID *OldInterface, IN VOID *NewInterface)
EFI_STATUS EFIAPI UnitTestUninstallProtocolInterface(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, IN VOID *Interface)
EFI_STATUS EFIAPI UnitTestProtocolsPerHandle(IN EFI_HANDLE UserHandle, OUT EFI_GUID ***ProtocolBuffer, OUT UINTN *ProtocolBufferCount)
EFI_STATUS EFIAPI UnitTestSetTimer(IN EFI_EVENT UserEvent, IN EFI_TIMER_DELAY Type, IN UINT64 TriggerTime)
EFI_STATUS EFIAPI UnitTestGetNextMonotonicCount(OUT UINT64 *Count)
EFI_STATUS EFIAPI UnitTestExitBootServices(IN EFI_HANDLE ImageHandle, IN UINTN MapKey)
EFI_STATUS EFIAPI UnitTestOpenProtocolInformation(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer, OUT UINTN *EntryCount)
EFI_STATUS EFIAPI UnitTestFreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI UnitTestHandleProtocol(IN EFI_HANDLE UserHandle, IN EFI_GUID *Protocol, OUT VOID **Interface)
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 UnitTestLocateHandle(IN EFI_LOCATE_SEARCH_TYPE SearchType, IN EFI_GUID *Protocol OPTIONAL, IN VOID *SearchKey OPTIONAL, IN OUT UINTN *BufferSize, OUT EFI_HANDLE *Buffer)
EFI_STATUS EFIAPI UnitTestInstallConfigurationTable(IN EFI_GUID *Guid, IN VOID *Table)
EFI_STATUS EFIAPI UnitTestInstallMultipleProtocolInterfaces(IN OUT EFI_HANDLE *Handle,...)
EFI_STATUS EFIAPI UnitTestLocateProtocol(IN EFI_GUID *Protocol, IN VOID *Registration OPTIONAL, OUT VOID **Interface)
EFI_STATUS EFIAPI UnitTestCreateEvent(IN UINT32 Type, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL IN VOID *NotifyContext, OPTIONAL OUT EFI_EVENT *Event)