diff options
author | Michael Kubacki <michael.kubacki@microsoft.com> | 2022-03-15 14:46:34 -0400 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-04-05 00:42:38 +0000 |
commit | a298a84478053872ed9da660a75f182ce81b8ddc (patch) | |
tree | 95b97a9ee3a91ec1340c15e5e3264bd5f8723292 /PrmPkg | |
parent | f3c11224b55cbad10b357f83d0324588b85862bb (diff) | |
download | edk2-a298a84478053872ed9da660a75f182ce81b8ddc.zip edk2-a298a84478053872ed9da660a75f182ce81b8ddc.tar.gz edk2-a298a84478053872ed9da660a75f182ce81b8ddc.tar.bz2 |
PrmPkg: Apply uncrustify changes
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in PrmPkg.
Cc: Andrew Fish <afish@apple.com>
Cc: Kang Gao <kang.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Liu Yun <yun.y.liu@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
Diffstat (limited to 'PrmPkg')
40 files changed, 1509 insertions, 1439 deletions
diff --git a/PrmPkg/Application/PrmInfo/PrmInfo.c b/PrmPkg/Application/PrmInfo/PrmInfo.c index e479667..0cde2fa 100644 --- a/PrmPkg/Application/PrmInfo/PrmInfo.c +++ b/PrmPkg/Application/PrmInfo/PrmInfo.c @@ -32,25 +32,25 @@ #include "PrmInfo.h"
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPrmInfoHelpTokenId = STRING_TOKEN (STR_PRMINFO_HELP);
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPrmInfoHelpTokenId = STRING_TOKEN (STR_PRMINFO_HELP);
//
// This is the generated String package data for all .UNI files.
// This data array is ready to be used as input of HiiAddPackages() to
// create a packagelist (which contains Form packages, String packages, etc).
//
-extern UINT8 PrmInfoStrings[];
+extern UINT8 PrmInfoStrings[];
-STATIC UINTN mPrmHandlerCount;
-STATIC UINTN mPrmModuleCount;
+STATIC UINTN mPrmHandlerCount;
+STATIC UINTN mPrmModuleCount;
-STATIC EFI_HII_HANDLE mPrmInfoHiiHandle;
-STATIC LIST_ENTRY mPrmHandlerList;
+STATIC EFI_HII_HANDLE mPrmInfoHiiHandle;
+STATIC LIST_ENTRY mPrmHandlerList;
-STATIC CONST SHELL_PARAM_ITEM mParamList[] = {
- {L"-l", TypeFlag},
- {L"-t", TypeValue},
- {NULL, TypeMax}
- };
+STATIC CONST SHELL_PARAM_ITEM mParamList[] = {
+ { L"-l", TypeFlag },
+ { L"-t", TypeValue },
+ { NULL, TypeMax }
+};
/**
Frees all of the nodes in a linked list.
@@ -61,12 +61,12 @@ STATIC CONST SHELL_PARAM_ITEM mParamList[] = { VOID
EFIAPI
FreeList (
- IN LIST_ENTRY *ListHead
+ IN LIST_ENTRY *ListHead
)
{
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
- PRM_HANDLER_CONTEXT_LIST_ENTRY *ListEntry;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *NextLink;
+ PRM_HANDLER_CONTEXT_LIST_ENTRY *ListEntry;
if (ListHead == NULL) {
return;
@@ -75,7 +75,7 @@ FreeList ( Link = GetFirstNode (&mPrmHandlerList);
while (!IsNull (&mPrmHandlerList, Link)) {
ListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
- NextLink = GetNextNode (&mPrmHandlerList, Link);
+ NextLink = GetNextNode (&mPrmHandlerList, Link);
RemoveEntryList (Link);
FreePool (ListEntry);
@@ -96,12 +96,13 @@ CreateNewPrmHandlerListEntry ( VOID
)
{
- PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry;
+ PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry;
PrmHandlerContextListEntry = AllocateZeroPool (sizeof (*PrmHandlerContextListEntry));
if (PrmHandlerContextListEntry == NULL) {
return NULL;
}
+
PrmHandlerContextListEntry->Signature = PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE;
return PrmHandlerContextListEntry;
@@ -118,14 +119,14 @@ PrintMmioRuntimeRangeInfo ( IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
)
{
- UINTN RuntimeMmioRangeCount;
- UINTN RuntimeMmioRangeIndex;
+ UINTN RuntimeMmioRangeCount;
+ UINTN RuntimeMmioRangeIndex;
if (RuntimeMmioRanges == NULL) {
return;
}
- RuntimeMmioRangeCount = (UINTN) RuntimeMmioRanges->Count;
+ RuntimeMmioRangeCount = (UINTN)RuntimeMmioRanges->Count;
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_RUNTIME_MMIO_COUNT), mPrmInfoHiiHandle, RuntimeMmioRangeCount);
for (RuntimeMmioRangeIndex = 0; RuntimeMmioRangeIndex < RuntimeMmioRangeCount; RuntimeMmioRangeIndex++) {
@@ -154,25 +155,25 @@ PrintMmioRuntimeRangeInfo ( **/
VOID
GatherPrmHandlerInfo (
- IN BOOLEAN PrintInformation
+ IN BOOLEAN PrintInformation
)
{
- EFI_STATUS Status;
- UINT16 MajorVersion;
- UINT16 MinorVersion;
- UINT16 HandlerCount;
- UINTN HandlerIndex;
- EFI_PHYSICAL_ADDRESS CurrentHandlerPhysicalAddress;
- EFI_PHYSICAL_ADDRESS CurrentImageAddress;
- PRM_HANDLER_CONTEXT CurrentHandlerContext;
- EFI_GUID *CurrentModuleGuid;
- EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
- PRM_CONTEXT_BUFFER *CurrentContextBuffer;
- PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
- PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
- PRM_HANDLER_CONTEXT_LIST_ENTRY *CurrentHandlerContextListEntry;
- PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
- PRM_RUNTIME_MMIO_RANGES *CurrentPrmModuleRuntimeMmioRanges;
+ EFI_STATUS Status;
+ UINT16 MajorVersion;
+ UINT16 MinorVersion;
+ UINT16 HandlerCount;
+ UINTN HandlerIndex;
+ EFI_PHYSICAL_ADDRESS CurrentHandlerPhysicalAddress;
+ EFI_PHYSICAL_ADDRESS CurrentImageAddress;
+ PRM_HANDLER_CONTEXT CurrentHandlerContext;
+ EFI_GUID *CurrentModuleGuid;
+ EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
+ PRM_CONTEXT_BUFFER *CurrentContextBuffer;
+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
+ PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
+ PRM_HANDLER_CONTEXT_LIST_ENTRY *CurrentHandlerContextListEntry;
+ PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
+ PRM_RUNTIME_MMIO_RANGES *CurrentPrmModuleRuntimeMmioRanges;
ASSERT (mPrmModuleCount <= mPrmHandlerCount);
@@ -182,25 +183,25 @@ GatherPrmHandlerInfo ( // Iterate across all PRM modules discovered
for (
- CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
- !EFI_ERROR (Status);
- Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) {
-
- CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
- CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
+ CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
+ !EFI_ERROR (Status);
+ Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext))
+ {
+ CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
+ CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
CurrentModuleGuid = &CurrentExportDescriptorStruct->Header.ModuleGuid;
- HandlerCount = CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
+ HandlerCount = CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
MajorVersion = 0;
MinorVersion = 0;
- Status = GetImageVersionInPeCoffImage (
- (VOID *) (UINTN) CurrentImageAddress,
- &CurrentPrmModuleImageContext->PeCoffImageContext,
- &MajorVersion,
- &MinorVersion
- );
+ Status = GetImageVersionInPeCoffImage (
+ (VOID *)(UINTN)CurrentImageAddress,
+ &CurrentPrmModuleImageContext->PeCoffImageContext,
+ &MajorVersion,
+ &MinorVersion
+ );
ASSERT_EFI_ERROR (Status);
if (PrintInformation) {
@@ -210,7 +211,7 @@ GatherPrmHandlerInfo ( NULL,
STRING_TOKEN (STR_PRMINFO_MODULE_NAME),
mPrmInfoHiiHandle,
- (CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirectory->Name)
+ (CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory->Name)
);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_GUID), mPrmInfoHiiHandle, CurrentModuleGuid);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_VERSION), mPrmInfoHiiHandle, MajorVersion, MinorVersion);
@@ -218,13 +219,13 @@ GatherPrmHandlerInfo ( // It is currently valid for a PRM module not to use a context buffer
CurrentPrmModuleRuntimeMmioRanges = NULL;
- Status = GetModuleContextBuffers (
- ByModuleGuid,
- CurrentModuleGuid,
- (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContextBuffers
- );
+ Status = GetModuleContextBuffers (
+ ByModuleGuid,
+ CurrentModuleGuid,
+ (CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers
+ );
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
- if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {
+ if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers != NULL)) {
CurrentPrmModuleRuntimeMmioRanges = CurrentModuleContextBuffers->RuntimeMmioRanges;
}
@@ -234,6 +235,7 @@ GatherPrmHandlerInfo ( } else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_MMIO_RANGES), mPrmInfoHiiHandle);
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_COUNT), mPrmInfoHiiHandle, HandlerCount);
}
@@ -241,9 +243,9 @@ GatherPrmHandlerInfo ( for (HandlerIndex = 0; HandlerIndex < HandlerCount; HandlerIndex++) {
ZeroMem (&CurrentHandlerContext, sizeof (CurrentHandlerContext));
- CurrentHandlerContext.ModuleName = (CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirectory->Name);
- CurrentHandlerContext.Guid = &CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid;
- CurrentHandlerContext.Name = (CHAR8 *) CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
+ CurrentHandlerContext.ModuleName = (CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory->Name);
+ CurrentHandlerContext.Guid = &CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid;
+ CurrentHandlerContext.Name = (CHAR8 *)CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
if (PrintInformation) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NAME), mPrmInfoHiiHandle, CurrentHandlerContext.Name);
@@ -258,7 +260,7 @@ GatherPrmHandlerInfo ( );
ASSERT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
- CurrentHandlerContext.Handler = (PRM_HANDLER *) (UINTN) CurrentHandlerPhysicalAddress;
+ CurrentHandlerContext.Handler = (PRM_HANDLER *)(UINTN)CurrentHandlerPhysicalAddress;
if (PrintInformation) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_PA), mPrmInfoHiiHandle, CurrentHandlerPhysicalAddress);
@@ -272,7 +274,7 @@ GatherPrmHandlerInfo ( Status = GetContextBuffer (
CurrentHandlerContext.Guid,
CurrentModuleContextBuffers,
- (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer
+ (CONST PRM_CONTEXT_BUFFER **)&CurrentContextBuffer
);
if (!EFI_ERROR (Status)) {
CurrentHandlerContext.StaticDataBuffer = CurrentContextBuffer->StaticDataBuffer;
@@ -286,7 +288,7 @@ GatherPrmHandlerInfo ( NULL,
STRING_TOKEN (STR_PRMINFO_STATIC_DATA_BUFFER),
mPrmInfoHiiHandle,
- (UINTN) CurrentHandlerContext.StaticDataBuffer
+ (UINTN)CurrentHandlerContext.StaticDataBuffer
);
} else {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
@@ -324,19 +326,19 @@ GatherPrmHandlerInfo ( **/
EFI_STATUS
PopulateContextBuffer (
- IN PRM_DATA_BUFFER *StaticDataBuffer OPTIONAL,
- IN EFI_GUID *HandlerGuid,
- IN PRM_CONTEXT_BUFFER *ContextBuffer
+ IN PRM_DATA_BUFFER *StaticDataBuffer OPTIONAL,
+ IN EFI_GUID *HandlerGuid,
+ IN PRM_CONTEXT_BUFFER *ContextBuffer
)
{
- if (HandlerGuid == NULL || ContextBuffer == NULL) {
+ if ((HandlerGuid == NULL) || (ContextBuffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
ZeroMem (ContextBuffer, sizeof (*ContextBuffer));
ContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
- ContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
+ ContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
CopyGuid (&ContextBuffer->HandlerGuid, HandlerGuid);
if (StaticDataBuffer != NULL) {
@@ -354,7 +356,7 @@ PopulateContextBuffer ( **/
VOID
PrintExecutionTime (
- IN UINT64 TimeInNanoSec
+ IN UINT64 TimeInNanoSec
)
{
UINT64 Sec;
@@ -363,24 +365,24 @@ PrintExecutionTime ( UINT64 NanoSec;
UINT64 RemainingTime;
- Sec = 0;
- MilliSec = 0;
- MicroSec = 0;
- NanoSec = 0;
+ Sec = 0;
+ MilliSec = 0;
+ MicroSec = 0;
+ NanoSec = 0;
RemainingTime = TimeInNanoSec;
- if (RemainingTime > ONE_SECOND) {
- Sec = DivU64x32 (RemainingTime, ONE_SECOND);
+ if (RemainingTime > ONE_SECOND) {
+ Sec = DivU64x32 (RemainingTime, ONE_SECOND);
RemainingTime -= MultU64x32 (Sec, ONE_SECOND);
}
if (RemainingTime > ONE_MILLISECOND) {
- MilliSec = DivU64x32 (RemainingTime, ONE_MILLISECOND);
+ MilliSec = DivU64x32 (RemainingTime, ONE_MILLISECOND);
RemainingTime -= MultU64x32 (MilliSec, ONE_MILLISECOND);
}
if (RemainingTime > ONE_MICROSECOND) {
- MicroSec = DivU64x32 (RemainingTime, ONE_MICROSECOND);
+ MicroSec = DivU64x32 (RemainingTime, ONE_MICROSECOND);
RemainingTime -= MultU64x32 (MicroSec, ONE_MICROSECOND);
}
@@ -412,20 +414,20 @@ PrintExecutionTime ( **/
EFI_STATUS
ExecutePrmHandlerByGuid (
- IN EFI_GUID *HandlerGuid
+ IN EFI_GUID *HandlerGuid
)
{
- EFI_STATUS Status;
- BOOLEAN ExecuteAllHandlers;
- BOOLEAN HandlerFound;
- UINT64 StartTime;
- UINT64 EndTime;
- PRM_CONTEXT_BUFFER CurrentContextBuffer;
- PRM_HANDLER_CONTEXT *HandlerContext;
- PRM_HANDLER_CONTEXT_LIST_ENTRY *HandlerContextListEntry;
- LIST_ENTRY *Link;
-
- Link = NULL;
+ EFI_STATUS Status;
+ BOOLEAN ExecuteAllHandlers;
+ BOOLEAN HandlerFound;
+ UINT64 StartTime;
+ UINT64 EndTime;
+ PRM_CONTEXT_BUFFER CurrentContextBuffer;
+ PRM_HANDLER_CONTEXT *HandlerContext;
+ PRM_HANDLER_CONTEXT_LIST_ENTRY *HandlerContextListEntry;
+ LIST_ENTRY *Link;
+
+ Link = NULL;
HandlerFound = FALSE;
if (HandlerGuid == NULL) {
@@ -439,14 +441,14 @@ ExecutePrmHandlerByGuid ( EFI_LIST_FOR_EACH (Link, &mPrmHandlerList) {
HandlerContextListEntry = CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE);
- HandlerContext = &HandlerContextListEntry->Context;
+ HandlerContext = &HandlerContextListEntry->Context;
if (!ExecuteAllHandlers && !CompareGuid (HandlerGuid, HandlerContext->Guid)) {
continue;
}
HandlerFound = TRUE;
- Status = PopulateContextBuffer (HandlerContext->StaticDataBuffer, HandlerContext->Guid, &CurrentContextBuffer);
+ Status = PopulateContextBuffer (HandlerContext->StaticDataBuffer, HandlerContext->Guid, &CurrentContextBuffer);
if (!EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
ShellPrintHiiEx (
@@ -461,10 +463,11 @@ ExecutePrmHandlerByGuid ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_GUID), mPrmInfoHiiHandle, HandlerContext->Guid);
StartTime = 0;
- EndTime = 0;
+ EndTime = 0;
if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) {
StartTime = GetPerformanceCounter ();
}
+
Status = HandlerContext->Handler (NULL, &CurrentContextBuffer);
if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) {
EndTime = GetPerformanceCounter ();
@@ -477,11 +480,12 @@ ExecutePrmHandlerByGuid ( }
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_EXEC_TIME), mPrmInfoHiiHandle);
- if (StartTime == 0 && EndTime == 0) {
+ if ((StartTime == 0) && (EndTime == 0)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_UNKNOWN), mPrmInfoHiiHandle);
} else {
PrintExecutionTime (GetTimeInNanoSecond (EndTime - StartTime));
}
+
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
} else {
@@ -519,20 +523,20 @@ ParseParameterList ( VOID
)
{
- EFI_STATUS Status;
- EFI_STATUS ReturnStatus;
- UINTN ArgumentCount;
- EFI_GUID HandlerGuid;
- BOOLEAN PrintHandlerInfo;
- LIST_ENTRY *Package;
- LIST_ENTRY *TempNode;
- CHAR16 *ProblemParam;
- CONST CHAR16 *HandlerGuidStr;
-
- HandlerGuidStr = NULL;
- Package = NULL;
+ EFI_STATUS Status;
+ EFI_STATUS ReturnStatus;
+ UINTN ArgumentCount;
+ EFI_GUID HandlerGuid;
+ BOOLEAN PrintHandlerInfo;
+ LIST_ENTRY *Package;
+ LIST_ENTRY *TempNode;
+ CHAR16 *ProblemParam;
+ CONST CHAR16 *HandlerGuidStr;
+
+ HandlerGuidStr = NULL;
+ Package = NULL;
PrintHandlerInfo = FALSE;
- ReturnStatus = EFI_SUCCESS;
+ ReturnStatus = EFI_SUCCESS;
InitializeListHead (&mPrmHandlerList);
@@ -541,7 +545,7 @@ ParseParameterList ( //
Status = ShellCommandLineParseEx (mParamList, &Package, &ProblemParam, FALSE, FALSE);
if (EFI_ERROR (Status)) {
- if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
+ if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_GEN_PROBLEM), mPrmInfoHiiHandle, APPLICATION_NAME, ProblemParam);
ReturnStatus = EFI_INVALID_PARAMETER;
FreePool (ProblemParam);
@@ -561,10 +565,12 @@ ParseParameterList ( // Get argument count including flags
//
for (
- ArgumentCount = 0, TempNode = Package;
- GetNextNode (Package, TempNode) != Package;
- ArgumentCount++, TempNode = GetNextNode (Package, TempNode)
- );
+ ArgumentCount = 0, TempNode = Package;
+ GetNextNode (Package, TempNode) != Package;
+ ArgumentCount++, TempNode = GetNextNode (Package, TempNode)
+ )
+ {
+ }
if (ArgumentCount == 1) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_ARG), mPrmInfoHiiHandle, APPLICATION_NAME);
@@ -635,13 +641,14 @@ ParseParameterList ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLERS_FOUND), mPrmInfoHiiHandle, mPrmHandlerCount);
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle);
}
+
GatherPrmHandlerInfo (PrintHandlerInfo);
if (HandlerGuidStr != NULL) {
- Status = ExecutePrmHandlerByGuid (&HandlerGuid);
- if (Status == EFI_NOT_FOUND) {
- ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NOT_FOUND), mPrmInfoHiiHandle, APPLICATION_NAME, HandlerGuid);
- }
+ Status = ExecutePrmHandlerByGuid (&HandlerGuid);
+ if (Status == EFI_NOT_FOUND) {
+ ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_NOT_FOUND), mPrmInfoHiiHandle, APPLICATION_NAME, HandlerGuid);
+ }
}
Done:
@@ -667,12 +674,12 @@ Done: EFI_STATUS
EFIAPI
UefiMain (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_HII_PACKAGE_LIST_HEADER *PackageList;
+ EFI_STATUS Status;
+ EFI_HII_PACKAGE_LIST_HEADER *PackageList;
//
// Retrieve the HII package list from ImageHandle
@@ -680,7 +687,7 @@ UefiMain ( Status = gBS->OpenProtocol (
ImageHandle,
&gEfiHiiPackageListProtocolGuid,
- (VOID **) &PackageList,
+ (VOID **)&PackageList,
ImageHandle,
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
diff --git a/PrmPkg/Application/PrmInfo/PrmInfo.h b/PrmPkg/Application/PrmInfo/PrmInfo.h index c2c3fa2..3813998 100644 --- a/PrmPkg/Application/PrmInfo/PrmInfo.h +++ b/PrmPkg/Application/PrmInfo/PrmInfo.h @@ -14,24 +14,24 @@ #include <PrmDataBuffer.h>
#include <Uefi.h>
-#define APPLICATION_NAME L"PrmInfo"
+#define APPLICATION_NAME L"PrmInfo"
-#define PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','H','E')
+#define PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','H','E')
#pragma pack(push, 1)
typedef struct {
- CHAR8 *Name;
- EFI_GUID *Guid;
- PRM_DATA_BUFFER *StaticDataBuffer;
- CHAR8 *ModuleName;
- PRM_HANDLER *Handler;
+ CHAR8 *Name;
+ EFI_GUID *Guid;
+ PRM_DATA_BUFFER *StaticDataBuffer;
+ CHAR8 *ModuleName;
+ PRM_HANDLER *Handler;
} PRM_HANDLER_CONTEXT;
typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- PRM_HANDLER_CONTEXT Context;
+ UINTN Signature;
+ LIST_ENTRY Link;
+ PRM_HANDLER_CONTEXT Context;
} PRM_HANDLER_CONTEXT_LIST_ENTRY;
#pragma pack(pop)
@@ -42,8 +42,8 @@ typedef struct { #define EFI_LIST_FOR_EACH(Entry, ListHead) \
for(Entry = (ListHead)->ForwardLink; Entry != (ListHead); Entry = Entry->ForwardLink)
-#define ONE_MICROSECOND (1000)
-#define ONE_MILLISECOND (1000 * ONE_MICROSECOND)
-#define ONE_SECOND (1000 * ONE_MILLISECOND)
+#define ONE_MICROSECOND (1000)
+#define ONE_MILLISECOND (1000 * ONE_MICROSECOND)
+#define ONE_SECOND (1000 * ONE_MILLISECOND)
#endif
diff --git a/PrmPkg/Include/Library/PrmContextBufferLib.h b/PrmPkg/Include/Library/PrmContextBufferLib.h index 93dcd1e..8416b6a 100644 --- a/PrmPkg/Include/Library/PrmContextBufferLib.h +++ b/PrmPkg/Include/Library/PrmContextBufferLib.h @@ -42,9 +42,9 @@ typedef enum { **/
EFI_STATUS
FindContextBufferInModuleBuffers (
- IN CONST EFI_GUID *HandlerGuid,
- IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
- OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
+ IN CONST EFI_GUID *HandlerGuid,
+ IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
+ OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
);
/**
@@ -68,9 +68,9 @@ FindContextBufferInModuleBuffers ( **/
EFI_STATUS
GetModuleContextBuffers (
- IN PRM_GUID_SEARCH_TYPE GuidSearchType,
- IN CONST EFI_GUID *Guid,
- OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
+ IN PRM_GUID_SEARCH_TYPE GuidSearchType,
+ IN CONST EFI_GUID *Guid,
+ OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
);
/**
@@ -91,9 +91,9 @@ GetModuleContextBuffers ( **/
EFI_STATUS
GetContextBuffer (
- IN CONST EFI_GUID *PrmHandlerGuid,
- IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
- OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
+ IN CONST EFI_GUID *PrmHandlerGuid,
+ IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
+ OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
);
#endif
diff --git a/PrmPkg/Include/Library/PrmModuleDiscoveryLib.h b/PrmPkg/Include/Library/PrmModuleDiscoveryLib.h index fe3a425..341b9b2 100644 --- a/PrmPkg/Include/Library/PrmModuleDiscoveryLib.h +++ b/PrmPkg/Include/Library/PrmModuleDiscoveryLib.h @@ -28,7 +28,7 @@ EFI_STATUS
EFIAPI
GetNextPrmModuleEntry (
- IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
+ IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
);
/**
@@ -53,8 +53,8 @@ GetNextPrmModuleEntry ( EFI_STATUS
EFIAPI
DiscoverPrmModules (
- OUT UINTN *ModuleCount OPTIONAL,
- OUT UINTN *HandlerCount OPTIONAL
+ OUT UINTN *ModuleCount OPTIONAL,
+ OUT UINTN *HandlerCount OPTIONAL
);
#endif
diff --git a/PrmPkg/Include/Library/PrmPeCoffLib.h b/PrmPkg/Include/Library/PrmPeCoffLib.h index 4698a94..a3cbeba 100644 --- a/PrmPkg/Include/Library/PrmPeCoffLib.h +++ b/PrmPkg/Include/Library/PrmPeCoffLib.h @@ -34,9 +34,9 @@ **/
EFI_STATUS
GetPrmModuleExportDescriptorTable (
- IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
- OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
+ IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
+ OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
);
/**
@@ -57,9 +57,9 @@ GetPrmModuleExportDescriptorTable ( **/
EFI_STATUS
GetExportDirectoryInPeCoffImage (
- IN VOID *Image,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
- OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
+ IN VOID *Image,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
+ OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
);
/**
@@ -80,10 +80,10 @@ GetExportDirectoryInPeCoffImage ( **/
EFI_STATUS
GetImageVersionInPeCoffImage (
- IN VOID *Image,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
- OUT UINT16 *ImageMajorVersion,
- OUT UINT16 *ImageMinorVersion
+ IN VOID *Image,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
+ OUT UINT16 *ImageMajorVersion,
+ OUT UINT16 *ImageMinorVersion
);
/**
@@ -102,10 +102,10 @@ GetImageVersionInPeCoffImage ( **/
EFI_STATUS
GetExportEntryAddress (
- IN CONST CHAR8 *ExportName,
- IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
- IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
- OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
+ IN CONST CHAR8 *ExportName,
+ IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
+ IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
+ OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
);
#endif
diff --git a/PrmPkg/Include/Prm.h b/PrmPkg/Include/Prm.h index 0e3ccff..e290e53 100644 --- a/PrmPkg/Include/Prm.h +++ b/PrmPkg/Include/Prm.h @@ -13,16 +13,16 @@ #include <Uefi.h>
#include <PrmContextBuffer.h>
-#if defined(_MSC_VER)
- #define PRM_EXPORT_API __declspec(dllexport)
+#if defined (_MSC_VER)
+#define PRM_EXPORT_API __declspec(dllexport)
#else
- #define PRM_EXPORT_API
+#define PRM_EXPORT_API
#endif
-#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128
+#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128
-#define PRM_STRING_(x) #x
-#define PRM_STRING(x) PRM_STRING_(x)
+#define PRM_STRING_(x) #x
+#define PRM_STRING(x) PRM_STRING_(x)
/**
A Platform Runtime Mechanism (PRM) handler function.
@@ -38,7 +38,7 @@ **/
typedef
EFI_STATUS
-(EFIAPI PRM_HANDLER) (
+(EFIAPI PRM_HANDLER)(
IN VOID *ParameterBuffer OPTIONAL,
IN PRM_CONTEXT_BUFFER *ContextBuffer OPTIONAL
);
diff --git a/PrmPkg/Include/PrmContextBuffer.h b/PrmPkg/Include/PrmContextBuffer.h index 8694801..781910d 100644 --- a/PrmPkg/Include/PrmContextBuffer.h +++ b/PrmPkg/Include/PrmContextBuffer.h @@ -27,8 +27,8 @@ // copy the ACPI parameter buffer address to the PRMT ACPI table.
//
typedef struct {
- EFI_GUID HandlerGuid;
- UINT64 AcpiParameterBufferAddress;
+ EFI_GUID HandlerGuid;
+ UINT64 AcpiParameterBufferAddress;
} ACPI_PARAMETER_BUFFER_DESCRIPTOR;
//
@@ -45,22 +45,22 @@ typedef struct { ///
/// Signature of this interface.
///
- UINT32 Signature;
+ UINT32 Signature;
///
/// Version of this interface.
///
- UINT16 Version;
+ UINT16 Version;
///
/// Reserved field.
///
- UINT16 Reserved;
+ UINT16 Reserved;
///
/// The GUID of the PRM handler represented by this context instance.
///
- EFI_GUID HandlerGuid;
+ EFI_GUID HandlerGuid;
///
/// A virtual address pointer to the static data buffer allocated for
@@ -71,7 +71,7 @@ typedef struct { ///
/// This pointer may be NULL if a static data buffer is not needed.
///
- PRM_DATA_BUFFER *StaticDataBuffer;
+ PRM_DATA_BUFFER *StaticDataBuffer;
///
/// A virtual address pointer to an array of PRM_RUNTIME_MMIO_RANGE
@@ -91,30 +91,29 @@ typedef struct { ///
/// This pointer may be NULL if runtime memory ranges are not needed.
///
- PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
+ PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
} PRM_CONTEXT_BUFFER;
//
// A firmware internal data structure used to track context buffer and
// runtime MMIO range usage across a PRM module.
//
-typedef struct
-{
+typedef struct {
///
/// The GUID of the PRM module.
///
- EFI_GUID ModuleGuid;
+ EFI_GUID ModuleGuid;
///
/// The number of PRM context buffers in ContextBuffers[].
/// This count should equal the number of PRM handlers in the module being configured.
///
- UINTN BufferCount;
+ UINTN BufferCount;
///
/// A pointer to an array of PRM context buffers
///
- PRM_CONTEXT_BUFFER *Buffer;
+ PRM_CONTEXT_BUFFER *Buffer;
/// The MMIO ranges are defined in the firmware boot environment.
/// The addresses within the PRM_RUNTIME_MMIO_RANGES structure will
@@ -135,13 +134,13 @@ typedef struct ///
/// This pointer may be NULL if runtime memory ranges are not needed.
///
- PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
+ PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
///
/// The number of ACPI parameter buffer descriptors in the array
/// AcpiParameterBufferDescriptors
///
- UINTN AcpiParameterBufferDescriptorCount;
+ UINTN AcpiParameterBufferDescriptorCount;
///
/// A pointer to an array of ACPI parameter buffer descriptors. PRM module
@@ -164,7 +163,7 @@ typedef struct /// for each PRM handler that actually uses an ACPI parameter buffer. If
/// no handlers use an ACPI parameter buffer this pointer should be NULL.
///
- ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParameterBufferDescriptors;
+ ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParameterBufferDescriptors;
} PRM_MODULE_CONTEXT_BUFFERS;
#pragma pack(pop)
diff --git a/PrmPkg/Include/PrmDataBuffer.h b/PrmPkg/Include/PrmDataBuffer.h index 70d690c..c5181f4 100644 --- a/PrmPkg/Include/PrmDataBuffer.h +++ b/PrmPkg/Include/PrmDataBuffer.h @@ -12,7 +12,7 @@ #include <Uefi.h>
-#define PRM_DATA_BUFFER_HEADER_SIGNATURE SIGNATURE_32('P','R','M','D')
+#define PRM_DATA_BUFFER_HEADER_SIGNATURE SIGNATURE_32('P','R','M','D')
#pragma pack(push, 1)
@@ -23,11 +23,11 @@ typedef struct { ///
/// PRM Data Buffer signature.
///
- UINT32 Signature;
+ UINT32 Signature;
///
/// Length of the entire data buffer, including the size of the header.
///
- UINT32 Length;
+ UINT32 Length;
} PRM_DATA_BUFFER_HEADER;
///
@@ -37,12 +37,12 @@ typedef struct { ///
/// The header is required at the beginning of every PRM data buffer.
///
- PRM_DATA_BUFFER_HEADER Header;
+ PRM_DATA_BUFFER_HEADER Header;
///
/// The beginning of data immediately follows the header.
///
- UINT8 Data[1];
+ UINT8 Data[1];
} PRM_DATA_BUFFER;
#pragma pack(pop)
diff --git a/PrmPkg/Include/PrmExportDescriptor.h b/PrmPkg/Include/PrmExportDescriptor.h index 76b67a0..85b38ea 100644 --- a/PrmPkg/Include/PrmExportDescriptor.h +++ b/PrmPkg/Include/PrmExportDescriptor.h @@ -12,9 +12,9 @@ #include <Prm.h>
-#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescriptor
-#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')
-#define PRM_MODULE_EXPORT_REVISION 0x0
+#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescriptor
+#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', 'M', '_', 'M', 'E', 'D', 'T')
+#define PRM_MODULE_EXPORT_REVISION 0x0
//
// Platform Runtime Mechanism (PRM) Export Descriptor Structures
@@ -22,30 +22,30 @@ #pragma pack(push, 1)
typedef struct {
- GUID PrmHandlerGuid;
- CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];
+ GUID PrmHandlerGuid;
+ CHAR8 PrmHandlerName[PRM_HANDLER_NAME_MAXIMUM_LENGTH];
} PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT;
typedef struct {
- UINT64 Signature;
- UINT16 Revision;
- UINT16 NumberPrmHandlers;
- GUID PlatformGuid;
- GUID ModuleGuid;
+ UINT64 Signature;
+ UINT16 Revision;
+ UINT16 NumberPrmHandlers;
+ GUID PlatformGuid;
+ GUID ModuleGuid;
} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER;
typedef struct {
- PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header;
- PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1];
+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header;
+ PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptors[1];
} PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT;
#pragma pack(pop)
-#if defined(_MSC_VER)
- #define PRM_PACKED_STRUCT(definition) \
+#if defined (_MSC_VER)
+#define PRM_PACKED_STRUCT(definition) \
__pragma(pack(push, 1)) typedef struct definition __pragma(pack(pop))
#elif defined (__GNUC__) || defined (__clang__)
- #define PRM_PACKED_STRUCT(definition) \
+#define PRM_PACKED_STRUCT(definition) \
typedef struct __attribute__((packed)) definition
#endif
@@ -67,6 +67,7 @@ typedef struct { PRM_STRING_(Name) \
} \
+
/**
A macro that returns the count of the number of variable-length arguments given.
diff --git a/PrmPkg/Include/PrmMmio.h b/PrmPkg/Include/PrmMmio.h index fb216c2..6aca19f 100644 --- a/PrmPkg/Include/PrmMmio.h +++ b/PrmPkg/Include/PrmMmio.h @@ -20,9 +20,9 @@ /// The memory range with the given base address and length will be marked as EFI_MEMORY_RUNTIME.
///
typedef struct {
- EFI_PHYSICAL_ADDRESS PhysicalBaseAddress;
- EFI_PHYSICAL_ADDRESS VirtualBaseAddress;
- UINT32 Length;
+ EFI_PHYSICAL_ADDRESS PhysicalBaseAddress;
+ EFI_PHYSICAL_ADDRESS VirtualBaseAddress;
+ UINT32 Length;
} PRM_RUNTIME_MMIO_RANGE;
///
@@ -33,11 +33,11 @@ typedef struct { ///
/// The number of runtime memory range elements in this buffer.
///
- UINT64 Count;
+ UINT64 Count;
///
/// The beginning of the runtime memory range data.
///
- PRM_RUNTIME_MMIO_RANGE Range[1];
+ PRM_RUNTIME_MMIO_RANGE Range[1];
} PRM_RUNTIME_MMIO_RANGES;
#pragma pack(pop)
diff --git a/PrmPkg/Include/PrmModule.h b/PrmPkg/Include/PrmModule.h index 1369add..094f7d1 100644 --- a/PrmPkg/Include/PrmModule.h +++ b/PrmPkg/Include/PrmModule.h @@ -26,16 +26,16 @@ #define PRM_HANDLER_EXPORT(Name) \
STATIC_ASSERT (sizeof (PRM_STRING_(Name)) <= PRM_HANDLER_NAME_MAXIMUM_LENGTH, "The PRM handler exceeds the maximum allowed size of 128."); \
\
-/** \
- A Platform Runtime Mechanism (PRM) handler. \
- \
- @param[in] ParameterBuffer A pointer to the PRM handler parameter buffer \
- @param[in] ContextBUffer A pointer to the PRM handler context buffer \
- \
- @retval EFI_STATUS The PRM handler executed successfully. \
- @retval Others An error occurred in the PRM handler. \
- \
-**/ \
+ /** \
+ A Platform Runtime Mechanism (PRM) handler. \
+ \
+ @param[in] ParameterBuffer A pointer to the PRM handler parameter buffer \
+ @param[in] ContextBUffer A pointer to the PRM handler context buffer \
+ \
+ @retval EFI_STATUS The PRM handler executed successfully. \
+ @retval Others An error occurred in the PRM handler. \
+ \
+ **/ \
EFI_STATUS \
PRM_EXPORT_API \
EFIAPI \
diff --git a/PrmPkg/Include/PrmModuleImageContext.h b/PrmPkg/Include/PrmModuleImageContext.h index 10146a2..0e38144 100644 --- a/PrmPkg/Include/PrmModuleImageContext.h +++ b/PrmPkg/Include/PrmModuleImageContext.h @@ -18,9 +18,9 @@ #pragma pack(push, 1)
typedef struct {
- PE_COFF_LOADER_IMAGE_CONTEXT PeCoffImageContext;
- EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
- PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *ExportDescriptor;
+ PE_COFF_LOADER_IMAGE_CONTEXT PeCoffImageContext;
+ EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *ExportDescriptor;
} PRM_MODULE_IMAGE_CONTEXT;
#pragma pack(pop)
diff --git a/PrmPkg/Include/Protocol/PrmConfig.h b/PrmPkg/Include/Protocol/PrmConfig.h index d90fe5a..4cce6b3 100644 --- a/PrmPkg/Include/Protocol/PrmConfig.h +++ b/PrmPkg/Include/Protocol/PrmConfig.h @@ -19,14 +19,13 @@ typedef struct _PRM_CONFIG_PROTOCOL PRM_CONFIG_PROTOCOL;
-#define PRM_CONFIG_PROTOCOL_SIGNATURE SIGNATURE_32('P','M','C','P')
-#define PRM_CONFIG_PROTOCOL_VERSION 1
+#define PRM_CONFIG_PROTOCOL_SIGNATURE SIGNATURE_32('P','M','C','P')
+#define PRM_CONFIG_PROTOCOL_VERSION 1
-struct _PRM_CONFIG_PROTOCOL
-{
- PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
+struct _PRM_CONFIG_PROTOCOL {
+ PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
};
-extern EFI_GUID gPrmConfigProtocolGuid;
+extern EFI_GUID gPrmConfigProtocolGuid;
#endif
diff --git a/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c b/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c index 1a1a15b..3036aa5 100644 --- a/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c +++ b/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c @@ -14,7 +14,7 @@ #include <Library/UefiBootServicesTableLib.h>
#include <Protocol/PrmConfig.h>
-#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]"
+#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]"
/**
Finds a PRM context buffer for the given PRM handler GUID.
@@ -33,16 +33,16 @@ **/
EFI_STATUS
FindContextBufferInModuleBuffers (
- IN CONST EFI_GUID *HandlerGuid,
- IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
- OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
+ IN CONST EFI_GUID *HandlerGuid,
+ IN CONST PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers,
+ OUT CONST PRM_CONTEXT_BUFFER **ContextBuffer
)
{
- UINTN Index;
+ UINTN Index;
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
- if (HandlerGuid == NULL || ModuleContextBuffers == NULL || ContextBuffer == NULL) {
+ if ((HandlerGuid == NULL) || (ModuleContextBuffers == NULL) || (ContextBuffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -77,23 +77,24 @@ FindContextBufferInModuleBuffers ( **/
EFI_STATUS
GetModuleContextBuffers (
- IN PRM_GUID_SEARCH_TYPE GuidSearchType,
- IN CONST EFI_GUID *Guid,
- OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
+ IN PRM_GUID_SEARCH_TYPE GuidSearchType,
+ IN CONST EFI_GUID *Guid,
+ OUT CONST PRM_MODULE_CONTEXT_BUFFERS **PrmModuleContextBuffers
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- UINTN Index;
- EFI_HANDLE *HandleBuffer;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
- CONST PRM_CONTEXT_BUFFER *PrmContextBuffer;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ UINTN Index;
+ EFI_HANDLE *HandleBuffer;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ CONST PRM_CONTEXT_BUFFER *PrmContextBuffer;
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
- if (Guid == NULL || PrmModuleContextBuffers == NULL) {
+ if ((Guid == NULL) || (PrmModuleContextBuffers == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
*PrmModuleContextBuffers = NULL;
Status = gBS->LocateHandleBuffer (
@@ -108,10 +109,10 @@ GetModuleContextBuffers ( Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gPrmConfigProtocolGuid,
- (VOID **) &PrmConfigProtocol
+ (VOID **)&PrmConfigProtocol
);
ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) {
+ if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) {
continue;
}
@@ -167,19 +168,20 @@ GetModuleContextBuffers ( **/
EFI_STATUS
GetContextBuffer (
- IN CONST EFI_GUID *PrmHandlerGuid,
- IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
- OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
+ IN CONST EFI_GUID *PrmHandlerGuid,
+ IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTIONAL,
+ OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer
)
{
- EFI_STATUS Status;
- CONST PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
+ EFI_STATUS Status;
+ CONST PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
- if (PrmHandlerGuid == NULL || PrmContextBuffer == NULL) {
+ if ((PrmHandlerGuid == NULL) || (PrmContextBuffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
*PrmContextBuffer = NULL;
if (PrmModuleContextBuffers == NULL) {
@@ -190,6 +192,7 @@ GetContextBuffer ( } else {
ContextBuffers = PrmModuleContextBuffers;
}
+
Status = FindContextBufferInModuleBuffers (PrmHandlerGuid, ContextBuffers, PrmContextBuffer);
return Status;
diff --git a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c index 07e2473..e244e7b 100644 --- a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c +++ b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUnitTest.c @@ -27,69 +27,69 @@ #include <Library/UnitTestLib.h>
#include <Protocol/PrmConfig.h>
-#define UNIT_TEST_NAME "PRM Context Buffer Library Unit Test"
-#define UNIT_TEST_VERSION "0.1"
+#define UNIT_TEST_NAME "PRM Context Buffer Library Unit Test"
+#define UNIT_TEST_VERSION "0.1"
-///=== TEST DATA ==================================================================================
+/// === TEST DATA ==================================================================================
EFI_HANDLE mTestProtocolHandle;
-//*----------------------------------------------------------------------------------*
-//* Context Structures *
-//*----------------------------------------------------------------------------------*
+// *----------------------------------------------------------------------------------*
+// * Context Structures *
+// *----------------------------------------------------------------------------------*
typedef struct {
- PRM_MODULE_CONTEXT_BUFFERS *InstallationStructure;
- EFI_HANDLE Handle;
- PRM_GUID_SEARCH_TYPE GuidSearchType;
- EFI_GUID *Guid;
- EFI_GUID *ExpectedModuleGuid;
- EFI_STATUS ExpectedStatus;
+ PRM_MODULE_CONTEXT_BUFFERS *InstallationStructure;
+ EFI_HANDLE Handle;
+ PRM_GUID_SEARCH_TYPE GuidSearchType;
+ EFI_GUID *Guid;
+ EFI_GUID *ExpectedModuleGuid;
+ EFI_STATUS ExpectedStatus;
} PRM_CONTEXT_BUFFERS_TEST_CONTEXT;
typedef struct {
- EFI_GUID *HandlerGuid;
- PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
- PRM_CONTEXT_BUFFER *ExpectedContextBuffer;
- EFI_STATUS ExpectedStatus;
+ EFI_GUID *HandlerGuid;
+ PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
+ PRM_CONTEXT_BUFFER *ExpectedContextBuffer;
+ EFI_STATUS ExpectedStatus;
} PRM_CONTEXT_BUFFER_TEST_CONTEXT;
-//*----------------------------------------------------------------------------------*
-//* Test GUIDs *
-//*----------------------------------------------------------------------------------*
+// *----------------------------------------------------------------------------------*
+// * Test GUIDs *
+// *----------------------------------------------------------------------------------*
// {52960b90-2f3a-4917-b91a-ed5f599a8809}
-#define HANDLER_TEST_GUID_1 {0x52960b90, 0x2f3a, 0x4917, { 0xb9, 0x1a, 0xed, 0x5f, 0x59, 0x9a, 0x88, 0x09 }}
-EFI_GUID mHandlerTestGuid1 = HANDLER_TEST_GUID_1;
+#define HANDLER_TEST_GUID_1 {0x52960b90, 0x2f3a, 0x4917, { 0xb9, 0x1a, 0xed, 0x5f, 0x59, 0x9a, 0x88, 0x09 }}
+EFI_GUID mHandlerTestGuid1 = HANDLER_TEST_GUID_1;
// {9316a80d-06dc-417b-b21d-6b3c2ae4ed6f}
-#define HANDLER_TEST_GUID_2 {0x9316a80d, 0x06dc, 0x417b, { 0xb2, 0x1d, 0x6b, 0x3c, 0x2a, 0xe4, 0xed, 0x6f }}
-EFI_GUID mHandlerTestGuid2 = HANDLER_TEST_GUID_2;
+#define HANDLER_TEST_GUID_2 {0x9316a80d, 0x06dc, 0x417b, { 0xb2, 0x1d, 0x6b, 0x3c, 0x2a, 0xe4, 0xed, 0x6f }}
+EFI_GUID mHandlerTestGuid2 = HANDLER_TEST_GUID_2;
// {d32ac8ba-6cc6-456f-9ed9-9233fa310434}
-#define HANDLER_TEST_GUID_3 {0xd32ac8ba, 0x6cc6, 0x456f, { 0x9e, 0xd9, 0x92, 0x33, 0xfa, 0x31, 0x04, 0x34 }}
-EFI_GUID mHandlerTestGuid3 = HANDLER_TEST_GUID_3;
+#define HANDLER_TEST_GUID_3 {0xd32ac8ba, 0x6cc6, 0x456f, { 0x9e, 0xd9, 0x92, 0x33, 0xfa, 0x31, 0x04, 0x34 }}
+EFI_GUID mHandlerTestGuid3 = HANDLER_TEST_GUID_3;
// {faadaa95-070b-4a34-a919-18305dc07370}
-#define MODULE_TEST_GUID_1 {0xfaadaa95, 0x070b, 0x4a34, { 0xa9, 0x19, 0x18, 0x30, 0x5d, 0xc0, 0x73, 0x70 }}
-EFI_GUID mModuleTestGuid1 = MODULE_TEST_GUID_1;
+#define MODULE_TEST_GUID_1 {0xfaadaa95, 0x070b, 0x4a34, { 0xa9, 0x19, 0x18, 0x30, 0x5d, 0xc0, 0x73, 0x70 }}
+EFI_GUID mModuleTestGuid1 = MODULE_TEST_GUID_1;
// {0ea24584-731c-4863-9100-75780af509a7}
-#define MODULE_TEST_GUID_2 {0x0ea24584, 0x731c, 0x4863, { 0x91, 0x00, 0x75, 0x78, 0x0a, 0xf5, 0x09, 0xa7 }}
-EFI_GUID mModuleTestGuid2 = MODULE_TEST_GUID_2;
+#define MODULE_TEST_GUID_2 {0x0ea24584, 0x731c, 0x4863, { 0x91, 0x00, 0x75, 0x78, 0x0a, 0xf5, 0x09, 0xa7 }}
+EFI_GUID mModuleTestGuid2 = MODULE_TEST_GUID_2;
// {f456b7a1-82a6-4427-8486-87e3a602df43}
-#define MODULE_TEST_GUID_3 {0xf456b7a1, 0x82a6, 0x4427, { 0x84, 0x86, 0x87, 0xe3, 0xa6, 0x02, 0xdf, 0x43 }}
-EFI_GUID mModuleTestGuid3 = MODULE_TEST_GUID_3;
+#define MODULE_TEST_GUID_3 {0xf456b7a1, 0x82a6, 0x4427, { 0x84, 0x86, 0x87, 0xe3, 0xa6, 0x02, 0xdf, 0x43 }}
+EFI_GUID mModuleTestGuid3 = MODULE_TEST_GUID_3;
// {4a941a9c-9dcf-471b-94b5-d9e2d8c64a1b}
-#define NEGATIVE_TEST_GUID {0x4a941a9c, 0x9dcf, 0x471b, {0x94, 0xb5, 0xd9, 0xe2, 0xd8, 0xc6, 0x4a, 0x1b }}
-EFI_GUID mNegativeTestGuid = NEGATIVE_TEST_GUID;
+#define NEGATIVE_TEST_GUID {0x4a941a9c, 0x9dcf, 0x471b, {0x94, 0xb5, 0xd9, 0xe2, 0xd8, 0xc6, 0x4a, 0x1b }}
+EFI_GUID mNegativeTestGuid = NEGATIVE_TEST_GUID;
-//*----------------------------------------------------------------------------------*
-//* PRM Static Test Structures *
-//*----------------------------------------------------------------------------------*
+// *----------------------------------------------------------------------------------*
+// * PRM Static Test Structures *
+// *----------------------------------------------------------------------------------*
-PRM_DATA_BUFFER mTestStaticDataBuffer1 = {
+PRM_DATA_BUFFER mTestStaticDataBuffer1 = {
{
PRM_DATA_BUFFER_HEADER_SIGNATURE,
sizeof (PRM_DATA_BUFFER)
@@ -97,7 +97,7 @@ PRM_DATA_BUFFER mTestStaticDataBuffer1 = { // No data in the buffer (only a header)
};
-PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 = {
+PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 = {
PRM_CONTEXT_BUFFER_SIGNATURE, // Signature
PRM_CONTEXT_BUFFER_INTERFACE_VERSION, // Version
0, // Reserved
@@ -105,7 +105,7 @@ PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 = { &mTestStaticDataBuffer1 // StaticDataBuffer
};
-PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] = {
+PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] = {
// Context buffer #1
{
PRM_CONTEXT_BUFFER_SIGNATURE, // Signature
@@ -124,56 +124,55 @@ PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] = { }
};
-PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers1 = {
+PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers1 = {
MODULE_TEST_GUID_1,
1,
&mTestPrmContextBuffer1,
NULL
};
-PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers2 = {
+PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers2 = {
MODULE_TEST_GUID_2,
1,
&mTestPrmContextBuffer1,
NULL
};
-PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 = {
+PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 = {
MODULE_TEST_GUID_3,
2,
&mTestPrmContextBuffer2[0],
NULL
};
+// *----------------------------------------------------------------------------------*
+// * Test Contexts *
+// *----------------------------------------------------------------------------------*
-//*----------------------------------------------------------------------------------*
-//* Test Contexts *
-//*----------------------------------------------------------------------------------*
-
-//* Searches by module GUID *
+// * Searches by module GUID *
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
// + InstallationStructure | Handle | GuidSearchType | Guid | ExpectedModuleGuid | ExpectedStatus |
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers00 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &mModuleTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers01 = { &mTestPrmModuleContextBuffers2, NULL, ByModuleGuid, &mModuleTestGuid2, &mModuleTestGuid2, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers02 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mModuleTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers03 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers04 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers00 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &mModuleTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers01 = { &mTestPrmModuleContextBuffers2, NULL, ByModuleGuid, &mModuleTestGuid2, &mModuleTestGuid2, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers02 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mModuleTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers03 = { &mTestPrmModuleContextBuffers3, NULL, ByModuleGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers04 = { &mTestPrmModuleContextBuffers1, NULL, ByModuleGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
-//* Searches by handler GUID *
+// * Searches by handler GUID *
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
// + InstallationStructure | Handle | GuidSearchType | Guid | ExpectedModuleGuid | ExpectedStatus |
// +--------------------------------+--------+----------------+--------------------+--------------------+--------------------+
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers05 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers06 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers07 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid2, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers08 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers09 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid1, &gZeroGuid, EFI_NOT_FOUND };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers10 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid2, &mModuleTestGuid3, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers11 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers12 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
-
-PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] = {
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers05 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid1, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers06 = { &mTestPrmModuleContextBuffers1, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers07 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGuid2, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers08 = { &mTestPrmModuleContextBuffers2, NULL, ByHandlerGuid, &mNegativeTestGuid, &gZeroGuid, EFI_NOT_FOUND };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers09 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid1, &gZeroGuid, EFI_NOT_FOUND };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers10 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid2, &mModuleTestGuid3, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers11 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid3, &mModuleTestGuid3, EFI_SUCCESS };
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers12 = { &mTestPrmModuleContextBuffers3, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOUND };
+
+PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] = {
&mContextBuffers00,
&mContextBuffers01,
&mContextBuffers02,
@@ -192,14 +191,14 @@ PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] = { // +----------------------+----------------------------------+------------------------------------------+--------------------+
// + HandlerGuid | ContextBuffers | ExpectedContextBuffer | ExpectedStatus |
// +----------------------+----------------------------------+------------------------------------------+--------------------+
-PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer00 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers1, &mTestPrmContextBuffer1, EFI_SUCCESS };
-PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer01 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers2, &mTestPrmContextBuffer1, EFI_SUCCESS };
-PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer02 = { &mHandlerTestGuid2, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[0], EFI_SUCCESS };
-PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer03 = { &mHandlerTestGuid3, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[1], EFI_SUCCESS };
-PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer04 = { &mNegativeTestGuid, &mTestPrmModuleContextBuffers1, NULL, EFI_NOT_FOUND };
-PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer05 = { &gZeroGuid, &mTestPrmModuleContextBuffers3, NULL, EFI_NOT_FOUND };
-
-PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = {
+PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer00 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers1, &mTestPrmContextBuffer1, EFI_SUCCESS };
+PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer01 = { &mHandlerTestGuid1, &mTestPrmModuleContextBuffers2, &mTestPrmContextBuffer1, EFI_SUCCESS };
+PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer02 = { &mHandlerTestGuid2, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[0], EFI_SUCCESS };
+PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer03 = { &mHandlerTestGuid3, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[1], EFI_SUCCESS };
+PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer04 = { &mNegativeTestGuid, &mTestPrmModuleContextBuffers1, NULL, EFI_NOT_FOUND };
+PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer05 = { &gZeroGuid, &mTestPrmModuleContextBuffers3, NULL, EFI_NOT_FOUND };
+
+PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = {
&mContextBuffer00,
&mContextBuffer01,
&mContextBuffer02,
@@ -208,13 +207,13 @@ PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = { &mContextBuffer05
};
-///=== HELPER FUNCTIONS ===========================================================================
+/// === HELPER FUNCTIONS ===========================================================================
// None
-///=== TEST CASES =================================================================================
+/// === TEST CASES =================================================================================
-///===== BASIC SUITE ==================================================
+/// ===== BASIC SUITE ==================================================
/**
Verifies that passing NULL arguments to all library functions fails with EFI_INVALID_PARAMETER.
@@ -229,13 +228,13 @@ PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] = { UNIT_TEST_STATUS
EFIAPI
NullPointerArgumentsShouldFailGracefully (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_GUID Guid;
- PRM_CONTEXT_BUFFER *ContextBufferPtr;
- PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
- PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffersPtr;
+ EFI_GUID Guid;
+ PRM_CONTEXT_BUFFER *ContextBufferPtr;
+ PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers;
+ PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffersPtr;
UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, NULL, NULL), EFI_INVALID_PARAMETER);
UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, &ModuleContextBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER);
@@ -254,7 +253,7 @@ NullPointerArgumentsShouldFailGracefully ( return UNIT_TEST_PASSED;
}
-///===== FUNCTIONAL CORRECTNESS SUITE ==================================================
+/// ===== FUNCTIONAL CORRECTNESS SUITE ==================================================
/**
Functional Correctness pre-requisite function.
@@ -275,16 +274,16 @@ STATIC UNIT_TEST_STATUS
EFIAPI
InitializeFunctionalCorrectness (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
- PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers;
- PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
+ EFI_STATUS Status;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ PRM_MODULE_CONTEXT_BUFFERS *ModuleContextBuffers;
+ PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
UT_ASSERT_NOT_NULL (Context);
- TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context;
+ TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
ModuleContextBuffers = TestContext->InstallationStructure;
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
@@ -294,14 +293,14 @@ InitializeFunctionalCorrectness ( CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &ModuleContextBuffers->ModuleGuid);
PrmConfigProtocol->ModuleContextBuffers.BufferCount = ModuleContextBuffers->BufferCount;
- PrmConfigProtocol->ModuleContextBuffers.Buffer = ModuleContextBuffers->Buffer;
+ PrmConfigProtocol->ModuleContextBuffers.Buffer = ModuleContextBuffers->Buffer;
Status = gBS->InstallProtocolInterface (
- &TestContext->Handle,
- &gPrmConfigProtocolGuid,
- EFI_NATIVE_INTERFACE,
- (VOID *) PrmConfigProtocol
- );
+ &TestContext->Handle,
+ &gPrmConfigProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ (VOID *)PrmConfigProtocol
+ );
UT_ASSERT_NOT_EFI_ERROR (Status);
return UNIT_TEST_PASSED;
@@ -326,20 +325,20 @@ STATIC UNIT_TEST_STATUS
EFIAPI
DeInitializeFunctionalCorrectness (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
- PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
+ EFI_STATUS Status;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
UT_ASSERT_NOT_NULL (Context);
- TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context;
+ TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
Status = gBS->HandleProtocol (
TestContext->Handle,
&gPrmConfigProtocolGuid,
- (VOID **) &PrmConfigProtocol
+ (VOID **)&PrmConfigProtocol
);
UT_ASSERT_NOT_EFI_ERROR (Status);
@@ -348,7 +347,7 @@ DeInitializeFunctionalCorrectness ( TestContext->Handle,
&gPrmConfigProtocolGuid,
PrmConfigProtocol
- );
+ );
UT_ASSERT_NOT_EFI_ERROR (Status);
if (!EFI_ERROR (Status)) {
FreePool (PrmConfigProtocol);
@@ -373,15 +372,15 @@ DeInitializeFunctionalCorrectness ( UNIT_TEST_STATUS
EFIAPI
VerifyGetModuleContextBuffers (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status;
- PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
- PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
+ EFI_STATUS Status;
+ PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
+ PRM_CONTEXT_BUFFERS_TEST_CONTEXT *TestContext;
ContextBuffers = NULL;
- TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context;
+ TestContext = (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context;
Status = GetModuleContextBuffers (TestContext->GuidSearchType, TestContext->Guid, &ContextBuffers);
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
@@ -393,7 +392,7 @@ VerifyGetModuleContextBuffers ( __FUNCTION__,
((TestContext->GuidSearchType == ByModuleGuid) ? "module" : "handler"),
TestContext->Guid,
- (UINTN) ContextBuffers
+ (UINTN)ContextBuffers
);
}
@@ -415,17 +414,17 @@ VerifyGetModuleContextBuffers ( UNIT_TEST_STATUS
EFIAPI
VerifyFindContextBufferInModuleBuffers (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status;
- PRM_CONTEXT_BUFFER *FoundContextBuffer;
- PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
- PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
+ EFI_STATUS Status;
+ PRM_CONTEXT_BUFFER *FoundContextBuffer;
+ PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
+ PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
- ContextBuffers = NULL;
+ ContextBuffers = NULL;
FoundContextBuffer = NULL;
- TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *) Context;
+ TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
Status = FindContextBufferInModuleBuffers (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
@@ -461,17 +460,17 @@ VerifyFindContextBufferInModuleBuffers ( UNIT_TEST_STATUS
EFIAPI
VerifyGetContextBuffer (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- EFI_STATUS Status;
- PRM_CONTEXT_BUFFER *FoundContextBuffer;
- PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
- PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
+ EFI_STATUS Status;
+ PRM_CONTEXT_BUFFER *FoundContextBuffer;
+ PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers;
+ PRM_CONTEXT_BUFFER_TEST_CONTEXT *TestContext;
- ContextBuffers = NULL;
+ ContextBuffers = NULL;
FoundContextBuffer = NULL;
- TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *) Context;
+ TestContext = (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context;
Status = GetContextBuffer (TestContext->HandlerGuid, TestContext->ContextBuffers, &FoundContextBuffer);
UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus);
@@ -484,7 +483,7 @@ VerifyGetContextBuffer ( return UNIT_TEST_PASSED;
}
-///=== TEST ENGINE ================================================================================
+/// === TEST ENGINE ================================================================================
/**
Entry point for the PRM Context Buffer Library unit tests.
@@ -496,7 +495,9 @@ VerifyGetContextBuffer ( @retval other Some error occurred when executing this entry point.
**/
-int main ()
+int
+main (
+ )
{
EFI_STATUS Status;
UINTN Index;
@@ -640,8 +641,7 @@ int main () Status = RunAllTestSuites (Framework);
EXIT:
- if (Framework)
- {
+ if (Framework) {
FreeUnitTestFramework (Framework);
}
diff --git a/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c b/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c index 0dd6a76..e6bea47 100644 --- a/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c +++ b/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c @@ -23,7 +23,7 @@ #define _DBGMSGID_ "[PRMMODULEDISCOVERYLIB]"
-LIST_ENTRY mPrmModuleList;
+LIST_ENTRY mPrmModuleList;
/**
Gets the next PRM module discovered after the given PRM module.
@@ -40,13 +40,13 @@ LIST_ENTRY mPrmModuleList; EFI_STATUS
EFIAPI
GetNextPrmModuleEntry (
- IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
+ IN OUT PRM_MODULE_IMAGE_CONTEXT **ModuleImageContext
)
{
- LIST_ENTRY *CurrentLink;
- LIST_ENTRY *ForwardLink;
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *CurrentListEntry;
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ForwardListEntry;
+ LIST_ENTRY *CurrentLink;
+ LIST_ENTRY *ForwardLink;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *CurrentListEntry;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ForwardListEntry;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
@@ -59,7 +59,7 @@ GetNextPrmModuleEntry ( } else {
CurrentListEntry = NULL;
CurrentListEntry = CR (*ModuleImageContext, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Context, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
- if (CurrentListEntry == NULL || CurrentListEntry->Signature != PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE) {
+ if ((CurrentListEntry == NULL) || (CurrentListEntry->Signature != PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE)) {
return EFI_INVALID_PARAMETER;
}
@@ -92,7 +92,7 @@ CreateNewPrmModuleImageContextListEntry ( VOID
)
{
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
@@ -100,12 +100,13 @@ CreateNewPrmModuleImageContextListEntry ( if (PrmModuleImageContextListEntry == NULL) {
return NULL;
}
+
DEBUG ((
DEBUG_INFO,
" %a %a: Allocated PrmModuleImageContextListEntry at 0x%x of size 0x%x bytes.\n",
_DBGMSGID_,
__FUNCTION__,
- (UINTN) PrmModuleImageContextListEntry,
+ (UINTN)PrmModuleImageContextListEntry,
sizeof (*PrmModuleImageContextListEntry)
));
@@ -127,12 +128,12 @@ CreateNewPrmModuleImageContextListEntry ( BOOLEAN
EFIAPI
IsAddressInMmram (
- IN EFI_PHYSICAL_ADDRESS Address,
- IN EFI_MMRAM_DESCRIPTOR *MmramRanges,
- IN UINTN MmramRangeCount
+ IN EFI_PHYSICAL_ADDRESS Address,
+ IN EFI_MMRAM_DESCRIPTOR *MmramRanges,
+ IN UINTN MmramRangeCount
)
{
- UINTN Index;
+ UINTN Index;
for (Index = 0; Index < MmramRangeCount; Index++) {
if ((Address >= MmramRanges[Index].CpuStart) &&
@@ -167,28 +168,28 @@ IsAddressInMmram ( EFI_STATUS
EFIAPI
DiscoverPrmModules (
- OUT UINTN *ModuleCount OPTIONAL,
- OUT UINTN *HandlerCount OPTIONAL
+ OUT UINTN *ModuleCount OPTIONAL,
+ OUT UINTN *HandlerCount OPTIONAL
)
{
- EFI_STATUS Status;
- PRM_MODULE_IMAGE_CONTEXT TempPrmModuleImageContext;
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocol;
- EFI_HANDLE *HandleBuffer;
- UINTN HandleCount;
- UINTN Index;
- UINTN PrmHandlerCount;
- UINTN PrmModuleCount;
- EFI_MM_ACCESS_PROTOCOL *MmAccess;
- UINTN Size;
- EFI_MMRAM_DESCRIPTOR *MmramRanges;
- UINTN MmramRangeCount;
+ EFI_STATUS Status;
+ PRM_MODULE_IMAGE_CONTEXT TempPrmModuleImageContext;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry;
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImageProtocol;
+ EFI_HANDLE *HandleBuffer;
+ UINTN HandleCount;
+ UINTN Index;
+ UINTN PrmHandlerCount;
+ UINTN PrmModuleCount;
+ EFI_MM_ACCESS_PROTOCOL *MmAccess;
+ UINTN Size;
+ EFI_MMRAM_DESCRIPTOR *MmramRanges;
+ UINTN MmramRangeCount;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
PrmHandlerCount = 0;
- PrmModuleCount = 0;
+ PrmModuleCount = 0;
if (!IsListEmpty (&mPrmModuleList)) {
return EFI_ALREADY_STARTED;
@@ -206,18 +207,18 @@ DiscoverPrmModules ( return EFI_NOT_FOUND;
}
- MmramRanges = NULL;
+ MmramRanges = NULL;
MmramRangeCount = 0;
- Status = gBS->LocateProtocol (
- &gEfiMmAccessProtocolGuid,
- NULL,
- (VOID **)&MmAccess
- );
+ Status = gBS->LocateProtocol (
+ &gEfiMmAccessProtocolGuid,
+ NULL,
+ (VOID **)&MmAccess
+ );
if (Status == EFI_SUCCESS) {
//
// Get MMRAM range information
//
- Size = 0;
+ Size = 0;
Status = MmAccess->GetCapabilities (MmAccess, &Size, NULL);
if ((Status == EFI_BUFFER_TOO_SMALL) && (Size != 0)) {
MmramRanges = (EFI_MMRAM_DESCRIPTOR *)AllocatePool (Size);
@@ -234,7 +235,7 @@ DiscoverPrmModules ( Status = gBS->HandleProtocol (
HandleBuffer[Index],
&gEfiLoadedImageProtocolGuid,
- (VOID **) &LoadedImageProtocol
+ (VOID **)&LoadedImageProtocol
);
if (EFI_ERROR (Status)) {
continue;
@@ -249,16 +250,17 @@ DiscoverPrmModules ( TempPrmModuleImageContext.PeCoffImageContext.ImageRead = PeCoffLoaderImageReadFromMemory;
Status = PeCoffLoaderGetImageInfo (&TempPrmModuleImageContext.PeCoffImageContext);
- if (EFI_ERROR (Status) || TempPrmModuleImageContext.PeCoffImageContext.ImageError != IMAGE_ERROR_SUCCESS) {
+ if (EFI_ERROR (Status) || (TempPrmModuleImageContext.PeCoffImageContext.ImageError != IMAGE_ERROR_SUCCESS)) {
DEBUG ((
DEBUG_WARN,
"%a %a: ImageHandle 0x%016lx is not a valid PE/COFF image. It cannot be considered a PRM module.\n",
_DBGMSGID_,
__FUNCTION__,
- (EFI_PHYSICAL_ADDRESS) (UINTN) LoadedImageProtocol->ImageBase
+ (EFI_PHYSICAL_ADDRESS)(UINTN)LoadedImageProtocol->ImageBase
));
continue;
}
+
if (TempPrmModuleImageContext.PeCoffImageContext.IsTeImage) {
// A PRM Module is not allowed to be a TE image
continue;
@@ -276,13 +278,14 @@ DiscoverPrmModules ( // Attempt to find the PRM Module Export Descriptor in the export table
Status = GetPrmModuleExportDescriptorTable (
- TempPrmModuleImageContext.ExportDirectory,
- &TempPrmModuleImageContext.PeCoffImageContext,
- &TempPrmModuleImageContext.ExportDescriptor
- );
- if (EFI_ERROR (Status) || TempPrmModuleImageContext.ExportDescriptor == NULL) {
+ TempPrmModuleImageContext.ExportDirectory,
+ &TempPrmModuleImageContext.PeCoffImageContext,
+ &TempPrmModuleImageContext.ExportDescriptor
+ );
+ if (EFI_ERROR (Status) || (TempPrmModuleImageContext.ExportDescriptor == NULL)) {
continue;
}
+
// A PRM Module Export Descriptor was successfully found, this is considered a PRM Module.
//
@@ -292,6 +295,7 @@ DiscoverPrmModules ( if (PrmModuleImageContextListEntry == NULL) {
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem (
&PrmModuleImageContextListEntry->Context,
&TempPrmModuleImageContext,
@@ -306,6 +310,7 @@ DiscoverPrmModules ( if (HandlerCount != NULL) {
*HandlerCount = PrmHandlerCount;
}
+
if (ModuleCount != NULL) {
*ModuleCount = PrmModuleCount;
}
@@ -331,13 +336,13 @@ DiscoverPrmModules ( EFI_STATUS
EFIAPI
PrmModuleDiscoveryLibDestructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *NextLink;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
if (IsListEmpty (&mPrmModuleList)) {
return EFI_SUCCESS;
@@ -346,7 +351,7 @@ PrmModuleDiscoveryLibDestructor ( Link = GetFirstNode (&mPrmModuleList);
while (!IsNull (&mPrmModuleList, Link)) {
ListEntry = CR (Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE);
- NextLink = GetNextNode (&mPrmModuleList, Link);
+ NextLink = GetNextNode (&mPrmModuleList, Link);
RemoveEntryList (Link);
FreePool (ListEntry);
@@ -371,8 +376,8 @@ PrmModuleDiscoveryLibDestructor ( EFI_STATUS
EFIAPI
PrmModuleDiscoveryLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
InitializeListHead (&mPrmModuleList);
diff --git a/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h b/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h index ea42cf2..f6b8962 100644 --- a/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h +++ b/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h @@ -12,14 +12,14 @@ #include <PrmModuleImageContext.h>
-#define PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','M','E')
+#define PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE SIGNATURE_32('P','R','M','E')
#pragma pack(push, 1)
typedef struct {
- UINTN Signature;
- LIST_ENTRY Link;
- PRM_MODULE_IMAGE_CONTEXT Context;
+ UINTN Signature;
+ LIST_ENTRY Link;
+ PRM_MODULE_IMAGE_CONTEXT Context;
} PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY;
#pragma pack(pop)
diff --git a/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscoveryLibUnitTest.c b/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscoveryLibUnitTest.c index ef8abe3..558cd85 100644 --- a/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscoveryLibUnitTest.c +++ b/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscoveryLibUnitTest.c @@ -24,12 +24,12 @@ #include "../PrmModuleDiscovery.h"
-#define UNIT_TEST_NAME "PRM Module Discovery Library Unit Test"
-#define UNIT_TEST_VERSION "0.1"
+#define UNIT_TEST_NAME "PRM Module Discovery Library Unit Test"
+#define UNIT_TEST_VERSION "0.1"
-///=== TEST CASES =================================================================================
+/// === TEST CASES =================================================================================
-///===== CREATE NEW PRM MODULE IMAGE CONTEXT LIST ENTRY TESTS SUITE ==================================================
+/// ===== CREATE NEW PRM MODULE IMAGE CONTEXT LIST ENTRY TESTS SUITE ==================================================
/**
Verifies that the buffer returned can be deallocated.
@@ -44,10 +44,10 @@ UNIT_TEST_STATUS
EFIAPI
PrmModuleImageContextListEntryShouldDeallocate (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
ListEntry = CreateNewPrmModuleImageContextListEntry ();
@@ -72,10 +72,10 @@ PrmModuleImageContextListEntryShouldDeallocate ( UNIT_TEST_STATUS
EFIAPI
PrmModuleImageContextListEntrySignatureShouldBeValid (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
ListEntry = CreateNewPrmModuleImageContextListEntry ();
@@ -101,11 +101,11 @@ PrmModuleImageContextListEntrySignatureShouldBeValid ( UNIT_TEST_STATUS
EFIAPI
PrmModuleImageContextListEntryImageContextShouldBeZeroed (
- IN UNIT_TEST_CONTEXT Context
+ IN UNIT_TEST_CONTEXT Context
)
{
- PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
- PRM_MODULE_IMAGE_CONTEXT ImageContext;
+ PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *ListEntry;
+ PRM_MODULE_IMAGE_CONTEXT ImageContext;
ListEntry = CreateNewPrmModuleImageContextListEntry ();
@@ -119,7 +119,7 @@ PrmModuleImageContextListEntryImageContextShouldBeZeroed ( return UNIT_TEST_PASSED;
}
-///=== TEST ENGINE ================================================================================
+/// === TEST ENGINE ================================================================================
/**
Entry point for the PRM Context Buffer Library unit tests.
@@ -131,7 +131,9 @@ PrmModuleImageContextListEntryImageContextShouldBeZeroed ( @retval other Some error occurred when executing this entry point.
**/
-int main ()
+int
+main (
+ )
{
EFI_STATUS Status;
UNIT_TEST_FRAMEWORK_HANDLE Framework;
@@ -200,8 +202,7 @@ int main () Status = RunAllTestSuites (Framework);
EXIT:
- if (Framework)
- {
+ if (Framework) {
FreeUnitTestFramework (Framework);
}
diff --git a/PrmPkg/Library/DxePrmPeCoffLib/DxePrmPeCoffLib.c b/PrmPkg/Library/DxePrmPeCoffLib/DxePrmPeCoffLib.c index d760d13..d535c2c 100644 --- a/PrmPkg/Library/DxePrmPeCoffLib/DxePrmPeCoffLib.c +++ b/PrmPkg/Library/DxePrmPeCoffLib/DxePrmPeCoffLib.c @@ -37,26 +37,27 @@ **/
EFI_STATUS
GetPrmModuleExportDescriptorTable (
- IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
- OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
+ IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
+ OUT PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT **ExportDescriptor
)
{
- UINTN Index;
- EFI_PHYSICAL_ADDRESS CurrentImageAddress;
- UINT16 PrmModuleExportDescriptorOrdinal;
- CONST CHAR8 *CurrentExportName;
- UINT16 *OrdinalTable;
- UINT32 *ExportNamePointerTable;
- UINT32 *ExportAddressTable;
- PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *TempExportDescriptor;
+ UINTN Index;
+ EFI_PHYSICAL_ADDRESS CurrentImageAddress;
+ UINT16 PrmModuleExportDescriptorOrdinal;
+ CONST CHAR8 *CurrentExportName;
+ UINT16 *OrdinalTable;
+ UINT32 *ExportNamePointerTable;
+ UINT32 *ExportAddressTable;
+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *TempExportDescriptor;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
- if (ImageExportDirectory == NULL ||
- PeCoffLoaderImageContext == NULL ||
- PeCoffLoaderImageContext->ImageAddress == 0 ||
- ExportDescriptor == NULL) {
+ if ((ImageExportDirectory == NULL) ||
+ (PeCoffLoaderImageContext == NULL) ||
+ (PeCoffLoaderImageContext->ImageAddress == 0) ||
+ (ExportDescriptor == NULL))
+ {
return EFI_INVALID_PARAMETER;
}
@@ -73,13 +74,13 @@ GetPrmModuleExportDescriptorTable ( //
// The export name pointer table and export ordinal table form two parallel arrays associated by index.
//
- CurrentImageAddress = PeCoffLoaderImageContext->ImageAddress;
- ExportAddressTable = (UINT32 *) ((UINTN) CurrentImageAddress + ImageExportDirectory->AddressOfFunctions);
- ExportNamePointerTable = (UINT32 *) ((UINTN) CurrentImageAddress + ImageExportDirectory->AddressOfNames);
- OrdinalTable = (UINT16 *) ((UINTN) CurrentImageAddress + ImageExportDirectory->AddressOfNameOrdinals);
+ CurrentImageAddress = PeCoffLoaderImageContext->ImageAddress;
+ ExportAddressTable = (UINT32 *)((UINTN)CurrentImageAddress + ImageExportDirectory->AddressOfFunctions);
+ ExportNamePointerTable = (UINT32 *)((UINTN)CurrentImageAddress + ImageExportDirectory->AddressOfNames);
+ OrdinalTable = (UINT16 *)((UINTN)CurrentImageAddress + ImageExportDirectory->AddressOfNameOrdinals);
for (Index = 0; Index < ImageExportDirectory->NumberOfNames; Index++) {
- CurrentExportName = (CONST CHAR8 *) ((UINTN) CurrentImageAddress + ExportNamePointerTable[Index]);
+ CurrentExportName = (CONST CHAR8 *)((UINTN)CurrentImageAddress + ExportNamePointerTable[Index]);
DEBUG ((
DEBUG_INFO,
" %a %a: Export Name[0x%x] - %a.\n",
@@ -89,11 +90,12 @@ GetPrmModuleExportDescriptorTable ( CurrentExportName
));
if (
- AsciiStrnCmp (
- PRM_STRING(PRM_MODULE_EXPORT_DESCRIPTOR_NAME),
- CurrentExportName,
- AsciiStrLen (PRM_STRING(PRM_MODULE_EXPORT_DESCRIPTOR_NAME))
- ) == 0) {
+ AsciiStrnCmp (
+ PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME),
+ CurrentExportName,
+ AsciiStrLen (PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME))
+ ) == 0)
+ {
PrmModuleExportDescriptorOrdinal = OrdinalTable[Index];
DEBUG ((
DEBUG_INFO,
@@ -106,19 +108,21 @@ GetPrmModuleExportDescriptorTable ( DEBUG ((DEBUG_ERROR, "%a %a: The PRM Module Export Descriptor ordinal value is invalid.\n", _DBGMSGID_, __FUNCTION__));
return EFI_NOT_FOUND;
}
- TempExportDescriptor = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *) ((UINTN) CurrentImageAddress + ExportAddressTable[PrmModuleExportDescriptorOrdinal]);
+
+ TempExportDescriptor = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *)((UINTN)CurrentImageAddress + ExportAddressTable[PrmModuleExportDescriptorOrdinal]);
if (TempExportDescriptor->Header.Signature == PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE) {
*ExportDescriptor = TempExportDescriptor;
- DEBUG ((DEBUG_INFO, " %a %a: PRM Module Export Descriptor found at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN) ExportDescriptor));
+ DEBUG ((DEBUG_INFO, " %a %a: PRM Module Export Descriptor found at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN)ExportDescriptor));
} else {
DEBUG ((
DEBUG_INFO,
" %a %a: PRM Module Export Descriptor found at 0x%x but signature check failed.\n",
_DBGMSGID_,
__FUNCTION__,
- (UINTN) TempExportDescriptor
+ (UINTN)TempExportDescriptor
));
}
+
DEBUG ((DEBUG_INFO, " %a %a: Exiting export iteration since export descriptor found.\n", _DBGMSGID_, __FUNCTION__));
return EFI_SUCCESS;
}
@@ -145,18 +149,18 @@ GetPrmModuleExportDescriptorTable ( **/
EFI_STATUS
GetExportDirectoryInPeCoffImage (
- IN VOID *Image,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
- OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
+ IN VOID *Image,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
+ OUT EFI_IMAGE_EXPORT_DIRECTORY **ImageExportDirectory
)
{
- UINT16 Magic;
- UINT32 NumberOfRvaAndSizes;
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
- EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
- EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
+ UINT16 Magic;
+ UINT32 NumberOfRvaAndSizes;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
+ EFI_IMAGE_DATA_DIRECTORY *DirectoryEntry;
+ EFI_IMAGE_EXPORT_DIRECTORY *ExportDirectory;
- if (Image == NULL || PeCoffLoaderImageContext == NULL || ImageExportDirectory == NULL) {
+ if ((Image == NULL) || (PeCoffLoaderImageContext == NULL) || (ImageExportDirectory == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -169,36 +173,36 @@ GetExportDirectoryInPeCoffImage ( // image with PE32 magic.
//
switch (PeCoffLoaderImageContext->Machine) {
- case EFI_IMAGE_MACHINE_IA32:
- //
- // Assume PE32 image with IA32 Machine field.
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
- break;
- case EFI_IMAGE_MACHINE_X64:
- case EFI_IMAGE_MACHINE_AARCH64:
- //
- // Assume PE32+ image with X64 Machine field
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
- break;
- default:
- //
- // For unknown Machine field, use Magic in optional header
- //
- DEBUG ((
- DEBUG_WARN,
- "%a %a: The machine type for this image is not valid for a PRM module.\n",
- _DBGMSGID_,
- __FUNCTION__
- ));
- return EFI_UNSUPPORTED;
+ case EFI_IMAGE_MACHINE_IA32:
+ //
+ // Assume PE32 image with IA32 Machine field.
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ break;
+ case EFI_IMAGE_MACHINE_X64:
+ case EFI_IMAGE_MACHINE_AARCH64:
+ //
+ // Assume PE32+ image with X64 Machine field
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+ default:
+ //
+ // For unknown Machine field, use Magic in optional header
+ //
+ DEBUG ((
+ DEBUG_WARN,
+ "%a %a: The machine type for this image is not valid for a PRM module.\n",
+ _DBGMSGID_,
+ __FUNCTION__
+ ));
+ return EFI_UNSUPPORTED;
}
- OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) (
- (UINTN) Image +
- PeCoffLoaderImageContext->PeCoffHeaderOffset
- );
+ OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(
+ (UINTN)Image +
+ PeCoffLoaderImageContext->PeCoffHeaderOffset
+ );
//
// Check the PE/COFF Header Signature. Determine if the image is valid and/or a TE image.
@@ -213,43 +217,44 @@ GetExportDirectoryInPeCoffImage ( // Use the PE32 offset to get the Export Directory Entry
//
NumberOfRvaAndSizes = OptionalHeaderPtrUnion.Pe32->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHeaderPtrUnion.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHeaderPtrUnion.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
} else if (OptionalHeaderPtrUnion.Pe32->OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
//
// Use the PE32+ offset get the Export Directory Entry
//
NumberOfRvaAndSizes = OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.NumberOfRvaAndSizes;
- DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
+ DirectoryEntry = (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHeaderPtrUnion.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]);
} else {
return EFI_UNSUPPORTED;
}
- if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_EXPORT || DirectoryEntry->VirtualAddress == 0) {
+ if ((NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_EXPORT) || (DirectoryEntry->VirtualAddress == 0)) {
//
// The export directory is not present
//
return EFI_NOT_FOUND;
- } else if (((UINT32) (~0) - DirectoryEntry->VirtualAddress) < DirectoryEntry->Size) {
+ } else if (((UINT32)(~0) - DirectoryEntry->VirtualAddress) < DirectoryEntry->Size) {
//
// The directory address overflows
//
DEBUG ((DEBUG_ERROR, "%a %a: The export directory entry in this image results in overflow.\n", _DBGMSGID_, __FUNCTION__));
return EFI_UNSUPPORTED;
} else {
- DEBUG ((DEBUG_INFO, "%a %a: Export Directory Entry found in the image at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN) OptionalHeaderPtrUnion.Pe32));
+ DEBUG ((DEBUG_INFO, "%a %a: Export Directory Entry found in the image at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN)OptionalHeaderPtrUnion.Pe32));
DEBUG ((DEBUG_INFO, " %a %a: Directory Entry Virtual Address = 0x%x.\n", _DBGMSGID_, __FUNCTION__, DirectoryEntry->VirtualAddress));
- ExportDirectory = (EFI_IMAGE_EXPORT_DIRECTORY *) ((UINTN) Image + DirectoryEntry->VirtualAddress);
+ ExportDirectory = (EFI_IMAGE_EXPORT_DIRECTORY *)((UINTN)Image + DirectoryEntry->VirtualAddress);
DEBUG ((
DEBUG_INFO,
" %a %a: Export Directory Table found successfully at 0x%x. Name address = 0x%x. Name = %a.\n",
_DBGMSGID_,
__FUNCTION__,
- (UINTN) ExportDirectory,
- ((UINTN) Image + ExportDirectory->Name),
- (CHAR8 *) ((UINTN) Image + ExportDirectory->Name)
+ (UINTN)ExportDirectory,
+ ((UINTN)Image + ExportDirectory->Name),
+ (CHAR8 *)((UINTN)Image + ExportDirectory->Name)
));
}
+
*ImageExportDirectory = ExportDirectory;
return EFI_SUCCESS;
@@ -273,18 +278,18 @@ GetExportDirectoryInPeCoffImage ( **/
EFI_STATUS
GetImageVersionInPeCoffImage (
- IN VOID *Image,
- IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
- OUT UINT16 *ImageMajorVersion,
- OUT UINT16 *ImageMinorVersion
+ IN VOID *Image,
+ IN PE_COFF_LOADER_IMAGE_CONTEXT *PeCoffLoaderImageContext,
+ OUT UINT16 *ImageMajorVersion,
+ OUT UINT16 *ImageMinorVersion
)
{
- EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
- UINT16 Magic;
+ EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION OptionalHeaderPtrUnion;
+ UINT16 Magic;
DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
- if (Image == NULL || PeCoffLoaderImageContext == NULL || ImageMajorVersion == NULL || ImageMinorVersion == NULL) {
+ if ((Image == NULL) || (PeCoffLoaderImageContext == NULL) || (ImageMajorVersion == NULL) || (ImageMinorVersion == NULL)) {
return EFI_INVALID_PARAMETER;
}
@@ -294,36 +299,36 @@ GetImageVersionInPeCoffImage ( // image with PE32 magic.
//
switch (PeCoffLoaderImageContext->Machine) {
- case EFI_IMAGE_MACHINE_IA32:
- //
- // Assume PE32 image
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
- break;
- case EFI_IMAGE_MACHINE_X64:
- case EFI_IMAGE_MACHINE_AARCH64:
- //
- // Assume PE32+ image
- //
- Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
- break;
- default:
- //
- // For unknown Machine field, use Magic in optional header
- //
- DEBUG ((
- DEBUG_WARN,
- "%a %a: The machine type for this image is not valid for a PRM module.\n",
- _DBGMSGID_,
- __FUNCTION__
- ));
- return EFI_UNSUPPORTED;
+ case EFI_IMAGE_MACHINE_IA32:
+ //
+ // Assume PE32 image
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC;
+ break;
+ case EFI_IMAGE_MACHINE_X64:
+ case EFI_IMAGE_MACHINE_AARCH64:
+ //
+ // Assume PE32+ image
+ //
+ Magic = EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC;
+ break;
+ default:
+ //
+ // For unknown Machine field, use Magic in optional header
+ //
+ DEBUG ((
+ DEBUG_WARN,
+ "%a %a: The machine type for this image is not valid for a PRM module.\n",
+ _DBGMSGID_,
+ __FUNCTION__
+ ));
+ return EFI_UNSUPPORTED;
}
- OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *) (
- (UINTN) Image +
- PeCoffLoaderImageContext->PeCoffHeaderOffset
- );
+ OptionalHeaderPtrUnion.Pe32 = (EFI_IMAGE_NT_HEADERS32 *)(
+ (UINTN)Image +
+ PeCoffLoaderImageContext->PeCoffHeaderOffset
+ );
//
// Check the PE/COFF Header Signature. Determine if the image is valid and/or a TE image.
//
@@ -368,30 +373,31 @@ GetImageVersionInPeCoffImage ( **/
EFI_STATUS
GetExportEntryAddress (
- IN CONST CHAR8 *ExportName,
- IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
- IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
- OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
+ IN CONST CHAR8 *ExportName,
+ IN EFI_PHYSICAL_ADDRESS ImageBaseAddress,
+ IN EFI_IMAGE_EXPORT_DIRECTORY *ImageExportDirectory,
+ OUT EFI_PHYSICAL_ADDRESS *ExportPhysicalAddress
)
{
- UINTN ExportNameIndex;
- UINT16 CurrentExportOrdinal;
- UINT32 *ExportAddressTable;
- UINT32 *ExportNamePointerTable;
- UINT16 *OrdinalTable;
- CONST CHAR8 *ExportNameTablePointerName;
-
- if (ExportName == NULL || ImageBaseAddress == 0 || ImageExportDirectory == NULL || ExportPhysicalAddress == NULL) {
+ UINTN ExportNameIndex;
+ UINT16 CurrentExportOrdinal;
+ UINT32 *ExportAddressTable;
+ UINT32 *ExportNamePointerTable;
+ UINT16 *OrdinalTable;
+ CONST CHAR8 *ExportNameTablePointerName;
+
+ if ((ExportName == NULL) || (ImageBaseAddress == 0) || (ImageExportDirectory == NULL) || (ExportPhysicalAddress == NULL)) {
return EFI_INVALID_PARAMETER;
}
+
*ExportPhysicalAddress = 0;
- ExportAddressTable = (UINT32 *) ((UINTN) ImageBaseAddress + ImageExportDirectory->AddressOfFunctions);
- ExportNamePointerTable = (UINT32 *) ((UINTN) ImageBaseAddress + ImageExportDirectory->AddressOfNames);
- OrdinalTable = (UINT16 *) ((UINTN) ImageBaseAddress + ImageExportDirectory->AddressOfNameOrdinals);
+ ExportAddressTable = (UINT32 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfFunctions);
+ ExportNamePointerTable = (UINT32 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfNames);
+ OrdinalTable = (UINT16 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfNameOrdinals);
for (ExportNameIndex = 0; ExportNameIndex < ImageExportDirectory->NumberOfNames; ExportNameIndex++) {
- ExportNameTablePointerName = (CONST CHAR8 *) ((UINTN) ImageBaseAddress + ExportNamePointerTable[ExportNameIndex]);
+ ExportNameTablePointerName = (CONST CHAR8 *)((UINTN)ImageBaseAddress + ExportNamePointerTable[ExportNameIndex]);
if (AsciiStrnCmp (ExportName, ExportNameTablePointerName, PRM_HANDLER_NAME_MAXIMUM_LENGTH) == 0) {
CurrentExportOrdinal = OrdinalTable[ExportNameIndex];
@@ -402,7 +408,7 @@ GetExportEntryAddress ( break;
}
- *ExportPhysicalAddress = (EFI_PHYSICAL_ADDRESS) ((UINTN) ImageBaseAddress + ExportAddressTable[CurrentExportOrdinal]);
+ *ExportPhysicalAddress = (EFI_PHYSICAL_ADDRESS)((UINTN)ImageBaseAddress + ExportAddressTable[CurrentExportOrdinal]);
return EFI_SUCCESS;
}
}
diff --git a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c index f3223d6..c175ee2 100644 --- a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c +++ b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c @@ -23,11 +23,11 @@ #include <PrmMmio.h>
#include <Protocol/PrmConfig.h>
-#define _DBGMSGID_ "[PRMCONFIG]"
+#define _DBGMSGID_ "[PRMCONFIG]"
-STATIC UINTN mMaxRuntimeMmioRangeCount;
+STATIC UINTN mMaxRuntimeMmioRangeCount;
-GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntimeMmioRanges;
+GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntimeMmioRanges;
/**
Converts the runtime memory range physical addresses to virtual addresses.
@@ -37,18 +37,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntimeMmioRa **/
VOID
ConvertRuntimeMemoryRangeAddresses (
- IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
+ IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
)
{
- UINTN Index;
+ UINTN Index;
- if (RuntimeMmioRanges == NULL || RuntimeMmioRanges->Count == 0) {
+ if ((RuntimeMmioRanges == NULL) || (RuntimeMmioRanges->Count == 0)) {
return;
}
- for (Index = 0; Index < (UINTN) RuntimeMmioRanges->Count; Index++) {
+ for (Index = 0; Index < (UINTN)RuntimeMmioRanges->Count; Index++) {
RuntimeMmioRanges->Range[Index].VirtualBaseAddress = RuntimeMmioRanges->Range[Index].PhysicalBaseAddress;
- gRT->ConvertPointer (0x0, (VOID **) &(RuntimeMmioRanges->Range[Index].VirtualBaseAddress));
+ gRT->ConvertPointer (0x0, (VOID **)&(RuntimeMmioRanges->Range[Index].VirtualBaseAddress));
}
}
@@ -63,23 +63,28 @@ ConvertRuntimeMemoryRangeAddresses ( **/
VOID
SetRuntimeMemoryRangeAttributes (
- IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
+ IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges
)
{
- EFI_STATUS Status;
- EFI_STATUS Status2;
- UINTN Index;
- EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
+ EFI_STATUS Status;
+ EFI_STATUS Status2;
+ UINTN Index;
+ EFI_GCD_MEMORY_SPACE_DESCRIPTOR Descriptor;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
- if (RuntimeMmioRanges == NULL || RuntimeMmioRanges->Count == 0) {
+ if ((RuntimeMmioRanges == NULL) || (RuntimeMmioRanges->Count == 0)) {
return;
}
- for (Index = 0; Index < (UINTN) RuntimeMmioRanges->Count; Index++) {
+ for (Index = 0; Index < (UINTN)RuntimeMmioRanges->Count; Index++) {
DEBUG ((
- DEBUG_INFO, " %a %a: Runtime MMIO Range [%d].\n", _DBGMSGID_, __FUNCTION__, Index));
+ DEBUG_INFO,
+ " %a %a: Runtime MMIO Range [%d].\n",
+ _DBGMSGID_,
+ __FUNCTION__,
+ Index
+ ));
DEBUG ((
DEBUG_INFO,
" %a %a: Physical address = 0x%016x. Length = 0x%x.\n",
@@ -94,24 +99,25 @@ SetRuntimeMemoryRangeAttributes ( ASSERT ((RuntimeMmioRanges->Range[Index].Length & EFI_PAGE_MASK) == 0);
Status2 = EFI_NOT_FOUND;
- Status = gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, &Descriptor);
+ Status = gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, &Descriptor);
if (!EFI_ERROR (Status) &&
- (
- (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo && Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved) ||
- ((Descriptor.Length & EFI_PAGE_MASK) != 0)
+ (
+ ((Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) && (Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved)) ||
+ ((Descriptor.Length & EFI_PAGE_MASK) != 0)
+ )
)
- ) {
+ {
Status2 = gDS->RemoveMemorySpace (
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
Descriptor.Length
);
}
- if (Status == EFI_NOT_FOUND || !EFI_ERROR (Status2)) {
+ if ((Status == EFI_NOT_FOUND) || !EFI_ERROR (Status2)) {
Status = gDS->AddMemorySpace (
EfiGcdMemoryTypeMemoryMappedIo,
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
- (UINT64) RuntimeMmioRanges->Range[Index].Length,
+ (UINT64)RuntimeMmioRanges->Range[Index].Length,
EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
);
ASSERT_EFI_ERROR (Status);
@@ -120,7 +126,7 @@ SetRuntimeMemoryRangeAttributes ( EfiGcdAllocateAddress,
EfiGcdMemoryTypeMemoryMappedIo,
0,
- (UINT64) RuntimeMmioRanges->Range[Index].Length,
+ (UINT64)RuntimeMmioRanges->Range[Index].Length,
&RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
gImageHandle,
NULL
@@ -141,13 +147,14 @@ SetRuntimeMemoryRangeAttributes ( ));
continue;
}
+
if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) != 0) {
continue;
}
Status = gDS->SetMemorySpaceAttributes (
RuntimeMmioRanges->Range[Index].PhysicalBaseAddress,
- (UINT64) RuntimeMmioRanges->Range[Index].Length,
+ (UINT64)RuntimeMmioRanges->Range[Index].Length,
Descriptor.Attributes | EFI_MEMORY_RUNTIME
);
ASSERT_EFI_ERROR (Status);
@@ -175,19 +182,19 @@ StoreVirtualMemoryAddressChangePointers ( VOID
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- UINTN HandleIndex;
- UINTN RangeIndex;
- EFI_HANDLE *HandleBuffer;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ UINTN HandleIndex;
+ UINTN RangeIndex;
+ EFI_HANDLE *HandleBuffer;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
RangeIndex = 0;
mRuntimeMmioRanges = AllocateRuntimeZeroPool (sizeof (*mRuntimeMmioRanges) * mMaxRuntimeMmioRangeCount);
- if (mRuntimeMmioRanges == NULL && mMaxRuntimeMmioRangeCount > 0) {
+ if ((mRuntimeMmioRanges == NULL) && (mMaxRuntimeMmioRangeCount > 0)) {
DEBUG ((
DEBUG_ERROR,
" %a %a: Memory allocation for runtime MMIO pointer array failed.\n",
@@ -199,22 +206,22 @@ StoreVirtualMemoryAddressChangePointers ( }
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gPrmConfigProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gPrmConfigProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (!EFI_ERROR (Status)) {
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
&gPrmConfigProtocolGuid,
- (VOID **) &PrmConfigProtocol
+ (VOID **)&PrmConfigProtocol
);
ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) {
+ if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) {
continue;
}
@@ -232,9 +239,11 @@ StoreVirtualMemoryAddressChangePointers ( ASSERT_EFI_ERROR (Status);
return;
}
+
mRuntimeMmioRanges[RangeIndex++] = PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges;
}
}
+
DEBUG ((
DEBUG_INFO,
" %a %a: %d MMIO ranges buffers saved for future virtual memory conversion.\n",
@@ -260,7 +269,7 @@ StoreVirtualMemoryAddressChangePointers ( **/
EFI_STATUS
ValidatePrmDataBuffer (
- IN CONST PRM_DATA_BUFFER *PrmDataBuffer
+ IN CONST PRM_DATA_BUFFER *PrmDataBuffer
)
{
if (PrmDataBuffer == NULL) {
@@ -271,6 +280,7 @@ ValidatePrmDataBuffer ( DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer signature is invalid. PRM module.\n", _DBGMSGID_, __FUNCTION__));
return EFI_NOT_FOUND;
}
+
if (PrmDataBuffer->Header.Length < sizeof (PRM_DATA_BUFFER_HEADER)) {
DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer length is invalid.\n", _DBGMSGID_, __FUNCTION__));
return EFI_BUFFER_TOO_SMALL;
@@ -293,7 +303,7 @@ ValidatePrmDataBuffer ( **/
EFI_STATUS
ValidatePrmContextBuffer (
- IN CONST PRM_CONTEXT_BUFFER *PrmContextBuffer
+ IN CONST PRM_CONTEXT_BUFFER *PrmContextBuffer
)
{
if (PrmContextBuffer == NULL) {
@@ -310,7 +320,7 @@ ValidatePrmContextBuffer ( return EFI_NOT_FOUND;
}
- if (PrmContextBuffer->StaticDataBuffer != NULL && EFI_ERROR (ValidatePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) {
+ if ((PrmContextBuffer->StaticDataBuffer != NULL) && EFI_ERROR (ValidatePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) {
DEBUG ((
DEBUG_ERROR,
" %a %a: Error in static buffer for PRM handler %g.\n",
@@ -337,11 +347,11 @@ ValidatePrmContextBuffer ( VOID
EFIAPI
PrmConfigVirtualAddressChangeEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- UINTN Index;
+ UINTN Index;
//
// Convert runtime MMIO ranges
@@ -365,47 +375,47 @@ PrmConfigVirtualAddressChangeEvent ( VOID
EFIAPI
PrmConfigEndOfDxeNotification (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- UINTN HandleCount;
- UINTN BufferIndex;
- UINTN HandleIndex;
- EFI_HANDLE *HandleBuffer;
- PRM_CONTEXT_BUFFER *CurrentContextBuffer;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ EFI_STATUS Status;
+ UINTN HandleCount;
+ UINTN BufferIndex;
+ UINTN HandleIndex;
+ EFI_HANDLE *HandleBuffer;
+ PRM_CONTEXT_BUFFER *CurrentContextBuffer;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
HandleBuffer = NULL;
- Status = gBS->LocateHandleBuffer (
- ByProtocol,
- &gPrmConfigProtocolGuid,
- NULL,
- &HandleCount,
- &HandleBuffer
- );
+ Status = gBS->LocateHandleBuffer (
+ ByProtocol,
+ &gPrmConfigProtocolGuid,
+ NULL,
+ &HandleCount,
+ &HandleBuffer
+ );
if (!EFI_ERROR (Status)) {
for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {
Status = gBS->HandleProtocol (
HandleBuffer[HandleIndex],
&gPrmConfigProtocolGuid,
- (VOID **) &PrmConfigProtocol
+ (VOID **)&PrmConfigProtocol
);
ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) {
+ if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) {
continue;
}
DEBUG ((
DEBUG_INFO,
" %a %a: Found PRM configuration protocol for PRM module %g.\n",
- _DBGMSGID_,
- __FUNCTION__,
- &PrmConfigProtocol->ModuleContextBuffers.ModuleGuid
- ));
+ _DBGMSGID_,
+ __FUNCTION__,
+ &PrmConfigProtocol->ModuleContextBuffers.ModuleGuid
+ ));
DEBUG ((DEBUG_INFO, " %a %a: Validating module context buffers...\n", _DBGMSGID_, __FUNCTION__));
for (BufferIndex = 0; BufferIndex < PrmConfigProtocol->ModuleContextBuffers.BufferCount; BufferIndex++) {
@@ -422,16 +432,17 @@ PrmConfigEndOfDxeNotification ( ));
}
}
+
DEBUG ((DEBUG_INFO, " %a %a: Module context buffer validation complete.\n", _DBGMSGID_, __FUNCTION__));
if (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges != NULL) {
DEBUG ((
DEBUG_INFO,
" %a %a: Found %d PRM runtime MMIO ranges.\n",
- _DBGMSGID_,
- __FUNCTION__,
- PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges->Count
- ));
+ _DBGMSGID_,
+ __FUNCTION__,
+ PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges->Count
+ ));
SetRuntimeMemoryRangeAttributes (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges);
mMaxRuntimeMmioRangeCount++;
}
@@ -443,7 +454,8 @@ PrmConfigEndOfDxeNotification ( if (HandleBuffer != NULL) {
gBS->FreePool (HandleBuffer);
}
- gBS->CloseEvent(Event);
+
+ gBS->CloseEvent (Event);
}
/**
@@ -459,19 +471,19 @@ PrmConfigEndOfDxeNotification ( EFI_STATUS
EFIAPI
PrmConfigEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_EVENT Event;
+ EFI_STATUS Status;
+ EFI_EVENT Event;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
//
// Register a notification function to change memory attributes at end of DXE
//
- Event = NULL;
+ Event = NULL;
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
@@ -485,7 +497,7 @@ PrmConfigEntryPoint ( //
// Register a notification function for virtual address change
//
- Event = NULL;
+ Event = NULL;
Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_NOTIFY,
diff --git a/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h b/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h index 6f9ba8f..e2034d4 100644 --- a/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h +++ b/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h @@ -14,11 +14,11 @@ #include <Base.h>
#include <IndustryStandard/Acpi10.h>
-#define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R', 'M', 'T')
+#define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R', 'M', 'T')
-#define PRM_TABLE_REVISION 0x0
-#define PRM_MODULE_INFORMATION_STRUCT_REVISION 0x00
-#define PRM_HANDLER_INFORMATION_STRUCT_REVISION 0x00
+#define PRM_TABLE_REVISION 0x0
+#define PRM_MODULE_INFORMATION_STRUCT_REVISION 0x00
+#define PRM_HANDLER_INFORMATION_STRUCT_REVISION 0x00
#pragma pack(push, 1)
@@ -26,13 +26,13 @@ // Platform Runtime Mechanism (PRM) ACPI Table (PRMT) structures
//
typedef struct {
- UINT16 StructureRevision; ///< Revision of this structure
- UINT16 StructureLength; ///< Length in bytes of this structure
- GUID Identifier; ///< GUID of the PRM handler for this structure
- UINT64 PhysicalAddress; ///< Physical address of this PRM handler
- UINT64 StaticDataBuffer; ///< Physical address of the static data buffer for
+ UINT16 StructureRevision; ///< Revision of this structure
+ UINT16 StructureLength; ///< Length in bytes of this structure
+ GUID Identifier; ///< GUID of the PRM handler for this structure
+ UINT64 PhysicalAddress; ///< Physical address of this PRM handler
+ UINT64 StaticDataBuffer; ///< Physical address of the static data buffer for
///< this PRM handler (PRM_DATA_BUFFER *)
- UINT64 AcpiParameterBuffer; ///< Physical address of the parameter buffer
+ UINT64 AcpiParameterBuffer; ///< Physical address of the parameter buffer
///< for this PRM handler (PRM_DATA_BUFFER *)
///< that is only used in the case of _DSM invocation.
///< If _DSM invocation is not used, this value is
@@ -40,29 +40,29 @@ typedef struct { } PRM_HANDLER_INFORMATION_STRUCT;
typedef struct {
- UINT16 StructureRevision; ///< Revision of this structure
- UINT16 StructureLength; ///< Length in bytes of this structure including the
+ UINT16 StructureRevision; ///< Revision of this structure
+ UINT16 StructureLength; ///< Length in bytes of this structure including the
///< variable length PRM Handler Info array
- GUID Identifier; ///< GUID of the PRM module for this structure
- UINT16 MajorRevision; ///< PRM module major revision
- UINT16 MinorRevision; ///< PRM module minor revision
- UINT16 HandlerCount; ///< Number of entries in the Handler Info array
- UINT32 HandlerInfoOffset; ///< Offset in bytes from the beginning of this
+ GUID Identifier; ///< GUID of the PRM module for this structure
+ UINT16 MajorRevision; ///< PRM module major revision
+ UINT16 MinorRevision; ///< PRM module minor revision
+ UINT16 HandlerCount; ///< Number of entries in the Handler Info array
+ UINT32 HandlerInfoOffset; ///< Offset in bytes from the beginning of this
///< structure to the Handler Info array
- UINT64 RuntimeMmioRanges; ///< Physical address of the PRM MMIO Ranges
+ UINT64 RuntimeMmioRanges; ///< Physical address of the PRM MMIO Ranges
///< structure (PRM_MODULE_RUNTIME_MMIO_RANGES *)
- PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1];
+ PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1];
} PRM_MODULE_INFORMATION_STRUCT;
typedef struct {
- EFI_ACPI_DESCRIPTION_HEADER Header; ///< Standard ACPI description header
- GUID PrmPlatformGuid; ///< A GUID that uniquely identifies this platform.
+ EFI_ACPI_DESCRIPTION_HEADER Header; ///< Standard ACPI description header
+ GUID PrmPlatformGuid; ///< A GUID that uniquely identifies this platform.
///< Used to check for compatibility in PRM module
///< runtime updates.
- UINT32 PrmModuleInfoOffset; ///< Offset in bytes from the beginning of this
+ UINT32 PrmModuleInfoOffset; ///< Offset in bytes from the beginning of this
///< structure to the PRM Module Info array
- UINT32 PrmModuleInfoCount; ///< Number of entries in the PRM Module Info array
- PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1];
+ UINT32 PrmModuleInfoCount; ///< Number of entries in the PRM Module Info array
+ PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1];
} PRM_ACPI_DESCRIPTION_TABLE;
#pragma pack(pop)
@@ -72,19 +72,19 @@ typedef struct { //
// Todo: Revisit whether to use; currently both macros are not used
//
-#define PRM_MODULE_INFORMATION_STRUCTURE(ModuleGuid, ModuleRevision, HandlerCount, PrmHanderInfoStructureArray) { \
+#define PRM_MODULE_INFORMATION_STRUCTURE(ModuleGuid, ModuleRevision, HandlerCount, PrmHanderInfoStructureArray) { \
{ \
- PRM_MODULE_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
- (OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) + (HandlerCount * sizeof (PRM_HANDLER_INFORMATION_STRUCT))) /* UINT16 StructureLength; */ \
- ModuleGuid, /* GUID ModuleGuid; */ \
- ModuleRevision, /* UINT16 ModuleRevision */ \
- HandlerCount, /* UINT16 HandlerCount */ \
- OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoOffset), /* UINT32 HandlerInfoOffset */ \
- PrmHanderInfoStructureArray /* PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure */ \
+ PRM_MODULE_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
+ (OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) + (HandlerCount * sizeof (PRM_HANDLER_INFORMATION_STRUCT))) /* UINT16 StructureLength; */ \
+ ModuleGuid, /* GUID ModuleGuid; */ \
+ ModuleRevision, /* UINT16 ModuleRevision */ \
+ HandlerCount, /* UINT16 HandlerCount */ \
+ OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoOffset), /* UINT32 HandlerInfoOffset */ \
+ PrmHanderInfoStructureArray /* PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure */ \
} \
}
-#define PRM_HANDLER_INFORMATION_STRUCTURE(HandlerGuid, PhysicalAddress) { \
+#define PRM_HANDLER_INFORMATION_STRUCTURE(HandlerGuid, PhysicalAddress) { \
{ \
PRM_HANDLER_INFORMATION_STRUCT_REVISION, /* UINT16 StructureRevision; */ \
sizeof (PRM_HANDLER_INFORMATION_STRUCT), /* UINT16 StructureLength; */ \
diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c index e2779f5..5a223d7 100644 --- a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c +++ b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c @@ -30,8 +30,8 @@ #define _DBGMSGID_ "[PRMLOADER]"
-UINTN mPrmHandlerCount;
-UINTN mPrmModuleCount;
+UINTN mPrmHandlerCount;
+UINTN mPrmModuleCount;
/**
Processes a list of PRM context entries to build a PRM ACPI table.
@@ -50,34 +50,35 @@ UINTN mPrmModuleCount; **/
EFI_STATUS
ProcessPrmModules (
- OUT PRM_ACPI_DESCRIPTION_TABLE **PrmAcpiDescriptionTable
+ OUT PRM_ACPI_DESCRIPTION_TABLE **PrmAcpiDescriptionTable
)
{
- EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
- PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
- PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiTable;
- PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
- CONST CHAR8 *CurrentExportDescriptorHandlerName;
-
- ACPI_PARAMETER_BUFFER_DESCRIPTOR *CurrentModuleAcpiParamDescriptors;
- PRM_CONTEXT_BUFFER *CurrentContextBuffer;
- PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
- PRM_MODULE_INFORMATION_STRUCT *CurrentModuleInfoStruct;
- PRM_HANDLER_INFORMATION_STRUCT *CurrentHandlerInfoStruct;
-
- EFI_STATUS Status;
- EFI_PHYSICAL_ADDRESS CurrentImageAddress;
- UINTN AcpiParamIndex;
- UINTN HandlerIndex;
- UINT32 PrmAcpiDescriptionTableBufferSize;
-
- UINT64 HandlerPhysicalAddress;
+ EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory;
+ PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct;
+ PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiTable;
+ PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext;
+ CONST CHAR8 *CurrentExportDescriptorHandlerName;
+
+ ACPI_PARAMETER_BUFFER_DESCRIPTOR *CurrentModuleAcpiParamDescriptors;
+ PRM_CONTEXT_BUFFER *CurrentContextBuffer;
+ PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers;
+ PRM_MODULE_INFORMATION_STRUCT *CurrentModuleInfoStruct;
+ PRM_HANDLER_INFORMATION_STRUCT *CurrentHandlerInfoStruct;
+
+ EFI_STATUS Status;
+ EFI_PHYSICAL_ADDRESS CurrentImageAddress;
+ UINTN AcpiParamIndex;
+ UINTN HandlerIndex;
+ UINT32 PrmAcpiDescriptionTableBufferSize;
+
+ UINT64 HandlerPhysicalAddress;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
if (PrmAcpiDescriptionTable == NULL) {
return EFI_INVALID_PARAMETER;
}
+
*PrmAcpiDescriptionTable = NULL;
//
@@ -96,42 +97,42 @@ ProcessPrmModules ( DEBUG ((DEBUG_INFO, " %a %a: %d total PRM modules to process.\n", _DBGMSGID_, __FUNCTION__, mPrmModuleCount));
DEBUG ((DEBUG_INFO, " %a %a: %d total PRM handlers to process.\n", _DBGMSGID_, __FUNCTION__, mPrmHandlerCount));
- PrmAcpiDescriptionTableBufferSize = (UINT32) (OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure) +
- (OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) * mPrmModuleCount) +
- (sizeof (PRM_HANDLER_INFORMATION_STRUCT) * mPrmHandlerCount)
- );
+ PrmAcpiDescriptionTableBufferSize = (UINT32)(OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure) +
+ (OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) * mPrmModuleCount) +
+ (sizeof (PRM_HANDLER_INFORMATION_STRUCT) * mPrmHandlerCount)
+ );
DEBUG ((DEBUG_INFO, " %a %a: Total PRM ACPI table size: 0x%x.\n", _DBGMSGID_, __FUNCTION__, PrmAcpiDescriptionTableBufferSize));
- PrmAcpiTable = AllocateZeroPool ((UINTN) PrmAcpiDescriptionTableBufferSize);
+ PrmAcpiTable = AllocateZeroPool ((UINTN)PrmAcpiDescriptionTableBufferSize);
if (PrmAcpiTable == NULL) {
return EFI_OUT_OF_RESOURCES;
}
- PrmAcpiTable->Header.Signature = PRM_TABLE_SIGNATURE;
- PrmAcpiTable->Header.Length = PrmAcpiDescriptionTableBufferSize;
- PrmAcpiTable->Header.Revision = PRM_TABLE_REVISION;
- PrmAcpiTable->Header.Checksum = 0x0;
+ PrmAcpiTable->Header.Signature = PRM_TABLE_SIGNATURE;
+ PrmAcpiTable->Header.Length = PrmAcpiDescriptionTableBufferSize;
+ PrmAcpiTable->Header.Revision = PRM_TABLE_REVISION;
+ PrmAcpiTable->Header.Checksum = 0x0;
CopyMem (&PrmAcpiTable->Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId), sizeof (PrmAcpiTable->Header.OemId));
- PrmAcpiTable->Header.OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
- PrmAcpiTable->Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
- PrmAcpiTable->Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
- PrmAcpiTable->Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
+ PrmAcpiTable->Header.OemTableId = PcdGet64 (PcdAcpiDefaultOemTableId);
+ PrmAcpiTable->Header.OemRevision = PcdGet32 (PcdAcpiDefaultOemRevision);
+ PrmAcpiTable->Header.CreatorId = PcdGet32 (PcdAcpiDefaultCreatorId);
+ PrmAcpiTable->Header.CreatorRevision = PcdGet32 (PcdAcpiDefaultCreatorRevision);
CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid);
- PrmAcpiTable->PrmModuleInfoOffset = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure);
- PrmAcpiTable->PrmModuleInfoCount = (UINT32) mPrmModuleCount;
+ PrmAcpiTable->PrmModuleInfoOffset = OFFSET_OF (PRM_ACPI_DESCRIPTION_TABLE, PrmModuleInfoStructure);
+ PrmAcpiTable->PrmModuleInfoCount = (UINT32)mPrmModuleCount;
//
// Iterate across all PRM Modules on the list
//
CurrentModuleInfoStruct = &PrmAcpiTable->PrmModuleInfoStructure[0];
for (
- CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
- !EFI_ERROR (Status);
- Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) {
-
- CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
- CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
- CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
+ CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext);
+ !EFI_ERROR (Status);
+ Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext))
+ {
+ CurrentImageAddress = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress;
+ CurrentImageExportDirectory = CurrentPrmModuleImageContext->ExportDirectory;
+ CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor;
CurrentModuleAcpiParamDescriptors = NULL;
DEBUG ((
@@ -139,39 +140,39 @@ ProcessPrmModules ( " %a %a: PRM Module - %a with %d handlers.\n",
_DBGMSGID_,
__FUNCTION__,
- (CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirectory->Name),
+ (CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory->Name),
CurrentExportDescriptorStruct->Header.NumberPrmHandlers
));
CurrentModuleInfoStruct->StructureRevision = PRM_MODULE_INFORMATION_STRUCT_REVISION;
- CurrentModuleInfoStruct->StructureLength = (
- OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) +
- (CurrentExportDescriptorStruct->Header.NumberPrmHandlers * sizeof (PRM_HANDLER_INFORMATION_STRUCT))
- );
+ CurrentModuleInfoStruct->StructureLength = (
+ OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) +
+ (CurrentExportDescriptorStruct->Header.NumberPrmHandlers * sizeof (PRM_HANDLER_INFORMATION_STRUCT))
+ );
CopyGuid (&CurrentModuleInfoStruct->Identifier, &CurrentExportDescriptorStruct->Header.ModuleGuid);
- CurrentModuleInfoStruct->HandlerCount = (UINT32) CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
- CurrentModuleInfoStruct->HandlerInfoOffset = OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure);
+ CurrentModuleInfoStruct->HandlerCount = (UINT32)CurrentExportDescriptorStruct->Header.NumberPrmHandlers;
+ CurrentModuleInfoStruct->HandlerInfoOffset = OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure);
CurrentModuleInfoStruct->MajorRevision = 0;
CurrentModuleInfoStruct->MinorRevision = 0;
- Status = GetImageVersionInPeCoffImage (
- (VOID *) (UINTN) CurrentImageAddress,
- &CurrentPrmModuleImageContext->PeCoffImageContext,
- &CurrentModuleInfoStruct->MajorRevision,
- &CurrentModuleInfoStruct->MinorRevision
- );
+ Status = GetImageVersionInPeCoffImage (
+ (VOID *)(UINTN)CurrentImageAddress,
+ &CurrentPrmModuleImageContext->PeCoffImageContext,
+ &CurrentModuleInfoStruct->MajorRevision,
+ &CurrentModuleInfoStruct->MinorRevision
+ );
ASSERT_EFI_ERROR (Status);
// It is currently valid for a PRM module not to use a context buffer
Status = GetModuleContextBuffers (
- ByModuleGuid,
- &CurrentModuleInfoStruct->Identifier,
- (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContextBuffers
- );
+ ByModuleGuid,
+ &CurrentModuleInfoStruct->Identifier,
+ (CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers
+ );
ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND);
- if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) {
- CurrentModuleInfoStruct->RuntimeMmioRanges = (UINT64) (UINTN) CurrentModuleContextBuffers->RuntimeMmioRanges;
- CurrentModuleAcpiParamDescriptors = CurrentModuleContextBuffers->AcpiParameterBufferDescriptors;
+ if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers != NULL)) {
+ CurrentModuleInfoStruct->RuntimeMmioRanges = (UINT64)(UINTN)CurrentModuleContextBuffers->RuntimeMmioRanges;
+ CurrentModuleAcpiParamDescriptors = CurrentModuleContextBuffers->AcpiParameterBufferDescriptors;
}
//
@@ -181,21 +182,21 @@ ProcessPrmModules ( CurrentHandlerInfoStruct = &(CurrentModuleInfoStruct->HandlerInfoStructure[HandlerIndex]);
CurrentHandlerInfoStruct->StructureRevision = PRM_HANDLER_INFORMATION_STRUCT_REVISION;
- CurrentHandlerInfoStruct->StructureLength = sizeof (PRM_HANDLER_INFORMATION_STRUCT);
+ CurrentHandlerInfoStruct->StructureLength = sizeof (PRM_HANDLER_INFORMATION_STRUCT);
CopyGuid (
&CurrentHandlerInfoStruct->Identifier,
&CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid
);
- CurrentExportDescriptorHandlerName = (CONST CHAR8 *) CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
+ CurrentExportDescriptorHandlerName = (CONST CHAR8 *)CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName;
Status = GetContextBuffer (
&CurrentHandlerInfoStruct->Identifier,
CurrentModuleContextBuffers,
- (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer
+ (CONST PRM_CONTEXT_BUFFER **)&CurrentContextBuffer
);
if (!EFI_ERROR (Status)) {
- CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64) (UINTN) CurrentContextBuffer->StaticDataBuffer;
+ CurrentHandlerInfoStruct->StaticDataBuffer = (UINT64)(UINTN)CurrentContextBuffer->StaticDataBuffer;
}
Status = GetExportEntryAddress (
@@ -223,15 +224,17 @@ ProcessPrmModules ( if (CurrentModuleAcpiParamDescriptors != NULL) {
for (AcpiParamIndex = 0; AcpiParamIndex < CurrentModuleContextBuffers->AcpiParameterBufferDescriptorCount; AcpiParamIndex++) {
if (CompareGuid (&CurrentModuleAcpiParamDescriptors[AcpiParamIndex].HandlerGuid, &CurrentHandlerInfoStruct->Identifier)) {
- CurrentHandlerInfoStruct->AcpiParameterBuffer = (UINT64) (UINTN) (
- CurrentModuleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBufferAddress
- );
+ CurrentHandlerInfoStruct->AcpiParameterBuffer = (UINT64)(UINTN)(
+ CurrentModuleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBufferAddress
+ );
}
}
}
}
- CurrentModuleInfoStruct = (PRM_MODULE_INFORMATION_STRUCT *) ((UINTN) CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength);
+
+ CurrentModuleInfoStruct = (PRM_MODULE_INFORMATION_STRUCT *)((UINTN)CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength);
}
+
*PrmAcpiDescriptionTable = PrmAcpiTable;
return EFI_SUCCESS;
@@ -252,18 +255,18 @@ ProcessPrmModules ( **/
EFI_STATUS
PublishPrmAcpiTable (
- IN PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable
+ IN PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable
)
{
- EFI_STATUS Status;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
- UINTN TableKey;
+ EFI_STATUS Status;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
+ UINTN TableKey;
- if (PrmAcpiDescriptionTable == NULL || PrmAcpiDescriptionTable->Header.Signature != PRM_TABLE_SIGNATURE) {
+ if ((PrmAcpiDescriptionTable == NULL) || (PrmAcpiDescriptionTable->Header.Signature != PRM_TABLE_SIGNATURE)) {
return EFI_INVALID_PARAMETER;
}
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (!EFI_ERROR (Status)) {
TableKey = 0;
//
@@ -279,6 +282,7 @@ PublishPrmAcpiTable ( DEBUG ((DEBUG_INFO, "%a %a: The PRMT ACPI table was installed successfully.\n", _DBGMSGID_, __FUNCTION__));
}
}
+
ASSERT_EFI_ERROR (Status);
return Status;
@@ -305,12 +309,12 @@ PublishPrmAcpiTable ( VOID
EFIAPI
PrmLoaderEndOfDxeNotification (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable;
+ EFI_STATUS Status;
+ PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiDescriptionTable;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
@@ -326,6 +330,7 @@ PrmLoaderEndOfDxeNotification ( if (PrmAcpiDescriptionTable != NULL) {
FreePool (PrmAcpiDescriptionTable);
}
+
gBS->CloseEvent (Event);
}
@@ -342,12 +347,12 @@ PrmLoaderEndOfDxeNotification ( EFI_STATUS
EFIAPI
PrmLoaderEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- EFI_EVENT EndOfDxeEvent;
+ EFI_STATUS Status;
+ EFI_EVENT EndOfDxeEvent;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
@@ -355,7 +360,7 @@ PrmLoaderEntryPoint ( // Discover and process installed PRM modules at the End of DXE
// The PRM ACPI table is published if one or PRM modules are discovered
//
- Status = gBS->CreateEventEx(
+ Status = gBS->CreateEventEx (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
PrmLoaderEndOfDxeNotification,
diff --git a/PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c b/PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c index bd9ce2c..e8bf4cf 100644 --- a/PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c +++ b/PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c @@ -33,14 +33,14 @@ **/
EFI_STATUS
InstallPrmSsdt (
- IN CONST UINT8 *OemId
+ IN CONST UINT8 *OemId
)
{
- EFI_STATUS Status;
- UINTN SsdtSize;
- UINTN TableKey;
- EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
- EFI_ACPI_DESCRIPTION_HEADER *Ssdt;
+ EFI_STATUS Status;
+ UINTN SsdtSize;
+ UINTN TableKey;
+ EFI_ACPI_TABLE_PROTOCOL *AcpiTableProtocol;
+ EFI_ACPI_DESCRIPTION_HEADER *Ssdt;
DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__));
@@ -48,7 +48,7 @@ InstallPrmSsdt ( return EFI_INVALID_PARAMETER;
}
- Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTableProtocol);
+ Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **)&AcpiTableProtocol);
if (!EFI_ERROR (Status)) {
//
// Discover the SSDT
@@ -57,7 +57,7 @@ InstallPrmSsdt ( &gEfiCallerIdGuid,
EFI_SECTION_RAW,
0,
- (VOID **) &Ssdt,
+ (VOID **)&Ssdt,
&SsdtSize
);
ASSERT_EFI_ERROR (Status);
@@ -72,12 +72,12 @@ InstallPrmSsdt ( // Publish the SSDT. Table is re-checksummed.
//
TableKey = 0;
- Status = AcpiTableProtocol->InstallAcpiTable (
- AcpiTableProtocol,
- Ssdt,
- SsdtSize,
- &TableKey
- );
+ Status = AcpiTableProtocol->InstallAcpiTable (
+ AcpiTableProtocol,
+ Ssdt,
+ SsdtSize,
+ &TableKey
+ );
ASSERT_EFI_ERROR (Status);
}
@@ -97,13 +97,13 @@ InstallPrmSsdt ( EFI_STATUS
EFIAPI
PrmSsdtInstallEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
- Status = InstallPrmSsdt ((UINT8 *) PcdGetPtr (PcdAcpiDefaultOemId));
+ Status = InstallPrmSsdt ((UINT8 *)PcdGetPtr (PcdAcpiDefaultOemId));
ASSERT_EFI_ERROR (Status);
return Status;
diff --git a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiParameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiParameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c index b135517..760d8bc 100644 --- a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiParameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c +++ b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiParameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c @@ -17,10 +17,14 @@ STATIC EFI_HANDLE mPrmConfigProtocolHandle;
// {dc2a58a6-5927-4776-b995-d118a27335a2}
-STATIC CONST EFI_GUID mPrmModuleGuid = {0xdc2a58a6, 0x5927, 0x4776, {0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2}};
+STATIC CONST EFI_GUID mPrmModuleGuid = {
+ 0xdc2a58a6, 0x5927, 0x4776, { 0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2 }
+};
// {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
-STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}};
+STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {
+ 0x2e4f2d13, 0x6240, 0x4ed0, { 0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8 }
+};
/**
Constructor of the PRM configuration library.
@@ -34,8 +38,8 @@ STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {0x2e4f2d13, 0x6240, 0x4 EFI_STATUS
EFIAPI
AcpiParameterBufferModuleConfigLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -43,9 +47,9 @@ AcpiParameterBufferModuleConfigLibConstructor ( ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParamBufferDescriptor;
PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
- AcpiParameterBuffer = NULL;
+ AcpiParameterBuffer = NULL;
AcpiParamBufferDescriptor = NULL;
- PrmConfigProtocol = NULL;
+ PrmConfigProtocol = NULL;
/*
In this sample PRM module, the protocol describing this sample module's resources is simply
@@ -82,15 +86,16 @@ AcpiParameterBufferModuleConfigLibConstructor ( Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
+
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
// Populate the ACPI Parameter Buffer Descriptor structure
CopyGuid (&AcpiParamBufferDescriptor->HandlerGuid, &mCheckParamBufferPrmHandlerGuid);
- AcpiParamBufferDescriptor->AcpiParameterBufferAddress = (UINT64) (UINTN) AcpiParameterBuffer;
+ AcpiParamBufferDescriptor->AcpiParameterBufferAddress = (UINT64)(UINTN)AcpiParameterBuffer;
// Populate the PRM Module Context Buffers structure
PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptorCount = 1;
- PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors = AcpiParamBufferDescriptor;
+ PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors = AcpiParamBufferDescriptor;
//
// Install the PRM Configuration Protocol for this module. This indicates the configuration
@@ -100,7 +105,7 @@ AcpiParameterBufferModuleConfigLibConstructor ( &mPrmConfigProtocolHandle,
&gPrmConfigProtocolGuid,
EFI_NATIVE_INTERFACE,
- (VOID *) PrmConfigProtocol
+ (VOID *)PrmConfigProtocol
);
Done:
@@ -108,9 +113,11 @@ Done: if (AcpiParameterBuffer != NULL) {
FreePool (AcpiParameterBuffer);
}
+
if (AcpiParamBufferDescriptor != NULL) {
FreePool (AcpiParamBufferDescriptor);
}
+
if (PrmConfigProtocol != NULL) {
FreePool (PrmConfigProtocol);
}
diff --git a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.c b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.c index ebb5ba0..eb8a2b9 100644 --- a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.c +++ b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameterBufferModule.c @@ -15,14 +15,14 @@ // TEMP
#include <Library/DebugLib.h>
-#define PARAM_BUFFER_TEST_SIGNATURE SIGNATURE_32('T','E','S','T')
+#define PARAM_BUFFER_TEST_SIGNATURE SIGNATURE_32('T','E','S','T')
//
// PRM Handler GUIDs
//
// {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
-#define CHECK_PARAM_BUFFER_PRM_HANDLER_GUID {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}}
+#define CHECK_PARAM_BUFFER_PRM_HANDLER_GUID {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}}
/**
A sample Platform Runtime Mechanism (PRM) handler.
@@ -39,13 +39,12 @@ @retval Others An error occurred in the PRM handler.
**/
-PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler)
-{
+PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) {
if (ParameterBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
- if (*((UINT32 *) ParameterBuffer) == PARAM_BUFFER_TEST_SIGNATURE) {
+ if (*((UINT32 *)ParameterBuffer) == PARAM_BUFFER_TEST_SIGNATURE) {
return EFI_SUCCESS;
}
@@ -71,8 +70,8 @@ PRM_MODULE_EXPORT ( EFI_STATUS
EFIAPI
PrmSampleAcpiParameterBufferModuleInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;
diff --git a/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h b/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h index 8fe3cf9..c3a5067 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h @@ -13,12 +13,12 @@ #include <Base.h>
-#define SOME_VALUE_ARRAY_MAX_VALUES 16
+#define SOME_VALUE_ARRAY_MAX_VALUES 16
typedef struct {
- BOOLEAN Policy1Enabled;
- BOOLEAN Policy2Enabled;
- UINT8 SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
+ BOOLEAN Policy1Enabled;
+ BOOLEAN Policy2Enabled;
+ UINT8 SomeValueArray[SOME_VALUE_ARRAY_MAX_VALUES];
} STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE;
#endif
diff --git a/PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBufferModuleConfigLib/DxeContextBufferModuleConfigLib.c b/PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBufferModuleConfigLib/DxeContextBufferModuleConfigLib.c index 4c0c334..123d5ac 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBufferModuleConfigLib/DxeContextBufferModuleConfigLib.c +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBufferModuleConfigLib/DxeContextBufferModuleConfigLib.c @@ -21,10 +21,14 @@ STATIC EFI_HANDLE mPrmConfigProtocolHandle;
// {5a6cf42b-8bb4-472c-a233-5c4dc4033dc7}
-STATIC CONST EFI_GUID mPrmModuleGuid = {0x5a6cf42b, 0x8bb4, 0x472c, {0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7}};
+STATIC CONST EFI_GUID mPrmModuleGuid = {
+ 0x5a6cf42b, 0x8bb4, 0x472c, { 0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7 }
+};
// {e1466081-7562-430f-896b-b0e523dc335a}
-STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid = {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}};
+STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid = {
+ 0xe1466081, 0x7562, 0x430f, { 0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a }
+};
/**
Populates the static data buffer for this PRM module.
@@ -70,16 +74,17 @@ PopulateStaticDataBuffer ( **/
EFI_STATUS
GetStaticDataBuffer (
- OUT PRM_DATA_BUFFER **StaticDataBuffer
+ OUT PRM_DATA_BUFFER **StaticDataBuffer
)
{
- EFI_STATUS Status;
- PRM_DATA_BUFFER *DataBuffer;
- UINTN DataBufferLength;
+ EFI_STATUS Status;
+ PRM_DATA_BUFFER *DataBuffer;
+ UINTN DataBufferLength;
if (StaticDataBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
+
*StaticDataBuffer = NULL;
//
@@ -96,9 +101,9 @@ GetStaticDataBuffer ( // Initialize the data buffer header
//
DataBuffer->Header.Signature = PRM_DATA_BUFFER_HEADER_SIGNATURE;
- DataBuffer->Header.Length = (UINT32) DataBufferLength;
+ DataBuffer->Header.Length = (UINT32)DataBufferLength;
- Status = PopulateStaticDataBuffer ((STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE *) &DataBuffer->Data[0]);
+ Status = PopulateStaticDataBuffer ((STATIC_DATA_SAMPLE_CONTEXT_BUFFER_MODULE *)&DataBuffer->Data[0]);
ASSERT_EFI_ERROR (Status);
*StaticDataBuffer = DataBuffer;
@@ -117,17 +122,17 @@ GetStaticDataBuffer ( EFI_STATUS
EFIAPI
ContextBufferModuleConfigLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- PRM_CONTEXT_BUFFER *PrmContextBuffer;
- PRM_DATA_BUFFER *StaticDataBuffer;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ EFI_STATUS Status;
+ PRM_CONTEXT_BUFFER *PrmContextBuffer;
+ PRM_DATA_BUFFER *StaticDataBuffer;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
- PrmContextBuffer = NULL;
- StaticDataBuffer = NULL;
+ PrmContextBuffer = NULL;
+ StaticDataBuffer = NULL;
PrmConfigProtocol = NULL;
/*
@@ -144,7 +149,7 @@ ContextBufferModuleConfigLibConstructor ( //
Status = GetStaticDataBuffer (&StaticDataBuffer);
ASSERT_EFI_ERROR (Status);
- if (EFI_ERROR (Status) || StaticDataBuffer == NULL) {
+ if (EFI_ERROR (Status) || (StaticDataBuffer == NULL)) {
goto Done;
}
@@ -166,9 +171,10 @@ ContextBufferModuleConfigLibConstructor ( Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
+
CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHandlerGuid);
- PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
- PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
+ PrmContextBuffer->Signature = PRM_CONTEXT_BUFFER_SIGNATURE;
+ PrmContextBuffer->Version = PRM_CONTEXT_BUFFER_INTERFACE_VERSION;
PrmContextBuffer->StaticDataBuffer = StaticDataBuffer;
PrmConfigProtocol = AllocateZeroPool (sizeof (*PrmConfigProtocol));
@@ -177,9 +183,10 @@ ContextBufferModuleConfigLibConstructor ( Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
+
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
PrmConfigProtocol->ModuleContextBuffers.BufferCount = 1;
- PrmConfigProtocol->ModuleContextBuffers.Buffer = PrmContextBuffer;
+ PrmConfigProtocol->ModuleContextBuffers.Buffer = PrmContextBuffer;
//
// Install the PRM Configuration Protocol for this module. This indicates the configuration
@@ -189,7 +196,7 @@ ContextBufferModuleConfigLibConstructor ( &mPrmConfigProtocolHandle,
&gPrmConfigProtocolGuid,
EFI_NATIVE_INTERFACE,
- (VOID *) PrmConfigProtocol
+ (VOID *)PrmConfigProtocol
);
Done:
@@ -197,9 +204,11 @@ Done: if (StaticDataBuffer != NULL) {
FreePool (StaticDataBuffer);
}
+
if (PrmContextBuffer != NULL) {
FreePool (PrmContextBuffer);
}
+
if (PrmConfigProtocol != NULL) {
FreePool (PrmConfigProtocol);
}
diff --git a/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.c b/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.c index 5c4e5c7..e7f8fff 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.c +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule.c @@ -21,7 +21,7 @@ //
// {e1466081-7562-430f-896b-b0e523dc335a}
-#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}
+#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}
/**
A sample Platform Runtime Mechanism (PRM) handler.
@@ -35,8 +35,7 @@ @retval Others An error occurred in the PRM handler.
**/
-PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler)
-{
+PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) {
if (ContextBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
@@ -49,8 +48,9 @@ PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) // Verify PRM data buffer signature is valid
//
if (
- ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE ||
- ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE) {
+ (ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE) ||
+ (ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE))
+ {
return EFI_NOT_FOUND;
}
@@ -76,8 +76,8 @@ PRM_MODULE_EXPORT ( EFI_STATUS
EFIAPI
PrmSampleContextBufferModuleInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;
diff --git a/PrmPkg/Samples/PrmSampleHardwareAccessModule/Hpet.h b/PrmPkg/Samples/PrmSampleHardwareAccessModule/Hpet.h index a4f8758..d729885 100644 --- a/PrmPkg/Samples/PrmSampleHardwareAccessModule/Hpet.h +++ b/PrmPkg/Samples/PrmSampleHardwareAccessModule/Hpet.h @@ -15,8 +15,8 @@ #ifndef HPET_REGISTER_H_
#define HPET_REGISTER_H_
-#define HPET_BASE_ADDRESS 0xFED00000
-#define HPET_RANGE_LENGTH 0x1000
+#define HPET_BASE_ADDRESS 0xFED00000
+#define HPET_RANGE_LENGTH 0x1000
///
/// HPET General Register Offsets
@@ -28,15 +28,15 @@ ///
/// HPET Timer Register Offsets
///
-#define HPET_MAIN_COUNTER_OFFSET 0x0F0
-#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
-#define HPET_TIMER_COMPARATOR_OFFSET 0x108
-#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
+#define HPET_MAIN_COUNTER_OFFSET 0x0F0
+#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
+#define HPET_TIMER_COMPARATOR_OFFSET 0x108
+#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
///
/// Stride between sets of HPET Timer Registers
///
-#define HPET_TIMER_STRIDE 0x20
+#define HPET_TIMER_STRIDE 0x20
#pragma pack(1)
@@ -45,15 +45,15 @@ ///
typedef union {
struct {
- UINT32 Revision:8;
- UINT32 NumberOfTimers:5;
- UINT32 CounterSize:1;
- UINT32 Reserved0:1;
- UINT32 LegacyRoute:1;
- UINT32 VendorId:16;
- UINT32 CounterClockPeriod:32;
+ UINT32 Revision : 8;
+ UINT32 NumberOfTimers : 5;
+ UINT32 CounterSize : 1;
+ UINT32 Reserved0 : 1;
+ UINT32 LegacyRoute : 1;
+ UINT32 VendorId : 16;
+ UINT32 CounterClockPeriod : 32;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_GENERAL_CAPABILITIES_ID_REGISTER;
///
@@ -61,12 +61,12 @@ typedef union { ///
typedef union {
struct {
- UINT32 MainCounterEnable:1;
- UINT32 LegacyRouteEnable:1;
- UINT32 Reserved0:30;
- UINT32 Reserved1:32;
+ UINT32 MainCounterEnable : 1;
+ UINT32 LegacyRouteEnable : 1;
+ UINT32 Reserved0 : 30;
+ UINT32 Reserved1 : 32;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_GENERAL_CONFIGURATION_REGISTER;
///
@@ -74,22 +74,22 @@ typedef union { ///
typedef union {
struct {
- UINT32 Reserved0:1;
- UINT32 LevelTriggeredInterrupt:1;
- UINT32 InterruptEnable:1;
- UINT32 PeriodicInterruptEnable:1;
- UINT32 PeriodicInterruptCapability:1;
- UINT32 CounterSizeCapability:1;
- UINT32 ValueSetEnable:1;
- UINT32 Reserved1:1;
- UINT32 CounterSizeEnable:1;
- UINT32 InterruptRoute:5;
- UINT32 MsiInterruptEnable:1;
- UINT32 MsiInterruptCapability:1;
- UINT32 Reserved2:16;
- UINT32 InterruptRouteCapability;
+ UINT32 Reserved0 : 1;
+ UINT32 LevelTriggeredInterrupt : 1;
+ UINT32 InterruptEnable : 1;
+ UINT32 PeriodicInterruptEnable : 1;
+ UINT32 PeriodicInterruptCapability : 1;
+ UINT32 CounterSizeCapability : 1;
+ UINT32 ValueSetEnable : 1;
+ UINT32 Reserved1 : 1;
+ UINT32 CounterSizeEnable : 1;
+ UINT32 InterruptRoute : 5;
+ UINT32 MsiInterruptEnable : 1;
+ UINT32 MsiInterruptCapability : 1;
+ UINT32 Reserved2 : 16;
+ UINT32 InterruptRouteCapability;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_TIMER_CONFIGURATION_REGISTER;
///
@@ -97,10 +97,10 @@ typedef union { ///
typedef union {
struct {
- UINT32 Value:32;
- UINT32 Address:32;
+ UINT32 Value : 32;
+ UINT32 Address : 32;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_TIMER_MSI_ROUTE_REGISTER;
#pragma pack()
diff --git a/PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAccessModuleConfigLib/DxeHardwareAccessModuleConfigLib.c b/PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAccessModuleConfigLib/DxeHardwareAccessModuleConfigLib.c index c00ab9f..1dc9a8d 100644 --- a/PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAccessModuleConfigLib/DxeHardwareAccessModuleConfigLib.c +++ b/PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAccessModuleConfigLib/DxeHardwareAccessModuleConfigLib.c @@ -18,7 +18,9 @@ STATIC EFI_HANDLE mPrmConfigProtocolHandle;
// {0ef93ed7-14ae-425b-928f-b85a6213b57e}
-STATIC CONST EFI_GUID mPrmModuleGuid = {0x0ef93ed7, 0x14ae, 0x425b, {0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e}};
+STATIC CONST EFI_GUID mPrmModuleGuid = {
+ 0x0ef93ed7, 0x14ae, 0x425b, { 0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e }
+};
/**
Constructor of the PRM configuration library.
@@ -32,13 +34,13 @@ STATIC CONST EFI_GUID mPrmModuleGuid = {0x0ef93ed7, 0x14ae, 0x425b, {0x92, 0x8f, EFI_STATUS
EFIAPI
HardwareAccessModuleConfigLibConstructor (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
- PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
+ EFI_STATUS Status;
+ PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges;
+ PRM_CONFIG_PROTOCOL *PrmConfigProtocol;
RuntimeMmioRanges = NULL;
PrmConfigProtocol = NULL;
@@ -70,12 +72,13 @@ HardwareAccessModuleConfigLibConstructor ( Status = EFI_OUT_OF_RESOURCES;
goto Done;
}
+
CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid);
// Populate the Runtime MMIO Ranges structure
- RuntimeMmioRanges->Count = 1;
+ RuntimeMmioRanges->Count = 1;
RuntimeMmioRanges->Range[0].PhysicalBaseAddress = HPET_BASE_ADDRESS;
- RuntimeMmioRanges->Range[0].Length = HPET_RANGE_LENGTH;
+ RuntimeMmioRanges->Range[0].Length = HPET_RANGE_LENGTH;
PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges = RuntimeMmioRanges;
@@ -87,7 +90,7 @@ HardwareAccessModuleConfigLibConstructor ( &mPrmConfigProtocolHandle,
&gPrmConfigProtocolGuid,
EFI_NATIVE_INTERFACE,
- (VOID *) PrmConfigProtocol
+ (VOID *)PrmConfigProtocol
);
Done:
@@ -95,6 +98,7 @@ Done: if (RuntimeMmioRanges != NULL) {
FreePool (RuntimeMmioRanges);
}
+
if (PrmConfigProtocol != NULL) {
FreePool (PrmConfigProtocol);
}
diff --git a/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAccessModule.c b/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAccessModule.c index 14d1e56..1a1e735 100644 --- a/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAccessModule.c +++ b/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAccessModule.c @@ -24,18 +24,18 @@ //
// {2120cd3c-848b-4d8f-abbb-4b74ce64ac89}
-#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}}
+#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}}
// {ea0935a7-506b-4159-bbbb-48deeecb6f58}
-#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x4159, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}}
+#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x4159, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}}
// {1bd1bda9-909a-4614-9699-25ec0c2783f7}
-#define MMIO_ACCESS_HPET_PRM_HANDLER_GUID {0x1bd1bda9, 0x909a, 0x4614, {0x96, 0x99, 0x25, 0xec, 0x0c, 0x27, 0x83, 0xf7}}
+#define MMIO_ACCESS_HPET_PRM_HANDLER_GUID {0x1bd1bda9, 0x909a, 0x4614, {0x96, 0x99, 0x25, 0xec, 0x0c, 0x27, 0x83, 0xf7}}
//
// BEGIN: MtrrLib internal library globals and function prototypes here for testing
//
-extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
+extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[];
/**
Initializes the valid bits mask and valid address mask for MTRRs.
@@ -48,8 +48,8 @@ extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[]; **/
VOID
MtrrLibInitializeMtrrMask (
- OUT UINT64 *MtrrValidBitsMask,
- OUT UINT64 *MtrrValidAddressMask
+ OUT UINT64 *MtrrValidBitsMask,
+ OUT UINT64 *MtrrValidAddressMask
);
/**
@@ -109,11 +109,11 @@ MtrrLibApplyFixedMtrrs ( **/
RETURN_STATUS
MtrrLibApplyVariableMtrrs (
- IN CONST MTRR_MEMORY_RANGE *VariableMtrr,
- IN UINT32 VariableMtrrCount,
- IN OUT MTRR_MEMORY_RANGE *Ranges,
- IN UINTN RangeCapacity,
- IN OUT UINTN *RangeCount
+ IN CONST MTRR_MEMORY_RANGE *VariableMtrr,
+ IN UINT32 VariableMtrrCount,
+ IN OUT MTRR_MEMORY_RANGE *Ranges,
+ IN UINTN RangeCapacity,
+ IN OUT UINTN *RangeCount
);
//
@@ -130,17 +130,17 @@ AccessAllMtrrs ( VOID
)
{
- MTRR_SETTINGS LocalMtrrs;
- MTRR_SETTINGS *Mtrrs;
- UINTN RangeCount;
- UINT64 MtrrValidBitsMask;
- UINT64 MtrrValidAddressMask;
- UINT32 VariableMtrrCount;
-
- MTRR_MEMORY_RANGE Ranges[
- MTRR_NUMBER_OF_FIXED_MTRR * sizeof (UINT64) + 2 * ARRAY_SIZE (Mtrrs->Variables.Mtrr) + 1
- ];
- MTRR_MEMORY_RANGE RawVariableRanges[ARRAY_SIZE (Mtrrs->Variables.Mtrr)];
+ MTRR_SETTINGS LocalMtrrs;
+ MTRR_SETTINGS *Mtrrs;
+ UINTN RangeCount;
+ UINT64 MtrrValidBitsMask;
+ UINT64 MtrrValidAddressMask;
+ UINT32 VariableMtrrCount;
+
+ MTRR_MEMORY_RANGE Ranges[
+ MTRR_NUMBER_OF_FIXED_MTRR * sizeof (UINT64) + 2 * ARRAY_SIZE (Mtrrs->Variables.Mtrr) + 1
+ ];
+ MTRR_MEMORY_RANGE RawVariableRanges[ARRAY_SIZE (Mtrrs->Variables.Mtrr)];
if (!IsMtrrSupported ()) {
return;
@@ -155,15 +155,21 @@ AccessAllMtrrs ( Ranges[0].BaseAddress = 0;
Ranges[0].Length = MtrrValidBitsMask + 1;
Ranges[0].Type = MtrrGetDefaultMemoryType ();
- RangeCount = 1;
+ RangeCount = 1;
MtrrLibGetRawVariableRanges (
- &Mtrrs->Variables, VariableMtrrCount,
- MtrrValidBitsMask, MtrrValidAddressMask, RawVariableRanges
+ &Mtrrs->Variables,
+ VariableMtrrCount,
+ MtrrValidBitsMask,
+ MtrrValidAddressMask,
+ RawVariableRanges
);
MtrrLibApplyVariableMtrrs (
- RawVariableRanges, VariableMtrrCount,
- Ranges, ARRAY_SIZE (Ranges), &RangeCount
+ RawVariableRanges,
+ VariableMtrrCount,
+ Ranges,
+ ARRAY_SIZE (Ranges),
+ &RangeCount
);
MtrrLibApplyFixedMtrrs (&Mtrrs->Fixed, Ranges, ARRAY_SIZE (Ranges), &RangeCount);
@@ -187,11 +193,11 @@ AccessAllMtrrs ( UINT64
EFIAPI
HpetRead (
- IN UINTN Offset
+ IN UINTN Offset
)
{
- UINTN Address;
- UINT64 Value;
+ UINTN Address;
+ UINT64 Value;
Address = HPET_BASE_ADDRESS + Offset;
@@ -200,7 +206,7 @@ HpetRead ( }
MemoryFence ();
- Value = *(volatile UINT64*)Address;
+ Value = *(volatile UINT64 *)Address;
MemoryFence ();
return Value;
@@ -251,8 +257,7 @@ GetMicrocodeSignature ( @retval Others An error occurred in the PRM handler.
**/
-PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler)
-{
+PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) {
UINT32 MicrocodeSignature;
MicrocodeSignature = 0;
@@ -277,8 +282,7 @@ PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) @retval Others An error occurred in the PRM handler.
**/
-PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler)
-{
+PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) {
AccessAllMtrrs ();
return EFI_SUCCESS;
@@ -296,8 +300,7 @@ PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) @retval Others An error occurred in the PRM handler.
**/
-PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler)
-{
+PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) {
AccessHpetConfiguration ();
return EFI_SUCCESS;
@@ -324,8 +327,8 @@ PRM_MODULE_EXPORT ( EFI_STATUS
EFIAPI
PrmSampleHardwareAccessModuleInit (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
return EFI_SUCCESS;
diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c index d41cba3..ea3235e 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 687508c..82853bb 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 16bd3f4..c1ec801 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 b6083a4..a5799ff 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 48da39d..2c9a198 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 dbe3e76..ab79365 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 65e69ec..799b153 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 2857db2..6428090 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 7e1849f..5b7b670 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;
|