summaryrefslogtreecommitdiffstats
path: root/PrmPkg/Test
diff options
context:
space:
mode:
Diffstat (limited to 'PrmPkg/Test')
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c94
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.h192
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestEventTimer.c32
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestImage.c16
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMemory.c12
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMisc.c20
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.c589
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.h85
-rw-r--r--PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestTpl.c4
9 files changed, 527 insertions, 517 deletions
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c
index d41cba3fea..ea3235e448 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c
@@ -16,10 +16,10 @@
#include "UefiBootServicesTableLibUnitTest.h"
-EFI_HANDLE gImageHandle = NULL;
-EFI_SYSTEM_TABLE *gST = NULL;
+EFI_HANDLE gImageHandle = NULL;
+EFI_SYSTEM_TABLE *gST = NULL;
-STATIC EFI_BOOT_SERVICES mBootServices = {
+STATIC EFI_BOOT_SERVICES mBootServices = {
{
EFI_BOOT_SERVICES_SIGNATURE, // Signature
EFI_BOOT_SERVICES_REVISION, // Revision
@@ -27,50 +27,50 @@ STATIC EFI_BOOT_SERVICES mBootServices = {
0, // CRC32
0 // Reserved
},
- (EFI_RAISE_TPL) UnitTestRaiseTpl, // RaiseTPL
- (EFI_RESTORE_TPL) UnitTestRestoreTpl, // RestoreTPL
- (EFI_ALLOCATE_PAGES) UnitTestAllocatePages, // AllocatePages
- (EFI_FREE_PAGES) UnitTestFreePages, // FreePages
- (EFI_GET_MEMORY_MAP) UnitTestGetMemoryMap, // GetMemoryMap
- (EFI_ALLOCATE_POOL) UnitTestAllocatePool, // AllocatePool
- (EFI_FREE_POOL) UnitTestFreePool, // FreePool
- (EFI_CREATE_EVENT) UnitTestCreateEvent, // CreateEvent
- (EFI_SET_TIMER) UnitTestSetTimer, // SetTimer
- (EFI_WAIT_FOR_EVENT) UnitTestWaitForEvent, // WaitForEvent
- (EFI_SIGNAL_EVENT) UnitTestSignalEvent, // SignalEvent
- (EFI_CLOSE_EVENT) UnitTestCloseEvent, // CloseEvent
- (EFI_CHECK_EVENT) UnitTestCheckEvent, // CheckEvent
- (EFI_INSTALL_PROTOCOL_INTERFACE) UnitTestInstallProtocolInterface, // InstallProtocolInterface
- (EFI_REINSTALL_PROTOCOL_INTERFACE) UnitTestReinstallProtocolInterface, // ReinstallProtocolInterface
- (EFI_UNINSTALL_PROTOCOL_INTERFACE) UnitTestUninstallProtocolInterface, // UninstallProtocolInterface
- (EFI_HANDLE_PROTOCOL) UnitTestHandleProtocol, // HandleProtocol
- (VOID *) NULL, // Reserved
- (EFI_REGISTER_PROTOCOL_NOTIFY) UnitTestRegisterProtocolNotify, // RegisterProtocolNotify
- (EFI_LOCATE_HANDLE) UnitTestLocateHandle, // LocateHandle
- (EFI_LOCATE_DEVICE_PATH) UnitTestLocateDevicePath, // LocateDevicePath
- (EFI_INSTALL_CONFIGURATION_TABLE) UnitTestInstallConfigurationTable, // InstallConfigurationTable
- (EFI_IMAGE_LOAD) UnitTestLoadImage, // LoadImage
- (EFI_IMAGE_START) UnitTestStartImage, // StartImage
- (EFI_EXIT) UnitTestExit, // Exit
- (EFI_IMAGE_UNLOAD) UnitTestUnloadImage, // UnloadImage
- (EFI_EXIT_BOOT_SERVICES) UnitTestExitBootServices, // ExitBootServices
- (EFI_GET_NEXT_MONOTONIC_COUNT) UnitTestGetNextMonotonicCount, // GetNextMonotonicCount
- (EFI_STALL) UnitTestStall, // Stall
- (EFI_SET_WATCHDOG_TIMER) UnitTestSetWatchdogTimer, // SetWatchdogTimer
- (EFI_CONNECT_CONTROLLER) UnitTestConnectController, // ConnectController
- (EFI_DISCONNECT_CONTROLLER) UnitTestDisconnectController, // DisconnectController
- (EFI_OPEN_PROTOCOL) UnitTestOpenProtocol, // OpenProtocol
- (EFI_CLOSE_PROTOCOL) UnitTestCloseProtocol, // CloseProtocol
- (EFI_OPEN_PROTOCOL_INFORMATION) UnitTestOpenProtocolInformation, // OpenProtocolInformation
- (EFI_PROTOCOLS_PER_HANDLE) UnitTestProtocolsPerHandle, // ProtocolsPerHandle
- (EFI_LOCATE_HANDLE_BUFFER) UnitTestLocateHandleBuffer, // LocateHandleBuffer
- (EFI_LOCATE_PROTOCOL) UnitTestLocateProtocol, // LocateProtocol
- (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) UnitTestInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
- (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) UnitTestUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
- (EFI_CALCULATE_CRC32) UnitTestCalculateCrc32, // CalculateCrc32
- (EFI_COPY_MEM) CopyMem, // CopyMem
- (EFI_SET_MEM) SetMem, // SetMem
- (EFI_CREATE_EVENT_EX) UnitTestCreateEventEx // CreateEventEx
+ (EFI_RAISE_TPL)UnitTestRaiseTpl, // RaiseTPL
+ (EFI_RESTORE_TPL)UnitTestRestoreTpl, // RestoreTPL
+ (EFI_ALLOCATE_PAGES)UnitTestAllocatePages, // AllocatePages
+ (EFI_FREE_PAGES)UnitTestFreePages, // FreePages
+ (EFI_GET_MEMORY_MAP)UnitTestGetMemoryMap, // GetMemoryMap
+ (EFI_ALLOCATE_POOL)UnitTestAllocatePool, // AllocatePool
+ (EFI_FREE_POOL)UnitTestFreePool, // FreePool
+ (EFI_CREATE_EVENT)UnitTestCreateEvent, // CreateEvent
+ (EFI_SET_TIMER)UnitTestSetTimer, // SetTimer
+ (EFI_WAIT_FOR_EVENT)UnitTestWaitForEvent, // WaitForEvent
+ (EFI_SIGNAL_EVENT)UnitTestSignalEvent, // SignalEvent
+ (EFI_CLOSE_EVENT)UnitTestCloseEvent, // CloseEvent
+ (EFI_CHECK_EVENT)UnitTestCheckEvent, // CheckEvent
+ (EFI_INSTALL_PROTOCOL_INTERFACE)UnitTestInstallProtocolInterface, // InstallProtocolInterface
+ (EFI_REINSTALL_PROTOCOL_INTERFACE)UnitTestReinstallProtocolInterface, // ReinstallProtocolInterface
+ (EFI_UNINSTALL_PROTOCOL_INTERFACE)UnitTestUninstallProtocolInterface, // UninstallProtocolInterface
+ (EFI_HANDLE_PROTOCOL)UnitTestHandleProtocol, // HandleProtocol
+ (VOID *)NULL, // Reserved
+ (EFI_REGISTER_PROTOCOL_NOTIFY)UnitTestRegisterProtocolNotify, // RegisterProtocolNotify
+ (EFI_LOCATE_HANDLE)UnitTestLocateHandle, // LocateHandle
+ (EFI_LOCATE_DEVICE_PATH)UnitTestLocateDevicePath, // LocateDevicePath
+ (EFI_INSTALL_CONFIGURATION_TABLE)UnitTestInstallConfigurationTable, // InstallConfigurationTable
+ (EFI_IMAGE_LOAD)UnitTestLoadImage, // LoadImage
+ (EFI_IMAGE_START)UnitTestStartImage, // StartImage
+ (EFI_EXIT)UnitTestExit, // Exit
+ (EFI_IMAGE_UNLOAD)UnitTestUnloadImage, // UnloadImage
+ (EFI_EXIT_BOOT_SERVICES)UnitTestExitBootServices, // ExitBootServices
+ (EFI_GET_NEXT_MONOTONIC_COUNT)UnitTestGetNextMonotonicCount, // GetNextMonotonicCount
+ (EFI_STALL)UnitTestStall, // Stall
+ (EFI_SET_WATCHDOG_TIMER)UnitTestSetWatchdogTimer, // SetWatchdogTimer
+ (EFI_CONNECT_CONTROLLER)UnitTestConnectController, // ConnectController
+ (EFI_DISCONNECT_CONTROLLER)UnitTestDisconnectController, // DisconnectController
+ (EFI_OPEN_PROTOCOL)UnitTestOpenProtocol, // OpenProtocol
+ (EFI_CLOSE_PROTOCOL)UnitTestCloseProtocol, // CloseProtocol
+ (EFI_OPEN_PROTOCOL_INFORMATION)UnitTestOpenProtocolInformation, // OpenProtocolInformation
+ (EFI_PROTOCOLS_PER_HANDLE)UnitTestProtocolsPerHandle, // ProtocolsPerHandle
+ (EFI_LOCATE_HANDLE_BUFFER)UnitTestLocateHandleBuffer, // LocateHandleBuffer
+ (EFI_LOCATE_PROTOCOL)UnitTestLocateProtocol, // LocateProtocol
+ (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES)UnitTestInstallMultipleProtocolInterfaces, // InstallMultipleProtocolInterfaces
+ (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)UnitTestUninstallMultipleProtocolInterfaces, // UninstallMultipleProtocolInterfaces
+ (EFI_CALCULATE_CRC32)UnitTestCalculateCrc32, // CalculateCrc32
+ (EFI_COPY_MEM)CopyMem, // CopyMem
+ (EFI_SET_MEM)SetMem, // SetMem
+ (EFI_CREATE_EVENT_EX)UnitTestCreateEventEx // CreateEventEx
};
EFI_BOOT_SERVICES *gBS = &mBootServices;
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.h b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.h
index 687508cf1f..82853bb61a 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.h
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.h
@@ -34,11 +34,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_TPL
EFIAPI
UnitTestRaiseTpl (
- IN EFI_TPL NewTpl
+ IN EFI_TPL NewTpl
);
-
-
/**
Lowers the task priority to the previous value. If the new
priority unmasks events at a higher priority, they are dispatched.
@@ -49,7 +47,7 @@ UnitTestRaiseTpl (
VOID
EFIAPI
UnitTestRestoreTpl (
- IN EFI_TPL NewTpl
+ IN EFI_TPL NewTpl
);
/**
@@ -73,9 +71,9 @@ UnitTestRestoreTpl (
EFI_STATUS
EFIAPI
UnitTestAllocatePages (
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN NumberOfPages,
+ IN EFI_ALLOCATE_TYPE Type,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN NumberOfPages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
);
@@ -93,8 +91,8 @@ UnitTestAllocatePages (
EFI_STATUS
EFIAPI
UnitTestFreePages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN NumberOfPages
+ IN EFI_PHYSICAL_ADDRESS Memory,
+ IN UINTN NumberOfPages
);
/**
@@ -137,8 +135,6 @@ UnitTestGetMemoryMap (
OUT UINT32 *DescriptorVersion
);
-
-
/**
Allocate pool of a particular type.
@@ -172,7 +168,7 @@ UnitTestAllocatePool (
EFI_STATUS
EFIAPI
UnitTestFreePool (
- IN VOID *Buffer
+ IN VOID *Buffer
);
/**
@@ -188,8 +184,8 @@ UnitTestFreePool (
EFI_STATUS
EFIAPI
UnitTestInternalFreePool (
- IN VOID *Buffer,
- OUT EFI_MEMORY_TYPE *PoolType OPTIONAL
+ IN VOID *Buffer,
+ OUT EFI_MEMORY_TYPE *PoolType OPTIONAL
);
/**
@@ -213,9 +209,9 @@ UnitTestInternalFreePool (
EFI_STATUS
EFIAPI
UnitTestCreateEvent (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN UINT32 Type,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN VOID *NotifyContext, OPTIONAL
OUT EFI_EVENT *Event
);
@@ -238,9 +234,9 @@ UnitTestCreateEvent (
EFI_STATUS
EFIAPI
UnitTestSetTimer (
- IN EFI_EVENT UserEvent,
- IN EFI_TIMER_DELAY Type,
- IN UINT64 TriggerTime
+ IN EFI_EVENT UserEvent,
+ IN EFI_TIMER_DELAY Type,
+ IN UINT64 TriggerTime
);
/**
@@ -260,9 +256,9 @@ UnitTestSetTimer (
EFI_STATUS
EFIAPI
UnitTestWaitForEvent (
- IN UINTN NumberOfEvents,
- IN EFI_EVENT *UserEvents,
- OUT UINTN *UserIndex
+ IN UINTN NumberOfEvents,
+ IN EFI_EVENT *UserEvents,
+ OUT UINTN *UserIndex
);
/**
@@ -277,7 +273,7 @@ UnitTestWaitForEvent (
EFI_STATUS
EFIAPI
UnitTestSignalEvent (
- IN EFI_EVENT UserEvent
+ IN EFI_EVENT UserEvent
);
/**
@@ -292,7 +288,7 @@ UnitTestSignalEvent (
EFI_STATUS
EFIAPI
UnitTestCloseEvent (
- IN EFI_EVENT UserEvent
+ IN EFI_EVENT UserEvent
);
/**
@@ -308,7 +304,7 @@ UnitTestCloseEvent (
EFI_STATUS
EFIAPI
UnitTestCheckEvent (
- IN EFI_EVENT UserEvent
+ IN EFI_EVENT UserEvent
);
/**
@@ -328,10 +324,10 @@ UnitTestCheckEvent (
EFI_STATUS
EFIAPI
UnitTestInstallProtocolInterface (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface
+ IN OUT EFI_HANDLE *UserHandle,
+ IN EFI_GUID *Protocol,
+ IN EFI_INTERFACE_TYPE InterfaceType,
+ IN VOID *Interface
);
/**
@@ -351,10 +347,10 @@ UnitTestInstallProtocolInterface (
EFI_STATUS
EFIAPI
UnitTestReinstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *OldInterface,
- IN VOID *NewInterface
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ IN VOID *OldInterface,
+ IN VOID *NewInterface
);
/**
@@ -373,9 +369,9 @@ UnitTestReinstallProtocolInterface (
EFI_STATUS
EFIAPI
UnitTestUninstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ IN VOID *Interface
);
/**
@@ -392,9 +388,9 @@ UnitTestUninstallProtocolInterface (
EFI_STATUS
EFIAPI
UnitTestHandleProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT VOID **Interface
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ OUT VOID **Interface
);
/**
@@ -413,9 +409,9 @@ UnitTestHandleProtocol (
EFI_STATUS
EFIAPI
UnitTestRegisterProtocolNotify (
- IN EFI_GUID *Protocol,
- IN EFI_EVENT Event,
- OUT VOID **Registration
+ IN EFI_GUID *Protocol,
+ IN EFI_EVENT Event,
+ OUT VOID **Registration
);
/**
@@ -439,11 +435,11 @@ UnitTestRegisterProtocolNotify (
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
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,
+ IN EFI_GUID *Protocol OPTIONAL,
+ IN VOID *SearchKey OPTIONAL,
+ IN OUT UINTN *BufferSize,
+ OUT EFI_HANDLE *Buffer
);
/**
@@ -464,9 +460,9 @@ UnitTestLocateHandle (
EFI_STATUS
EFIAPI
UnitTestLocateDevicePath (
- IN EFI_GUID *Protocol,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT EFI_HANDLE *Device
+ IN EFI_GUID *Protocol,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT EFI_HANDLE *Device
);
/**
@@ -487,8 +483,8 @@ UnitTestLocateDevicePath (
EFI_STATUS
EFIAPI
UnitTestInstallConfigurationTable (
- IN EFI_GUID *Guid,
- IN VOID *Table
+ IN EFI_GUID *Guid,
+ IN VOID *Table
);
/**
@@ -528,12 +524,12 @@ UnitTestInstallConfigurationTable (
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
+ IN BOOLEAN BootPolicy,
+ IN EFI_HANDLE ParentImageHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
+ IN VOID *SourceBuffer OPTIONAL,
+ IN UINTN SourceSize,
+ OUT EFI_HANDLE *ImageHandle
);
/**
@@ -626,8 +622,8 @@ UnitTestUnloadImage (
EFI_STATUS
EFIAPI
UnitTestExitBootServices (
- IN EFI_HANDLE ImageHandle,
- IN UINTN MapKey
+ IN EFI_HANDLE ImageHandle,
+ IN UINTN MapKey
);
/**
@@ -643,7 +639,7 @@ UnitTestExitBootServices (
EFI_STATUS
EFIAPI
UnitTestGetNextMonotonicCount (
- OUT UINT64 *Count
+ OUT UINT64 *Count
);
/**
@@ -659,7 +655,7 @@ UnitTestGetNextMonotonicCount (
EFI_STATUS
EFIAPI
UnitTestStall (
- IN UINTN Microseconds
+ IN UINTN Microseconds
);
/**
@@ -687,10 +683,10 @@ UnitTestStall (
EFI_STATUS
EFIAPI
UnitTestSetWatchdogTimer (
- IN UINTN Timeout,
- IN UINT64 WatchdogCode,
- IN UINTN DataSize,
- IN CHAR16 *WatchdogData OPTIONAL
+ IN UINTN Timeout,
+ IN UINT64 WatchdogCode,
+ IN UINTN DataSize,
+ IN CHAR16 *WatchdogData OPTIONAL
);
/**
@@ -791,12 +787,12 @@ UnitTestDisconnectController (
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
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ OUT VOID **Interface OPTIONAL,
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_HANDLE ControllerHandle,
+ IN UINT32 Attributes
);
/**
@@ -827,10 +823,10 @@ UnitTestOpenProtocol (
EFI_STATUS
EFIAPI
UnitTestCloseProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_HANDLE AgentHandle,
- IN EFI_HANDLE ControllerHandle
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ IN EFI_HANDLE AgentHandle,
+ IN EFI_HANDLE ControllerHandle
);
/**
@@ -847,10 +843,10 @@ UnitTestCloseProtocol (
EFI_STATUS
EFIAPI
UnitTestOpenProtocolInformation (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
- OUT UINTN *EntryCount
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
+ OUT UINTN *EntryCount
);
/**
@@ -879,9 +875,9 @@ UnitTestOpenProtocolInformation (
EFI_STATUS
EFIAPI
UnitTestProtocolsPerHandle (
- IN EFI_HANDLE UserHandle,
- OUT EFI_GUID ***ProtocolBuffer,
- OUT UINTN *ProtocolBufferCount
+ IN EFI_HANDLE UserHandle,
+ OUT EFI_GUID ***ProtocolBuffer,
+ OUT UINTN *ProtocolBufferCount
);
/**
@@ -909,11 +905,11 @@ UnitTestProtocolsPerHandle (
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
+ IN EFI_LOCATE_SEARCH_TYPE SearchType,
+ IN EFI_GUID *Protocol OPTIONAL,
+ IN VOID *SearchKey OPTIONAL,
+ IN OUT UINTN *NumberHandles,
+ OUT EFI_HANDLE **Buffer
);
/**
@@ -964,7 +960,7 @@ UnitTestLocateProtocol (
EFI_STATUS
EFIAPI
UnitTestInstallMultipleProtocolInterfaces (
- IN OUT EFI_HANDLE *Handle,
+ IN OUT EFI_HANDLE *Handle,
...
);
@@ -985,7 +981,7 @@ UnitTestInstallMultipleProtocolInterfaces (
EFI_STATUS
EFIAPI
UnitTestUninstallMultipleProtocolInterfaces (
- IN EFI_HANDLE Handle,
+ IN EFI_HANDLE Handle,
...
);
@@ -1007,9 +1003,9 @@ UnitTestUninstallMultipleProtocolInterfaces (
EFI_STATUS
EFIAPI
UnitTestCalculateCrc32 (
- IN VOID *Data,
- IN UINTN DataSize,
- OUT UINT32 *Crc32
+ IN VOID *Data,
+ IN UINTN DataSize,
+ OUT UINT32 *Crc32
);
/**
@@ -1035,11 +1031,11 @@ UnitTestCalculateCrc32 (
EFI_STATUS
EFIAPI
UnitTestCreateEventEx (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN UINT32 Type,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN CONST VOID *NotifyContext, OPTIONAL
- IN CONST EFI_GUID *EventGroup, OPTIONAL
+ IN CONST EFI_GUID *EventGroup, OPTIONAL
OUT EFI_EVENT *Event
);
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestEventTimer.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestEventTimer.c
index 16bd3f4c54..c1ec801bca 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestEventTimer.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestEventTimer.c
@@ -29,9 +29,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
UnitTestCreateEvent (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN UINT32 Type,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN VOID *NotifyContext, OPTIONAL
OUT EFI_EVENT *Event
)
@@ -57,9 +57,9 @@ UnitTestCreateEvent (
EFI_STATUS
EFIAPI
UnitTestSetTimer (
- IN EFI_EVENT UserEvent,
- IN EFI_TIMER_DELAY Type,
- IN UINT64 TriggerTime
+ IN EFI_EVENT UserEvent,
+ IN EFI_TIMER_DELAY Type,
+ IN UINT64 TriggerTime
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -82,9 +82,9 @@ UnitTestSetTimer (
EFI_STATUS
EFIAPI
UnitTestWaitForEvent (
- IN UINTN NumberOfEvents,
- IN EFI_EVENT *UserEvents,
- OUT UINTN *UserIndex
+ IN UINTN NumberOfEvents,
+ IN EFI_EVENT *UserEvents,
+ OUT UINTN *UserIndex
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -102,7 +102,7 @@ UnitTestWaitForEvent (
EFI_STATUS
EFIAPI
UnitTestSignalEvent (
- IN EFI_EVENT UserEvent
+ IN EFI_EVENT UserEvent
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -120,7 +120,7 @@ UnitTestSignalEvent (
EFI_STATUS
EFIAPI
UnitTestCloseEvent (
- IN EFI_EVENT UserEvent
+ IN EFI_EVENT UserEvent
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -139,7 +139,7 @@ UnitTestCloseEvent (
EFI_STATUS
EFIAPI
UnitTestCheckEvent (
- IN EFI_EVENT UserEvent
+ IN EFI_EVENT UserEvent
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -168,11 +168,11 @@ UnitTestCheckEvent (
EFI_STATUS
EFIAPI
UnitTestCreateEventEx (
- IN UINT32 Type,
- IN EFI_TPL NotifyTpl,
- IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+ IN UINT32 Type,
+ IN EFI_TPL NotifyTpl,
+ IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
IN CONST VOID *NotifyContext, OPTIONAL
- IN CONST EFI_GUID *EventGroup, OPTIONAL
+ IN CONST EFI_GUID *EventGroup, OPTIONAL
OUT EFI_EVENT *Event
)
{
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestImage.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestImage.c
index b6083a4c3f..a5799ff92d 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestImage.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestImage.c
@@ -45,12 +45,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
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
+ IN BOOLEAN BootPolicy,
+ IN EFI_HANDLE ParentImageHandle,
+ IN EFI_DEVICE_PATH_PROTOCOL *FilePath,
+ IN VOID *SourceBuffer OPTIONAL,
+ IN UINTN SourceSize,
+ OUT EFI_HANDLE *ImageHandle
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -155,8 +155,8 @@ UnitTestUnloadImage (
EFI_STATUS
EFIAPI
UnitTestExitBootServices (
- IN EFI_HANDLE ImageHandle,
- IN UINTN MapKey
+ IN EFI_HANDLE ImageHandle,
+ IN UINTN MapKey
)
{
return EFI_NOT_AVAILABLE_YET;
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMemory.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMemory.c
index 48da39d0c3..2c9a1989f2 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMemory.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMemory.c
@@ -29,9 +29,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
UnitTestAllocatePages (
- IN EFI_ALLOCATE_TYPE Type,
- IN EFI_MEMORY_TYPE MemoryType,
- IN UINTN NumberOfPages,
+ IN EFI_ALLOCATE_TYPE Type,
+ IN EFI_MEMORY_TYPE MemoryType,
+ IN UINTN NumberOfPages,
IN OUT EFI_PHYSICAL_ADDRESS *Memory
)
{
@@ -52,8 +52,8 @@ UnitTestAllocatePages (
EFI_STATUS
EFIAPI
UnitTestFreePages (
- IN EFI_PHYSICAL_ADDRESS Memory,
- IN UINTN NumberOfPages
+ IN EFI_PHYSICAL_ADDRESS Memory,
+ IN UINTN NumberOfPages
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -138,7 +138,7 @@ UnitTestAllocatePool (
EFI_STATUS
EFIAPI
UnitTestFreePool (
- IN VOID *Buffer
+ IN VOID *Buffer
)
{
return EFI_NOT_AVAILABLE_YET;
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMisc.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMisc.c
index dbe3e76b54..ab79365448 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMisc.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMisc.c
@@ -21,7 +21,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
EFIAPI
UnitTestGetNextMonotonicCount (
- OUT UINT64 *Count
+ OUT UINT64 *Count
)
{
STATIC UINT64 StaticCount = 0;
@@ -44,7 +44,7 @@ UnitTestGetNextMonotonicCount (
EFI_STATUS
EFIAPI
UnitTestStall (
- IN UINTN Microseconds
+ IN UINTN Microseconds
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -75,10 +75,10 @@ UnitTestStall (
EFI_STATUS
EFIAPI
UnitTestSetWatchdogTimer (
- IN UINTN Timeout,
- IN UINT64 WatchdogCode,
- IN UINTN DataSize,
- IN CHAR16 *WatchdogData OPTIONAL
+ IN UINTN Timeout,
+ IN UINT64 WatchdogCode,
+ IN UINTN DataSize,
+ IN CHAR16 *WatchdogData OPTIONAL
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -183,12 +183,12 @@ UnitTestDisconnectController (
EFI_STATUS
EFIAPI
UnitTestCalculateCrc32 (
- IN VOID *Data,
- IN UINTN DataSize,
- OUT UINT32 *Crc32
+ IN VOID *Data,
+ IN UINTN DataSize,
+ OUT UINT32 *Crc32
)
{
- if (Data == NULL || Crc32 == NULL || DataSize == 0) {
+ if ((Data == NULL) || (Crc32 == NULL) || (DataSize == 0)) {
return EFI_INVALID_PARAMETER;
}
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.c
index 65e69ecc3d..799b153a44 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.c
@@ -8,10 +8,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "UefiBootServicesTableLibUnitTestProtocol.h"
-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;
+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;
//
// Helper Functions
@@ -27,12 +27,12 @@ STATIC UINTN mEfiLocateHandleRequest = 0;
**/
EFI_STATUS
- UnitTestValidateHandle (
- IN EFI_HANDLE UserHandle
+UnitTestValidateHandle (
+ IN EFI_HANDLE UserHandle
)
{
- IHANDLE *Handle;
- LIST_ENTRY *Link;
+ IHANDLE *Handle;
+ LIST_ENTRY *Link;
if (UserHandle == NULL) {
return EFI_INVALID_PARAMETER;
@@ -40,7 +40,7 @@ EFI_STATUS
for (Link = gHandleList.BackLink; Link != &gHandleList; Link = Link->BackLink) {
Handle = CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
- if (Handle == (IHANDLE *) UserHandle) {
+ if (Handle == (IHANDLE *)UserHandle) {
return EFI_SUCCESS;
}
}
@@ -59,13 +59,13 @@ EFI_STATUS
**/
PROTOCOL_ENTRY *
UnitTestFindProtocolEntry (
- IN EFI_GUID *Protocol,
- IN BOOLEAN Create
+ IN EFI_GUID *Protocol,
+ IN BOOLEAN Create
)
{
- LIST_ENTRY *Link;
- PROTOCOL_ENTRY *Item;
- PROTOCOL_ENTRY *ProtEntry;
+ LIST_ENTRY *Link;
+ PROTOCOL_ENTRY *Item;
+ PROTOCOL_ENTRY *ProtEntry;
//
// Search the database for the matching GUID
@@ -74,11 +74,10 @@ UnitTestFindProtocolEntry (
ProtEntry = NULL;
for (Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
- Link = Link->ForwardLink) {
-
+ Link = Link->ForwardLink)
+ {
Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
if (CompareGuid (&Item->ProtocolID, Protocol)) {
-
//
// This is the protocol entry
//
@@ -100,7 +99,7 @@ UnitTestFindProtocolEntry (
// Initialize new protocol entry structure
//
ProtEntry->Signature = PROTOCOL_ENTRY_SIGNATURE;
- CopyGuid ((VOID *) &ProtEntry->ProtocolID, Protocol);
+ CopyGuid ((VOID *)&ProtEntry->ProtocolID, Protocol);
InitializeListHead (&ProtEntry->Protocols);
InitializeListHead (&ProtEntry->Notify);
@@ -128,9 +127,9 @@ UnitTestFindProtocolEntry (
**/
PROTOCOL_INTERFACE *
UnitTestFindProtocolInterface (
- IN IHANDLE *Handle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
+ IN IHANDLE *Handle,
+ IN EFI_GUID *Protocol,
+ IN VOID *Interface
)
{
PROTOCOL_INTERFACE *Prot;
@@ -145,17 +144,15 @@ UnitTestFindProtocolInterface (
ProtEntry = UnitTestFindProtocolEntry (Protocol, FALSE);
if (ProtEntry != NULL) {
-
//
// Look at each protocol interface for any matches
//
- for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link=Link->ForwardLink) {
-
+ for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
//
// If this protocol interface matches, remove it
//
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
- if (Prot->Interface == Interface && Prot->Protocol == ProtEntry) {
+ Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
+ if ((Prot->Interface == Interface) && (Prot->Protocol == ProtEntry)) {
break;
}
@@ -174,14 +171,14 @@ UnitTestFindProtocolInterface (
**/
VOID
UnitTestNotifyProtocolEntry (
- IN PROTOCOL_ENTRY *ProtEntry
+ IN PROTOCOL_ENTRY *ProtEntry
)
{
- PROTOCOL_NOTIFY *ProtNotify;
- LIST_ENTRY *Link;
+ PROTOCOL_NOTIFY *ProtNotify;
+ LIST_ENTRY *Link;
- for (Link=ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
+ for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {
+ ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
UnitTestSignalEvent (ProtNotify->Event);
}
}
@@ -199,11 +196,11 @@ UnitTestNotifyProtocolEntry (
**/
IHANDLE *
UnitTestGetNextLocateAllHandles (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
+ IN OUT LOCATE_POSITION *Position,
+ OUT VOID **Interface
)
{
- IHANDLE *Handle;
+ IHANDLE *Handle;
//
// Next handle
@@ -213,8 +210,8 @@ UnitTestGetNextLocateAllHandles (
//
// If not at the end of the list, get the handle
//
- Handle = NULL;
- *Interface = NULL;
+ Handle = NULL;
+ *Interface = NULL;
if (Position->Position != &gHandleList) {
Handle = CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE);
}
@@ -236,8 +233,8 @@ UnitTestGetNextLocateAllHandles (
**/
IHANDLE *
UnitTestGetNextLocateByRegisterNotify (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
+ IN OUT LOCATE_POSITION *Position,
+ OUT VOID **Interface
)
{
IHANDLE *Handle;
@@ -245,8 +242,8 @@ UnitTestGetNextLocateByRegisterNotify (
PROTOCOL_INTERFACE *Prot;
LIST_ENTRY *Link;
- Handle = NULL;
- *Interface = NULL;
+ Handle = NULL;
+ *Interface = NULL;
ProtNotify = Position->SearchKey;
//
@@ -261,8 +258,8 @@ UnitTestGetNextLocateByRegisterNotify (
//
Link = ProtNotify->Position->ForwardLink;
if (Link != &ProtNotify->Protocol->Protocols) {
- Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
- Handle = Prot->Handle;
+ Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
+ Handle = Prot->Handle;
*Interface = Prot->Interface;
}
}
@@ -270,7 +267,6 @@ UnitTestGetNextLocateByRegisterNotify (
return Handle;
}
-
/**
Routine to get the next Handle, when you are searching for a given protocol.
@@ -284,21 +280,21 @@ UnitTestGetNextLocateByRegisterNotify (
**/
IHANDLE *
UnitTestGetNextLocateByProtocol (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
+ IN OUT LOCATE_POSITION *Position,
+ OUT VOID **Interface
)
{
IHANDLE *Handle;
LIST_ENTRY *Link;
PROTOCOL_INTERFACE *Prot;
- Handle = NULL;
- *Interface = NULL;
- for (; ;) {
+ Handle = NULL;
+ *Interface = NULL;
+ for ( ; ;) {
//
// Next entry
//
- Link = Position->Position->ForwardLink;
+ Link = Position->Position->ForwardLink;
Position->Position = Link;
//
@@ -312,8 +308,8 @@ UnitTestGetNextLocateByProtocol (
//
// Get the handle
//
- Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
- Handle = Prot->Handle;
+ Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE);
+ Handle = Prot->Handle;
*Interface = Prot->Interface;
//
@@ -345,14 +341,14 @@ UnitTestGetNextLocateByProtocol (
**/
EFI_STATUS
UnitTestDisconnectControllersUsingProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN PROTOCOL_INTERFACE *Prot
+ IN EFI_HANDLE UserHandle,
+ IN PROTOCOL_INTERFACE *Prot
)
{
- EFI_STATUS Status;
- BOOLEAN ItemFound;
- LIST_ENTRY *Link;
- OPEN_PROTOCOL_DATA *OpenData;
+ EFI_STATUS Status;
+ BOOLEAN ItemFound;
+ LIST_ENTRY *Link;
+ OPEN_PROTOCOL_DATA *OpenData;
Status = EFI_SUCCESS;
@@ -368,6 +364,7 @@ UnitTestDisconnectControllersUsingProtocolInterface (
if (!EFI_ERROR (Status)) {
ItemFound = TRUE;
}
+
break;
}
}
@@ -380,7 +377,8 @@ UnitTestDisconnectControllersUsingProtocolInterface (
for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList;) {
OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
if ((OpenData->Attributes &
- (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0) {
+ (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0)
+ {
Link = RemoveEntryList (&OpenData->Link);
Prot->OpenListCount--;
FreePool (OpenData);
@@ -413,9 +411,9 @@ UnitTestDisconnectControllersUsingProtocolInterface (
**/
PROTOCOL_INTERFACE *
UnitTestRemoveInterfaceFromProtocol (
- IN IHANDLE *Handle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
+ IN IHANDLE *Handle,
+ IN EFI_GUID *Protocol,
+ IN VOID *Interface
)
{
PROTOCOL_INTERFACE *Prot;
@@ -425,14 +423,13 @@ UnitTestRemoveInterfaceFromProtocol (
Prot = UnitTestFindProtocolInterface (Handle, Protocol, Interface);
if (Prot != NULL) {
-
ProtEntry = Prot->Protocol;
//
// If there's a protocol notify location pointing to this entry, back it up one
//
- for(Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link=Link->ForwardLink) {
- ProtNotify = CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
+ for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) {
+ ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE);
if (ProtNotify->Position == &Prot->ByProtocol) {
ProtNotify->Position = Prot->ByProtocol.BackLink;
@@ -463,8 +460,8 @@ UnitTestRemoveInterfaceFromProtocol (
**/
PROTOCOL_INTERFACE *
UnitTestGetProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol
)
{
EFI_STATUS Status;
@@ -478,18 +475,19 @@ UnitTestGetProtocolInterface (
return NULL;
}
- Handle = (IHANDLE *) UserHandle;
+ Handle = (IHANDLE *)UserHandle;
//
// Look at each protocol interface for a match
//
for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) {
- Prot = CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
+ Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE);
ProtEntry = Prot->Protocol;
if (CompareGuid (&ProtEntry->ProtocolID, Protocol)) {
return Prot;
}
}
+
return NULL;
}
@@ -512,11 +510,11 @@ UnitTestGetProtocolInterface (
**/
EFI_STATUS
UnitTestInstallProtocolInterfaceNotify (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface,
- IN BOOLEAN Notify
+ IN OUT EFI_HANDLE *UserHandle,
+ IN EFI_GUID *Protocol,
+ IN EFI_INTERFACE_TYPE InterfaceType,
+ IN VOID *Interface,
+ IN BOOLEAN Notify
)
{
PROTOCOL_INTERFACE *Prot;
@@ -529,7 +527,7 @@ UnitTestInstallProtocolInterfaceNotify (
// returns EFI_INVALID_PARAMETER if InterfaceType is invalid.
// Also added check for invalid UserHandle and Protocol pointers.
//
- if (UserHandle == NULL || Protocol == NULL) {
+ if ((UserHandle == NULL) || (Protocol == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -543,11 +541,11 @@ UnitTestInstallProtocolInterfaceNotify (
UT_LOG_INFO ("InstallProtocolInterface: %g %p\n", Protocol, Interface);
Status = EFI_OUT_OF_RESOURCES;
- Prot = NULL;
+ Prot = NULL;
Handle = NULL;
if (*UserHandle != NULL) {
- Status = UnitTestHandleProtocol (*UserHandle, Protocol, (VOID **) &ExistingInterface);
+ Status = UnitTestHandleProtocol (*UserHandle, Protocol, (VOID **)&ExistingInterface);
if (!EFI_ERROR (Status)) {
return EFI_INVALID_PARAMETER;
}
@@ -573,7 +571,7 @@ UnitTestInstallProtocolInterfaceNotify (
//
// If caller didn't supply a handle, allocate a new one
//
- Handle = (IHANDLE *) *UserHandle;
+ Handle = (IHANDLE *)*UserHandle;
if (Handle == NULL) {
Handle = AllocateZeroPool (sizeof (IHANDLE));
if (Handle == NULL) {
@@ -601,7 +599,7 @@ UnitTestInstallProtocolInterfaceNotify (
} else {
Status = UnitTestValidateHandle (Handle);
if (EFI_ERROR (Status)) {
- DEBUG((DEBUG_ERROR, "InstallProtocolInterface: input handle at 0x%x is invalid\n", Handle));
+ DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: input handle at 0x%x is invalid\n", Handle));
goto Done;
}
}
@@ -615,8 +613,8 @@ UnitTestInstallProtocolInterfaceNotify (
// Initialize the protocol interface structure
//
Prot->Signature = PROTOCOL_INTERFACE_SIGNATURE;
- Prot->Handle = Handle;
- Prot->Protocol = ProtEntry;
+ Prot->Handle = Handle;
+ Prot->Protocol = ProtEntry;
Prot->Interface = Interface;
//
@@ -643,6 +641,7 @@ UnitTestInstallProtocolInterfaceNotify (
if (Notify) {
UnitTestNotifyProtocolEntry (ProtEntry);
}
+
Status = EFI_SUCCESS;
Done:
@@ -658,6 +657,7 @@ Done:
if (Prot != NULL) {
UnitTestFreePool (Prot);
}
+
DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status));
}
@@ -681,19 +681,19 @@ Done:
EFI_STATUS
EFIAPI
UnitTestInstallProtocolInterface (
- IN OUT EFI_HANDLE *UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_INTERFACE_TYPE InterfaceType,
- IN VOID *Interface
+ IN OUT EFI_HANDLE *UserHandle,
+ IN EFI_GUID *Protocol,
+ IN EFI_INTERFACE_TYPE InterfaceType,
+ IN VOID *Interface
)
{
return UnitTestInstallProtocolInterfaceNotify (
- UserHandle,
- Protocol,
- InterfaceType,
- Interface,
- TRUE
- );
+ UserHandle,
+ Protocol,
+ InterfaceType,
+ Interface,
+ TRUE
+ );
}
/**
@@ -713,10 +713,10 @@ UnitTestInstallProtocolInterface (
EFI_STATUS
EFIAPI
UnitTestReinstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *OldInterface,
- IN VOID *NewInterface
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ IN VOID *OldInterface,
+ IN VOID *NewInterface
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -738,14 +738,14 @@ UnitTestReinstallProtocolInterface (
EFI_STATUS
EFIAPI
UnitTestUninstallProtocolInterface (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN VOID *Interface
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ IN VOID *Interface
)
{
- EFI_STATUS Status;
- IHANDLE *Handle;
- PROTOCOL_INTERFACE *Prot;
+ EFI_STATUS Status;
+ IHANDLE *Handle;
+ PROTOCOL_INTERFACE *Prot;
//
// Check that Protocol is valid
@@ -789,7 +789,7 @@ UnitTestUninstallProtocolInterface (
// Remove the protocol interface from the protocol
//
Status = EFI_NOT_FOUND;
- Handle = (IHANDLE *) UserHandle;
+ Handle = (IHANDLE *)UserHandle;
Prot = UnitTestRemoveInterfaceFromProtocol (Handle, Protocol, Interface);
if (Prot != NULL) {
@@ -839,19 +839,19 @@ Done:
EFI_STATUS
EFIAPI
UnitTestHandleProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT VOID **Interface
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ OUT VOID **Interface
)
{
- return UnitTestOpenProtocol (
- UserHandle,
- Protocol,
- Interface,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
- );
+ return UnitTestOpenProtocol (
+ UserHandle,
+ Protocol,
+ Interface,
+ gImageHandle,
+ NULL,
+ EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL
+ );
}
/**
@@ -870,9 +870,9 @@ UnitTestHandleProtocol (
EFI_STATUS
EFIAPI
UnitTestRegisterProtocolNotify (
- IN EFI_GUID *Protocol,
- IN EFI_EVENT Event,
- OUT VOID **Registration
+ IN EFI_GUID *Protocol,
+ IN EFI_EVENT Event,
+ OUT VOID **Registration
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -899,11 +899,11 @@ UnitTestRegisterProtocolNotify (
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
+ 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 Status;
@@ -932,49 +932,52 @@ UnitTestLocateHandle (
Position.SearchKey = SearchKey;
Position.Position = &gHandleList;
- ResultSize = 0;
- ResultBuffer = (IHANDLE **) Buffer;
- Status = EFI_SUCCESS;
+ ResultSize = 0;
+ ResultBuffer = (IHANDLE **)Buffer;
+ Status = EFI_SUCCESS;
//
// Get the search function based on type
//
switch (SearchType) {
- case AllHandles:
- GetNext = UnitTestGetNextLocateAllHandles;
- break;
-
- case ByRegisterNotify:
- //
- // Must have SearchKey for locate ByRegisterNotify
- //
- if (SearchKey == NULL) {
- Status = EFI_INVALID_PARAMETER;
+ case AllHandles:
+ GetNext = UnitTestGetNextLocateAllHandles;
break;
- }
- GetNext = UnitTestGetNextLocateByRegisterNotify;
- break;
- case ByProtocol:
- GetNext = UnitTestGetNextLocateByProtocol;
- if (Protocol == NULL) {
- Status = EFI_INVALID_PARAMETER;
+ case ByRegisterNotify:
+ //
+ // Must have SearchKey for locate ByRegisterNotify
+ //
+ if (SearchKey == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ GetNext = UnitTestGetNextLocateByRegisterNotify;
break;
- }
- //
- // Look up the protocol entry and set the head pointer
- //
- Position.ProtEntry = UnitTestFindProtocolEntry (Protocol, FALSE);
- if (Position.ProtEntry == NULL) {
- Status = EFI_NOT_FOUND;
+
+ case ByProtocol:
+ GetNext = UnitTestGetNextLocateByProtocol;
+ if (Protocol == NULL) {
+ Status = EFI_INVALID_PARAMETER;
+ break;
+ }
+
+ //
+ // Look up the protocol entry and set the head pointer
+ //
+ Position.ProtEntry = UnitTestFindProtocolEntry (Protocol, FALSE);
+ if (Position.ProtEntry == NULL) {
+ Status = EFI_NOT_FOUND;
+ break;
+ }
+
+ Position.Position = &Position.ProtEntry->Protocols;
break;
- }
- Position.Position = &Position.ProtEntry->Protocols;
- break;
- default:
- Status = EFI_INVALID_PARAMETER;
- break;
+ default:
+ Status = EFI_INVALID_PARAMETER;
+ break;
}
if (EFI_ERROR (Status)) {
@@ -986,7 +989,7 @@ UnitTestLocateHandle (
// Enumerate out the matching handles
//
mEfiLocateHandleRequest += 1;
- for (; ;) {
+ for ( ; ;) {
//
// Get the next handle. If no more handles, stop
//
@@ -1001,8 +1004,8 @@ UnitTestLocateHandle (
//
ResultSize += sizeof (Handle);
if (ResultSize <= *BufferSize) {
- *ResultBuffer = Handle;
- ResultBuffer += 1;
+ *ResultBuffer = Handle;
+ ResultBuffer += 1;
}
}
@@ -1023,13 +1026,13 @@ UnitTestLocateHandle (
*BufferSize = ResultSize;
- if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) {
+ if ((SearchType == ByRegisterNotify) && !EFI_ERROR (Status)) {
//
// If this is a search by register notify and a handle was
// returned, update the register notification position
//
ASSERT (SearchKey != NULL);
- ProtNotify = SearchKey;
+ ProtNotify = SearchKey;
ProtNotify->Position = ProtNotify->Position->ForwardLink;
}
}
@@ -1055,9 +1058,9 @@ UnitTestLocateHandle (
EFI_STATUS
EFIAPI
UnitTestLocateDevicePath (
- IN EFI_GUID *Protocol,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
- OUT EFI_HANDLE *Device
+ IN EFI_GUID *Protocol,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
+ OUT EFI_HANDLE *Device
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -1081,8 +1084,8 @@ UnitTestLocateDevicePath (
EFI_STATUS
EFIAPI
UnitTestInstallConfigurationTable (
- IN EFI_GUID *Guid,
- IN VOID *Table
+ IN EFI_GUID *Guid,
+ IN VOID *Table
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -1111,12 +1114,12 @@ UnitTestInstallConfigurationTable (
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
+ 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 Status;
@@ -1154,42 +1157,48 @@ UnitTestOpenProtocol (
// Check for invalid Attributes
//
switch (Attributes) {
- case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
- Status = UnitTestValidateHandle (ImageHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = UnitTestValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- if (UserHandle == ControllerHandle) {
+ case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:
+ Status = UnitTestValidateHandle (ImageHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = UnitTestValidateHandle (ControllerHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ if (UserHandle == ControllerHandle) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ break;
+ case EFI_OPEN_PROTOCOL_BY_DRIVER:
+ case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:
+ Status = UnitTestValidateHandle (ImageHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ Status = UnitTestValidateHandle (ControllerHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ break;
+ case EFI_OPEN_PROTOCOL_EXCLUSIVE:
+ Status = UnitTestValidateHandle (ImageHandle);
+ if (EFI_ERROR (Status)) {
+ return Status;
+ }
+
+ break;
+ case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
+ case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
+ case EFI_OPEN_PROTOCOL_TEST_PROTOCOL:
+ break;
+ default:
return EFI_INVALID_PARAMETER;
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_DRIVER :
- case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :
- Status = UnitTestValidateHandle (ImageHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- Status = UnitTestValidateHandle (ControllerHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- break;
- case EFI_OPEN_PROTOCOL_EXCLUSIVE :
- Status = UnitTestValidateHandle (ImageHandle);
- if (EFI_ERROR (Status)) {
- return Status;
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
- case EFI_OPEN_PROTOCOL_GET_PROTOCOL :
- case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :
- break;
- default:
- return EFI_INVALID_PARAMETER;
}
//
@@ -1203,10 +1212,10 @@ UnitTestOpenProtocol (
Status = EFI_SUCCESS;
- ByDriver = FALSE;
- Exclusive = FALSE;
+ ByDriver = FALSE;
+ Exclusive = FALSE;
for ( Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
+ OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
ExactMatch = (BOOLEAN)((OpenData->AgentHandle == ImageHandle) &&
(OpenData->Attributes == Attributes) &&
(OpenData->ControllerHandle == ControllerHandle));
@@ -1217,6 +1226,7 @@ UnitTestOpenProtocol (
goto Done;
}
}
+
if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) {
Exclusive = TRUE;
} else if (ExactMatch) {
@@ -1234,60 +1244,64 @@ UnitTestOpenProtocol (
//
switch (Attributes) {
- case EFI_OPEN_PROTOCOL_BY_DRIVER :
- if (Exclusive || ByDriver) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE :
- case EFI_OPEN_PROTOCOL_EXCLUSIVE :
- if (Exclusive) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- }
- if (ByDriver) {
- do {
- Disconnect = FALSE;
- for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
- OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
- if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
- Disconnect = TRUE;
- Status = UnitTestDisconnectController (UserHandle, OpenData->AgentHandle, NULL);
- if (EFI_ERROR (Status)) {
- Status = EFI_ACCESS_DENIED;
- goto Done;
- } else {
- break;
+ case EFI_OPEN_PROTOCOL_BY_DRIVER:
+ if (Exclusive || ByDriver) {
+ Status = EFI_ACCESS_DENIED;
+ goto Done;
+ }
+
+ break;
+ case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE:
+ case EFI_OPEN_PROTOCOL_EXCLUSIVE:
+ if (Exclusive) {
+ Status = EFI_ACCESS_DENIED;
+ goto Done;
+ }
+
+ if (ByDriver) {
+ do {
+ Disconnect = FALSE;
+ for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList; Link = Link->ForwardLink) {
+ OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE);
+ if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) {
+ Disconnect = TRUE;
+ Status = UnitTestDisconnectController (UserHandle, OpenData->AgentHandle, NULL);
+ if (EFI_ERROR (Status)) {
+ Status = EFI_ACCESS_DENIED;
+ goto Done;
+ } else {
+ break;
+ }
}
}
- }
- } while (Disconnect);
- }
- break;
- case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER :
- case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL :
- case EFI_OPEN_PROTOCOL_GET_PROTOCOL :
- case EFI_OPEN_PROTOCOL_TEST_PROTOCOL :
- break;
+ } while (Disconnect);
+ }
+
+ break;
+ case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER:
+ case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL:
+ case EFI_OPEN_PROTOCOL_GET_PROTOCOL:
+ case EFI_OPEN_PROTOCOL_TEST_PROTOCOL:
+ break;
}
if (ImageHandle == NULL) {
Status = EFI_SUCCESS;
goto Done;
}
+
//
// Create new entry
//
- OpenData = AllocatePool (sizeof(OPEN_PROTOCOL_DATA));
+ OpenData = AllocatePool (sizeof (OPEN_PROTOCOL_DATA));
if (OpenData == NULL) {
Status = EFI_OUT_OF_RESOURCES;
} else {
- OpenData->Signature = OPEN_PROTOCOL_DATA_SIGNATURE;
- OpenData->AgentHandle = ImageHandle;
- OpenData->ControllerHandle = ControllerHandle;
- OpenData->Attributes = Attributes;
- OpenData->OpenCount = 1;
+ OpenData->Signature = OPEN_PROTOCOL_DATA_SIGNATURE;
+ OpenData->AgentHandle = ImageHandle;
+ OpenData->ControllerHandle = ControllerHandle;
+ OpenData->Attributes = Attributes;
+ OpenData->OpenCount = 1;
InsertTailList (&Prot->OpenList, &OpenData->Link);
Prot->OpenListCount++;
Status = EFI_SUCCESS;
@@ -1300,7 +1314,7 @@ Done:
// Keep Interface unmodified in case of any Error
// except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.
//
- if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) {
+ if (!EFI_ERROR (Status) || (Status == EFI_ALREADY_STARTED)) {
//
// According to above logic, if 'Prot' is NULL, then the 'Status' must be
// EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so 'Prot'
@@ -1354,10 +1368,10 @@ Done:
EFI_STATUS
EFIAPI
UnitTestCloseProtocol (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- IN EFI_HANDLE AgentHandle,
- IN EFI_HANDLE ControllerHandle
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ IN EFI_HANDLE AgentHandle,
+ IN EFI_HANDLE ControllerHandle
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -1377,10 +1391,10 @@ UnitTestCloseProtocol (
EFI_STATUS
EFIAPI
UnitTestOpenProtocolInformation (
- IN EFI_HANDLE UserHandle,
- IN EFI_GUID *Protocol,
- OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
- OUT UINTN *EntryCount
+ IN EFI_HANDLE UserHandle,
+ IN EFI_GUID *Protocol,
+ OUT EFI_OPEN_PROTOCOL_INFORMATION_ENTRY **EntryBuffer,
+ OUT UINTN *EntryCount
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -1412,9 +1426,9 @@ UnitTestOpenProtocolInformation (
EFI_STATUS
EFIAPI
UnitTestProtocolsPerHandle (
- IN EFI_HANDLE UserHandle,
- OUT EFI_GUID ***ProtocolBuffer,
- OUT UINTN *ProtocolBufferCount
+ IN EFI_HANDLE UserHandle,
+ OUT EFI_GUID ***ProtocolBuffer,
+ OUT UINTN *ProtocolBufferCount
)
{
return EFI_NOT_AVAILABLE_YET;
@@ -1445,15 +1459,15 @@ UnitTestProtocolsPerHandle (
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
+ 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 Status;
- UINTN BufferSize;
+ EFI_STATUS Status;
+ UINTN BufferSize;
if (NumberHandles == NULL) {
return EFI_INVALID_PARAMETER;
@@ -1463,26 +1477,27 @@ UnitTestLocateHandleBuffer (
return EFI_INVALID_PARAMETER;
}
- BufferSize = 0;
+ BufferSize = 0;
*NumberHandles = 0;
- *Buffer = NULL;
- Status = UnitTestLocateHandle (
- SearchType,
- Protocol,
- SearchKey,
- &BufferSize,
- *Buffer
- );
+ *Buffer = NULL;
+ Status = UnitTestLocateHandle (
+ SearchType,
+ Protocol,
+ SearchKey,
+ &BufferSize,
+ *Buffer
+ );
//
// LocateHandleBuffer() returns incorrect status code if SearchType is
// invalid.
//
// Add code to correctly handle expected errors from UnitTestLocateHandle().
//
- if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) {
+ if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) {
if (Status != EFI_INVALID_PARAMETER) {
Status = EFI_NOT_FOUND;
}
+
return Status;
}
@@ -1558,7 +1573,7 @@ UnitTestLocateProtocol (
EFI_STATUS
EFIAPI
UnitTestInstallMultipleProtocolInterfaces (
- IN OUT EFI_HANDLE *Handle,
+ IN OUT EFI_HANDLE *Handle,
...
)
{
@@ -1582,15 +1597,15 @@ UnitTestInstallMultipleProtocolInterfaces (
EFI_STATUS
EFIAPI
UnitTestUninstallMultipleProtocolInterfaces (
- IN EFI_HANDLE Handle,
+ IN EFI_HANDLE Handle,
...
)
{
- EFI_STATUS Status;
- VA_LIST Args;
- EFI_GUID *Protocol;
- VOID *Interface;
- UINTN Index;
+ EFI_STATUS Status;
+ VA_LIST Args;
+ EFI_GUID *Protocol;
+ VOID *Interface;
+ UINTN Index;
VA_START (Args, Handle);
for (Index = 0, Status = EFI_SUCCESS; !EFI_ERROR (Status); Index++) {
@@ -1609,6 +1624,7 @@ UnitTestUninstallMultipleProtocolInterfaces (
//
Status = UnitTestUninstallProtocolInterface (Handle, Protocol, Interface);
}
+
VA_END (Args);
//
@@ -1620,11 +1636,12 @@ UnitTestUninstallMultipleProtocolInterfaces (
// Reset the va_arg back to the first argument.
//
VA_START (Args, Handle);
- for (; Index > 1; Index--) {
- Protocol = VA_ARG(Args, EFI_GUID *);
- Interface = VA_ARG(Args, VOID *);
+ for ( ; Index > 1; Index--) {
+ Protocol = VA_ARG (Args, EFI_GUID *);
+ Interface = VA_ARG (Args, VOID *);
UnitTestInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface);
}
+
VA_END (Args);
Status = EFI_INVALID_PARAMETER;
}
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.h b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.h
index 2857db2b2c..6428090071 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.h
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProtocol.h
@@ -14,25 +14,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include "UefiBootServicesTableLibUnitTest.h"
-#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
+#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l')
///
/// IHANDLE - contains a list of protocol handles
///
typedef struct {
- UINTN Signature;
+ UINTN Signature;
/// All handles list of IHANDLE
- LIST_ENTRY AllHandles;
+ LIST_ENTRY AllHandles;
/// List of PROTOCOL_INTERFACE's for this handle
- LIST_ENTRY Protocols;
- UINTN LocateRequest;
+ LIST_ENTRY Protocols;
+ UINTN LocateRequest;
/// The Handle Database Key value when this handle was last created or modified
- UINT64 Key;
+ UINT64 Key;
} IHANDLE;
#define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature == EFI_HANDLE_SIGNATURE)
-#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
+#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e')
///
/// PROTOCOL_ENTRY - each different protocol has 1 entry in the protocol
@@ -40,18 +40,17 @@ typedef struct {
/// with a list of registered notifies.
///
typedef struct {
- UINTN Signature;
+ UINTN Signature;
/// Link Entry inserted to mProtocolDatabase
- LIST_ENTRY AllEntries;
+ LIST_ENTRY AllEntries;
/// ID of the protocol
- EFI_GUID ProtocolID;
+ EFI_GUID ProtocolID;
/// All protocol interfaces
- LIST_ENTRY Protocols;
+ LIST_ENTRY Protocols;
/// Registered notification handlers
- LIST_ENTRY Notify;
+ LIST_ENTRY Notify;
} PROTOCOL_ENTRY;
-
#define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c')
///
@@ -59,65 +58,63 @@ typedef struct {
/// with a protocol interface structure
///
typedef struct {
- UINTN Signature;
+ UINTN Signature;
/// Link on IHANDLE.Protocols
- LIST_ENTRY Link;
+ LIST_ENTRY Link;
/// Back pointer
- IHANDLE *Handle;
+ IHANDLE *Handle;
/// Link on PROTOCOL_ENTRY.Protocols
- LIST_ENTRY ByProtocol;
+ LIST_ENTRY ByProtocol;
/// The protocol ID
- PROTOCOL_ENTRY *Protocol;
+ PROTOCOL_ENTRY *Protocol;
/// The interface value
- VOID *Interface;
+ VOID *Interface;
/// OPEN_PROTOCOL_DATA list
- LIST_ENTRY OpenList;
- UINTN OpenListCount;
-
+ LIST_ENTRY OpenList;
+ UINTN OpenListCount;
} PROTOCOL_INTERFACE;
#define OPEN_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('p','o','d','l')
typedef struct {
- UINTN Signature;
- ///Link on PROTOCOL_INTERFACE.OpenList
- LIST_ENTRY Link;
-
- EFI_HANDLE AgentHandle;
- EFI_HANDLE ControllerHandle;
- UINT32 Attributes;
- UINT32 OpenCount;
+ UINTN Signature;
+ /// Link on PROTOCOL_INTERFACE.OpenList
+ LIST_ENTRY Link;
+
+ EFI_HANDLE AgentHandle;
+ EFI_HANDLE ControllerHandle;
+ UINT32 Attributes;
+ UINT32 OpenCount;
} OPEN_PROTOCOL_DATA;
-
-#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
+#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n')
///
/// PROTOCOL_NOTIFY - used for each register notification for a protocol
///
typedef struct {
- UINTN Signature;
- PROTOCOL_ENTRY *Protocol;
+ UINTN Signature;
+ PROTOCOL_ENTRY *Protocol;
/// All notifications for this protocol
- LIST_ENTRY Link;
+ LIST_ENTRY Link;
/// Event to notify
- EFI_EVENT Event;
+ EFI_EVENT Event;
/// Last position notified
- LIST_ENTRY *Position;
+ LIST_ENTRY *Position;
} PROTOCOL_NOTIFY;
typedef struct {
- EFI_GUID *Protocol;
- VOID *SearchKey;
- LIST_ENTRY *Position;
- PROTOCOL_ENTRY *ProtEntry;
+ EFI_GUID *Protocol;
+ VOID *SearchKey;
+ LIST_ENTRY *Position;
+ PROTOCOL_ENTRY *ProtEntry;
} LOCATE_POSITION;
typedef
IHANDLE *
-(* UNIT_TEST_GET_NEXT) (
- IN OUT LOCATE_POSITION *Position,
- OUT VOID **Interface
+(*UNIT_TEST_GET_NEXT) (
+ IN OUT LOCATE_POSITION *Position,
+ OUT VOID **Interface
);
#endif
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestTpl.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestTpl.c
index 7e1849fbd4..5b7b6700f8 100644
--- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestTpl.c
+++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestTpl.c
@@ -20,7 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_TPL
EFIAPI
UnitTestRaiseTpl (
- IN EFI_TPL NewTpl
+ IN EFI_TPL NewTpl
)
{
return TPL_APPLICATION;
@@ -36,7 +36,7 @@ UnitTestRaiseTpl (
VOID
EFIAPI
UnitTestRestoreTpl (
- IN EFI_TPL NewTpl
+ IN EFI_TPL NewTpl
)
{
return;