From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mx.groups.io with SMTP id smtpd.web12.13910.1647974235970928822 for ; Tue, 22 Mar 2022 11:37:16 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@linux.microsoft.com header.s=default header.b=DcM+5Q60; spf=pass (domain: linux.microsoft.com, ip: 13.77.154.182, mailfrom: mikuback@linux.microsoft.com) Received: from localhost.localdomain (unknown [47.202.59.224]) by linux.microsoft.com (Postfix) with ESMTPSA id C5D2720DE47A; Tue, 22 Mar 2022 11:37:13 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C5D2720DE47A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1647974235; bh=paD+Img9SiImP8gGRs2ze9dc6Xck3BAhCMv4KJpuIJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DcM+5Q60OEbvcpfO/fLrBML1WUd8g13GvHD5AKj0zDc3QDpdGMFZcDfcpvsGvfZ++ yrP+ZnDoX7Pc2RXeHrgnIUqprl1GkH3VkSYh57vITR3c+jW6mCfQmCJVWD9yGTjts0 FNIiNe3W+b3f+J+3dZHD4KVUUSHCIaxdQRrGZhHw= From: "Michael Kubacki" To: devel@edk2.groups.io Cc: Andrew Fish , Kang Gao , Michael D Kinney , Michael Kubacki , Leif Lindholm , Benjamin You , Liu Yun , Ankit Sinha , Nate DeSimone Subject: [PATCH v1 41/41] PrmPkg: Apply uncrustify changes Date: Tue, 22 Mar 2022 14:36:42 -0400 Message-Id: <20220322183642.9436-2-mikuback@linux.microsoft.com> X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20220322183642.9436-1-mikuback@linux.microsoft.com> References: <20220322183642.9436-1-mikuback@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Kubacki REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3737 Apply uncrustify changes to .c/.h files in PrmPkg. Cc: Andrew Fish Cc: Kang Gao Cc: Michael D Kinney Cc: Michael Kubacki Cc: Leif Lindholm Cc: Benjamin You Cc: Liu Yun Cc: Ankit Sinha Cc: Nate DeSimone Signed-off-by: Michael Kubacki --- PrmPkg/Application/PrmInfo/PrmInfo.c = | 243 +++= +---- PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c = | 51 +- PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferLibUni= tTest.c | 242 +++= +---- PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c = | 109 ++-= - PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscoveryLi= bUnitTest.c | 31 +- PrmPkg/Library/DxePrmPeCoffLib/DxePrmPeCoffLib.c = | 256 +++= +----- PrmPkg/PrmConfigDxe/PrmConfigDxe.c = | 172 +++= --- PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c = | 173 +++= --- PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c = | 36 +- PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiParamet= erBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c | 25 +- PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiParameter= BufferModule.c | 13 +- PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBufferModu= leConfigLib/DxeContextBufferModuleConfigLib.c | 51 +- PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferModule= .c | 14 +- PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAccessMo= duleConfigLib/DxeHardwareAccessModuleConfigLib.c | 22 +- PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAccessModu= le.c | 79 +-- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTest.c | 94 ++-= - PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestEventTimer.c | 32 +- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestImage.c | 16 +- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestMemory.c | 12 +- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestMisc.c | 20 +- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestProtocol.c | 589 +++= +++++++---------- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestTpl.c | 4 +- PrmPkg/Application/PrmInfo/PrmInfo.h = | 26 +- PrmPkg/Include/Library/PrmContextBufferLib.h = | 18 +- PrmPkg/Include/Library/PrmModuleDiscoveryLib.h = | 6 +- PrmPkg/Include/Library/PrmPeCoffLib.h = | 28 +- PrmPkg/Include/Prm.h = | 14 +- PrmPkg/Include/PrmContextBuffer.h = | 31 +- PrmPkg/Include/PrmDataBuffer.h = | 10 +- PrmPkg/Include/PrmExportDescriptor.h = | 31 +- PrmPkg/Include/PrmMmio.h = | 10 +- PrmPkg/Include/PrmModule.h = | 20 +- PrmPkg/Include/PrmModuleImageContext.h = | 6 +- PrmPkg/Include/Protocol/PrmConfig.h = | 11 +- PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h = | 8 +- PrmPkg/PrmLoaderDxe/PrmAcpiTable.h = | 66 +-- PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h = | 8 +- PrmPkg/Samples/PrmSampleHardwareAccessModule/Hpet.h = | 76 +-- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTest.h | 192 +++= +--- PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiBootSe= rvicesTableLibUnitTestProtocol.h | 83 ++- 40 files changed, 1499 insertions(+), 1429 deletions(-) diff --git a/PrmPkg/Application/PrmInfo/PrmInfo.c b/PrmPkg/Application/Pr= mInfo/PrmInfo.c index e479667ec7eb..0cde2fad3b4b 100644 --- a/PrmPkg/Application/PrmInfo/PrmInfo.c +++ b/PrmPkg/Application/PrmInfo/PrmInfo.c @@ -32,25 +32,25 @@ =20 #include "PrmInfo.h" =20 -GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPrmInfoHelpTokenId =3D= STRING_TOKEN (STR_PRMINFO_HELP); +GLOBAL_REMOVE_IF_UNREFERENCED EFI_STRING_ID mStringPrmInfoHelpTokenId =3D= 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[]; =20 -STATIC UINTN mPrmHandlerCount; -STATIC UINTN mPrmModuleCount; +STATIC UINTN mPrmHandlerCount; +STATIC UINTN mPrmModuleCount; =20 -STATIC EFI_HII_HANDLE mPrmInfoHiiHandle; -STATIC LIST_ENTRY mPrmHandlerList; +STATIC EFI_HII_HANDLE mPrmInfoHiiHandle; +STATIC LIST_ENTRY mPrmHandlerList; =20 -STATIC CONST SHELL_PARAM_ITEM mParamList[] =3D { - {L"-l", TypeFlag}, - {L"-t", TypeValue}, - {NULL, TypeMax} - }; +STATIC CONST SHELL_PARAM_ITEM mParamList[] =3D { + { L"-l", TypeFlag }, + { L"-t", TypeValue }, + { NULL, TypeMax } +}; =20 /** Frees all of the nodes in a linked list. @@ -61,12 +61,12 @@ STATIC CONST SHELL_PARAM_ITEM mParamList[] =3D { 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; =20 if (ListHead =3D=3D NULL) { return; @@ -75,7 +75,7 @@ FreeList ( Link =3D GetFirstNode (&mPrmHandlerList); while (!IsNull (&mPrmHandlerList, Link)) { ListEntry =3D CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY, Link, PRM_HA= NDLER_CONTEXT_LIST_ENTRY_SIGNATURE); - NextLink =3D GetNextNode (&mPrmHandlerList, Link); + NextLink =3D GetNextNode (&mPrmHandlerList, Link); =20 RemoveEntryList (Link); FreePool (ListEntry); @@ -96,12 +96,13 @@ CreateNewPrmHandlerListEntry ( VOID ) { - PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry; + PRM_HANDLER_CONTEXT_LIST_ENTRY *PrmHandlerContextListEntry; =20 PrmHandlerContextListEntry =3D AllocateZeroPool (sizeof (*PrmHandlerCo= ntextListEntry)); if (PrmHandlerContextListEntry =3D=3D NULL) { return NULL; } + PrmHandlerContextListEntry->Signature =3D PRM_HANDLER_CONTEXT_LIST_ENT= RY_SIGNATURE; =20 return PrmHandlerContextListEntry; @@ -118,14 +119,14 @@ PrintMmioRuntimeRangeInfo ( IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges ) { - UINTN RuntimeMmioRangeCount; - UINTN RuntimeMmioRangeIndex; + UINTN RuntimeMmioRangeCount; + UINTN RuntimeMmioRangeIndex; =20 if (RuntimeMmioRanges =3D=3D NULL) { return; } =20 - RuntimeMmioRangeCount =3D (UINTN) RuntimeMmioRanges->Count; + RuntimeMmioRangeCount =3D (UINTN)RuntimeMmioRanges->Count; ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_RUNTIME_MMIO_= COUNT), mPrmInfoHiiHandle, RuntimeMmioRangeCount); =20 for (RuntimeMmioRangeIndex =3D 0; RuntimeMmioRangeIndex < RuntimeMmioR= angeCount; 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 *CurrentPrmModuleRuntimeMmioRang= es; + 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 *CurrentPrmModuleRuntimeMmioRange= s; =20 ASSERT (mPrmModuleCount <=3D mPrmHandlerCount); =20 @@ -182,25 +183,25 @@ GatherPrmHandlerInfo ( =20 // Iterate across all PRM modules discovered for ( - CurrentPrmModuleImageContext =3D NULL, Status =3D GetNextPrmModuleEn= try (&CurrentPrmModuleImageContext); - !EFI_ERROR (Status); - Status =3D GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) { - - CurrentImageAddress =3D CurrentPrmModuleImageContext->PeCoffImageCon= text.ImageAddress; - CurrentImageExportDirectory =3D CurrentPrmModuleImageContext->Export= Directory; + CurrentPrmModuleImageContext =3D NULL, Status =3D GetNextPrmModul= eEntry (&CurrentPrmModuleImageContext); + !EFI_ERROR (Status); + Status =3D GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) + { + CurrentImageAddress =3D CurrentPrmModuleImageContext->PeCo= ffImageContext.ImageAddress; + CurrentImageExportDirectory =3D CurrentPrmModuleImageContext->Expo= rtDirectory; CurrentExportDescriptorStruct =3D CurrentPrmModuleImageContext->Expo= rtDescriptor; =20 CurrentModuleGuid =3D &CurrentExportDescriptorStruct->Header.ModuleG= uid; - HandlerCount =3D CurrentExportDescriptorStruct->Header.NumberPrmHand= lers; + HandlerCount =3D CurrentExportDescriptorStruct->Header.NumberPr= mHandlers; =20 MajorVersion =3D 0; MinorVersion =3D 0; - Status =3D GetImageVersionInPeCoffImage ( - (VOID *) (UINTN) CurrentImageAddress, - &CurrentPrmModuleImageContext->PeCoffImageContext, - &MajorVersion, - &MinorVersion - ); + Status =3D GetImageVersionInPeCoffImage ( + (VOID *)(UINTN)CurrentImageAddress, + &CurrentPrmModuleImageContext->PeCoffImageContext, + &MajorVersion, + &MinorVersion + ); ASSERT_EFI_ERROR (Status); =20 if (PrintInformation) { @@ -210,7 +211,7 @@ GatherPrmHandlerInfo ( NULL, STRING_TOKEN (STR_PRMINFO_MODULE_NAME), mPrmInfoHiiHandle, - (CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirec= tory->Name) + (CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirecto= ry->Name) ); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_GU= ID), mPrmInfoHiiHandle, CurrentModuleGuid); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_MODULE_VE= RSION), mPrmInfoHiiHandle, MajorVersion, MinorVersion); @@ -218,13 +219,13 @@ GatherPrmHandlerInfo ( =20 // It is currently valid for a PRM module not to use a context buffe= r CurrentPrmModuleRuntimeMmioRanges =3D NULL; - Status =3D GetModuleContextBuffers ( - ByModuleGuid, - CurrentModuleGuid, - (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContex= tBuffers - ); + Status =3D GetModuleContextBuffers ( + ByModuleGuid, + CurrentModuleGuid, + (CONST PRM_MODULE_CONTEXT_BUFF= ERS **)&CurrentModuleContextBuffers + ); ASSERT (!EFI_ERROR (Status) || Status =3D=3D EFI_NOT_FOUND); - if (!EFI_ERROR (Status) && CurrentModuleContextBuffers !=3D NULL) { + if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers !=3D NULL)) = { CurrentPrmModuleRuntimeMmioRanges =3D CurrentModuleContextBuffers-= >RuntimeMmioRanges; } =20 @@ -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_BREA= K), mPrmInfoHiiHandle); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_C= OUNT), mPrmInfoHiiHandle, HandlerCount); } @@ -241,9 +243,9 @@ GatherPrmHandlerInfo ( for (HandlerIndex =3D 0; HandlerIndex < HandlerCount; HandlerIndex++= ) { ZeroMem (&CurrentHandlerContext, sizeof (CurrentHandlerContext)); =20 - CurrentHandlerContext.ModuleName =3D (CHAR8 *) ((UINTN) CurrentIma= geAddress + CurrentImageExportDirectory->Name); - CurrentHandlerContext.Guid =3D &CurrentExportDescriptorStruct->Prm= HandlerExportDescriptors[HandlerIndex].PrmHandlerGuid; - CurrentHandlerContext.Name =3D (CHAR8 *) CurrentExportDescriptorSt= ruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName; + CurrentHandlerContext.ModuleName =3D (CHAR8 *)((UINTN)CurrentImage= Address + CurrentImageExportDirectory->Name); + CurrentHandlerContext.Guid =3D &CurrentExportDescriptorStruc= t->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerGuid; + CurrentHandlerContext.Name =3D (CHAR8 *)CurrentExportDescrip= torStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerName; =20 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 =3D (PRM_HANDLER *) (UINTN) Curren= tHandlerPhysicalAddress; + CurrentHandlerContext.Handler =3D (PRM_HANDLER *)(UINTN)CurrentH= andlerPhysicalAddress; =20 if (PrintInformation) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDL= ER_PA), mPrmInfoHiiHandle, CurrentHandlerPhysicalAddress); @@ -272,7 +274,7 @@ GatherPrmHandlerInfo ( Status =3D GetContextBuffer ( CurrentHandlerContext.Guid, CurrentModuleContextBuffers, - (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer + (CONST PRM_CONTEXT_BUFFER **)&CurrentContextBuffer ); if (!EFI_ERROR (Status)) { CurrentHandlerContext.StaticDataBuffer =3D 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 =3D=3D NULL || ContextBuffer =3D=3D NULL) { + if ((HandlerGuid =3D=3D NULL) || (ContextBuffer =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 ZeroMem (ContextBuffer, sizeof (*ContextBuffer)); =20 ContextBuffer->Signature =3D PRM_CONTEXT_BUFFER_SIGNATURE; - ContextBuffer->Version =3D PRM_CONTEXT_BUFFER_INTERFACE_VERSION; + ContextBuffer->Version =3D PRM_CONTEXT_BUFFER_INTERFACE_VERSION; CopyGuid (&ContextBuffer->HandlerGuid, HandlerGuid); =20 if (StaticDataBuffer !=3D 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; =20 - Sec =3D 0; - MilliSec =3D 0; - MicroSec =3D 0; - NanoSec =3D 0; + Sec =3D 0; + MilliSec =3D 0; + MicroSec =3D 0; + NanoSec =3D 0; RemainingTime =3D TimeInNanoSec; =20 - if (RemainingTime > ONE_SECOND) { - Sec =3D DivU64x32 (RemainingTime, ONE_SECOND); + if (RemainingTime > ONE_SECOND) { + Sec =3D DivU64x32 (RemainingTime, ONE_SECOND); RemainingTime -=3D MultU64x32 (Sec, ONE_SECOND); } =20 if (RemainingTime > ONE_MILLISECOND) { - MilliSec =3D DivU64x32 (RemainingTime, ONE_MILLISECOND); + MilliSec =3D DivU64x32 (RemainingTime, ONE_MILLISECOND); RemainingTime -=3D MultU64x32 (MilliSec, ONE_MILLISECOND); } =20 if (RemainingTime > ONE_MICROSECOND) { - MicroSec =3D DivU64x32 (RemainingTime, ONE_MICROSECOND); + MicroSec =3D DivU64x32 (RemainingTime, ONE_MICROSECOND); RemainingTime -=3D MultU64x32 (MicroSec, ONE_MICROSECOND); } =20 @@ -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; + 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; =20 - Link =3D NULL; + Link =3D NULL; HandlerFound =3D FALSE; =20 if (HandlerGuid =3D=3D NULL) { @@ -439,14 +441,14 @@ ExecutePrmHandlerByGuid ( =20 EFI_LIST_FOR_EACH (Link, &mPrmHandlerList) { HandlerContextListEntry =3D CR (Link, PRM_HANDLER_CONTEXT_LIST_ENTRY= , Link, PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE); - HandlerContext =3D &HandlerContextListEntry->Context; + HandlerContext =3D &HandlerContextListEntry->Context; =20 if (!ExecuteAllHandlers && !CompareGuid (HandlerGuid, HandlerContext= ->Guid)) { continue; } =20 HandlerFound =3D TRUE; - Status =3D PopulateContextBuffer (HandlerContext->StaticDataBuffer, = HandlerContext->Guid, &CurrentContextBuffer); + Status =3D PopulateContextBuffer (HandlerContext->StaticDataBu= ffer, HandlerContext->Guid, &CurrentContextBuffer); if (!EFI_ERROR (Status)) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREA= K), mPrmInfoHiiHandle); ShellPrintHiiEx ( @@ -461,10 +463,11 @@ ExecutePrmHandlerByGuid ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_G= UID), mPrmInfoHiiHandle, HandlerContext->Guid); =20 StartTime =3D 0; - EndTime =3D 0; + EndTime =3D 0; if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) { StartTime =3D GetPerformanceCounter (); } + Status =3D HandlerContext->Handler (NULL, &CurrentContextBuffer); if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) { EndTime =3D GetPerformanceCounter (); @@ -477,11 +480,12 @@ ExecutePrmHandlerByGuid ( } =20 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_E= XEC_TIME), mPrmInfoHiiHandle); - if (StartTime =3D=3D 0 && EndTime =3D=3D 0) { + if ((StartTime =3D=3D 0) && (EndTime =3D=3D 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_BREA= K), mPrmInfoHiiHandle); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREA= K), 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; + EFI_STATUS Status; + EFI_STATUS ReturnStatus; + UINTN ArgumentCount; + EFI_GUID HandlerGuid; + BOOLEAN PrintHandlerInfo; + LIST_ENTRY *Package; + LIST_ENTRY *TempNode; + CHAR16 *ProblemParam; + CONST CHAR16 *HandlerGuidStr; =20 - HandlerGuidStr =3D NULL; - Package =3D NULL; + HandlerGuidStr =3D NULL; + Package =3D NULL; PrintHandlerInfo =3D FALSE; - ReturnStatus =3D EFI_SUCCESS; + ReturnStatus =3D EFI_SUCCESS; =20 InitializeListHead (&mPrmHandlerList); =20 @@ -541,7 +545,7 @@ ParseParameterList ( // Status =3D ShellCommandLineParseEx (mParamList, &Package, &ProblemPara= m, FALSE, FALSE); if (EFI_ERROR (Status)) { - if (Status =3D=3D EFI_VOLUME_CORRUPTED && ProblemParam !=3D NULL) { + if ((Status =3D=3D EFI_VOLUME_CORRUPTED) && (ProblemParam !=3D NULL)= ) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_GEN_PROBL= EM), mPrmInfoHiiHandle, APPLICATION_NAME, ProblemParam); ReturnStatus =3D EFI_INVALID_PARAMETER; FreePool (ProblemParam); @@ -561,10 +565,12 @@ ParseParameterList ( // Get argument count including flags // for ( - ArgumentCount =3D 0, TempNode =3D Package; - GetNextNode (Package, TempNode) !=3D Package; - ArgumentCount++, TempNode =3D GetNextNode (Package, TempNode) - ); + ArgumentCount =3D 0, TempNode =3D Package; + GetNextNode (Package, TempNode) !=3D Package; + ArgumentCount++, TempNode =3D GetNextNode (Package, TempNode) + ) + { + } =20 if (ArgumentCount =3D=3D 1) { ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_ARG), mP= rmInfoHiiHandle, APPLICATION_NAME); @@ -635,13 +641,14 @@ ParseParameterList ( ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLERS_FO= UND), mPrmInfoHiiHandle, mPrmHandlerCount); ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK)= , mPrmInfoHiiHandle); } + GatherPrmHandlerInfo (PrintHandlerInfo); =20 if (HandlerGuidStr !=3D NULL) { - Status =3D ExecutePrmHandlerByGuid (&HandlerGuid); - if (Status =3D=3D EFI_NOT_FOUND) { - ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER= _NOT_FOUND), mPrmInfoHiiHandle, APPLICATION_NAME, HandlerGuid); - } + Status =3D ExecutePrmHandlerByGuid (&HandlerGuid); + if (Status =3D=3D EFI_NOT_FOUND) { + ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_N= OT_FOUND), mPrmInfoHiiHandle, APPLICATION_NAME, HandlerGuid); + } } =20 Done: @@ -667,12 +674,12 @@ ParseParameterList ( 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; =20 // // Retrieve the HII package list from ImageHandle @@ -680,7 +687,7 @@ UefiMain ( Status =3D gBS->OpenProtocol ( ImageHandle, &gEfiHiiPackageListProtocolGuid, - (VOID **) &PackageList, + (VOID **)&PackageList, ImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL diff --git a/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib= .c b/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c index 1a1a15b5cdbb..3036aa503ec8 100644 --- a/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c +++ b/PrmPkg/Library/DxePrmContextBufferLib/DxePrmContextBufferLib.c @@ -14,7 +14,7 @@ #include #include =20 -#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]" +#define _DBGMSGID_ "[PRMCONTEXTBUFFERLIB]" =20 /** 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; =20 DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__))= ; =20 - if (HandlerGuid =3D=3D NULL || ModuleContextBuffers =3D=3D NULL || Con= textBuffer =3D=3D NULL) { + if ((HandlerGuid =3D=3D NULL) || (ModuleContextBuffers =3D=3D NULL) ||= (ContextBuffer =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -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; =20 DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__))= ; =20 - if (Guid =3D=3D NULL || PrmModuleContextBuffers =3D=3D NULL) { + if ((Guid =3D=3D NULL) || (PrmModuleContextBuffers =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } + *PrmModuleContextBuffers =3D NULL; =20 Status =3D gBS->LocateHandleBuffer ( @@ -108,10 +109,10 @@ GetModuleContextBuffers ( Status =3D gBS->HandleProtocol ( HandleBuffer[Index], &gPrmConfigProtocolGuid, - (VOID **) &PrmConfigProtocol + (VOID **)&PrmConfigProtocol ); ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status) || PrmConfigProtocol =3D=3D NULL) { + if (EFI_ERROR (Status) || (PrmConfigProtocol =3D=3D NULL)) { continue; } =20 @@ -167,19 +168,20 @@ GetModuleContextBuffers ( **/ EFI_STATUS GetContextBuffer ( - IN CONST EFI_GUID *PrmHandlerGuid, - IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTI= ONAL, - OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer + IN CONST EFI_GUID *PrmHandlerGuid, + IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTION= AL, + OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer ) { - EFI_STATUS Status; - CONST PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers; + EFI_STATUS Status; + CONST PRM_MODULE_CONTEXT_BUFFERS *ContextBuffers; =20 DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__))= ; =20 - if (PrmHandlerGuid =3D=3D NULL || PrmContextBuffer =3D=3D NULL) { + if ((PrmHandlerGuid =3D=3D NULL) || (PrmContextBuffer =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } + *PrmContextBuffer =3D NULL; =20 if (PrmModuleContextBuffers =3D=3D NULL) { @@ -190,6 +192,7 @@ GetContextBuffer ( } else { ContextBuffers =3D PrmModuleContextBuffers; } + Status =3D FindContextBufferInModuleBuffers (PrmHandlerGuid, ContextBu= ffers, PrmContextBuffer); =20 return Status; diff --git a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContext= BufferLibUnitTest.c b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxeP= rmContextBufferLibUnitTest.c index 07e247305880..e244e7b09575 100644 --- a/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferL= ibUnitTest.c +++ b/PrmPkg/Library/DxePrmContextBufferLib/UnitTest/DxePrmContextBufferL= ibUnitTest.c @@ -27,69 +27,69 @@ #include #include =20 -#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" =20 -///=3D=3D=3D TEST DATA =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D TEST DATA =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 EFI_HANDLE mTestProtocolHandle; =20 -//*---------------------------------------------------------------------= -------------* -//* 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; =20 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; =20 -//*---------------------------------------------------------------------= -------------* -//* Test GUIDs = * -//*---------------------------------------------------------------------= -------------* +// *--------------------------------------------------------------------= --------------* +// * Test GUIDs = * +// *--------------------------------------------------------------------= --------------* =20 // {52960b90-2f3a-4917-b91a-ed5f599a8809} -#define HANDLER_TEST_GUID_1 {0x52960b90, 0x2f3a, 0x4917, { 0xb9, 0x1a, 0= xed, 0x5f, 0x59, 0x9a, 0x88, 0x09 }} -EFI_GUID mHandlerTestGuid1 =3D HANDLER_TEST_GUID_1; +#define HANDLER_TEST_GUID_1 {0x52960b90, 0x2f3a, 0x4917, { 0xb9, 0x1a, = 0xed, 0x5f, 0x59, 0x9a, 0x88, 0x09 }} +EFI_GUID mHandlerTestGuid1 =3D HANDLER_TEST_GUID_1; =20 // {9316a80d-06dc-417b-b21d-6b3c2ae4ed6f} -#define HANDLER_TEST_GUID_2 {0x9316a80d, 0x06dc, 0x417b, { 0xb2, 0x1d, 0= x6b, 0x3c, 0x2a, 0xe4, 0xed, 0x6f }} -EFI_GUID mHandlerTestGuid2 =3D HANDLER_TEST_GUID_2; +#define HANDLER_TEST_GUID_2 {0x9316a80d, 0x06dc, 0x417b, { 0xb2, 0x1d, = 0x6b, 0x3c, 0x2a, 0xe4, 0xed, 0x6f }} +EFI_GUID mHandlerTestGuid2 =3D HANDLER_TEST_GUID_2; =20 // {d32ac8ba-6cc6-456f-9ed9-9233fa310434} -#define HANDLER_TEST_GUID_3 {0xd32ac8ba, 0x6cc6, 0x456f, { 0x9e, 0xd9, 0= x92, 0x33, 0xfa, 0x31, 0x04, 0x34 }} -EFI_GUID mHandlerTestGuid3 =3D HANDLER_TEST_GUID_3; +#define HANDLER_TEST_GUID_3 {0xd32ac8ba, 0x6cc6, 0x456f, { 0x9e, 0xd9, = 0x92, 0x33, 0xfa, 0x31, 0x04, 0x34 }} +EFI_GUID mHandlerTestGuid3 =3D HANDLER_TEST_GUID_3; =20 // {faadaa95-070b-4a34-a919-18305dc07370} -#define MODULE_TEST_GUID_1 {0xfaadaa95, 0x070b, 0x4a34, { 0xa9, 0x19, 0x= 18, 0x30, 0x5d, 0xc0, 0x73, 0x70 }} -EFI_GUID mModuleTestGuid1 =3D MODULE_TEST_GUID_1; +#define MODULE_TEST_GUID_1 {0xfaadaa95, 0x070b, 0x4a34, { 0xa9, 0x19, 0= x18, 0x30, 0x5d, 0xc0, 0x73, 0x70 }} +EFI_GUID mModuleTestGuid1 =3D MODULE_TEST_GUID_1; =20 // {0ea24584-731c-4863-9100-75780af509a7} -#define MODULE_TEST_GUID_2 {0x0ea24584, 0x731c, 0x4863, { 0x91, 0x00, 0x= 75, 0x78, 0x0a, 0xf5, 0x09, 0xa7 }} -EFI_GUID mModuleTestGuid2 =3D MODULE_TEST_GUID_2; +#define MODULE_TEST_GUID_2 {0x0ea24584, 0x731c, 0x4863, { 0x91, 0x00, 0= x75, 0x78, 0x0a, 0xf5, 0x09, 0xa7 }} +EFI_GUID mModuleTestGuid2 =3D MODULE_TEST_GUID_2; =20 // {f456b7a1-82a6-4427-8486-87e3a602df43} -#define MODULE_TEST_GUID_3 {0xf456b7a1, 0x82a6, 0x4427, { 0x84, 0x86, 0x= 87, 0xe3, 0xa6, 0x02, 0xdf, 0x43 }} -EFI_GUID mModuleTestGuid3 =3D MODULE_TEST_GUID_3; +#define MODULE_TEST_GUID_3 {0xf456b7a1, 0x82a6, 0x4427, { 0x84, 0x86, 0= x87, 0xe3, 0xa6, 0x02, 0xdf, 0x43 }} +EFI_GUID mModuleTestGuid3 =3D MODULE_TEST_GUID_3; =20 // {4a941a9c-9dcf-471b-94b5-d9e2d8c64a1b} -#define NEGATIVE_TEST_GUID {0x4a941a9c, 0x9dcf, 0x471b, {0x94, 0xb5, 0x= d9, 0xe2, 0xd8, 0xc6, 0x4a, 0x1b }} -EFI_GUID mNegativeTestGuid =3D NEGATIVE_TEST_GUID; +#define NEGATIVE_TEST_GUID {0x4a941a9c, 0x9dcf, 0x471b, {0x94, 0xb5, 0= xd9, 0xe2, 0xd8, 0xc6, 0x4a, 0x1b }} +EFI_GUID mNegativeTestGuid =3D NEGATIVE_TEST_GUID; =20 -//*---------------------------------------------------------------------= -------------* -//* PRM Static Test Structures = * -//*---------------------------------------------------------------------= -------------* +// *--------------------------------------------------------------------= --------------* +// * PRM Static Test Structures = * +// *--------------------------------------------------------------------= --------------* =20 -PRM_DATA_BUFFER mTestStaticDataBuffer1 =3D { +PRM_DATA_BUFFER mTestStaticDataBuffer1 =3D { { PRM_DATA_BUFFER_HEADER_SIGNATURE, sizeof (PRM_DATA_BUFFER) @@ -97,7 +97,7 @@ PRM_DATA_BUFFER mTestStaticDataBuffer1 =3D { // No data in the buffer (only a header) }; =20 -PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 =3D { +PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 =3D { PRM_CONTEXT_BUFFER_SIGNATURE, // Signature PRM_CONTEXT_BUFFER_INTERFACE_VERSION, // Version 0, // Reserved @@ -105,7 +105,7 @@ PRM_CONTEXT_BUFFER mTestPrmContextBuffer1 =3D { &mTestStaticDataBuffer1 // StaticDataBuffer }; =20 -PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] =3D { +PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] =3D { // Context buffer #1 { PRM_CONTEXT_BUFFER_SIGNATURE, // Signature @@ -124,56 +124,55 @@ PRM_CONTEXT_BUFFER mTestPrmContextBuffer2[2] =3D { } }; =20 -PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers1 =3D { +PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers1 =3D { MODULE_TEST_GUID_1, 1, &mTestPrmContextBuffer1, NULL }; =20 -PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers2 =3D { +PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers2 =3D { MODULE_TEST_GUID_2, 1, &mTestPrmContextBuffer1, NULL }; =20 -PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 =3D { +PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 =3D { MODULE_TEST_GUID_3, 2, &mTestPrmContextBuffer2[0], NULL }; =20 +// *--------------------------------------------------------------------= --------------* +// * Test Contexts = * +// *--------------------------------------------------------------------= --------------* =20 -//*---------------------------------------------------------------------= -------------* -//* Test Contexts = * -//*---------------------------------------------------------------------= -------------* - -//* Searches by module GUID * +// * Searches by module GUID * // +------------------= --------------+--------+----------------+--------------------+-----------= ---------+--------------------+ // + InstallationStruc= ture | Handle | GuidSearchType | Guid | ExpectedMo= duleGuid | ExpectedStatus | // +------------------= --------------+--------+----------------+--------------------+-----------= ---------+--------------------+ -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers00 =3D { &mTestPrmModule= ContextBuffers1, NULL, ByModuleGuid, &mModuleTestGuid1, &mModule= TestGuid1, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers01 =3D { &mTestPrmModule= ContextBuffers2, NULL, ByModuleGuid, &mModuleTestGuid2, &mModule= TestGuid2, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers02 =3D { &mTestPrmModule= ContextBuffers3, NULL, ByModuleGuid, &mModuleTestGuid3, &mModule= TestGuid3, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers03 =3D { &mTestPrmModule= ContextBuffers3, NULL, ByModuleGuid, &mNegativeTestGuid, &gZeroGu= id, EFI_NOT_FOUND }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers04 =3D { &mTestPrmModule= ContextBuffers1, NULL, ByModuleGuid, &gZeroGuid, &gZeroGu= id, EFI_NOT_FOUND }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers00 =3D { &mTestPrmModul= eContextBuffers1, NULL, ByModuleGuid, &mModuleTestGuid1, &mModuleTestGuid= 1, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers01 =3D { &mTestPrmModul= eContextBuffers2, NULL, ByModuleGuid, &mModuleTestGuid2, &mModuleTestGuid= 2, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers02 =3D { &mTestPrmModul= eContextBuffers3, NULL, ByModuleGuid, &mModuleTestGuid3, &mModuleTestGuid= 3, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers03 =3D { &mTestPrmModul= eContextBuffers3, NULL, ByModuleGuid, &mNegativeTestGuid, &gZeroGuid, EFI= _NOT_FOUND }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers04 =3D { &mTestPrmModul= eContextBuffers1, NULL, ByModuleGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FOU= ND }; =20 -//* Searches by handler GUID * +// * Searches by handler GUID * // +------------------= --------------+--------+----------------+--------------------+-----------= ---------+--------------------+ // + InstallationStruc= ture | Handle | GuidSearchType | Guid | ExpectedMo= duleGuid | ExpectedStatus | // +------------------= --------------+--------+----------------+--------------------+-----------= ---------+--------------------+ -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers05 =3D { &mTestPrmModule= ContextBuffers1, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModule= TestGuid1, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers06 =3D { &mTestPrmModule= ContextBuffers1, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGu= id, EFI_NOT_FOUND }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers07 =3D { &mTestPrmModule= ContextBuffers2, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModule= TestGuid2, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers08 =3D { &mTestPrmModule= ContextBuffers2, NULL, ByHandlerGuid, &mNegativeTestGuid, &gZeroGu= id, EFI_NOT_FOUND }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers09 =3D { &mTestPrmModule= ContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid1, &gZeroGu= id, EFI_NOT_FOUND }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers10 =3D { &mTestPrmModule= ContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid2, &mModule= TestGuid3, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers11 =3D { &mTestPrmModule= ContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid3, &mModule= TestGuid3, EFI_SUCCESS }; -PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers12 =3D { &mTestPrmModule= ContextBuffers3, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGu= id, EFI_NOT_FOUND }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers05 =3D { &mTestPrmModul= eContextBuffers1, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGu= id1, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers06 =3D { &mTestPrmModul= eContextBuffers1, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FO= UND }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers07 =3D { &mTestPrmModul= eContextBuffers2, NULL, ByHandlerGuid, &mHandlerTestGuid1, &mModuleTestGu= id2, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers08 =3D { &mTestPrmModul= eContextBuffers2, NULL, ByHandlerGuid, &mNegativeTestGuid, &gZeroGuid, EF= I_NOT_FOUND }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers09 =3D { &mTestPrmModul= eContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid1, &gZeroGuid, EF= I_NOT_FOUND }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers10 =3D { &mTestPrmModul= eContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid2, &mModuleTestGu= id3, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers11 =3D { &mTestPrmModul= eContextBuffers3, NULL, ByHandlerGuid, &mHandlerTestGuid3, &mModuleTestGu= id3, EFI_SUCCESS }; +PRM_CONTEXT_BUFFERS_TEST_CONTEXT mContextBuffers12 =3D { &mTestPrmModul= eContextBuffers3, NULL, ByHandlerGuid, &gZeroGuid, &gZeroGuid, EFI_NOT_FO= UND }; =20 -PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] =3D { +PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersArray[] =3D { &mContextBuffers00, &mContextBuffers01, &mContextBuffers02, @@ -192,14 +191,14 @@ PRM_CONTEXT_BUFFERS_TEST_CONTEXT *mContextBuffersAr= ray[] =3D { // +--------------------= --+----------------------------------+-----------------------------------= -------+--------------------+ // + HandlerGuid = | ContextBuffers | ExpectedContextBuffer = | ExpectedStatus | // +--------------------= --+----------------------------------+-----------------------------------= -------+--------------------+ -PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer00 =3D { &mHandlerTestGuid= 1, &mTestPrmModuleContextBuffers1, &mTestPrmContextBuffer1, = EFI_SUCCESS }; -PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer01 =3D { &mHandlerTestGuid= 1, &mTestPrmModuleContextBuffers2, &mTestPrmContextBuffer1, = EFI_SUCCESS }; -PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer02 =3D { &mHandlerTestGuid= 2, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[0], = EFI_SUCCESS }; -PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer03 =3D { &mHandlerTestGuid= 3, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[1], = EFI_SUCCESS }; -PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer04 =3D { &mNegativeTestGui= d, &mTestPrmModuleContextBuffers1, NULL, = EFI_NOT_FOUND }; -PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer05 =3D { &gZeroGuid, = &mTestPrmModuleContextBuffers3, NULL, = EFI_NOT_FOUND }; +PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer00 =3D { &mHandlerTestGui= d1, &mTestPrmModuleContextBuffers1, &mTestPrmContextBuffer1, EFI_SUCCESS = }; +PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer01 =3D { &mHandlerTestGui= d1, &mTestPrmModuleContextBuffers2, &mTestPrmContextBuffer1, EFI_SUCCESS = }; +PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer02 =3D { &mHandlerTestGui= d2, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[0], EFI_SUCCE= SS }; +PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer03 =3D { &mHandlerTestGui= d3, &mTestPrmModuleContextBuffers3, &mTestPrmContextBuffer2[1], EFI_SUCCE= SS }; +PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer04 =3D { &mNegativeTestGu= id, &mTestPrmModuleContextBuffers1, NULL, EFI_NOT_FOUND }; +PRM_CONTEXT_BUFFER_TEST_CONTEXT mContextBuffer05 =3D { &gZeroGuid, &mTe= stPrmModuleContextBuffers3, NULL, EFI_NOT_FOUND }; =20 -PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] =3D { +PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArray[] =3D { &mContextBuffer00, &mContextBuffer01, &mContextBuffer02, @@ -208,13 +207,13 @@ PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArra= y[] =3D { &mContextBuffer05 }; =20 -///=3D=3D=3D HELPER FUNCTIONS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D HELPER FUNCTIONS =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 // None =20 -///=3D=3D=3D TEST CASES =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D TEST CASES =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -///=3D=3D=3D=3D=3D BASIC SUITE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D=3D=3D BASIC SUITE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 /** Verifies that passing NULL arguments to all library functions fails wi= th EFI_INVALID_PARAMETER. @@ -229,13 +228,13 @@ PRM_CONTEXT_BUFFER_TEST_CONTEXT *mContextBufferArra= y[] =3D { 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; =20 UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, NULL, NULL), = EFI_INVALID_PARAMETER); UT_ASSERT_EQUAL (FindContextBufferInModuleBuffers (NULL, &ModuleContex= tBuffers, &ContextBufferPtr), EFI_INVALID_PARAMETER); @@ -254,7 +253,7 @@ NullPointerArgumentsShouldFailGracefully ( return UNIT_TEST_PASSED; } =20 -///=3D=3D=3D=3D=3D FUNCTIONAL CORRECTNESS SUITE =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D=3D=3D FUNCTIONAL CORRECTNESS SUITE =3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 /** 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; =20 UT_ASSERT_NOT_NULL (Context); - TestContext =3D (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context; + TestContext =3D (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context; ModuleContextBuffers =3D TestContext->InstallationStructure; =20 PrmConfigProtocol =3D AllocateZeroPool (sizeof (*PrmConfigProtocol)); @@ -294,14 +293,14 @@ InitializeFunctionalCorrectness ( =20 CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &Module= ContextBuffers->ModuleGuid); PrmConfigProtocol->ModuleContextBuffers.BufferCount =3D ModuleContextB= uffers->BufferCount; - PrmConfigProtocol->ModuleContextBuffers.Buffer =3D ModuleContextBuffer= s->Buffer; + PrmConfigProtocol->ModuleContextBuffers.Buffer =3D ModuleContextB= uffers->Buffer; =20 Status =3D gBS->InstallProtocolInterface ( - &TestContext->Handle, - &gPrmConfigProtocolGuid, - EFI_NATIVE_INTERFACE, - (VOID *) PrmConfigProtocol - ); + &TestContext->Handle, + &gPrmConfigProtocolGuid, + EFI_NATIVE_INTERFACE, + (VOID *)PrmConfigProtocol + ); UT_ASSERT_NOT_EFI_ERROR (Status); =20 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; =20 UT_ASSERT_NOT_NULL (Context); - TestContext =3D (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context; + TestContext =3D (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context; =20 Status =3D gBS->HandleProtocol ( TestContext->Handle, &gPrmConfigProtocolGuid, - (VOID **) &PrmConfigProtocol + (VOID **)&PrmConfigProtocol ); UT_ASSERT_NOT_EFI_ERROR (Status); =20 @@ -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; =20 ContextBuffers =3D NULL; - TestContext =3D (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *) Context; + TestContext =3D (PRM_CONTEXT_BUFFERS_TEST_CONTEXT *)Context; =20 Status =3D GetModuleContextBuffers (TestContext->GuidSearchType, TestC= ontext->Guid, &ContextBuffers); UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus); @@ -393,7 +392,7 @@ VerifyGetModuleContextBuffers ( __FUNCTION__, ((TestContext->GuidSearchType =3D=3D ByModuleGuid) ? "module" : "h= andler"), TestContext->Guid, - (UINTN) ContextBuffers + (UINTN)ContextBuffers ); } =20 @@ -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; =20 - ContextBuffers =3D NULL; + ContextBuffers =3D NULL; FoundContextBuffer =3D NULL; - TestContext =3D (PRM_CONTEXT_BUFFER_TEST_CONTEXT *) Context; + TestContext =3D (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context; =20 Status =3D 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; =20 - ContextBuffers =3D NULL; + ContextBuffers =3D NULL; FoundContextBuffer =3D NULL; - TestContext =3D (PRM_CONTEXT_BUFFER_TEST_CONTEXT *) Context; + TestContext =3D (PRM_CONTEXT_BUFFER_TEST_CONTEXT *)Context; =20 Status =3D GetContextBuffer (TestContext->HandlerGuid, TestContext->Co= ntextBuffers, &FoundContextBuffer); UT_ASSERT_STATUS_EQUAL (Status, TestContext->ExpectedStatus); @@ -484,7 +483,7 @@ VerifyGetContextBuffer ( return UNIT_TEST_PASSED; } =20 -///=3D=3D=3D TEST ENGINE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D TEST ENGINE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 /** 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. =20 **/ -int main () +int +main ( + ) { EFI_STATUS Status; UINTN Index; @@ -640,8 +641,7 @@ int main () Status =3D RunAllTestSuites (Framework); =20 EXIT: - if (Framework) - { + if (Framework) { FreeUnitTestFramework (Framework); } =20 diff --git a/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscover= yLib.c b/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib= .c index 0dd6a76be4d7..e6bea47bc583 100644 --- a/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c +++ b/PrmPkg/Library/DxePrmModuleDiscoveryLib/DxePrmModuleDiscoveryLib.c @@ -23,7 +23,7 @@ =20 #define _DBGMSGID_ "[PRMMODULEDISCOVERYLIB]" =20 -LIST_ENTRY mPrmModuleList; +LIST_ENTRY mPrmModuleList; =20 /** 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 @@ -59,7 +59,7 @@ GetNextPrmModuleEntry ( } else { CurrentListEntry =3D NULL; CurrentListEntry =3D CR (*ModuleImageContext, PRM_MODULE_IMAGE_CONTE= XT_LIST_ENTRY, Context, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE); - if (CurrentListEntry =3D=3D NULL || CurrentListEntry->Signature !=3D= PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE) { + if ((CurrentListEntry =3D=3D NULL) || (CurrentListEntry->Signature != =3D PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE)) { return EFI_INVALID_PARAMETER; } =20 @@ -92,7 +92,7 @@ CreateNewPrmModuleImageContextListEntry ( VOID ) { - PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntr= y; + PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY *PrmModuleImageContextListEntry; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 @@ -100,12 +100,13 @@ CreateNewPrmModuleImageContextListEntry ( if (PrmModuleImageContextListEntry =3D=3D NULL) { return NULL; } + DEBUG (( DEBUG_INFO, " %a %a: Allocated PrmModuleImageContextListEntry at 0x%x of size 0= x%x bytes.\n", _DBGMSGID_, __FUNCTION__, - (UINTN) PrmModuleImageContextListEntry, + (UINTN)PrmModuleImageContextListEntry, sizeof (*PrmModuleImageContextListEntry) )); =20 @@ -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; =20 for (Index =3D 0; Index < MmramRangeCount; Index++) { if ((Address >=3D 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 *PrmModuleImageContextListEntr= y; - 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 PrmHandlerCount =3D 0; - PrmModuleCount =3D 0; + PrmModuleCount =3D 0; =20 if (!IsListEmpty (&mPrmModuleList)) { return EFI_ALREADY_STARTED; @@ -206,18 +207,18 @@ DiscoverPrmModules ( return EFI_NOT_FOUND; } =20 - MmramRanges =3D NULL; + MmramRanges =3D NULL; MmramRangeCount =3D 0; - Status =3D gBS->LocateProtocol ( - &gEfiMmAccessProtocolGuid, - NULL, - (VOID **)&MmAccess - ); + Status =3D gBS->LocateProtocol ( + &gEfiMmAccessProtocolGuid, + NULL, + (VOID **)&MmAccess + ); if (Status =3D=3D EFI_SUCCESS) { // // Get MMRAM range information // - Size =3D 0; + Size =3D 0; Status =3D MmAccess->GetCapabilities (MmAccess, &Size, NULL); if ((Status =3D=3D EFI_BUFFER_TOO_SMALL) && (Size !=3D 0)) { MmramRanges =3D (EFI_MMRAM_DESCRIPTOR *)AllocatePool (Size); @@ -234,7 +235,7 @@ DiscoverPrmModules ( Status =3D gBS->HandleProtocol ( HandleBuffer[Index], &gEfiLoadedImageProtocolGuid, - (VOID **) &LoadedImageProtocol + (VOID **)&LoadedImageProtocol ); if (EFI_ERROR (Status)) { continue; @@ -249,16 +250,17 @@ DiscoverPrmModules ( TempPrmModuleImageContext.PeCoffImageContext.ImageRead =3D PeCoffLoa= derImageReadFromMemory; =20 Status =3D PeCoffLoaderGetImageInfo (&TempPrmModuleImageContext.PeCo= ffImageContext); - if (EFI_ERROR (Status) || TempPrmModuleImageContext.PeCoffImageConte= xt.ImageError !=3D IMAGE_ERROR_SUCCESS) { + if (EFI_ERROR (Status) || (TempPrmModuleImageContext.PeCoffImageCont= ext.ImageError !=3D IMAGE_ERROR_SUCCESS)) { DEBUG (( DEBUG_WARN, "%a %a: ImageHandle 0x%016lx is not a valid PE/COFF image. It ca= nnot 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 ( =20 // Attempt to find the PRM Module Export Descriptor in the export ta= ble Status =3D GetPrmModuleExportDescriptorTable ( - TempPrmModuleImageContext.ExportDirectory, - &TempPrmModuleImageContext.PeCoffImageContext, - &TempPrmModuleImageContext.ExportDescriptor - ); - if (EFI_ERROR (Status) || TempPrmModuleImageContext.ExportDescriptor= =3D=3D NULL) { + TempPrmModuleImageContext.ExportDirectory, + &TempPrmModuleImageContext.PeCoffImageContext, + &TempPrmModuleImageContext.ExportDescriptor + ); + if (EFI_ERROR (Status) || (TempPrmModuleImageContext.ExportDescripto= r =3D=3D NULL)) { continue; } + // A PRM Module Export Descriptor was successfully found, this is co= nsidered a PRM Module. =20 // @@ -292,6 +295,7 @@ DiscoverPrmModules ( if (PrmModuleImageContextListEntry =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } + CopyMem ( &PrmModuleImageContextListEntry->Context, &TempPrmModuleImageContext, @@ -306,6 +310,7 @@ DiscoverPrmModules ( if (HandlerCount !=3D NULL) { *HandlerCount =3D PrmHandlerCount; } + if (ModuleCount !=3D NULL) { *ModuleCount =3D 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; =20 if (IsListEmpty (&mPrmModuleList)) { return EFI_SUCCESS; @@ -346,7 +351,7 @@ PrmModuleDiscoveryLibDestructor ( Link =3D GetFirstNode (&mPrmModuleList); while (!IsNull (&mPrmModuleList, Link)) { ListEntry =3D CR (Link, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Link, P= RM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE); - NextLink =3D GetNextNode (&mPrmModuleList, Link); + NextLink =3D GetNextNode (&mPrmModuleList, Link); =20 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/UnitTest/DxePrmModul= eDiscoveryLibUnitTest.c b/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTes= t/DxePrmModuleDiscoveryLibUnitTest.c index ef8abe397cd4..558cd858d2ba 100644 --- a/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscov= eryLibUnitTest.c +++ b/PrmPkg/Library/DxePrmModuleDiscoveryLib/UnitTest/DxePrmModuleDiscov= eryLibUnitTest.c @@ -24,12 +24,12 @@ =20 #include "../PrmModuleDiscovery.h" =20 -#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" =20 -///=3D=3D=3D TEST CASES =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D TEST CASES =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 -///=3D=3D=3D=3D=3D CREATE NEW PRM MODULE IMAGE CONTEXT LIST ENTRY TESTS = SUITE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D +/// =3D=3D=3D=3D=3D CREATE NEW PRM MODULE IMAGE CONTEXT LIST ENTRY TESTS= SUITE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D =20 /** 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; =20 ListEntry =3D CreateNewPrmModuleImageContextListEntry (); =20 @@ -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; =20 ListEntry =3D CreateNewPrmModuleImageContextListEntry (); =20 @@ -101,11 +101,11 @@ PrmModuleImageContextListEntrySignatureShouldBeVali= d ( 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; =20 ListEntry =3D CreateNewPrmModuleImageContextListEntry (); =20 @@ -119,7 +119,7 @@ PrmModuleImageContextListEntryImageContextShouldBeZer= oed ( return UNIT_TEST_PASSED; } =20 -///=3D=3D=3D TEST ENGINE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +/// =3D=3D=3D TEST ENGINE =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 /** Entry point for the PRM Context Buffer Library unit tests. @@ -131,7 +131,9 @@ PrmModuleImageContextListEntryImageContextShouldBeZer= oed ( @retval other Some error occurred when executing this entry = point. =20 **/ -int main () +int +main ( + ) { EFI_STATUS Status; UNIT_TEST_FRAMEWORK_HANDLE Framework; @@ -200,8 +202,7 @@ int main () Status =3D RunAllTestSuites (Framework); =20 EXIT: - if (Framework) - { + if (Framework) { FreeUnitTestFramework (Framework); } =20 diff --git a/PrmPkg/Library/DxePrmPeCoffLib/DxePrmPeCoffLib.c b/PrmPkg/Li= brary/DxePrmPeCoffLib/DxePrmPeCoffLib.c index d760d137dc2b..d535c2c10596 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 PrmModuleExportDescriptorOrdin= al; - 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 - if (ImageExportDirectory =3D=3D NULL || - PeCoffLoaderImageContext =3D=3D NULL || - PeCoffLoaderImageContext->ImageAddress =3D=3D 0 || - ExportDescriptor =3D=3D NULL) { + if ((ImageExportDirectory =3D=3D NULL) || + (PeCoffLoaderImageContext =3D=3D NULL) || + (PeCoffLoaderImageContext->ImageAddress =3D=3D 0) || + (ExportDescriptor =3D=3D NULL)) + { return EFI_INVALID_PARAMETER; } =20 @@ -73,13 +74,13 @@ GetPrmModuleExportDescriptorTable ( // // The export name pointer table and export ordinal table form two par= allel arrays associated by index. // - CurrentImageAddress =3D PeCoffLoaderImageContext->ImageAddress; - ExportAddressTable =3D (UINT32 *) ((UINTN) CurrentImageAddress + Image= ExportDirectory->AddressOfFunctions); - ExportNamePointerTable =3D (UINT32 *) ((UINTN) CurrentImageAddress + I= mageExportDirectory->AddressOfNames); - OrdinalTable =3D (UINT16 *) ((UINTN) CurrentImageAddress + ImageExport= Directory->AddressOfNameOrdinals); + CurrentImageAddress =3D PeCoffLoaderImageContext->ImageAddress; + ExportAddressTable =3D (UINT32 *)((UINTN)CurrentImageAddress + Ima= geExportDirectory->AddressOfFunctions); + ExportNamePointerTable =3D (UINT32 *)((UINTN)CurrentImageAddress + Ima= geExportDirectory->AddressOfNames); + OrdinalTable =3D (UINT16 *)((UINTN)CurrentImageAddress + Ima= geExportDirectory->AddressOfNameOrdinals); =20 for (Index =3D 0; Index < ImageExportDirectory->NumberOfNames; Index++= ) { - CurrentExportName =3D (CONST CHAR8 *) ((UINTN) CurrentImageAddress += ExportNamePointerTable[Index]); + CurrentExportName =3D (CONST CHAR8 *)((UINTN)CurrentImageAddress + E= xportNamePointerTable[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)) - ) =3D=3D 0) { + AsciiStrnCmp ( + PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME), + CurrentExportName, + AsciiStrLen (PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME)) + ) =3D=3D 0) + { PrmModuleExportDescriptorOrdinal =3D OrdinalTable[Index]; DEBUG (( DEBUG_INFO, @@ -106,19 +108,21 @@ GetPrmModuleExportDescriptorTable ( DEBUG ((DEBUG_ERROR, "%a %a: The PRM Module Export Descriptor or= dinal value is invalid.\n", _DBGMSGID_, __FUNCTION__)); return EFI_NOT_FOUND; } - TempExportDescriptor =3D (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *) (= (UINTN) CurrentImageAddress + ExportAddressTable[PrmModuleExportDescripto= rOrdinal]); + + TempExportDescriptor =3D (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *)((= UINTN)CurrentImageAddress + ExportAddressTable[PrmModuleExportDescriptorO= rdinal]); if (TempExportDescriptor->Header.Signature =3D=3D PRM_MODULE_EXPOR= T_DESCRIPTOR_SIGNATURE) { *ExportDescriptor =3D 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 signa= ture check failed.\n", _DBGMSGID_, __FUNCTION__, - (UINTN) TempExportDescriptor + (UINTN)TempExportDescriptor )); } + DEBUG ((DEBUG_INFO, " %a %a: Exiting export iteration since expor= t 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; =20 - if (Image =3D=3D NULL || PeCoffLoaderImageContext =3D=3D NULL || Image= ExportDirectory =3D=3D NULL) { + if ((Image =3D=3D NULL) || (PeCoffLoaderImageContext =3D=3D NULL) || (= ImageExportDirectory =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -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 =3D 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 =3D 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 mod= ule.\n", - _DBGMSGID_, - __FUNCTION__ - )); - return EFI_UNSUPPORTED; + case EFI_IMAGE_MACHINE_IA32: + // + // Assume PE32 image with IA32 Machine field. + // + Magic =3D 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 =3D 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 m= odule.\n", + _DBGMSGID_, + __FUNCTION__ + )); + return EFI_UNSUPPORTED; } =20 - OptionalHeaderPtrUnion.Pe32 =3D (EFI_IMAGE_NT_HEADERS32 *) ( - (UINTN) Image + - PeCoffLoaderImageContext->PeCoffHeader= Offset - ); + OptionalHeaderPtrUnion.Pe32 =3D (EFI_IMAGE_NT_HEADERS32 *)( + (UINTN)Image = + + PeCoffLoaderI= mageContext->PeCoffHeaderOffset + ); =20 // // 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 =3D OptionalHeaderPtrUnion.Pe32->OptionalHeader.= NumberOfRvaAndSizes; - DirectoryEntry =3D (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHeaderPtrU= nion.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXPORT]= ); + DirectoryEntry =3D (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHeader= PtrUnion.Pe32->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXP= ORT]); } else if (OptionalHeaderPtrUnion.Pe32->OptionalHeader.Magic =3D=3D EF= I_IMAGE_NT_OPTIONAL_HDR64_MAGIC) { // // Use the PE32+ offset get the Export Directory Entry // NumberOfRvaAndSizes =3D OptionalHeaderPtrUnion.Pe32Plus->OptionalHea= der.NumberOfRvaAndSizes; - DirectoryEntry =3D (EFI_IMAGE_DATA_DIRECTORY *) &(OptionalHeaderPtrU= nion.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY_EXP= ORT]); + DirectoryEntry =3D (EFI_IMAGE_DATA_DIRECTORY *)&(OptionalHeader= PtrUnion.Pe32Plus->OptionalHeader.DataDirectory[EFI_IMAGE_DIRECTORY_ENTRY= _EXPORT]); } else { return EFI_UNSUPPORTED; } =20 - if (NumberOfRvaAndSizes <=3D EFI_IMAGE_DIRECTORY_ENTRY_EXPORT || Direc= toryEntry->VirtualAddress =3D=3D 0) { + if ((NumberOfRvaAndSizes <=3D EFI_IMAGE_DIRECTORY_ENTRY_EXPORT) || (Di= rectoryEntry->VirtualAddress =3D=3D 0)) { // // The export directory is not present // return EFI_NOT_FOUND; - } else if (((UINT32) (~0) - DirectoryEntry->VirtualAddress) < Director= yEntry->Size) { + } else if (((UINT32)(~0) - DirectoryEntry->VirtualAddress) < Directory= Entry->Size) { // // The directory address overflows // DEBUG ((DEBUG_ERROR, "%a %a: The export directory entry in this imag= e results in overflow.\n", _DBGMSGID_, __FUNCTION__)); return EFI_UNSUPPORTED; } else { - DEBUG ((DEBUG_INFO, "%a %a: Export Directory Entry found in the imag= e at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN) OptionalHeaderPtrUnion.P= e32)); + DEBUG ((DEBUG_INFO, "%a %a: Export Directory Entry found in the imag= e at 0x%x.\n", _DBGMSGID_, __FUNCTION__, (UINTN)OptionalHeaderPtrUnion.Pe= 32)); DEBUG ((DEBUG_INFO, " %a %a: Directory Entry Virtual Address =3D 0x= %x.\n", _DBGMSGID_, __FUNCTION__, DirectoryEntry->VirtualAddress)); =20 - ExportDirectory =3D (EFI_IMAGE_EXPORT_DIRECTORY *) ((UINTN) Image + = DirectoryEntry->VirtualAddress); + ExportDirectory =3D (EFI_IMAGE_EXPORT_DIRECTORY *)((UINTN)Image + Di= rectoryEntry->VirtualAddress); DEBUG (( DEBUG_INFO, " %a %a: Export Directory Table found successfully at 0x%x. Name = address =3D 0x%x. Name =3D %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 =3D ExportDirectory; =20 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; =20 DEBUG ((DEBUG_INFO, " %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__))= ; =20 - if (Image =3D=3D NULL || PeCoffLoaderImageContext =3D=3D NULL || Image= MajorVersion =3D=3D NULL || ImageMinorVersion =3D=3D NULL) { + if ((Image =3D=3D NULL) || (PeCoffLoaderImageContext =3D=3D NULL) || (= ImageMajorVersion =3D=3D NULL) || (ImageMinorVersion =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -294,36 +299,36 @@ GetImageVersionInPeCoffImage ( // image with PE32 magic. // switch (PeCoffLoaderImageContext->Machine) { - case EFI_IMAGE_MACHINE_IA32: - // - // Assume PE32 image - // - Magic =3D EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; - break; - case EFI_IMAGE_MACHINE_X64: - case EFI_IMAGE_MACHINE_AARCH64: - // - // Assume PE32+ image - // - Magic =3D 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 mod= ule.\n", - _DBGMSGID_, - __FUNCTION__ - )); - return EFI_UNSUPPORTED; + case EFI_IMAGE_MACHINE_IA32: + // + // Assume PE32 image + // + Magic =3D EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC; + break; + case EFI_IMAGE_MACHINE_X64: + case EFI_IMAGE_MACHINE_AARCH64: + // + // Assume PE32+ image + // + Magic =3D 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 m= odule.\n", + _DBGMSGID_, + __FUNCTION__ + )); + return EFI_UNSUPPORTED; } =20 - OptionalHeaderPtrUnion.Pe32 =3D (EFI_IMAGE_NT_HEADERS32 *) ( - (UINTN) Image + - PeCoffLoaderImageContext->PeCoffHeader= Offset - ); + OptionalHeaderPtrUnion.Pe32 =3D (EFI_IMAGE_NT_HEADERS32 *)( + (UINTN)Image = + + PeCoffLoaderI= mageContext->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; + UINTN ExportNameIndex; + UINT16 CurrentExportOrdinal; + UINT32 *ExportAddressTable; + UINT32 *ExportNamePointerTable; + UINT16 *OrdinalTable; + CONST CHAR8 *ExportNameTablePointerName; =20 - if (ExportName =3D=3D NULL || ImageBaseAddress =3D=3D 0 || ImageExport= Directory =3D=3D NULL || ExportPhysicalAddress =3D=3D NULL) { + if ((ExportName =3D=3D NULL) || (ImageBaseAddress =3D=3D 0) || (ImageE= xportDirectory =3D=3D NULL) || (ExportPhysicalAddress =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } + *ExportPhysicalAddress =3D 0; =20 - ExportAddressTable =3D (UINT32 *) ((UINTN) ImageBaseAddress + ImageExp= ortDirectory->AddressOfFunctions); - ExportNamePointerTable =3D (UINT32 *) ((UINTN) ImageBaseAddress + Imag= eExportDirectory->AddressOfNames); - OrdinalTable =3D (UINT16 *) ((UINTN) ImageBaseAddress + ImageExportDir= ectory->AddressOfNameOrdinals); + ExportAddressTable =3D (UINT32 *)((UINTN)ImageBaseAddress + ImageE= xportDirectory->AddressOfFunctions); + ExportNamePointerTable =3D (UINT32 *)((UINTN)ImageBaseAddress + ImageE= xportDirectory->AddressOfNames); + OrdinalTable =3D (UINT16 *)((UINTN)ImageBaseAddress + ImageE= xportDirectory->AddressOfNameOrdinals); =20 for (ExportNameIndex =3D 0; ExportNameIndex < ImageExportDirectory->Nu= mberOfNames; ExportNameIndex++) { - ExportNameTablePointerName =3D (CONST CHAR8 *) ((UINTN) ImageBaseAdd= ress + ExportNamePointerTable[ExportNameIndex]); + ExportNameTablePointerName =3D (CONST CHAR8 *)((UINTN)ImageBaseAddre= ss + ExportNamePointerTable[ExportNameIndex]); =20 if (AsciiStrnCmp (ExportName, ExportNameTablePointerName, PRM_HANDLE= R_NAME_MAXIMUM_LENGTH) =3D=3D 0) { CurrentExportOrdinal =3D OrdinalTable[ExportNameIndex]; @@ -402,7 +408,7 @@ GetExportEntryAddress ( break; } =20 - *ExportPhysicalAddress =3D (EFI_PHYSICAL_ADDRESS) ((UINTN) ImageBa= seAddress + ExportAddressTable[CurrentExportOrdinal]); + *ExportPhysicalAddress =3D (EFI_PHYSICAL_ADDRESS)((UINTN)ImageBase= Address + ExportAddressTable[CurrentExportOrdinal]); return EFI_SUCCESS; } } diff --git a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c b/PrmPkg/PrmConfigDxe/Prm= ConfigDxe.c index f3223d63de0c..c175ee2183ce 100644 --- a/PrmPkg/PrmConfigDxe/PrmConfigDxe.c +++ b/PrmPkg/PrmConfigDxe/PrmConfigDxe.c @@ -23,11 +23,11 @@ #include #include =20 -#define _DBGMSGID_ "[PRMCONFIG]" +#define _DBGMSGID_ "[PRMCONFIG]" =20 -STATIC UINTN mMaxRuntimeMmioRangeCount; +STATIC UINTN mMaxRuntimeMmioRangeCount; =20 -GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRunti= meMmioRanges; +GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMIO_RANGES **mRuntim= eMmioRanges; =20 /** Converts the runtime memory range physical addresses to virtual addres= ses. @@ -37,18 +37,18 @@ GLOBAL_REMOVE_IF_UNREFERENCED STATIC PRM_RUNTIME_MMI= O_RANGES **mRuntimeMmioRa **/ VOID ConvertRuntimeMemoryRangeAddresses ( - IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges + IN PRM_RUNTIME_MMIO_RANGES *RuntimeMmioRanges ) { - UINTN Index; + UINTN Index; =20 - if (RuntimeMmioRanges =3D=3D NULL || RuntimeMmioRanges->Count =3D=3D 0= ) { + if ((RuntimeMmioRanges =3D=3D NULL) || (RuntimeMmioRanges->Count =3D=3D= 0)) { return; } =20 - for (Index =3D 0; Index < (UINTN) RuntimeMmioRanges->Count; Index++) { + for (Index =3D 0; Index < (UINTN)RuntimeMmioRanges->Count; Index++) { RuntimeMmioRanges->Range[Index].VirtualBaseAddress =3D RuntimeMmioRa= nges->Range[Index].PhysicalBaseAddress; - gRT->ConvertPointer (0x0, (VOID **) &(RuntimeMmioRanges->Range[Index= ].VirtualBaseAddress)); + gRT->ConvertPointer (0x0, (VOID **)&(RuntimeMmioRanges->Range[Index]= .VirtualBaseAddress)); } } =20 @@ -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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 - if (RuntimeMmioRanges =3D=3D NULL || RuntimeMmioRanges->Count =3D=3D 0= ) { + if ((RuntimeMmioRanges =3D=3D NULL) || (RuntimeMmioRanges->Count =3D=3D= 0)) { return; } =20 - for (Index =3D 0; Index < (UINTN) RuntimeMmioRanges->Count; Index++) { + for (Index =3D 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 =3D 0x%016x. Length =3D 0x%x.\n", @@ -94,24 +99,25 @@ SetRuntimeMemoryRangeAttributes ( ASSERT ((RuntimeMmioRanges->Range[Index].Length & EFI_PAGE_MASK) =3D= =3D 0); =20 Status2 =3D EFI_NOT_FOUND; - Status =3D gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[I= ndex].PhysicalBaseAddress, &Descriptor); + Status =3D gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[= Index].PhysicalBaseAddress, &Descriptor); if (!EFI_ERROR (Status) && - ( - (Descriptor.GcdMemoryType !=3D EfiGcdMemoryTypeMemoryMappedIo &&= Descriptor.GcdMemoryType !=3D EfiGcdMemoryTypeReserved) || - ((Descriptor.Length & EFI_PAGE_MASK) !=3D 0) + ( + ((Descriptor.GcdMemoryType !=3D EfiGcdMemoryTypeMemoryMappedIo)= && (Descriptor.GcdMemoryType !=3D EfiGcdMemoryTypeReserved)) || + ((Descriptor.Length & EFI_PAGE_MASK) !=3D 0) ) - ) { + ) + { Status2 =3D gDS->RemoveMemorySpace ( RuntimeMmioRanges->Range[Index].PhysicalBaseAddr= ess, Descriptor.Length ); } =20 - if (Status =3D=3D EFI_NOT_FOUND || !EFI_ERROR (Status2)) { + if ((Status =3D=3D EFI_NOT_FOUND) || !EFI_ERROR (Status2)) { Status =3D gDS->AddMemorySpace ( EfiGcdMemoryTypeMemoryMappedIo, RuntimeMmioRanges->Range[Index].PhysicalBaseAddres= s, - (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].PhysicalBaseAddre= ss, gImageHandle, NULL @@ -141,13 +147,14 @@ SetRuntimeMemoryRangeAttributes ( )); continue; } + if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) !=3D 0) { continue; } =20 Status =3D 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 RangeIndex =3D 0; =20 mRuntimeMmioRanges =3D AllocateRuntimeZeroPool (sizeof (*mRuntimeMmioR= anges) * mMaxRuntimeMmioRangeCount); - if (mRuntimeMmioRanges =3D=3D NULL && mMaxRuntimeMmioRangeCount > 0) { + if ((mRuntimeMmioRanges =3D=3D NULL) && (mMaxRuntimeMmioRangeCount > 0= )) { DEBUG (( DEBUG_ERROR, " %a %a: Memory allocation for runtime MMIO pointer array failed.= \n", @@ -199,22 +206,22 @@ StoreVirtualMemoryAddressChangePointers ( } =20 HandleBuffer =3D NULL; - Status =3D gBS->LocateHandleBuffer ( - ByProtocol, - &gPrmConfigProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + &gPrmConfigProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer + ); if (!EFI_ERROR (Status)) { for (HandleIndex =3D 0; HandleIndex < HandleCount; HandleIndex++) { Status =3D gBS->HandleProtocol ( HandleBuffer[HandleIndex], &gPrmConfigProtocolGuid, - (VOID **) &PrmConfigProtocol + (VOID **)&PrmConfigProtocol ); ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status) || PrmConfigProtocol =3D=3D NULL) { + if (EFI_ERROR (Status) || (PrmConfigProtocol =3D=3D NULL)) { continue; } =20 @@ -232,9 +239,11 @@ StoreVirtualMemoryAddressChangePointers ( ASSERT_EFI_ERROR (Status); return; } + mRuntimeMmioRanges[RangeIndex++] =3D PrmConfigProtocol->ModuleCo= ntextBuffers.RuntimeMmioRanges; } } + DEBUG (( DEBUG_INFO, " %a %a: %d MMIO ranges buffers saved for future virtual memory c= onversion.\n", @@ -260,7 +269,7 @@ StoreVirtualMemoryAddressChangePointers ( **/ EFI_STATUS ValidatePrmDataBuffer ( - IN CONST PRM_DATA_BUFFER *PrmDataBuffer + IN CONST PRM_DATA_BUFFER *PrmDataBuffer ) { if (PrmDataBuffer =3D=3D NULL) { @@ -271,6 +280,7 @@ ValidatePrmDataBuffer ( DEBUG ((DEBUG_ERROR, " %a %a: The PRM data buffer signature is inva= lid. 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 =3D=3D NULL) { @@ -310,7 +320,7 @@ ValidatePrmContextBuffer ( return EFI_NOT_FOUND; } =20 - if (PrmContextBuffer->StaticDataBuffer !=3D NULL && EFI_ERROR (Validat= ePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) { + if ((PrmContextBuffer->StaticDataBuffer !=3D NULL) && EFI_ERROR (Valid= atePrmDataBuffer (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; =20 // // 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 HandleBuffer =3D NULL; - Status =3D gBS->LocateHandleBuffer ( - ByProtocol, - &gPrmConfigProtocolGuid, - NULL, - &HandleCount, - &HandleBuffer - ); + Status =3D gBS->LocateHandleBuffer ( + ByProtocol, + &gPrmConfigProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer + ); if (!EFI_ERROR (Status)) { for (HandleIndex =3D 0; HandleIndex < HandleCount; HandleIndex++) { Status =3D gBS->HandleProtocol ( HandleBuffer[HandleIndex], &gPrmConfigProtocolGuid, - (VOID **) &PrmConfigProtocol + (VOID **)&PrmConfigProtocol ); ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status) || PrmConfigProtocol =3D=3D NULL) { + if (EFI_ERROR (Status) || (PrmConfigProtocol =3D=3D NULL)) { continue; } =20 DEBUG (( DEBUG_INFO, " %a %a: Found PRM configuration protocol for PRM module %g.\n"= , - _DBGMSGID_, - __FUNCTION__, - &PrmConfigProtocol->ModuleContextBuffers.ModuleGuid - )); + _DBGMSGID_, + __FUNCTION__, + &PrmConfigProtocol->ModuleContextBuffers.ModuleGuid + )); =20 DEBUG ((DEBUG_INFO, " %a %a: Validating module context buffer= s...\n", _DBGMSGID_, __FUNCTION__)); for (BufferIndex =3D 0; BufferIndex < PrmConfigProtocol->ModuleCon= textBuffers.BufferCount; BufferIndex++) { @@ -422,16 +432,17 @@ PrmConfigEndOfDxeNotification ( )); } } + DEBUG ((DEBUG_INFO, " %a %a: Module context buffer validation= complete.\n", _DBGMSGID_, __FUNCTION__)); =20 if (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges !=3D= NULL) { DEBUG (( DEBUG_INFO, " %a %a: Found %d PRM runtime MMIO ranges.\n", - _DBGMSGID_, - __FUNCTION__, - PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges->Co= unt - )); + _DBGMSGID_, + __FUNCTION__, + PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges->Cou= nt + )); SetRuntimeMemoryRangeAttributes (PrmConfigProtocol->ModuleContex= tBuffers.RuntimeMmioRanges); mMaxRuntimeMmioRangeCount++; } @@ -443,7 +454,8 @@ PrmConfigEndOfDxeNotification ( if (HandleBuffer !=3D NULL) { gBS->FreePool (HandleBuffer); } - gBS->CloseEvent(Event); + + gBS->CloseEvent (Event); } =20 /** @@ -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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 // // Register a notification function to change memory attributes at end= of DXE // - Event =3D NULL; + Event =3D NULL; Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, @@ -485,7 +497,7 @@ PrmConfigEntryPoint ( // // Register a notification function for virtual address change // - Event =3D NULL; + Event =3D NULL; Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_NOTIFY, diff --git a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c b/PrmPkg/PrmLoaderDxe/Prm= LoaderDxe.c index e2779f5c1786..5a223d783d80 100644 --- a/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c +++ b/PrmPkg/PrmLoaderDxe/PrmLoaderDxe.c @@ -30,8 +30,8 @@ =20 #define _DBGMSGID_ "[PRMLOADER]" =20 -UINTN mPrmHandlerCount; -UINTN mPrmModuleCount; +UINTN mPrmHandlerCount; +UINTN mPrmModuleCount; =20 /** 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 *CurrentExportDescriptorHandle= rName; + EFI_IMAGE_EXPORT_DIRECTORY *CurrentImageExportDirectory; + PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *CurrentExportDescriptorStruct; + PRM_ACPI_DESCRIPTION_TABLE *PrmAcpiTable; + PRM_MODULE_IMAGE_CONTEXT *CurrentPrmModuleImageContext; + CONST CHAR8 *CurrentExportDescriptorHandlerNa= me; =20 - ACPI_PARAMETER_BUFFER_DESCRIPTOR *CurrentModuleAcpiParamDescrip= tors; - PRM_CONTEXT_BUFFER *CurrentContextBuffer; - PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers; - PRM_MODULE_INFORMATION_STRUCT *CurrentModuleInfoStruct; - PRM_HANDLER_INFORMATION_STRUCT *CurrentHandlerInfoStruct; + ACPI_PARAMETER_BUFFER_DESCRIPTOR *CurrentModuleAcpiParamDescriptors; + PRM_CONTEXT_BUFFER *CurrentContextBuffer; + PRM_MODULE_CONTEXT_BUFFERS *CurrentModuleContextBuffers; + PRM_MODULE_INFORMATION_STRUCT *CurrentModuleInfoStruct; + PRM_HANDLER_INFORMATION_STRUCT *CurrentHandlerInfoStruct; =20 - EFI_STATUS Status; - EFI_PHYSICAL_ADDRESS CurrentImageAddress; - UINTN AcpiParamIndex; - UINTN HandlerIndex; - UINT32 PrmAcpiDescriptionTableBufferS= ize; + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS CurrentImageAddress; + UINTN AcpiParamIndex; + UINTN HandlerIndex; + UINT32 PrmAcpiDescriptionTableBufferSize; =20 - UINT64 HandlerPhysicalAddress; + UINT64 HandlerPhysicalAddress; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 if (PrmAcpiDescriptionTable =3D=3D NULL) { return EFI_INVALID_PARAMETER; } + *PrmAcpiDescriptionTable =3D NULL; =20 // @@ -96,42 +97,42 @@ ProcessPrmModules ( DEBUG ((DEBUG_INFO, " %a %a: %d total PRM modules to process.\n", _DB= GMSGID_, __FUNCTION__, mPrmModuleCount)); DEBUG ((DEBUG_INFO, " %a %a: %d total PRM handlers to process.\n", _D= BGMSGID_, __FUNCTION__, mPrmHandlerCount)); =20 - PrmAcpiDescriptionTableBufferSize =3D (UINT32) (OFFSET_OF (PRM_ACPI_DE= SCRIPTION_TABLE, PrmModuleInfoStructure) + - (OFFSET_OF (PRM_MODULE_INFORMATI= ON_STRUCT, HandlerInfoStructure) * mPrmModuleCount) + - (sizeof (PRM_HANDLER_INFORMATION= _STRUCT) * mPrmHandlerCount) - ); + PrmAcpiDescriptionTableBufferSize =3D (UINT32)(OFFSET_OF (PRM_ACPI_DES= CRIPTION_TABLE, PrmModuleInfoStructure) + + (OFFSET_OF (PRM_MODULE_IN= FORMATION_STRUCT, HandlerInfoStructure) * mPrmModuleCount) + + (sizeof (PRM_HANDLER_INFO= RMATION_STRUCT) * mPrmHandlerCount) + ); DEBUG ((DEBUG_INFO, " %a %a: Total PRM ACPI table size: 0x%x.\n", _DB= GMSGID_, __FUNCTION__, PrmAcpiDescriptionTableBufferSize)); =20 - PrmAcpiTable =3D AllocateZeroPool ((UINTN) PrmAcpiDescriptionTableBuff= erSize); + PrmAcpiTable =3D AllocateZeroPool ((UINTN)PrmAcpiDescriptionTableBuffe= rSize); if (PrmAcpiTable =3D=3D NULL) { return EFI_OUT_OF_RESOURCES; } =20 - PrmAcpiTable->Header.Signature =3D PRM_TABLE_SIGNATURE; - PrmAcpiTable->Header.Length =3D PrmAcpiDescriptionTableBuffe= rSize; - PrmAcpiTable->Header.Revision =3D PRM_TABLE_REVISION; - PrmAcpiTable->Header.Checksum =3D 0x0; + PrmAcpiTable->Header.Signature =3D PRM_TABLE_SIGNATURE; + PrmAcpiTable->Header.Length =3D PrmAcpiDescriptionTableBufferSize; + PrmAcpiTable->Header.Revision =3D PRM_TABLE_REVISION; + PrmAcpiTable->Header.Checksum =3D 0x0; CopyMem (&PrmAcpiTable->Header.OemId, PcdGetPtr (PcdAcpiDefaultOemId),= sizeof (PrmAcpiTable->Header.OemId)); - PrmAcpiTable->Header.OemTableId =3D PcdGet64 (PcdAcpiDefaultOemT= ableId); - PrmAcpiTable->Header.OemRevision =3D PcdGet32 (PcdAcpiDefaultOemR= evision); - PrmAcpiTable->Header.CreatorId =3D PcdGet32 (PcdAcpiDefaultCrea= torId); - PrmAcpiTable->Header.CreatorRevision =3D PcdGet32 (PcdAcpiDefaultCrea= torRevision); + PrmAcpiTable->Header.OemTableId =3D PcdGet64 (PcdAcpiDefaultOemTa= bleId); + PrmAcpiTable->Header.OemRevision =3D PcdGet32 (PcdAcpiDefaultOemRe= vision); + PrmAcpiTable->Header.CreatorId =3D PcdGet32 (PcdAcpiDefaultCreat= orId); + PrmAcpiTable->Header.CreatorRevision =3D PcdGet32 (PcdAcpiDefaultCreat= orRevision); CopyGuid (&PrmAcpiTable->PrmPlatformGuid, &gEdkiiDscPlatformGuid); - PrmAcpiTable->PrmModuleInfoOffset =3D OFFSET_OF (PRM_ACPI_DESCRIPT= ION_TABLE, PrmModuleInfoStructure); - PrmAcpiTable->PrmModuleInfoCount =3D (UINT32) mPrmModuleCount; + PrmAcpiTable->PrmModuleInfoOffset =3D OFFSET_OF (PRM_ACPI_DESCRIPTION_= TABLE, PrmModuleInfoStructure); + PrmAcpiTable->PrmModuleInfoCount =3D (UINT32)mPrmModuleCount; =20 // // Iterate across all PRM Modules on the list // CurrentModuleInfoStruct =3D &PrmAcpiTable->PrmModuleInfoStructure[0]; for ( - CurrentPrmModuleImageContext =3D NULL, Status =3D GetNextPrmModuleEn= try (&CurrentPrmModuleImageContext); - !EFI_ERROR (Status); - Status =3D GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) { - - CurrentImageAddress =3D CurrentPrmModuleImageContext->PeCoffImageCon= text.ImageAddress; - CurrentImageExportDirectory =3D CurrentPrmModuleImageContext->Export= Directory; - CurrentExportDescriptorStruct =3D CurrentPrmModuleImageContext->Expo= rtDescriptor; + CurrentPrmModuleImageContext =3D NULL, Status =3D GetNextPrmModul= eEntry (&CurrentPrmModuleImageContext); + !EFI_ERROR (Status); + Status =3D GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) + { + CurrentImageAddress =3D CurrentPrmModuleImageContext->= PeCoffImageContext.ImageAddress; + CurrentImageExportDirectory =3D CurrentPrmModuleImageContext->= ExportDirectory; + CurrentExportDescriptorStruct =3D CurrentPrmModuleImageContext->= ExportDescriptor; CurrentModuleAcpiParamDescriptors =3D NULL; =20 DEBUG (( @@ -139,39 +140,39 @@ ProcessPrmModules ( " %a %a: PRM Module - %a with %d handlers.\n", _DBGMSGID_, __FUNCTION__, - (CHAR8 *) ((UINTN) CurrentImageAddress + CurrentImageExportDirecto= ry->Name), + (CHAR8 *)((UINTN)CurrentImageAddress + CurrentImageExportDirectory= ->Name), CurrentExportDescriptorStruct->Header.NumberPrmHandlers )); =20 CurrentModuleInfoStruct->StructureRevision =3D PRM_MODULE_INFORMATIO= N_STRUCT_REVISION; - CurrentModuleInfoStruct->StructureLength =3D ( - OFFSET_OF (PRM_MODULE_INFOR= MATION_STRUCT, HandlerInfoStructure) + - (CurrentExportDescriptorStr= uct->Header.NumberPrmHandlers * sizeof (PRM_HANDLER_INFORMATION_STRUCT)) - ); + CurrentModuleInfoStruct->StructureLength =3D ( + OFFSET_OF (PRM_MODULE_= INFORMATION_STRUCT, HandlerInfoStructure) + + (CurrentExportDescript= orStruct->Header.NumberPrmHandlers * sizeof (PRM_HANDLER_INFORMATION_STRU= CT)) + ); CopyGuid (&CurrentModuleInfoStruct->Identifier, &CurrentExportDescri= ptorStruct->Header.ModuleGuid); - CurrentModuleInfoStruct->HandlerCount =3D (UINT32) CurrentExpo= rtDescriptorStruct->Header.NumberPrmHandlers; - CurrentModuleInfoStruct->HandlerInfoOffset =3D OFFSET_OF (PRM_MODUL= E_INFORMATION_STRUCT, HandlerInfoStructure); + CurrentModuleInfoStruct->HandlerCount =3D (UINT32)CurrentExport= DescriptorStruct->Header.NumberPrmHandlers; + CurrentModuleInfoStruct->HandlerInfoOffset =3D OFFSET_OF (PRM_MODULE= _INFORMATION_STRUCT, HandlerInfoStructure); =20 CurrentModuleInfoStruct->MajorRevision =3D 0; CurrentModuleInfoStruct->MinorRevision =3D 0; - Status =3D GetImageVersionInPeCoffImage ( - (VOID *) (UINTN) CurrentImageAddress, - &CurrentPrmModuleImageContext->PeCoffImageContext, - &CurrentModuleInfoStruct->MajorRevision, - &CurrentModuleInfoStruct->MinorRevision - ); + Status =3D GetImageVersionInPeCoffI= mage ( + (VOID *)(UINTN)CurrentIm= ageAddress, + &CurrentPrmModuleImageCo= ntext->PeCoffImageContext, + &CurrentModuleInfoStruct= ->MajorRevision, + &CurrentModuleInfoStruct= ->MinorRevision + ); ASSERT_EFI_ERROR (Status); =20 // It is currently valid for a PRM module not to use a context buffe= r Status =3D GetModuleContextBuffers ( - ByModuleGuid, - &CurrentModuleInfoStruct->Identifier, - (CONST PRM_MODULE_CONTEXT_BUFFERS **) &CurrentModuleContex= tBuffers - ); + ByModuleGuid, + &CurrentModuleInfoStruct->Identifier, + (CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContex= tBuffers + ); ASSERT (!EFI_ERROR (Status) || Status =3D=3D EFI_NOT_FOUND); - if (!EFI_ERROR (Status) && CurrentModuleContextBuffers !=3D NULL) { - CurrentModuleInfoStruct->RuntimeMmioRanges =3D (UINT64) (UINTN) Cu= rrentModuleContextBuffers->RuntimeMmioRanges; - CurrentModuleAcpiParamDescriptors =3D CurrentModuleContextBuffers-= >AcpiParameterBufferDescriptors; + if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers !=3D NULL)) = { + CurrentModuleInfoStruct->RuntimeMmioRanges =3D (UINT64)(UINTN)Curr= entModuleContextBuffers->RuntimeMmioRanges; + CurrentModuleAcpiParamDescriptors =3D CurrentModuleContex= tBuffers->AcpiParameterBufferDescriptors; } =20 // @@ -181,21 +182,21 @@ ProcessPrmModules ( CurrentHandlerInfoStruct =3D &(CurrentModuleInfoStruct->HandlerInf= oStructure[HandlerIndex]); =20 CurrentHandlerInfoStruct->StructureRevision =3D PRM_HANDLER_INFORM= ATION_STRUCT_REVISION; - CurrentHandlerInfoStruct->StructureLength =3D sizeof (PRM_HANDLER_= INFORMATION_STRUCT); + CurrentHandlerInfoStruct->StructureLength =3D sizeof (PRM_HANDLE= R_INFORMATION_STRUCT); CopyGuid ( &CurrentHandlerInfoStruct->Identifier, &CurrentExportDescriptorStruct->PrmHandlerExportDescriptors[Hand= lerIndex].PrmHandlerGuid ); =20 - CurrentExportDescriptorHandlerName =3D (CONST CHAR8 *) CurrentExpo= rtDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerN= ame; + CurrentExportDescriptorHandlerName =3D (CONST CHAR8 *)CurrentExpor= tDescriptorStruct->PrmHandlerExportDescriptors[HandlerIndex].PrmHandlerNa= me; =20 Status =3D GetContextBuffer ( &CurrentHandlerInfoStruct->Identifier, CurrentModuleContextBuffers, - (CONST PRM_CONTEXT_BUFFER **) &CurrentContextBuffer + (CONST PRM_CONTEXT_BUFFER **)&CurrentContextBuffer ); if (!EFI_ERROR (Status)) { - CurrentHandlerInfoStruct->StaticDataBuffer =3D (UINT64) (UINTN) = CurrentContextBuffer->StaticDataBuffer; + CurrentHandlerInfoStruct->StaticDataBuffer =3D (UINT64)(UINTN)Cu= rrentContextBuffer->StaticDataBuffer; } =20 Status =3D GetExportEntryAddress ( @@ -223,15 +224,17 @@ ProcessPrmModules ( if (CurrentModuleAcpiParamDescriptors !=3D NULL) { for (AcpiParamIndex =3D 0; AcpiParamIndex < CurrentModuleContext= Buffers->AcpiParameterBufferDescriptorCount; AcpiParamIndex++) { if (CompareGuid (&CurrentModuleAcpiParamDescriptors[AcpiParamI= ndex].HandlerGuid, &CurrentHandlerInfoStruct->Identifier)) { - CurrentHandlerInfoStruct->AcpiParameterBuffer =3D (UINT64) (= UINTN) ( - CurrentMod= uleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBufferAddress - ); + CurrentHandlerInfoStruct->AcpiParameterBuffer =3D (UINT64)(U= INTN)( + = CurrentModuleAcpiParamDescriptors[AcpiParamIndex].AcpiParameterBuffer= Address + = ); } } } } - CurrentModuleInfoStruct =3D (PRM_MODULE_INFORMATION_STRUCT *) ((UINT= N) CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength); + + CurrentModuleInfoStruct =3D (PRM_MODULE_INFORMATION_STRUCT *)((UINTN= )CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength); } + *PrmAcpiDescriptionTable =3D PrmAcpiTable; =20 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; =20 - if (PrmAcpiDescriptionTable =3D=3D NULL || PrmAcpiDescriptionTable->He= ader.Signature !=3D PRM_TABLE_SIGNATURE) { + if ((PrmAcpiDescriptionTable =3D=3D NULL) || (PrmAcpiDescriptionTable-= >Header.Signature !=3D PRM_TABLE_SIGNATURE)) { return EFI_INVALID_PARAMETER; } =20 - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D **) &AcpiTableProtocol); + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D **)&AcpiTableProtocol); if (!EFI_ERROR (Status)) { TableKey =3D 0; // @@ -279,6 +282,7 @@ PublishPrmAcpiTable ( DEBUG ((DEBUG_INFO, "%a %a: The PRMT ACPI table was installed succ= essfully.\n", _DBGMSGID_, __FUNCTION__)); } } + ASSERT_EFI_ERROR (Status); =20 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 @@ -326,6 +330,7 @@ PrmLoaderEndOfDxeNotification ( if (PrmAcpiDescriptionTable !=3D NULL) { FreePool (PrmAcpiDescriptionTable); } + gBS->CloseEvent (Event); } =20 @@ -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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 @@ -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 discovere= d // - Status =3D gBS->CreateEventEx( + Status =3D gBS->CreateEventEx ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, PrmLoaderEndOfDxeNotification, diff --git a/PrmPkg/PrmSsdtInstallDxe/PrmSsdtInstallDxe.c b/PrmPkg/PrmSsd= tInstallDxe/PrmSsdtInstallDxe.c index bd9ce2c6fa02..e8bf4cfb8f2d 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; =20 DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); =20 @@ -48,7 +48,7 @@ InstallPrmSsdt ( return EFI_INVALID_PARAMETER; } =20 - Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D **) &AcpiTableProtocol); + Status =3D gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOI= D **)&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 =3D 0; - Status =3D AcpiTableProtocol->InstallAcpiTable ( - AcpiTableProtocol, - Ssdt, - SsdtSize, - &TableKey - ); + Status =3D AcpiTableProtocol->InstallAcpiTable ( + AcpiTableProtocol, + Ssdt, + SsdtSize, + &TableKey + ); ASSERT_EFI_ERROR (Status); } =20 @@ -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; =20 - Status =3D InstallPrmSsdt ((UINT8 *) PcdGetPtr (PcdAcpiDefaultOemId)); + Status =3D InstallPrmSsdt ((UINT8 *)PcdGetPtr (PcdAcpiDefaultOemId)); ASSERT_EFI_ERROR (Status); =20 return Status; diff --git a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/Dx= eAcpiParameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib= .c b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiPar= ameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c index b135517232f7..760d8bcfb932 100644 --- a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiPa= rameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c +++ b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/Library/DxeAcpiPa= rameterBufferModuleConfigLib/DxeAcpiParameterBufferModuleConfigLib.c @@ -17,10 +17,14 @@ STATIC EFI_HANDLE mPrmConfigProtocolHandle; =20 // {dc2a58a6-5927-4776-b995-d118a27335a2} -STATIC CONST EFI_GUID mPrmModuleGuid =3D {0xdc2a58a6, 0x5927, 0x4776, {0= xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2}}; +STATIC CONST EFI_GUID mPrmModuleGuid =3D { + 0xdc2a58a6, 0x5927, 0x4776, { 0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35= , 0xa2 } +}; =20 // {2e4f2d13-6240-4ed0-a401-c723fbdc34e8} -STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid =3D {0x2e4f2d13, 0= x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}}; +STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid =3D { + 0x2e4f2d13, 0x6240, 0x4ed0, { 0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34= , 0xe8 } +}; =20 /** Constructor of the PRM configuration library. @@ -34,8 +38,8 @@ STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid =3D= {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; =20 - AcpiParameterBuffer =3D NULL; + AcpiParameterBuffer =3D NULL; AcpiParamBufferDescriptor =3D NULL; - PrmConfigProtocol =3D NULL; + PrmConfigProtocol =3D NULL; =20 /* In this sample PRM module, the protocol describing this sample modul= e's resources is simply @@ -82,15 +86,16 @@ AcpiParameterBufferModuleConfigLibConstructor ( Status =3D EFI_OUT_OF_RESOURCES; goto Done; } + CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmMo= duleGuid); =20 // Populate the ACPI Parameter Buffer Descriptor structure CopyGuid (&AcpiParamBufferDescriptor->HandlerGuid, &mCheckParamBufferP= rmHandlerGuid); - AcpiParamBufferDescriptor->AcpiParameterBufferAddress =3D (UINT64) (UI= NTN) AcpiParameterBuffer; + AcpiParamBufferDescriptor->AcpiParameterBufferAddress =3D (UINT64)(UIN= TN)AcpiParameterBuffer; =20 // Populate the PRM Module Context Buffers structure PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptorC= ount =3D 1; - PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors= =3D AcpiParamBufferDescriptor; + PrmConfigProtocol->ModuleContextBuffers.AcpiParameterBufferDescriptors= =3D AcpiParamBufferDescriptor; =20 // // Install the PRM Configuration Protocol for this module. This indica= tes the configuration @@ -100,7 +105,7 @@ AcpiParameterBufferModuleConfigLibConstructor ( &mPrmConfigProtocolHandle, &gPrmConfigProtocolGuid, EFI_NATIVE_INTERFACE, - (VOID *) PrmConfigProtocol + (VOID *)PrmConfigProtocol ); =20 Done: @@ -108,9 +113,11 @@ AcpiParameterBufferModuleConfigLibConstructor ( if (AcpiParameterBuffer !=3D NULL) { FreePool (AcpiParameterBuffer); } + if (AcpiParamBufferDescriptor !=3D NULL) { FreePool (AcpiParamBufferDescriptor); } + if (PrmConfigProtocol !=3D NULL) { FreePool (PrmConfigProtocol); } diff --git a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleA= cpiParameterBufferModule.c b/PrmPkg/Samples/PrmSampleAcpiParameterBufferM= odule/PrmSampleAcpiParameterBufferModule.c index ebb5ba01a30c..eb8a2b930a4c 100644 --- a/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiPara= meterBufferModule.c +++ b/PrmPkg/Samples/PrmSampleAcpiParameterBufferModule/PrmSampleAcpiPara= meterBufferModule.c @@ -15,14 +15,14 @@ // TEMP #include =20 -#define PARAM_BUFFER_TEST_SIGNATURE SIGNATURE_32('T','E','S','T'= ) +#define PARAM_BUFFER_TEST_SIGNATURE SIGNATURE_32('T','E','S','T') =20 // // PRM Handler GUIDs // =20 // {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}} =20 /** A sample Platform Runtime Mechanism (PRM) handler. @@ -39,13 +39,12 @@ @retval Others An error occurred in the PRM handler. =20 **/ -PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) -{ +PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) { if (ParameterBuffer =3D=3D NULL) { return EFI_INVALID_PARAMETER; } =20 - if (*((UINT32 *) ParameterBuffer) =3D=3D PARAM_BUFFER_TEST_SIGNATURE) = { + if (*((UINT32 *)ParameterBuffer) =3D=3D PARAM_BUFFER_TEST_SIGNATURE) { return EFI_SUCCESS; } =20 @@ -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/Library/DxeConte= xtBufferModuleConfigLib/DxeContextBufferModuleConfigLib.c b/PrmPkg/Sample= s/PrmSampleContextBufferModule/Library/DxeContextBufferModuleConfigLib/Dx= eContextBufferModuleConfigLib.c index 4c0c3348459c..123d5acdf742 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBuffe= rModuleConfigLib/DxeContextBufferModuleConfigLib.c +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/Library/DxeContextBuffe= rModuleConfigLib/DxeContextBufferModuleConfigLib.c @@ -21,10 +21,14 @@ STATIC EFI_HANDLE mPrmConfigProtocolHandle; =20 // {5a6cf42b-8bb4-472c-a233-5c4dc4033dc7} -STATIC CONST EFI_GUID mPrmModuleGuid =3D {0x5a6cf42b, 0x8bb4, 0x472c, {0= xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7}}; +STATIC CONST EFI_GUID mPrmModuleGuid =3D { + 0x5a6cf42b, 0x8bb4, 0x472c, { 0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d= , 0xc7 } +}; =20 // {e1466081-7562-430f-896b-b0e523dc335a} -STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid =3D {0xe14660= 81, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}; +STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid =3D { + 0xe1466081, 0x7562, 0x430f, { 0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33= , 0x5a } +}; =20 /** 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; =20 if (StaticDataBuffer =3D=3D NULL) { return EFI_INVALID_PARAMETER; } + *StaticDataBuffer =3D NULL; =20 // @@ -96,9 +101,9 @@ GetStaticDataBuffer ( // Initialize the data buffer header // DataBuffer->Header.Signature =3D PRM_DATA_BUFFER_HEADER_SIGNATURE; - DataBuffer->Header.Length =3D (UINT32) DataBufferLength; + DataBuffer->Header.Length =3D (UINT32)DataBufferLength; =20 - Status =3D PopulateStaticDataBuffer ((STATIC_DATA_SAMPLE_CONTEXT_BUFFE= R_MODULE *) &DataBuffer->Data[0]); + Status =3D PopulateStaticDataBuffer ((STATIC_DATA_SAMPLE_CONTEXT_BUFFE= R_MODULE *)&DataBuffer->Data[0]); ASSERT_EFI_ERROR (Status); =20 *StaticDataBuffer =3D 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; =20 - PrmContextBuffer =3D NULL; - StaticDataBuffer =3D NULL; + PrmContextBuffer =3D NULL; + StaticDataBuffer =3D NULL; PrmConfigProtocol =3D NULL; =20 /* @@ -144,7 +149,7 @@ ContextBufferModuleConfigLibConstructor ( // Status =3D GetStaticDataBuffer (&StaticDataBuffer); ASSERT_EFI_ERROR (Status); - if (EFI_ERROR (Status) || StaticDataBuffer =3D=3D NULL) { + if (EFI_ERROR (Status) || (StaticDataBuffer =3D=3D NULL)) { goto Done; } =20 @@ -166,9 +171,10 @@ ContextBufferModuleConfigLibConstructor ( Status =3D EFI_OUT_OF_RESOURCES; goto Done; } + CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHa= ndlerGuid); - PrmContextBuffer->Signature =3D PRM_CONTEXT_BUFFER_SIGNATURE; - PrmContextBuffer->Version =3D PRM_CONTEXT_BUFFER_INTERFACE_VERSION; + PrmContextBuffer->Signature =3D PRM_CONTEXT_BUFFER_SIGNATURE; + PrmContextBuffer->Version =3D PRM_CONTEXT_BUFFER_INTERFACE_VE= RSION; PrmContextBuffer->StaticDataBuffer =3D StaticDataBuffer; =20 PrmConfigProtocol =3D AllocateZeroPool (sizeof (*PrmConfigProtocol)); @@ -177,9 +183,10 @@ ContextBufferModuleConfigLibConstructor ( Status =3D EFI_OUT_OF_RESOURCES; goto Done; } + CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmMo= duleGuid); PrmConfigProtocol->ModuleContextBuffers.BufferCount =3D 1; - PrmConfigProtocol->ModuleContextBuffers.Buffer =3D PrmContextBuffer; + PrmConfigProtocol->ModuleContextBuffers.Buffer =3D PrmContextBuff= er; =20 // // Install the PRM Configuration Protocol for this module. This indica= tes the configuration @@ -189,7 +196,7 @@ ContextBufferModuleConfigLibConstructor ( &mPrmConfigProtocolHandle, &gPrmConfigProtocolGuid, EFI_NATIVE_INTERFACE, - (VOID *) PrmConfigProtocol + (VOID *)PrmConfigProtocol ); =20 Done: @@ -197,9 +204,11 @@ ContextBufferModuleConfigLibConstructor ( if (StaticDataBuffer !=3D NULL) { FreePool (StaticDataBuffer); } + if (PrmContextBuffer !=3D NULL) { FreePool (PrmContextBuffer); } + if (PrmConfigProtocol !=3D NULL) { FreePool (PrmConfigProtocol); } diff --git a/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContext= BufferModule.c b/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleCon= textBufferModule.c index 5c4e5c7a10eb..e7f8fff1570a 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferM= odule.c +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/PrmSampleContextBufferM= odule.c @@ -21,7 +21,7 @@ // =20 // {e1466081-7562-430f-896b-b0e523dc335a} -#define CHECK_STATIC_DATA_BUFFER_PRM_HANDLER_GUID {0xe1466081, 0x7562, 0= x430f, {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}} =20 /** A sample Platform Runtime Mechanism (PRM) handler. @@ -35,8 +35,7 @@ @retval Others An error occurred in the PRM handler. =20 **/ -PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) -{ +PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) { if (ContextBuffer =3D=3D NULL) { return EFI_INVALID_PARAMETER; } @@ -49,8 +48,9 @@ PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) // Verify PRM data buffer signature is valid // if ( - ContextBuffer->Signature !=3D PRM_CONTEXT_BUFFER_SIGNATURE || - ContextBuffer->StaticDataBuffer->Header.Signature !=3D PRM_DATA_BUFF= ER_HEADER_SIGNATURE) { + (ContextBuffer->Signature !=3D PRM_CONTEXT_BUFFER_SIGNATURE) || + (ContextBuffer->StaticDataBuffer->Header.Signature !=3D PRM_DATA_B= UFFER_HEADER_SIGNATURE)) + { return EFI_NOT_FOUND; } =20 @@ -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/Library/DxeHard= wareAccessModuleConfigLib/DxeHardwareAccessModuleConfigLib.c b/PrmPkg/Sam= ples/PrmSampleHardwareAccessModule/Library/DxeHardwareAccessModuleConfigL= ib/DxeHardwareAccessModuleConfigLib.c index c00ab9ffbbe3..1dc9a8df984e 100644 --- a/PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAcc= essModuleConfigLib/DxeHardwareAccessModuleConfigLib.c +++ b/PrmPkg/Samples/PrmSampleHardwareAccessModule/Library/DxeHardwareAcc= essModuleConfigLib/DxeHardwareAccessModuleConfigLib.c @@ -18,7 +18,9 @@ STATIC EFI_HANDLE mPrmConfigProtocolHandle; =20 // {0ef93ed7-14ae-425b-928f-b85a6213b57e} -STATIC CONST EFI_GUID mPrmModuleGuid =3D {0x0ef93ed7, 0x14ae, 0x425b, {0= x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e}}; +STATIC CONST EFI_GUID mPrmModuleGuid =3D { + 0x0ef93ed7, 0x14ae, 0x425b, { 0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5= , 0x7e } +}; =20 /** Constructor of the PRM configuration library. @@ -32,13 +34,13 @@ STATIC CONST EFI_GUID mPrmModuleGuid =3D {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; =20 RuntimeMmioRanges =3D NULL; PrmConfigProtocol =3D NULL; @@ -70,12 +72,13 @@ HardwareAccessModuleConfigLibConstructor ( Status =3D EFI_OUT_OF_RESOURCES; goto Done; } + CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmMo= duleGuid); =20 // Populate the Runtime MMIO Ranges structure - RuntimeMmioRanges->Count =3D 1; + RuntimeMmioRanges->Count =3D 1; RuntimeMmioRanges->Range[0].PhysicalBaseAddress =3D HPET_BASE_ADDRESS; - RuntimeMmioRanges->Range[0].Length =3D HPET_RANGE_LENGTH; + RuntimeMmioRanges->Range[0].Length =3D HPET_RANGE_LENGTH; =20 PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges =3D RuntimeM= mioRanges; =20 @@ -87,7 +90,7 @@ HardwareAccessModuleConfigLibConstructor ( &mPrmConfigProtocolHandle, &gPrmConfigProtocolGuid, EFI_NATIVE_INTERFACE, - (VOID *) PrmConfigProtocol + (VOID *)PrmConfigProtocol ); =20 Done: @@ -95,6 +98,7 @@ HardwareAccessModuleConfigLibConstructor ( if (RuntimeMmioRanges !=3D NULL) { FreePool (RuntimeMmioRanges); } + if (PrmConfigProtocol !=3D NULL) { FreePool (PrmConfigProtocol); } diff --git a/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwa= reAccessModule.c b/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSample= HardwareAccessModule.c index 14d1e56ab88a..1a1e7350291f 100644 --- a/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAcces= sModule.c +++ b/PrmPkg/Samples/PrmSampleHardwareAccessModule/PrmSampleHardwareAcces= sModule.c @@ -24,18 +24,18 @@ // =20 // {2120cd3c-848b-4d8f-abbb-4b74ce64ac89} -#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x8= 48b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}} +#define MSR_ACCESS_MICROCODE_SIGNATURE_PRM_HANDLER_GUID {0x2120cd3c, 0x= 848b, 0x4d8f, {0xab, 0xbb, 0x4b, 0x74, 0xce, 0x64, 0xac, 0x89}} =20 // {ea0935a7-506b-4159-bbbb-48deeecb6f58} -#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x415= 9, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}} +#define MSR_ACCESS_MTRR_DUMP_PRM_HANDLER_GUID {0xea0935a7, 0x506b, 0x41= 59, {0xbb, 0xbb, 0x48, 0xde, 0xee, 0xcb, 0x6f, 0x58}} =20 // {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}} =20 // // BEGIN: MtrrLib internal library globals and function prototypes here = for testing // -extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[]; +extern CONST CHAR8 *mMtrrMemoryCacheTypeShortName[]; =20 /** Initializes the valid bits mask and valid address mask for MTRRs. @@ -48,8 +48,8 @@ extern CONST CHAR8 *mMtrrMemoryCacheTypeShortNam= e[]; **/ VOID MtrrLibInitializeMtrrMask ( - OUT UINT64 *MtrrValidBitsMask, - OUT UINT64 *MtrrValidAddressMask + OUT UINT64 *MtrrValidBitsMask, + OUT UINT64 *MtrrValidAddressMask ); =20 /** @@ -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 ); =20 // @@ -130,17 +130,17 @@ AccessAllMtrrs ( VOID ) { - MTRR_SETTINGS LocalMtrrs; - MTRR_SETTINGS *Mtrrs; - UINTN RangeCount; - UINT64 MtrrValidBitsMask; - UINT64 MtrrValidAddressMask; - UINT32 VariableMtrrCount; + MTRR_SETTINGS LocalMtrrs; + MTRR_SETTINGS *Mtrrs; + UINTN RangeCount; + UINT64 MtrrValidBitsMask; + UINT64 MtrrValidAddressMask; + UINT32 VariableMtrrCount; =20 - 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_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= )]; =20 if (!IsMtrrSupported ()) { return; @@ -155,15 +155,21 @@ AccessAllMtrrs ( Ranges[0].BaseAddress =3D 0; Ranges[0].Length =3D MtrrValidBitsMask + 1; Ranges[0].Type =3D MtrrGetDefaultMemoryType (); - RangeCount =3D 1; + RangeCount =3D 1; =20 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 ); =20 MtrrLibApplyFixedMtrrs (&Mtrrs->Fixed, Ranges, ARRAY_SIZE (Ranges), &R= angeCount); @@ -187,11 +193,11 @@ AccessAllMtrrs ( UINT64 EFIAPI HpetRead ( - IN UINTN Offset + IN UINTN Offset ) { - UINTN Address; - UINT64 Value; + UINTN Address; + UINT64 Value; =20 Address =3D HPET_BASE_ADDRESS + Offset; =20 @@ -200,7 +206,7 @@ HpetRead ( } =20 MemoryFence (); - Value =3D *(volatile UINT64*)Address; + Value =3D *(volatile UINT64 *)Address; MemoryFence (); =20 return Value; @@ -251,8 +257,7 @@ GetMicrocodeSignature ( @retval Others An error occurred in the PRM handler. =20 **/ -PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) -{ +PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) { UINT32 MicrocodeSignature; =20 MicrocodeSignature =3D 0; @@ -277,8 +282,7 @@ PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHan= dler) @retval Others An error occurred in the PRM handler. =20 **/ -PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) -{ +PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) { AccessAllMtrrs (); =20 return EFI_SUCCESS; @@ -296,8 +300,7 @@ PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) @retval Others An error occurred in the PRM handler. =20 **/ -PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) -{ +PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) { AccessHpetConfiguration (); =20 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/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTest.c b/PrmPkg/Test/UnitTest/Library/UefiB= ootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.c index d41cba3fea0e..ea3235e448a2 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTest.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTest.c @@ -16,10 +16,10 @@ =20 #include "UefiBootServicesTableLibUnitTest.h" =20 -EFI_HANDLE gImageHandle =3D NULL; -EFI_SYSTEM_TABLE *gST =3D NULL; +EFI_HANDLE gImageHandle =3D NULL; +EFI_SYSTEM_TABLE *gST =3D NULL; =20 -STATIC EFI_BOOT_SERVICES mBootServices =3D { +STATIC EFI_BOOT_SERVICES mBootServices =3D { { EFI_BOOT_SERVICES_SIGNATURE, = // Signature EFI_BOOT_SERVICES_REVISION, = // Revision @@ -27,50 +27,50 @@ STATIC EFI_BOOT_SERVICES mBootServices =3D { 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) UnitTestInstallProtocolI= nterface, // InstallProtocolInterface - (EFI_REINSTALL_PROTOCOL_INTERFACE) UnitTestReinstallProtoco= lInterface, // ReinstallProtocolInterface - (EFI_UNINSTALL_PROTOCOL_INTERFACE) UnitTestUninstallProtoco= lInterface, // UninstallProtocolInterface - (EFI_HANDLE_PROTOCOL) UnitTestHandleProtocol, = // HandleProtocol - (VOID *) NULL, = // Reserved - (EFI_REGISTER_PROTOCOL_NOTIFY) UnitTestRegisterProtocol= Notify, // RegisterProtocolNotify - (EFI_LOCATE_HANDLE) UnitTestLocateHandle, = // LocateHandle - (EFI_LOCATE_DEVICE_PATH) UnitTestLocateDevicePath= , // LocateDevicePath - (EFI_INSTALL_CONFIGURATION_TABLE) UnitTestInstallConfigura= tionTable, // 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) UnitTestGetNextMonotonic= Count, // GetNextMonotonicCount - (EFI_STALL) UnitTestStall, = // Stall - (EFI_SET_WATCHDOG_TIMER) UnitTestSetWatchdogTimer= , // SetWatchdogTimer - (EFI_CONNECT_CONTROLLER) UnitTestConnectControlle= r, // ConnectController - (EFI_DISCONNECT_CONTROLLER) UnitTestDisconnectContro= ller, // DisconnectController - (EFI_OPEN_PROTOCOL) UnitTestOpenProtocol, = // OpenProtocol - (EFI_CLOSE_PROTOCOL) UnitTestCloseProtocol, = // CloseProtocol - (EFI_OPEN_PROTOCOL_INFORMATION) UnitTestOpenProtocolInfo= rmation, // OpenProtocolInformation - (EFI_PROTOCOLS_PER_HANDLE) UnitTestProtocolsPerHand= le, // ProtocolsPerHandle - (EFI_LOCATE_HANDLE_BUFFER) UnitTestLocateHandleBuff= er, // LocateHandleBuffer - (EFI_LOCATE_PROTOCOL) UnitTestLocateProtocol, = // LocateProtocol - (EFI_INSTALL_MULTIPLE_PROTOCOL_INTERFACES) UnitTestInstallMultipleP= rotocolInterfaces, // InstallMultipleProtocolInterfaces - (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES) UnitTestUninstallMultipl= eProtocolInterfaces, // 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)UnitTestInstallMultipleProto= colInterfaces, // InstallMultipleProtocolInterfaces + (EFI_UNINSTALL_MULTIPLE_PROTOCOL_INTERFACES)UnitTestUninstallMultipleP= rotocolInterfaces, // UninstallMultipleProtocolInterfaces + (EFI_CALCULATE_CRC32)UnitTestCalculateCrc32, = // CalculateCrc32 + (EFI_COPY_MEM)CopyMem, = // CopyMem + (EFI_SET_MEM)SetMem, = // SetMem + (EFI_CREATE_EVENT_EX)UnitTestCreateEventEx = // CreateEventEx }; =20 EFI_BOOT_SERVICES *gBS =3D &mBootServices; diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestEventTimer.c b/PrmPkg/Test/UnitTest/Lib= rary/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestEve= ntTimer.c index 16bd3f4c547d..c1ec801bca42 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestEventTimer.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestEventTimer.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/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestImage.c b/PrmPkg/Test/UnitTest/Library/= UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestImage.c index b6083a4c3f27..a5799ff92d0c 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestImage.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestImage.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/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestMemory.c b/PrmPkg/Test/UnitTest/Library= /UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMemory.= c index 48da39d0c359..2c9a1989f2d1 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestMemory.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestMemory.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/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestMisc.c b/PrmPkg/Test/UnitTest/Library/U= efiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestMisc.c index dbe3e76b549f..ab7936544801 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestMisc.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestMisc.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 =3D 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 =3D=3D NULL || Crc32 =3D=3D NULL || DataSize =3D=3D 0) { + if ((Data =3D=3D NULL) || (Crc32 =3D=3D NULL) || (DataSize =3D=3D 0)) = { return EFI_INVALID_PARAMETER; } =20 diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestProtocol.c b/PrmPkg/Test/UnitTest/Libra= ry/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProto= col.c index 65e69ecc3d94..799b153a445f 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestProtocol.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestProtocol.c @@ -8,10 +8,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include "UefiBootServicesTableLibUnitTestProtocol.h" =20 -STATIC LIST_ENTRY mProtocolDatabase =3D INITIALIZE_LIST_HEAD_VAR= IABLE (mProtocolDatabase); -STATIC LIST_ENTRY gHandleList =3D INITIALIZE_LIST_HEAD_VAR= IABLE (gHandleList); -STATIC UINT64 gHandleDatabaseKey =3D 0; -STATIC UINTN mEfiLocateHandleRequest =3D 0; +STATIC LIST_ENTRY mProtocolDatabase =3D INITIALIZE_LIST_HEAD_VARI= ABLE (mProtocolDatabase); +STATIC LIST_ENTRY gHandleList =3D INITIALIZE_LIST_HEAD_VARI= ABLE (gHandleList); +STATIC UINT64 gHandleDatabaseKey =3D 0; +STATIC UINTN mEfiLocateHandleRequest =3D 0; =20 // // Helper Functions @@ -27,12 +27,12 @@ STATIC UINTN mEfiLocateHandleRequest =3D 0; =20 **/ EFI_STATUS - UnitTestValidateHandle ( - IN EFI_HANDLE UserHandle +UnitTestValidateHandle ( + IN EFI_HANDLE UserHandle ) { - IHANDLE *Handle; - LIST_ENTRY *Link; + IHANDLE *Handle; + LIST_ENTRY *Link; =20 if (UserHandle =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -40,7 +40,7 @@ EFI_STATUS =20 for (Link =3D gHandleList.BackLink; Link !=3D &gHandleList; Link =3D L= ink->BackLink) { Handle =3D CR (Link, IHANDLE, AllHandles, EFI_HANDLE_SIGNATURE); - if (Handle =3D=3D (IHANDLE *) UserHandle) { + if (Handle =3D=3D (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; =20 // // Search the database for the matching GUID @@ -74,11 +74,10 @@ UnitTestFindProtocolEntry ( ProtEntry =3D NULL; for (Link =3D mProtocolDatabase.ForwardLink; Link !=3D &mProtocolDatabase; - Link =3D Link->ForwardLink) { - + Link =3D Link->ForwardLink) + { Item =3D CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNAT= URE); if (CompareGuid (&Item->ProtocolID, Protocol)) { - // // This is the protocol entry // @@ -100,7 +99,7 @@ UnitTestFindProtocolEntry ( // Initialize new protocol entry structure // ProtEntry->Signature =3D PROTOCOL_ENTRY_SIGNATURE; - CopyGuid ((VOID *) &ProtEntry->ProtocolID, Protocol); + CopyGuid ((VOID *)&ProtEntry->ProtocolID, Protocol); InitializeListHead (&ProtEntry->Protocols); InitializeListHead (&ProtEntry->Notify); =20 @@ -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 ( =20 ProtEntry =3D UnitTestFindProtocolEntry (Protocol, FALSE); if (ProtEntry !=3D NULL) { - // // Look at each protocol interface for any matches // - for (Link =3D Handle->Protocols.ForwardLink; Link !=3D &Handle->Prot= ocols; Link=3DLink->ForwardLink) { - + for (Link =3D Handle->Protocols.ForwardLink; Link !=3D &Handle->Prot= ocols; Link =3D Link->ForwardLink) { // // If this protocol interface matches, remove it // - Prot =3D CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIG= NATURE); - if (Prot->Interface =3D=3D Interface && Prot->Protocol =3D=3D Prot= Entry) { + Prot =3D CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SI= GNATURE); + if ((Prot->Interface =3D=3D Interface) && (Prot->Protocol =3D=3D P= rotEntry)) { break; } =20 @@ -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; =20 - for (Link=3DProtEntry->Notify.ForwardLink; Link !=3D &ProtEntry->Notif= y; Link=3DLink->ForwardLink) { - ProtNotify =3D CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNA= TURE); + for (Link =3D ProtEntry->Notify.ForwardLink; Link !=3D &ProtEntry->Not= ify; Link =3D Link->ForwardLink) { + ProtNotify =3D CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGN= ATURE); 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; =20 // // Next handle @@ -213,8 +210,8 @@ UnitTestGetNextLocateAllHandles ( // // If not at the end of the list, get the handle // - Handle =3D NULL; - *Interface =3D NULL; + Handle =3D NULL; + *Interface =3D NULL; if (Position->Position !=3D &gHandleList) { Handle =3D CR (Position->Position, IHANDLE, AllHandles, EFI_HANDLE_S= IGNATURE); } @@ -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; =20 - Handle =3D NULL; - *Interface =3D NULL; + Handle =3D NULL; + *Interface =3D NULL; ProtNotify =3D Position->SearchKey; =20 // @@ -261,8 +258,8 @@ UnitTestGetNextLocateByRegisterNotify ( // Link =3D ProtNotify->Position->ForwardLink; if (Link !=3D &ProtNotify->Protocol->Protocols) { - Prot =3D CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERF= ACE_SIGNATURE); - Handle =3D Prot->Handle; + Prot =3D CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_= INTERFACE_SIGNATURE); + Handle =3D Prot->Handle; *Interface =3D Prot->Interface; } } @@ -270,7 +267,6 @@ UnitTestGetNextLocateByRegisterNotify ( return Handle; } =20 - /** Routine to get the next Handle, when you are searching for a given pro= tocol. =20 @@ -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; =20 - Handle =3D NULL; - *Interface =3D NULL; - for (; ;) { + Handle =3D NULL; + *Interface =3D NULL; + for ( ; ;) { // // Next entry // - Link =3D Position->Position->ForwardLink; + Link =3D Position->Position->ForwardLink; Position->Position =3D Link; =20 // @@ -312,8 +308,8 @@ UnitTestGetNextLocateByProtocol ( // // Get the handle // - Prot =3D CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFAC= E_SIGNATURE); - Handle =3D Prot->Handle; + Prot =3D CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_IN= TERFACE_SIGNATURE); + Handle =3D Prot->Handle; *Interface =3D Prot->Interface; =20 // @@ -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; =20 Status =3D EFI_SUCCESS; =20 @@ -368,6 +364,7 @@ UnitTestDisconnectControllersUsingProtocolInterface ( if (!EFI_ERROR (Status)) { ItemFound =3D TRUE; } + break; } } @@ -380,7 +377,8 @@ UnitTestDisconnectControllersUsingProtocolInterface ( for (Link =3D Prot->OpenList.ForwardLink; Link !=3D &Prot->OpenList;= ) { OpenData =3D CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DAT= A_SIGNATURE); if ((OpenData->Attributes & - (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_= PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) !=3D 0) { + (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET= _PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) !=3D 0) + { Link =3D 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 ( =20 Prot =3D UnitTestFindProtocolInterface (Handle, Protocol, Interface); if (Prot !=3D NULL) { - ProtEntry =3D Prot->Protocol; =20 // // If there's a protocol notify location pointing to this entry, bac= k it up one // - for(Link =3D ProtEntry->Notify.ForwardLink; Link !=3D &ProtEntry->No= tify; Link=3DLink->ForwardLink) { - ProtNotify =3D CR(Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIG= NATURE); + for (Link =3D ProtEntry->Notify.ForwardLink; Link !=3D &ProtEntry->N= otify; Link =3D Link->ForwardLink) { + ProtNotify =3D CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SI= GNATURE); =20 if (ProtNotify->Position =3D=3D &Prot->ByProtocol) { ProtNotify->Position =3D 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; } =20 - Handle =3D (IHANDLE *) UserHandle; + Handle =3D (IHANDLE *)UserHandle; =20 // // Look at each protocol interface for a match // for (Link =3D Handle->Protocols.ForwardLink; Link !=3D &Handle->Protoc= ols; Link =3D Link->ForwardLink) { - Prot =3D CR(Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNA= TURE); + Prot =3D CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE= _SIGNATURE); ProtEntry =3D Prot->Protocol; if (CompareGuid (&ProtEntry->ProtocolID, Protocol)) { return Prot; } } + return NULL; } =20 @@ -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 =3D=3D NULL || Protocol =3D=3D NULL) { + if ((UserHandle =3D=3D NULL) || (Protocol =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 @@ -543,11 +541,11 @@ UnitTestInstallProtocolInterfaceNotify ( UT_LOG_INFO ("InstallProtocolInterface: %g %p\n", Protocol, Interface)= ; =20 Status =3D EFI_OUT_OF_RESOURCES; - Prot =3D NULL; + Prot =3D NULL; Handle =3D NULL; =20 if (*UserHandle !=3D NULL) { - Status =3D UnitTestHandleProtocol (*UserHandle, Protocol, (VOID **) = &ExistingInterface); + Status =3D 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 =3D (IHANDLE *) *UserHandle; + Handle =3D (IHANDLE *)*UserHandle; if (Handle =3D=3D NULL) { Handle =3D AllocateZeroPool (sizeof (IHANDLE)); if (Handle =3D=3D NULL) { @@ -601,7 +599,7 @@ UnitTestInstallProtocolInterfaceNotify ( } else { Status =3D 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 =3D PROTOCOL_INTERFACE_SIGNATURE; - Prot->Handle =3D Handle; - Prot->Protocol =3D ProtEntry; + Prot->Handle =3D Handle; + Prot->Protocol =3D ProtEntry; Prot->Interface =3D Interface; =20 // @@ -643,6 +641,7 @@ UnitTestInstallProtocolInterfaceNotify ( if (Notify) { UnitTestNotifyProtocolEntry (ProtEntry); } + Status =3D EFI_SUCCESS; =20 Done: @@ -658,6 +657,7 @@ UnitTestInstallProtocolInterfaceNotify ( if (Prot !=3D NULL) { UnitTestFreePool (Prot); } + DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r= \n", Protocol, Interface, Status)); } =20 @@ -681,19 +681,19 @@ UnitTestInstallProtocolInterfaceNotify ( 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 + ); } =20 /** @@ -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; =20 // // Check that Protocol is valid @@ -789,7 +789,7 @@ UnitTestUninstallProtocolInterface ( // Remove the protocol interface from the protocol // Status =3D EFI_NOT_FOUND; - Handle =3D (IHANDLE *) UserHandle; + Handle =3D (IHANDLE *)UserHandle; Prot =3D UnitTestRemoveInterfaceFromProtocol (Handle, Protocol, Inte= rface); =20 if (Prot !=3D NULL) { @@ -839,19 +839,19 @@ 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 ) { - 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 + ); } =20 /** @@ -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 =3D SearchKey; Position.Position =3D &gHandleList; =20 - ResultSize =3D 0; - ResultBuffer =3D (IHANDLE **) Buffer; - Status =3D EFI_SUCCESS; + ResultSize =3D 0; + ResultBuffer =3D (IHANDLE **)Buffer; + Status =3D EFI_SUCCESS; =20 // // Get the search function based on type // switch (SearchType) { - case AllHandles: - GetNext =3D UnitTestGetNextLocateAllHandles; - break; - - case ByRegisterNotify: - // - // Must have SearchKey for locate ByRegisterNotify - // - if (SearchKey =3D=3D NULL) { - Status =3D EFI_INVALID_PARAMETER; + case AllHandles: + GetNext =3D UnitTestGetNextLocateAllHandles; break; - } - GetNext =3D UnitTestGetNextLocateByRegisterNotify; - break; =20 - case ByProtocol: - GetNext =3D UnitTestGetNextLocateByProtocol; - if (Protocol =3D=3D NULL) { - Status =3D EFI_INVALID_PARAMETER; + case ByRegisterNotify: + // + // Must have SearchKey for locate ByRegisterNotify + // + if (SearchKey =3D=3D NULL) { + Status =3D EFI_INVALID_PARAMETER; + break; + } + + GetNext =3D UnitTestGetNextLocateByRegisterNotify; break; - } - // - // Look up the protocol entry and set the head pointer - // - Position.ProtEntry =3D UnitTestFindProtocolEntry (Protocol, FALSE); - if (Position.ProtEntry =3D=3D NULL) { - Status =3D EFI_NOT_FOUND; + + case ByProtocol: + GetNext =3D UnitTestGetNextLocateByProtocol; + if (Protocol =3D=3D NULL) { + Status =3D EFI_INVALID_PARAMETER; + break; + } + + // + // Look up the protocol entry and set the head pointer + // + Position.ProtEntry =3D UnitTestFindProtocolEntry (Protocol, FALSE)= ; + if (Position.ProtEntry =3D=3D NULL) { + Status =3D EFI_NOT_FOUND; + break; + } + + Position.Position =3D &Position.ProtEntry->Protocols; break; - } - Position.Position =3D &Position.ProtEntry->Protocols; - break; =20 - default: - Status =3D EFI_INVALID_PARAMETER; - break; + default: + Status =3D EFI_INVALID_PARAMETER; + break; } =20 if (EFI_ERROR (Status)) { @@ -986,7 +989,7 @@ UnitTestLocateHandle ( // Enumerate out the matching handles // mEfiLocateHandleRequest +=3D 1; - for (; ;) { + for ( ; ;) { // // Get the next handle. If no more handles, stop // @@ -1001,8 +1004,8 @@ UnitTestLocateHandle ( // ResultSize +=3D sizeof (Handle); if (ResultSize <=3D *BufferSize) { - *ResultBuffer =3D Handle; - ResultBuffer +=3D 1; + *ResultBuffer =3D Handle; + ResultBuffer +=3D 1; } } =20 @@ -1023,13 +1026,13 @@ UnitTestLocateHandle ( =20 *BufferSize =3D ResultSize; =20 - if (SearchType =3D=3D ByRegisterNotify && !EFI_ERROR(Status)) { + if ((SearchType =3D=3D ByRegisterNotify) && !EFI_ERROR (Status)) { // // If this is a search by register notify and a handle was // returned, update the register notification position // ASSERT (SearchKey !=3D NULL); - ProtNotify =3D SearchKey; + ProtNotify =3D SearchKey; ProtNotify->Position =3D 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 =3D UnitTestValidateHandle (ImageHandle); - if (EFI_ERROR (Status)) { - return Status; - } - Status =3D UnitTestValidateHandle (ControllerHandle); - if (EFI_ERROR (Status)) { - return Status; - } - if (UserHandle =3D=3D ControllerHandle) { + case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER: + Status =3D UnitTestValidateHandle (ImageHandle); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D UnitTestValidateHandle (ControllerHandle); + if (EFI_ERROR (Status)) { + return Status; + } + + if (UserHandle =3D=3D ControllerHandle) { + return EFI_INVALID_PARAMETER; + } + + break; + case EFI_OPEN_PROTOCOL_BY_DRIVER: + case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE: + Status =3D UnitTestValidateHandle (ImageHandle); + if (EFI_ERROR (Status)) { + return Status; + } + + Status =3D UnitTestValidateHandle (ControllerHandle); + if (EFI_ERROR (Status)) { + return Status; + } + + break; + case EFI_OPEN_PROTOCOL_EXCLUSIVE: + Status =3D 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 =3D UnitTestValidateHandle (ImageHandle); - if (EFI_ERROR (Status)) { - return Status; - } - Status =3D UnitTestValidateHandle (ControllerHandle); - if (EFI_ERROR (Status)) { - return Status; - } - break; - case EFI_OPEN_PROTOCOL_EXCLUSIVE : - Status =3D 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; } =20 // @@ -1203,10 +1212,10 @@ UnitTestOpenProtocol ( =20 Status =3D EFI_SUCCESS; =20 - ByDriver =3D FALSE; - Exclusive =3D FALSE; + ByDriver =3D FALSE; + Exclusive =3D FALSE; for ( Link =3D Prot->OpenList.ForwardLink; Link !=3D &Prot->OpenList; = Link =3D Link->ForwardLink) { - OpenData =3D CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_= SIGNATURE); + OpenData =3D CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DAT= A_SIGNATURE); ExactMatch =3D (BOOLEAN)((OpenData->AgentHandle =3D=3D ImageHandle)= && (OpenData->Attributes =3D=3D Attributes) && (OpenData->ControllerHandle =3D=3D Controlle= rHandle)); @@ -1217,6 +1226,7 @@ UnitTestOpenProtocol ( goto Done; } } + if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) !=3D 0) { Exclusive =3D TRUE; } else if (ExactMatch) { @@ -1234,60 +1244,64 @@ UnitTestOpenProtocol ( // =20 switch (Attributes) { - case EFI_OPEN_PROTOCOL_BY_DRIVER : - if (Exclusive || ByDriver) { - Status =3D EFI_ACCESS_DENIED; - goto Done; - } - break; - case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE : - case EFI_OPEN_PROTOCOL_EXCLUSIVE : - if (Exclusive) { - Status =3D EFI_ACCESS_DENIED; - goto Done; - } - if (ByDriver) { - do { - Disconnect =3D FALSE; - for (Link =3D Prot->OpenList.ForwardLink; Link !=3D &Prot->OpenL= ist; Link =3D Link->ForwardLink) { - OpenData =3D CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL= _DATA_SIGNATURE); - if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) !=3D = 0) { - Disconnect =3D TRUE; - Status =3D UnitTestDisconnectController (UserHandle, OpenDat= a->AgentHandle, NULL); - if (EFI_ERROR (Status)) { - Status =3D EFI_ACCESS_DENIED; - goto Done; - } else { - break; + case EFI_OPEN_PROTOCOL_BY_DRIVER: + if (Exclusive || ByDriver) { + Status =3D EFI_ACCESS_DENIED; + goto Done; + } + + break; + case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE: + case EFI_OPEN_PROTOCOL_EXCLUSIVE: + if (Exclusive) { + Status =3D EFI_ACCESS_DENIED; + goto Done; + } + + if (ByDriver) { + do { + Disconnect =3D FALSE; + for (Link =3D Prot->OpenList.ForwardLink; Link !=3D &Prot->Ope= nList; Link =3D Link->ForwardLink) { + OpenData =3D CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOC= OL_DATA_SIGNATURE); + if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) !=3D= 0) { + Disconnect =3D TRUE; + Status =3D UnitTestDisconnectController (UserHandle, O= penData->AgentHandle, NULL); + if (EFI_ERROR (Status)) { + Status =3D 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; } =20 if (ImageHandle =3D=3D NULL) { Status =3D EFI_SUCCESS; goto Done; } + // // Create new entry // - OpenData =3D AllocatePool (sizeof(OPEN_PROTOCOL_DATA)); + OpenData =3D AllocatePool (sizeof (OPEN_PROTOCOL_DATA)); if (OpenData =3D=3D NULL) { Status =3D EFI_OUT_OF_RESOURCES; } else { - OpenData->Signature =3D OPEN_PROTOCOL_DATA_SIGNATURE; - OpenData->AgentHandle =3D ImageHandle; - OpenData->ControllerHandle =3D ControllerHandle; - OpenData->Attributes =3D Attributes; - OpenData->OpenCount =3D 1; + OpenData->Signature =3D OPEN_PROTOCOL_DATA_SIGNATURE; + OpenData->AgentHandle =3D ImageHandle; + OpenData->ControllerHandle =3D ControllerHandle; + OpenData->Attributes =3D Attributes; + OpenData->OpenCount =3D 1; InsertTailList (&Prot->OpenList, &OpenData->Link); Prot->OpenListCount++; Status =3D EFI_SUCCESS; @@ -1300,7 +1314,7 @@ UnitTestOpenProtocol ( // Keep Interface unmodified in case of any Error // except EFI_ALREADY_STARTED and EFI_UNSUPPORTED. // - if (!EFI_ERROR (Status) || Status =3D=3D EFI_ALREADY_STARTED) { + if (!EFI_ERROR (Status) || (Status =3D=3D 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 @@ 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 ) { 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; =20 if (NumberHandles =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -1463,26 +1477,27 @@ UnitTestLocateHandleBuffer ( return EFI_INVALID_PARAMETER; } =20 - BufferSize =3D 0; + BufferSize =3D 0; *NumberHandles =3D 0; - *Buffer =3D NULL; - Status =3D UnitTestLocateHandle ( - SearchType, - Protocol, - SearchKey, - &BufferSize, - *Buffer - ); + *Buffer =3D NULL; + Status =3D UnitTestLocateHandle ( + SearchType, + Protocol, + SearchKey, + &BufferSize, + *Buffer + ); // // LocateHandleBuffer() returns incorrect status code if SearchType is // invalid. // // Add code to correctly handle expected errors from UnitTestLocateHan= dle(). // - if (EFI_ERROR (Status) && Status !=3D EFI_BUFFER_TOO_SMALL) { + if (EFI_ERROR (Status) && (Status !=3D EFI_BUFFER_TOO_SMALL)) { if (Status !=3D EFI_INVALID_PARAMETER) { Status =3D EFI_NOT_FOUND; } + return Status; } =20 @@ -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; =20 VA_START (Args, Handle); for (Index =3D 0, Status =3D EFI_SUCCESS; !EFI_ERROR (Status); Index++= ) { @@ -1609,6 +1624,7 @@ UnitTestUninstallMultipleProtocolInterfaces ( // Status =3D UnitTestUninstallProtocolInterface (Handle, Protocol, Int= erface); } + VA_END (Args); =20 // @@ -1620,11 +1636,12 @@ UnitTestUninstallMultipleProtocolInterfaces ( // Reset the va_arg back to the first argument. // VA_START (Args, Handle); - for (; Index > 1; Index--) { - Protocol =3D VA_ARG(Args, EFI_GUID *); - Interface =3D VA_ARG(Args, VOID *); + for ( ; Index > 1; Index--) { + Protocol =3D VA_ARG (Args, EFI_GUID *); + Interface =3D VA_ARG (Args, VOID *); UnitTestInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_IN= TERFACE, Interface); } + VA_END (Args); Status =3D EFI_INVALID_PARAMETER; } diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestTpl.c b/PrmPkg/Test/UnitTest/Library/Ue= fiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestTpl.c index 7e1849fbd4a9..5b7b6700f874 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestTpl.c +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestTpl.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; diff --git a/PrmPkg/Application/PrmInfo/PrmInfo.h b/PrmPkg/Application/Pr= mInfo/PrmInfo.h index c2c3fa2f23fc..3813998e96a9 100644 --- a/PrmPkg/Application/PrmInfo/PrmInfo.h +++ b/PrmPkg/Application/PrmInfo/PrmInfo.h @@ -14,24 +14,24 @@ #include #include =20 -#define APPLICATION_NAME L"PrmInfo" +#define APPLICATION_NAME L"PrmInfo" =20 -#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') =20 #pragma pack(push, 1) =20 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; =20 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; =20 #pragma pack(pop) @@ -42,8 +42,8 @@ typedef struct { #define EFI_LIST_FOR_EACH(Entry, ListHead) \ for(Entry =3D (ListHead)->ForwardLink; Entry !=3D (ListHead); Entry =3D= Entry->ForwardLink) =20 -#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) =20 #endif diff --git a/PrmPkg/Include/Library/PrmContextBufferLib.h b/PrmPkg/Includ= e/Library/PrmContextBufferLib.h index 93dcd1e76642..8416b6a6c2d9 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 ); =20 /** @@ -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 ); =20 /** @@ -91,9 +91,9 @@ GetModuleContextBuffers ( **/ EFI_STATUS GetContextBuffer ( - IN CONST EFI_GUID *PrmHandlerGuid, - IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTI= ONAL, - OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer + IN CONST EFI_GUID *PrmHandlerGuid, + IN CONST PRM_MODULE_CONTEXT_BUFFERS *PrmModuleContextBuffers OPTION= AL, + OUT CONST PRM_CONTEXT_BUFFER **PrmContextBuffer ); =20 #endif diff --git a/PrmPkg/Include/Library/PrmModuleDiscoveryLib.h b/PrmPkg/Incl= ude/Library/PrmModuleDiscoveryLib.h index fe3a42586afa..341b9b26a0f8 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 ); =20 /** @@ -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 ); =20 #endif diff --git a/PrmPkg/Include/Library/PrmPeCoffLib.h b/PrmPkg/Include/Libra= ry/PrmPeCoffLib.h index 4698a9477699..a3cbeba0073e 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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 #endif diff --git a/PrmPkg/Include/Prm.h b/PrmPkg/Include/Prm.h index 0e3ccfffa333..e290e53510f0 100644 --- a/PrmPkg/Include/Prm.h +++ b/PrmPkg/Include/Prm.h @@ -13,16 +13,16 @@ #include #include =20 -#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 =20 -#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128 +#define PRM_HANDLER_NAME_MAXIMUM_LENGTH 128 =20 -#define PRM_STRING_(x) #x -#define PRM_STRING(x) PRM_STRING_(x) +#define PRM_STRING_(x) #x +#define PRM_STRING(x) PRM_STRING_(x) =20 /** 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/PrmContex= tBuffer.h index 869480101773..781910d67e6d 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; =20 // @@ -45,22 +45,22 @@ typedef struct { /// /// Signature of this interface. /// - UINT32 Signature; + UINT32 Signature; =20 /// /// Version of this interface. /// - UINT16 Version; + UINT16 Version; =20 /// /// Reserved field. /// - UINT16 Reserved; + UINT16 Reserved; =20 /// /// The GUID of the PRM handler represented by this context instance. /// - EFI_GUID HandlerGuid; + EFI_GUID HandlerGuid; =20 /// /// 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; =20 /// /// 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; =20 // // 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; =20 /// /// The number of PRM context buffers in ContextBuffers[]. /// This count should equal the number of PRM handlers in the module b= eing configured. /// - UINTN BufferCount; + UINTN BufferCount; =20 /// /// A pointer to an array of PRM context buffers /// - PRM_CONTEXT_BUFFER *Buffer; + PRM_CONTEXT_BUFFER *Buffer; =20 /// 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; =20 /// /// The number of ACPI parameter buffer descriptors in the array /// AcpiParameterBufferDescriptors /// - UINTN AcpiParameterBufferDescriptorC= ount; + UINTN AcpiParameterBufferDescriptorCount; =20 /// /// A pointer to an array of ACPI parameter buffer descriptors. PRM mo= dule @@ -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 NU= LL. /// - ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParameterBufferDescriptor= s; + ACPI_PARAMETER_BUFFER_DESCRIPTOR *AcpiParameterBufferDescriptors; } PRM_MODULE_CONTEXT_BUFFERS; =20 #pragma pack(pop) diff --git a/PrmPkg/Include/PrmDataBuffer.h b/PrmPkg/Include/PrmDataBuffe= r.h index 70d690ca5446..c5181f471940 100644 --- a/PrmPkg/Include/PrmDataBuffer.h +++ b/PrmPkg/Include/PrmDataBuffer.h @@ -12,7 +12,7 @@ =20 #include =20 -#define PRM_DATA_BUFFER_HEADER_SIGNATURE SIGNATURE_32('P','R','M','= D') +#define PRM_DATA_BUFFER_HEADER_SIGNATURE SIGNATURE_32('P','R','M','D') =20 #pragma pack(push, 1) =20 @@ -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; =20 /// @@ -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; =20 /// /// The beginning of data immediately follows the header. /// - UINT8 Data[1]; + UINT8 Data[1]; } PRM_DATA_BUFFER; =20 #pragma pack(pop) diff --git a/PrmPkg/Include/PrmExportDescriptor.h b/PrmPkg/Include/PrmExp= ortDescriptor.h index 76b67a05458a..85b38eace719 100644 --- a/PrmPkg/Include/PrmExportDescriptor.h +++ b/PrmPkg/Include/PrmExportDescriptor.h @@ -12,9 +12,9 @@ =20 #include =20 -#define PRM_MODULE_EXPORT_DESCRIPTOR_NAME PrmModuleExportDescrip= tor -#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 PrmModuleExportDescripto= r +#define PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE SIGNATURE_64 ('P', 'R', = 'M', '_', 'M', 'E', 'D', 'T') +#define PRM_MODULE_EXPORT_REVISION 0x0 =20 // // Platform Runtime Mechanism (PRM) Export Descriptor Structures @@ -22,30 +22,30 @@ #pragma pack(push, 1) =20 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; =20 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; =20 typedef struct { - PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header; - PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescriptor= s[1]; + PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT_HEADER Header; + PRM_HANDLER_EXPORT_DESCRIPTOR_STRUCT PrmHandlerExportDescript= ors[1]; } PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT; =20 #pragma pack(pop) =20 -#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 =20 @@ -67,6 +67,7 @@ typedef struct { PRM_STRING_(Name) \ } \ =20 + /** A macro that returns the count of the number of variable-length argume= nts given. =20 diff --git a/PrmPkg/Include/PrmMmio.h b/PrmPkg/Include/PrmMmio.h index fb216c27e8e3..6aca19f912cf 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 mark= ed 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; =20 /// @@ -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; =20 #pragma pack(pop) diff --git a/PrmPkg/Include/PrmModule.h b/PrmPkg/Include/PrmModule.h index 1369adda1aa7..094f7d1226d5 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)) <=3D PRM_HANDLER_NAME_MAXIMU= M_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 b= uffer \ - = \ - @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 paramet= er buffer \ + @param[in] ContextBUffer A pointer to the PRM handler context= buffer \ + = \ + @retval EFI_STATUS The PRM handler executed successfull= y. \ + @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/PrmM= oduleImageContext.h index 10146a272b6f..0e381442e1dc 100644 --- a/PrmPkg/Include/PrmModuleImageContext.h +++ b/PrmPkg/Include/PrmModuleImageContext.h @@ -18,9 +18,9 @@ #pragma pack(push, 1) =20 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; =20 #pragma pack(pop) diff --git a/PrmPkg/Include/Protocol/PrmConfig.h b/PrmPkg/Include/Protoco= l/PrmConfig.h index d90fe5a0dd73..4cce6b3c2c6d 100644 --- a/PrmPkg/Include/Protocol/PrmConfig.h +++ b/PrmPkg/Include/Protocol/PrmConfig.h @@ -19,14 +19,13 @@ =20 typedef struct _PRM_CONFIG_PROTOCOL PRM_CONFIG_PROTOCOL; =20 -#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 =20 -struct _PRM_CONFIG_PROTOCOL -{ - PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers; +struct _PRM_CONFIG_PROTOCOL { + PRM_MODULE_CONTEXT_BUFFERS ModuleContextBuffers; }; =20 -extern EFI_GUID gPrmConfigProtocolGuid; +extern EFI_GUID gPrmConfigProtocolGuid; =20 #endif diff --git a/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h= b/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h index ea42cf272550..f6b89626053e 100644 --- a/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h +++ b/PrmPkg/Library/DxePrmModuleDiscoveryLib/PrmModuleDiscovery.h @@ -12,14 +12,14 @@ =20 #include =20 -#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') =20 #pragma pack(push, 1) =20 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; =20 #pragma pack(pop) diff --git a/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h b/PrmPkg/PrmLoaderDxe/Prm= AcpiTable.h index 6f9ba8f77724..e2034d4738bd 100644 --- a/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h +++ b/PrmPkg/PrmLoaderDxe/PrmAcpiTable.h @@ -14,11 +14,11 @@ #include #include =20 -#define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R'= , 'M', 'T') +#define PRM_TABLE_SIGNATURE SIGNATURE_32 ('P', 'R', 'M', 'T') =20 -#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 =20 #pragma pack(push, 1) =20 @@ -26,13 +26,13 @@ // Platform Runtime Mechanism (PRM) ACPI Table (PRMT) structures // typedef struct { - UINT16 StructureRevision; ///< R= evision of this structure - UINT16 StructureLength; ///< L= ength in bytes of this structure - GUID Identifier; ///< G= UID of the PRM handler for this structure - UINT64 PhysicalAddress; ///< P= hysical address of this PRM handler - UINT64 StaticDataBuffer; ///< P= hysical address of the static data buffer for + UINT16 StructureRevision; ///< R= evision of this structure + UINT16 StructureLength; ///< L= ength in bytes of this structure + GUID Identifier; ///< G= UID of the PRM handler for this structure + UINT64 PhysicalAddress; ///< P= hysical address of this PRM handler + UINT64 StaticDataBuffer; ///< P= hysical address of the static data buffer for ///< t= his PRM handler (PRM_DATA_BUFFER *) - UINT64 AcpiParameterBuffer; ///< P= hysical address of the parameter buffer + UINT64 AcpiParameterBuffer; ///< P= hysical address of the parameter buffer ///< f= or this PRM handler (PRM_DATA_BUFFER *) ///< t= hat is only used in the case of _DSM invocation. ///< I= f _DSM invocation is not used, this value is @@ -40,29 +40,29 @@ typedef struct { } PRM_HANDLER_INFORMATION_STRUCT; =20 typedef struct { - UINT16 StructureRevision; ///< R= evision of this structure - UINT16 StructureLength; ///< L= ength in bytes of this structure including the + UINT16 StructureRevision; ///< R= evision of this structure + UINT16 StructureLength; ///< L= ength in bytes of this structure including the ///< v= ariable length PRM Handler Info array - GUID Identifier; ///< G= UID of the PRM module for this structure - UINT16 MajorRevision; ///< P= RM module major revision - UINT16 MinorRevision; ///< P= RM module minor revision - UINT16 HandlerCount; ///< N= umber of entries in the Handler Info array - UINT32 HandlerInfoOffset; ///< O= ffset in bytes from the beginning of this + GUID Identifier; ///< G= UID of the PRM module for this structure + UINT16 MajorRevision; ///< P= RM module major revision + UINT16 MinorRevision; ///< P= RM module minor revision + UINT16 HandlerCount; ///< N= umber of entries in the Handler Info array + UINT32 HandlerInfoOffset; ///< O= ffset in bytes from the beginning of this ///< s= tructure to the Handler Info array - UINT64 RuntimeMmioRanges; ///< P= hysical address of the PRM MMIO Ranges + UINT64 RuntimeMmioRanges; ///< P= hysical address of the PRM MMIO Ranges ///< s= tructure (PRM_MODULE_RUNTIME_MMIO_RANGES *) - PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1]; + PRM_HANDLER_INFORMATION_STRUCT HandlerInfoStructure[1]; } PRM_MODULE_INFORMATION_STRUCT; =20 typedef struct { - EFI_ACPI_DESCRIPTION_HEADER Header; ///< S= tandard ACPI description header - GUID PrmPlatformGuid; ///< A= GUID that uniquely identifies this platform. + EFI_ACPI_DESCRIPTION_HEADER Header; ///< S= tandard ACPI description header + GUID PrmPlatformGuid; ///< A= GUID that uniquely identifies this platform. ///< U= sed to check for compatibility in PRM module ///< r= untime updates. - UINT32 PrmModuleInfoOffset; ///< O= ffset in bytes from the beginning of this + UINT32 PrmModuleInfoOffset; ///< O= ffset in bytes from the beginning of this ///< s= tructure to the PRM Module Info array - UINT32 PrmModuleInfoCount; ///< N= umber of entries in the PRM Module Info array - PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1]; + UINT32 PrmModuleInfoCount; ///< N= umber of entries in the PRM Module Info array + PRM_MODULE_INFORMATION_STRUCT PrmModuleInfoStructure[1]; } PRM_ACPI_DESCRIPTION_TABLE; =20 #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, Han= dlerCount, PrmHanderInfoStructureArray) { \ +#define PRM_MODULE_INFORMATION_STRUCTURE(ModuleGuid, ModuleRevision, Han= dlerCount, 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 S= tructureRevision; */ \ + (OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoStructure) += (HandlerCount * sizeof (PRM_HANDLER_INFORMATION_STRUCT))) /* UINT16 S= tructureLength; */ \ + ModuleGuid, = /* GUID M= oduleGuid; */ \ + ModuleRevision, = /* UINT16 M= oduleRevision */ \ + HandlerCount, = /* UINT16 H= andlerCount */ \ + OFFSET_OF (PRM_MODULE_INFORMATION_STRUCT, HandlerInfoOffset), = /* UINT32 H= andlerInfoOffset */ \ + PrmHanderInfoStructureArray = /* PRM_HANDLER= _INFORMATION_STRUCT HandlerInfoStructure */ \ } \ } =20 -#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/Samples/PrmSampleContextBufferModule/Include/StaticDa= ta.h b/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h index 8fe3cf901fad..c3a5067c5547 100644 --- a/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h +++ b/PrmPkg/Samples/PrmSampleContextBufferModule/Include/StaticData.h @@ -13,12 +13,12 @@ =20 #include =20 -#define SOME_VALUE_ARRAY_MAX_VALUES 16 +#define SOME_VALUE_ARRAY_MAX_VALUES 16 =20 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; =20 #endif diff --git a/PrmPkg/Samples/PrmSampleHardwareAccessModule/Hpet.h b/PrmPkg= /Samples/PrmSampleHardwareAccessModule/Hpet.h index a4f8758516c0..d7298859f644 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_ =20 -#define HPET_BASE_ADDRESS 0xFED00000 -#define HPET_RANGE_LENGTH 0x1000 +#define HPET_BASE_ADDRESS 0xFED00000 +#define HPET_RANGE_LENGTH 0x1000 =20 /// /// 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 =20 /// /// Stride between sets of HPET Timer Registers /// -#define HPET_TIMER_STRIDE 0x20 +#define HPET_TIMER_STRIDE 0x20 =20 #pragma pack(1) =20 @@ -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; =20 /// @@ -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; =20 /// @@ -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; =20 /// @@ -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; =20 #pragma pack() diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTest.h b/PrmPkg/Test/UnitTest/Library/UefiB= ootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTest.h index 687508cf1faf..82853bb61a1c 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTest.h +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTest.h @@ -34,11 +34,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent EFI_TPL EFIAPI UnitTestRaiseTpl ( - IN EFI_TPL NewTpl + IN EFI_TPL NewTpl ); =20 - - /** 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 ); =20 /** @@ -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 ); =20 @@ -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 ); =20 /** @@ -137,8 +135,6 @@ UnitTestGetMemoryMap ( OUT UINT32 *DescriptorVersion ); =20 - - /** Allocate pool of a particular type. =20 @@ -172,7 +168,7 @@ UnitTestAllocatePool ( EFI_STATUS EFIAPI UnitTestFreePool ( - IN VOID *Buffer + IN VOID *Buffer ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -277,7 +273,7 @@ UnitTestWaitForEvent ( EFI_STATUS EFIAPI UnitTestSignalEvent ( - IN EFI_EVENT UserEvent + IN EFI_EVENT UserEvent ); =20 /** @@ -292,7 +288,7 @@ UnitTestSignalEvent ( EFI_STATUS EFIAPI UnitTestCloseEvent ( - IN EFI_EVENT UserEvent + IN EFI_EVENT UserEvent ); =20 /** @@ -308,7 +304,7 @@ UnitTestCloseEvent ( EFI_STATUS EFIAPI UnitTestCheckEvent ( - IN EFI_EVENT UserEvent + IN EFI_EVENT UserEvent ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -487,8 +483,8 @@ UnitTestLocateDevicePath ( EFI_STATUS EFIAPI UnitTestInstallConfigurationTable ( - IN EFI_GUID *Guid, - IN VOID *Table + IN EFI_GUID *Guid, + IN VOID *Table ); =20 /** @@ -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 ); =20 /** @@ -626,8 +622,8 @@ UnitTestUnloadImage ( EFI_STATUS EFIAPI UnitTestExitBootServices ( - IN EFI_HANDLE ImageHandle, - IN UINTN MapKey + IN EFI_HANDLE ImageHandle, + IN UINTN MapKey ); =20 /** @@ -643,7 +639,7 @@ UnitTestExitBootServices ( EFI_STATUS EFIAPI UnitTestGetNextMonotonicCount ( - OUT UINT64 *Count + OUT UINT64 *Count ); =20 /** @@ -659,7 +655,7 @@ UnitTestGetNextMonotonicCount ( EFI_STATUS EFIAPI UnitTestStall ( - IN UINTN Microseconds + IN UINTN Microseconds ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -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 ); =20 /** @@ -964,7 +960,7 @@ UnitTestLocateProtocol ( EFI_STATUS EFIAPI UnitTestInstallMultipleProtocolInterfaces ( - IN OUT EFI_HANDLE *Handle, + IN OUT EFI_HANDLE *Handle, ... ); =20 @@ -985,7 +981,7 @@ UnitTestInstallMultipleProtocolInterfaces ( EFI_STATUS EFIAPI UnitTestUninstallMultipleProtocolInterfaces ( - IN EFI_HANDLE Handle, + IN EFI_HANDLE Handle, ... ); =20 @@ -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 ); =20 /** @@ -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 ); =20 diff --git a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTes= t/UefiBootServicesTableLibUnitTestProtocol.h b/PrmPkg/Test/UnitTest/Libra= ry/UefiBootServicesTableLibUnitTest/UefiBootServicesTableLibUnitTestProto= col.h index 2857db2b2c7f..6428090071d6 100644 --- a/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestProtocol.h +++ b/PrmPkg/Test/UnitTest/Library/UefiBootServicesTableLibUnitTest/UefiB= ootServicesTableLibUnitTestProtocol.h @@ -14,25 +14,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent =20 #include "UefiBootServicesTableLibUnitTest.h" =20 -#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l') +#define EFI_HANDLE_SIGNATURE SIGNATURE_32('h','n','d','l') =20 /// /// 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; =20 #define ASSERT_IS_HANDLE(a) ASSERT((a)->Signature =3D=3D EFI_HANDLE_SIG= NATURE) =20 -#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e') +#define PROTOCOL_ENTRY_SIGNATURE SIGNATURE_32('p','r','t','e') =20 /// /// 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; =20 - #define PROTOCOL_INTERFACE_SIGNATURE SIGNATURE_32('p','i','f','c') =20 /// @@ -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; =20 #define OPEN_PROTOCOL_DATA_SIGNATURE SIGNATURE_32('p','o','d','l') =20 typedef struct { - UINTN Signature; - ///Link on PROTOCOL_INTERFACE.OpenList - LIST_ENTRY Link; + UINTN Signature; + /// Link on PROTOCOL_INTERFACE.OpenList + LIST_ENTRY Link; =20 - EFI_HANDLE AgentHandle; - EFI_HANDLE ControllerHandle; - UINT32 Attributes; - UINT32 OpenCount; + EFI_HANDLE AgentHandle; + EFI_HANDLE ControllerHandle; + UINT32 Attributes; + UINT32 OpenCount; } OPEN_PROTOCOL_DATA; =20 - -#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n') +#define PROTOCOL_NOTIFY_SIGNATURE SIGNATURE_32('p','r','t','n') =20 /// /// 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; =20 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; =20 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 ); =20 #endif --=20 2.28.0.windows.1