mirror of
				https://github.com/acidanthera/audk.git
				synced 2025-10-30 18:53:45 +01:00 
			
		
		
		
	PrmPkg: Apply uncrustify changes
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in PrmPkg. Cc: Andrew Fish <afish@apple.com> Cc: Kang Gao <kang.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Benjamin You <benjamin.you@intel.com> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Ankit Sinha <ankit.sinha@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Acked-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
This commit is contained in:
		
							parent
							
								
									f3c11224b5
								
							
						
					
					
						commit
						a298a84478
					
				| @ -102,6 +102,7 @@ CreateNewPrmHandlerListEntry ( | ||||
|   if (PrmHandlerContextListEntry == NULL) { | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   PrmHandlerContextListEntry->Signature = PRM_HANDLER_CONTEXT_LIST_ENTRY_SIGNATURE; | ||||
| 
 | ||||
|   return PrmHandlerContextListEntry; | ||||
| @ -184,8 +185,8 @@ GatherPrmHandlerInfo ( | ||||
|   for ( | ||||
|        CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext); | ||||
|        !EFI_ERROR (Status); | ||||
|     Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) { | ||||
| 
 | ||||
|        Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) | ||||
|   { | ||||
|     CurrentImageAddress           = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress; | ||||
|     CurrentImageExportDirectory   = CurrentPrmModuleImageContext->ExportDirectory; | ||||
|     CurrentExportDescriptorStruct = CurrentPrmModuleImageContext->ExportDescriptor; | ||||
| @ -224,7 +225,7 @@ GatherPrmHandlerInfo ( | ||||
|                                           (CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers | ||||
|                                           ); | ||||
|     ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND); | ||||
|     if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) { | ||||
|     if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers != NULL)) { | ||||
|       CurrentPrmModuleRuntimeMmioRanges = CurrentModuleContextBuffers->RuntimeMmioRanges; | ||||
|     } | ||||
| 
 | ||||
| @ -234,6 +235,7 @@ GatherPrmHandlerInfo ( | ||||
|       } else { | ||||
|         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_MMIO_RANGES), mPrmInfoHiiHandle); | ||||
|       } | ||||
| 
 | ||||
|       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle); | ||||
|       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_COUNT), mPrmInfoHiiHandle, HandlerCount); | ||||
|     } | ||||
| @ -329,7 +331,7 @@ PopulateContextBuffer ( | ||||
|   IN  PRM_CONTEXT_BUFFER  *ContextBuffer | ||||
|   ) | ||||
| { | ||||
|   if (HandlerGuid == NULL || ContextBuffer == NULL) { | ||||
|   if ((HandlerGuid == NULL) || (ContextBuffer == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -465,6 +467,7 @@ ExecutePrmHandlerByGuid ( | ||||
|       if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) { | ||||
|         StartTime = GetPerformanceCounter (); | ||||
|       } | ||||
| 
 | ||||
|       Status = HandlerContext->Handler (NULL, &CurrentContextBuffer); | ||||
|       if (PcdGetBool (PcdPrmInfoPrintHandlerExecutionTime)) { | ||||
|         EndTime = GetPerformanceCounter (); | ||||
| @ -477,11 +480,12 @@ ExecutePrmHandlerByGuid ( | ||||
|       } | ||||
| 
 | ||||
|       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLER_EXEC_TIME), mPrmInfoHiiHandle); | ||||
|       if (StartTime == 0 && EndTime == 0) { | ||||
|       if ((StartTime == 0) && (EndTime == 0)) { | ||||
|         ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_UNKNOWN), mPrmInfoHiiHandle); | ||||
|       } else { | ||||
|         PrintExecutionTime (GetTimeInNanoSecond (EndTime - StartTime)); | ||||
|       } | ||||
| 
 | ||||
|       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle); | ||||
|       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle); | ||||
|     } else { | ||||
| @ -541,7 +545,7 @@ ParseParameterList ( | ||||
|   //
 | ||||
|   Status = ShellCommandLineParseEx (mParamList, &Package, &ProblemParam, FALSE, FALSE); | ||||
|   if (EFI_ERROR (Status)) { | ||||
|     if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) { | ||||
|     if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam != NULL)) { | ||||
|       ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_GEN_PROBLEM), mPrmInfoHiiHandle, APPLICATION_NAME, ProblemParam); | ||||
|       ReturnStatus = EFI_INVALID_PARAMETER; | ||||
|       FreePool (ProblemParam); | ||||
| @ -564,7 +568,9 @@ ParseParameterList ( | ||||
|        ArgumentCount = 0, TempNode = Package; | ||||
|        GetNextNode (Package, TempNode) != Package; | ||||
|        ArgumentCount++, TempNode = GetNextNode (Package, TempNode) | ||||
|     ); | ||||
|        ) | ||||
|   { | ||||
|   } | ||||
| 
 | ||||
|   if (ArgumentCount == 1) { | ||||
|     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_NO_ARG), mPrmInfoHiiHandle, APPLICATION_NAME); | ||||
| @ -635,6 +641,7 @@ ParseParameterList ( | ||||
|     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_HANDLERS_FOUND), mPrmInfoHiiHandle, mPrmHandlerCount); | ||||
|     ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_PRMINFO_LINE_BREAK), mPrmInfoHiiHandle); | ||||
|   } | ||||
| 
 | ||||
|   GatherPrmHandlerInfo (PrintHandlerInfo); | ||||
| 
 | ||||
|   if (HandlerGuidStr != NULL) { | ||||
|  | ||||
| @ -98,8 +98,7 @@ typedef struct { | ||||
| // 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.
 | ||||
|   ///
 | ||||
|  | ||||
| @ -67,6 +67,7 @@ typedef struct { | ||||
|         PRM_STRING_(Name)                     \ | ||||
|       }                                       \ | ||||
| 
 | ||||
| 
 | ||||
| /**
 | ||||
|   A macro that returns the count of the number of variable-length arguments given. | ||||
| 
 | ||||
|  | ||||
| @ -22,8 +22,7 @@ typedef struct _PRM_CONFIG_PROTOCOL PRM_CONFIG_PROTOCOL; | ||||
| #define PRM_CONFIG_PROTOCOL_SIGNATURE  SIGNATURE_32('P','M','C','P') | ||||
| #define PRM_CONFIG_PROTOCOL_VERSION    1 | ||||
| 
 | ||||
| struct _PRM_CONFIG_PROTOCOL | ||||
| { | ||||
| struct _PRM_CONFIG_PROTOCOL { | ||||
|   PRM_MODULE_CONTEXT_BUFFERS    ModuleContextBuffers; | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -42,7 +42,7 @@ FindContextBufferInModuleBuffers ( | ||||
| 
 | ||||
|   DEBUG ((DEBUG_INFO, "    %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|   if (HandlerGuid == NULL || ModuleContextBuffers == NULL || ContextBuffer == NULL) { | ||||
|   if ((HandlerGuid == NULL) || (ModuleContextBuffers == NULL) || (ContextBuffer == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -91,9 +91,10 @@ GetModuleContextBuffers ( | ||||
| 
 | ||||
|   DEBUG ((DEBUG_INFO, "    %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|   if (Guid == NULL || PrmModuleContextBuffers == NULL) { | ||||
|   if ((Guid == NULL) || (PrmModuleContextBuffers == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   *PrmModuleContextBuffers = NULL; | ||||
| 
 | ||||
|   Status = gBS->LocateHandleBuffer ( | ||||
| @ -111,7 +112,7 @@ GetModuleContextBuffers ( | ||||
|                       (VOID **)&PrmConfigProtocol | ||||
|                       ); | ||||
|       ASSERT_EFI_ERROR (Status); | ||||
|       if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) { | ||||
|       if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) { | ||||
|         continue; | ||||
|       } | ||||
| 
 | ||||
| @ -177,9 +178,10 @@ GetContextBuffer ( | ||||
| 
 | ||||
|   DEBUG ((DEBUG_INFO, "    %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|   if (PrmHandlerGuid == NULL || PrmContextBuffer == NULL) { | ||||
|   if ((PrmHandlerGuid == NULL) || (PrmContextBuffer == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   *PrmContextBuffer = NULL; | ||||
| 
 | ||||
|   if (PrmModuleContextBuffers == NULL) { | ||||
| @ -190,6 +192,7 @@ GetContextBuffer ( | ||||
|   } else { | ||||
|     ContextBuffers = PrmModuleContextBuffers; | ||||
|   } | ||||
| 
 | ||||
|   Status = FindContextBufferInModuleBuffers (PrmHandlerGuid, ContextBuffers, PrmContextBuffer); | ||||
| 
 | ||||
|   return Status; | ||||
|  | ||||
| @ -145,7 +145,6 @@ PRM_MODULE_CONTEXT_BUFFERS mTestPrmModuleContextBuffers3 = { | ||||
|   NULL | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| // *----------------------------------------------------------------------------------*
 | ||||
| // * Test Contexts                                                                    *
 | ||||
| // *----------------------------------------------------------------------------------*
 | ||||
| @ -496,7 +495,9 @@ VerifyGetContextBuffer ( | ||||
|   @retval other           Some error occurred when executing this entry point. | ||||
| 
 | ||||
| **/ | ||||
| int main () | ||||
| int | ||||
| main ( | ||||
|   ) | ||||
| { | ||||
|   EFI_STATUS                  Status; | ||||
|   UINTN                       Index; | ||||
| @ -640,8 +641,7 @@ int main () | ||||
|   Status = RunAllTestSuites (Framework); | ||||
| 
 | ||||
| EXIT: | ||||
|   if (Framework) | ||||
|   { | ||||
|   if (Framework) { | ||||
|     FreeUnitTestFramework (Framework); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -59,7 +59,7 @@ GetNextPrmModuleEntry ( | ||||
|   } else { | ||||
|     CurrentListEntry = NULL; | ||||
|     CurrentListEntry = CR (*ModuleImageContext, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY, Context, PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE); | ||||
|     if (CurrentListEntry == NULL || CurrentListEntry->Signature != PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE) { | ||||
|     if ((CurrentListEntry == NULL) || (CurrentListEntry->Signature != PRM_MODULE_IMAGE_CONTEXT_LIST_ENTRY_SIGNATURE)) { | ||||
|       return EFI_INVALID_PARAMETER; | ||||
|     } | ||||
| 
 | ||||
| @ -100,6 +100,7 @@ CreateNewPrmModuleImageContextListEntry ( | ||||
|   if (PrmModuleImageContextListEntry == NULL) { | ||||
|     return NULL; | ||||
|   } | ||||
| 
 | ||||
|   DEBUG (( | ||||
|     DEBUG_INFO, | ||||
|     "  %a %a: Allocated PrmModuleImageContextListEntry at 0x%x of size 0x%x bytes.\n", | ||||
| @ -249,7 +250,7 @@ DiscoverPrmModules ( | ||||
|     TempPrmModuleImageContext.PeCoffImageContext.ImageRead = PeCoffLoaderImageReadFromMemory; | ||||
| 
 | ||||
|     Status = PeCoffLoaderGetImageInfo (&TempPrmModuleImageContext.PeCoffImageContext); | ||||
|     if (EFI_ERROR (Status) || TempPrmModuleImageContext.PeCoffImageContext.ImageError != IMAGE_ERROR_SUCCESS) { | ||||
|     if (EFI_ERROR (Status) || (TempPrmModuleImageContext.PeCoffImageContext.ImageError != IMAGE_ERROR_SUCCESS)) { | ||||
|       DEBUG (( | ||||
|         DEBUG_WARN, | ||||
|         "%a %a: ImageHandle 0x%016lx is not a valid PE/COFF image. It cannot be considered a PRM module.\n", | ||||
| @ -259,6 +260,7 @@ DiscoverPrmModules ( | ||||
|         )); | ||||
|       continue; | ||||
|     } | ||||
| 
 | ||||
|     if (TempPrmModuleImageContext.PeCoffImageContext.IsTeImage) { | ||||
|       // A PRM Module is not allowed to be a TE image
 | ||||
|       continue; | ||||
| @ -280,9 +282,10 @@ DiscoverPrmModules ( | ||||
|                &TempPrmModuleImageContext.PeCoffImageContext, | ||||
|                &TempPrmModuleImageContext.ExportDescriptor | ||||
|                ); | ||||
|     if (EFI_ERROR (Status) || TempPrmModuleImageContext.ExportDescriptor == NULL) { | ||||
|     if (EFI_ERROR (Status) || (TempPrmModuleImageContext.ExportDescriptor == NULL)) { | ||||
|       continue; | ||||
|     } | ||||
| 
 | ||||
|     // A PRM Module Export Descriptor was successfully found, this is considered a PRM Module.
 | ||||
| 
 | ||||
|     //
 | ||||
| @ -292,6 +295,7 @@ DiscoverPrmModules ( | ||||
|     if (PrmModuleImageContextListEntry == NULL) { | ||||
|       return EFI_OUT_OF_RESOURCES; | ||||
|     } | ||||
| 
 | ||||
|     CopyMem ( | ||||
|       &PrmModuleImageContextListEntry->Context, | ||||
|       &TempPrmModuleImageContext, | ||||
| @ -306,6 +310,7 @@ DiscoverPrmModules ( | ||||
|   if (HandlerCount != NULL) { | ||||
|     *HandlerCount = PrmHandlerCount; | ||||
|   } | ||||
| 
 | ||||
|   if (ModuleCount != NULL) { | ||||
|     *ModuleCount = PrmModuleCount; | ||||
|   } | ||||
|  | ||||
| @ -131,7 +131,9 @@ PrmModuleImageContextListEntryImageContextShouldBeZeroed ( | ||||
|   @retval other           Some error occurred when executing this entry point. | ||||
| 
 | ||||
| **/ | ||||
| int main () | ||||
| int | ||||
| main ( | ||||
|   ) | ||||
| { | ||||
|   EFI_STATUS                  Status; | ||||
|   UNIT_TEST_FRAMEWORK_HANDLE  Framework; | ||||
| @ -200,8 +202,7 @@ int main () | ||||
|   Status = RunAllTestSuites (Framework); | ||||
| 
 | ||||
| EXIT: | ||||
|   if (Framework) | ||||
|   { | ||||
|   if (Framework) { | ||||
|     FreeUnitTestFramework (Framework); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -53,10 +53,11 @@ GetPrmModuleExportDescriptorTable ( | ||||
| 
 | ||||
|   DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|   if (ImageExportDirectory == NULL || | ||||
|       PeCoffLoaderImageContext == NULL || | ||||
|       PeCoffLoaderImageContext->ImageAddress == 0 || | ||||
|       ExportDescriptor == NULL) { | ||||
|   if ((ImageExportDirectory == NULL) || | ||||
|       (PeCoffLoaderImageContext == NULL) || | ||||
|       (PeCoffLoaderImageContext->ImageAddress == 0) || | ||||
|       (ExportDescriptor == NULL)) | ||||
|   { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -93,7 +94,8 @@ GetPrmModuleExportDescriptorTable ( | ||||
|           PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME), | ||||
|           CurrentExportName, | ||||
|           AsciiStrLen (PRM_STRING (PRM_MODULE_EXPORT_DESCRIPTOR_NAME)) | ||||
|         ) == 0) { | ||||
|           ) == 0) | ||||
|     { | ||||
|       PrmModuleExportDescriptorOrdinal = OrdinalTable[Index]; | ||||
|       DEBUG (( | ||||
|         DEBUG_INFO, | ||||
| @ -106,6 +108,7 @@ GetPrmModuleExportDescriptorTable ( | ||||
|         DEBUG ((DEBUG_ERROR, "%a %a: The PRM Module Export Descriptor ordinal value is invalid.\n", _DBGMSGID_, __FUNCTION__)); | ||||
|         return EFI_NOT_FOUND; | ||||
|       } | ||||
| 
 | ||||
|       TempExportDescriptor = (PRM_MODULE_EXPORT_DESCRIPTOR_STRUCT *)((UINTN)CurrentImageAddress + ExportAddressTable[PrmModuleExportDescriptorOrdinal]); | ||||
|       if (TempExportDescriptor->Header.Signature == PRM_MODULE_EXPORT_DESCRIPTOR_SIGNATURE) { | ||||
|         *ExportDescriptor = TempExportDescriptor; | ||||
| @ -119,6 +122,7 @@ GetPrmModuleExportDescriptorTable ( | ||||
|           (UINTN)TempExportDescriptor | ||||
|           )); | ||||
|       } | ||||
| 
 | ||||
|       DEBUG ((DEBUG_INFO, "  %a %a: Exiting export iteration since export descriptor found.\n", _DBGMSGID_, __FUNCTION__)); | ||||
|       return EFI_SUCCESS; | ||||
|     } | ||||
| @ -156,7 +160,7 @@ GetExportDirectoryInPeCoffImage ( | ||||
|   EFI_IMAGE_DATA_DIRECTORY             *DirectoryEntry; | ||||
|   EFI_IMAGE_EXPORT_DIRECTORY           *ExportDirectory; | ||||
| 
 | ||||
|   if (Image == NULL || PeCoffLoaderImageContext == NULL || ImageExportDirectory == NULL) { | ||||
|   if ((Image == NULL) || (PeCoffLoaderImageContext == NULL) || (ImageExportDirectory == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -224,7 +228,7 @@ GetExportDirectoryInPeCoffImage ( | ||||
|     return EFI_UNSUPPORTED; | ||||
|   } | ||||
| 
 | ||||
|   if (NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_EXPORT || DirectoryEntry->VirtualAddress == 0) { | ||||
|   if ((NumberOfRvaAndSizes <= EFI_IMAGE_DIRECTORY_ENTRY_EXPORT) || (DirectoryEntry->VirtualAddress == 0)) { | ||||
|     //
 | ||||
|     // The export directory is not present
 | ||||
|     //
 | ||||
| @ -250,6 +254,7 @@ GetExportDirectoryInPeCoffImage ( | ||||
|       (CHAR8 *)((UINTN)Image + ExportDirectory->Name) | ||||
|       )); | ||||
|   } | ||||
| 
 | ||||
|   *ImageExportDirectory = ExportDirectory; | ||||
| 
 | ||||
|   return EFI_SUCCESS; | ||||
| @ -284,7 +289,7 @@ GetImageVersionInPeCoffImage ( | ||||
| 
 | ||||
|   DEBUG ((DEBUG_INFO, "    %a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|   if (Image == NULL || PeCoffLoaderImageContext == NULL || ImageMajorVersion == NULL || ImageMinorVersion == NULL) { | ||||
|   if ((Image == NULL) || (PeCoffLoaderImageContext == NULL) || (ImageMajorVersion == NULL) || (ImageMinorVersion == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -381,9 +386,10 @@ GetExportEntryAddress ( | ||||
|   UINT16       *OrdinalTable; | ||||
|   CONST CHAR8  *ExportNameTablePointerName; | ||||
| 
 | ||||
|   if (ExportName == NULL || ImageBaseAddress == 0 || ImageExportDirectory == NULL || ExportPhysicalAddress == NULL) { | ||||
|   if ((ExportName == NULL) || (ImageBaseAddress == 0) || (ImageExportDirectory == NULL) || (ExportPhysicalAddress == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   *ExportPhysicalAddress = 0; | ||||
| 
 | ||||
|   ExportAddressTable     = (UINT32 *)((UINTN)ImageBaseAddress + ImageExportDirectory->AddressOfFunctions); | ||||
|  | ||||
| @ -42,7 +42,7 @@ ConvertRuntimeMemoryRangeAddresses ( | ||||
| { | ||||
|   UINTN  Index; | ||||
| 
 | ||||
|   if (RuntimeMmioRanges == NULL || RuntimeMmioRanges->Count == 0) { | ||||
|   if ((RuntimeMmioRanges == NULL) || (RuntimeMmioRanges->Count == 0)) { | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
| @ -73,13 +73,18 @@ SetRuntimeMemoryRangeAttributes ( | ||||
| 
 | ||||
|   DEBUG ((DEBUG_INFO, "%a %a - Entry.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|   if (RuntimeMmioRanges == NULL || RuntimeMmioRanges->Count == 0) { | ||||
|   if ((RuntimeMmioRanges == NULL) || (RuntimeMmioRanges->Count == 0)) { | ||||
|     return; | ||||
|   } | ||||
| 
 | ||||
|   for (Index = 0; Index < (UINTN)RuntimeMmioRanges->Count; Index++) { | ||||
|     DEBUG (( | ||||
|       DEBUG_INFO, "      %a %a: Runtime MMIO Range [%d].\n", _DBGMSGID_, __FUNCTION__, Index)); | ||||
|       DEBUG_INFO, | ||||
|       "      %a %a: Runtime MMIO Range [%d].\n", | ||||
|       _DBGMSGID_, | ||||
|       __FUNCTION__, | ||||
|       Index | ||||
|       )); | ||||
|     DEBUG (( | ||||
|       DEBUG_INFO, | ||||
|       "      %a %a: Physical address = 0x%016x. Length = 0x%x.\n", | ||||
| @ -97,17 +102,18 @@ SetRuntimeMemoryRangeAttributes ( | ||||
|     Status  = gDS->GetMemorySpaceDescriptor (RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, &Descriptor); | ||||
|     if (!EFI_ERROR (Status) && | ||||
|         ( | ||||
|         (Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo && Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved) || | ||||
|          ((Descriptor.GcdMemoryType != EfiGcdMemoryTypeMemoryMappedIo) && (Descriptor.GcdMemoryType != EfiGcdMemoryTypeReserved)) || | ||||
|          ((Descriptor.Length & EFI_PAGE_MASK) != 0) | ||||
|         ) | ||||
|       ) { | ||||
|         ) | ||||
|     { | ||||
|       Status2 =  gDS->RemoveMemorySpace ( | ||||
|                         RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, | ||||
|                         Descriptor.Length | ||||
|                         ); | ||||
|     } | ||||
| 
 | ||||
|     if (Status == EFI_NOT_FOUND || !EFI_ERROR (Status2)) { | ||||
|     if ((Status == EFI_NOT_FOUND) || !EFI_ERROR (Status2)) { | ||||
|       Status = gDS->AddMemorySpace ( | ||||
|                       EfiGcdMemoryTypeMemoryMappedIo, | ||||
|                       RuntimeMmioRanges->Range[Index].PhysicalBaseAddress, | ||||
| @ -141,6 +147,7 @@ SetRuntimeMemoryRangeAttributes ( | ||||
|         )); | ||||
|       continue; | ||||
|     } | ||||
| 
 | ||||
|     if ((Descriptor.Attributes & EFI_MEMORY_RUNTIME) != 0) { | ||||
|       continue; | ||||
|     } | ||||
| @ -187,7 +194,7 @@ StoreVirtualMemoryAddressChangePointers ( | ||||
|   RangeIndex = 0; | ||||
| 
 | ||||
|   mRuntimeMmioRanges = AllocateRuntimeZeroPool (sizeof (*mRuntimeMmioRanges) * mMaxRuntimeMmioRangeCount); | ||||
|   if (mRuntimeMmioRanges == NULL && mMaxRuntimeMmioRangeCount > 0) { | ||||
|   if ((mRuntimeMmioRanges == NULL) && (mMaxRuntimeMmioRangeCount > 0)) { | ||||
|     DEBUG (( | ||||
|       DEBUG_ERROR, | ||||
|       "  %a %a: Memory allocation for runtime MMIO pointer array failed.\n", | ||||
| @ -214,7 +221,7 @@ StoreVirtualMemoryAddressChangePointers ( | ||||
|                       (VOID **)&PrmConfigProtocol | ||||
|                       ); | ||||
|       ASSERT_EFI_ERROR (Status); | ||||
|       if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) { | ||||
|       if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) { | ||||
|         continue; | ||||
|       } | ||||
| 
 | ||||
| @ -232,9 +239,11 @@ StoreVirtualMemoryAddressChangePointers ( | ||||
|           ASSERT_EFI_ERROR (Status); | ||||
|           return; | ||||
|         } | ||||
| 
 | ||||
|         mRuntimeMmioRanges[RangeIndex++] = PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges; | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     DEBUG (( | ||||
|       DEBUG_INFO, | ||||
|       "  %a %a: %d MMIO ranges buffers saved for future virtual memory conversion.\n", | ||||
| @ -271,6 +280,7 @@ ValidatePrmDataBuffer ( | ||||
|     DEBUG ((DEBUG_ERROR, "  %a %a: The PRM data buffer signature is invalid. PRM module.\n", _DBGMSGID_, __FUNCTION__)); | ||||
|     return EFI_NOT_FOUND; | ||||
|   } | ||||
| 
 | ||||
|   if (PrmDataBuffer->Header.Length < sizeof (PRM_DATA_BUFFER_HEADER)) { | ||||
|     DEBUG ((DEBUG_ERROR, "  %a %a: The PRM data buffer length is invalid.\n", _DBGMSGID_, __FUNCTION__)); | ||||
|     return EFI_BUFFER_TOO_SMALL; | ||||
| @ -310,7 +320,7 @@ ValidatePrmContextBuffer ( | ||||
|     return EFI_NOT_FOUND; | ||||
|   } | ||||
| 
 | ||||
|   if (PrmContextBuffer->StaticDataBuffer != NULL && EFI_ERROR (ValidatePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) { | ||||
|   if ((PrmContextBuffer->StaticDataBuffer != NULL) && EFI_ERROR (ValidatePrmDataBuffer (PrmContextBuffer->StaticDataBuffer))) { | ||||
|     DEBUG (( | ||||
|       DEBUG_ERROR, | ||||
|       "    %a %a: Error in static buffer for PRM handler %g.\n", | ||||
| @ -395,7 +405,7 @@ PrmConfigEndOfDxeNotification ( | ||||
|                       (VOID **)&PrmConfigProtocol | ||||
|                       ); | ||||
|       ASSERT_EFI_ERROR (Status); | ||||
|       if (EFI_ERROR (Status) || PrmConfigProtocol == NULL) { | ||||
|       if (EFI_ERROR (Status) || (PrmConfigProtocol == NULL)) { | ||||
|         continue; | ||||
|       } | ||||
| 
 | ||||
| @ -422,6 +432,7 @@ PrmConfigEndOfDxeNotification ( | ||||
|             )); | ||||
|         } | ||||
|       } | ||||
| 
 | ||||
|       DEBUG ((DEBUG_INFO, "      %a %a: Module context buffer validation complete.\n", _DBGMSGID_, __FUNCTION__)); | ||||
| 
 | ||||
|       if (PrmConfigProtocol->ModuleContextBuffers.RuntimeMmioRanges != NULL) { | ||||
| @ -443,6 +454,7 @@ PrmConfigEndOfDxeNotification ( | ||||
|   if (HandleBuffer != NULL) { | ||||
|     gBS->FreePool (HandleBuffer); | ||||
|   } | ||||
| 
 | ||||
|   gBS->CloseEvent (Event); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -78,6 +78,7 @@ ProcessPrmModules ( | ||||
|   if (PrmAcpiDescriptionTable == NULL) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   *PrmAcpiDescriptionTable = NULL; | ||||
| 
 | ||||
|   //
 | ||||
| @ -127,8 +128,8 @@ ProcessPrmModules ( | ||||
|   for ( | ||||
|        CurrentPrmModuleImageContext = NULL, Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext); | ||||
|        !EFI_ERROR (Status); | ||||
|     Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) { | ||||
| 
 | ||||
|        Status = GetNextPrmModuleEntry (&CurrentPrmModuleImageContext)) | ||||
|   { | ||||
|     CurrentImageAddress               = CurrentPrmModuleImageContext->PeCoffImageContext.ImageAddress; | ||||
|     CurrentImageExportDirectory       = CurrentPrmModuleImageContext->ExportDirectory; | ||||
|     CurrentExportDescriptorStruct     = CurrentPrmModuleImageContext->ExportDescriptor; | ||||
| @ -169,7 +170,7 @@ ProcessPrmModules ( | ||||
|                (CONST PRM_MODULE_CONTEXT_BUFFERS **)&CurrentModuleContextBuffers | ||||
|                ); | ||||
|     ASSERT (!EFI_ERROR (Status) || Status == EFI_NOT_FOUND); | ||||
|     if (!EFI_ERROR (Status) && CurrentModuleContextBuffers != NULL) { | ||||
|     if (!EFI_ERROR (Status) && (CurrentModuleContextBuffers != NULL)) { | ||||
|       CurrentModuleInfoStruct->RuntimeMmioRanges = (UINT64)(UINTN)CurrentModuleContextBuffers->RuntimeMmioRanges; | ||||
|       CurrentModuleAcpiParamDescriptors          = CurrentModuleContextBuffers->AcpiParameterBufferDescriptors; | ||||
|     } | ||||
| @ -230,8 +231,10 @@ ProcessPrmModules ( | ||||
|         } | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     CurrentModuleInfoStruct = (PRM_MODULE_INFORMATION_STRUCT *)((UINTN)CurrentModuleInfoStruct + CurrentModuleInfoStruct->StructureLength); | ||||
|   } | ||||
| 
 | ||||
|   *PrmAcpiDescriptionTable = PrmAcpiTable; | ||||
| 
 | ||||
|   return EFI_SUCCESS; | ||||
| @ -259,7 +262,7 @@ PublishPrmAcpiTable ( | ||||
|   EFI_ACPI_TABLE_PROTOCOL  *AcpiTableProtocol; | ||||
|   UINTN                    TableKey; | ||||
| 
 | ||||
|   if (PrmAcpiDescriptionTable == NULL || PrmAcpiDescriptionTable->Header.Signature != PRM_TABLE_SIGNATURE) { | ||||
|   if ((PrmAcpiDescriptionTable == NULL) || (PrmAcpiDescriptionTable->Header.Signature != PRM_TABLE_SIGNATURE)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -279,6 +282,7 @@ PublishPrmAcpiTable ( | ||||
|       DEBUG ((DEBUG_INFO, "%a %a: The PRMT ACPI table was installed successfully.\n", _DBGMSGID_, __FUNCTION__)); | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   ASSERT_EFI_ERROR (Status); | ||||
| 
 | ||||
|   return Status; | ||||
| @ -326,6 +330,7 @@ PrmLoaderEndOfDxeNotification ( | ||||
|   if (PrmAcpiDescriptionTable != NULL) { | ||||
|     FreePool (PrmAcpiDescriptionTable); | ||||
|   } | ||||
| 
 | ||||
|   gBS->CloseEvent (Event); | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -17,10 +17,14 @@ | ||||
| STATIC EFI_HANDLE  mPrmConfigProtocolHandle; | ||||
| 
 | ||||
| // {dc2a58a6-5927-4776-b995-d118a27335a2}
 | ||||
| STATIC CONST EFI_GUID mPrmModuleGuid = {0xdc2a58a6, 0x5927, 0x4776, {0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2}}; | ||||
| STATIC CONST EFI_GUID  mPrmModuleGuid = { | ||||
|   0xdc2a58a6, 0x5927, 0x4776, { 0xb9, 0x95, 0xd1, 0x18, 0xa2, 0x73, 0x35, 0xa2 } | ||||
| }; | ||||
| 
 | ||||
| // {2e4f2d13-6240-4ed0-a401-c723fbdc34e8}
 | ||||
| STATIC CONST EFI_GUID mCheckParamBufferPrmHandlerGuid = {0x2e4f2d13, 0x6240, 0x4ed0, {0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8}}; | ||||
| STATIC CONST EFI_GUID  mCheckParamBufferPrmHandlerGuid = { | ||||
|   0x2e4f2d13, 0x6240, 0x4ed0, { 0xa4, 0x01, 0xc7, 0x23, 0xfb, 0xdc, 0x34, 0xe8 } | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|   Constructor of the PRM configuration library. | ||||
| @ -82,6 +86,7 @@ AcpiParameterBufferModuleConfigLibConstructor ( | ||||
|     Status = EFI_OUT_OF_RESOURCES; | ||||
|     goto Done; | ||||
|   } | ||||
| 
 | ||||
|   CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid); | ||||
| 
 | ||||
|   // Populate the ACPI Parameter Buffer Descriptor structure
 | ||||
| @ -108,9 +113,11 @@ Done: | ||||
|     if (AcpiParameterBuffer != NULL) { | ||||
|       FreePool (AcpiParameterBuffer); | ||||
|     } | ||||
| 
 | ||||
|     if (AcpiParamBufferDescriptor != NULL) { | ||||
|       FreePool (AcpiParamBufferDescriptor); | ||||
|     } | ||||
| 
 | ||||
|     if (PrmConfigProtocol != NULL) { | ||||
|       FreePool (PrmConfigProtocol); | ||||
|     } | ||||
|  | ||||
| @ -39,8 +39,7 @@ | ||||
|   @retval Others                  An error occurred in the PRM handler. | ||||
| 
 | ||||
| **/ | ||||
| PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) | ||||
| { | ||||
| PRM_HANDLER_EXPORT (CheckParamBufferPrmHandler) { | ||||
|   if (ParameterBuffer == NULL) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
|  | ||||
| @ -21,10 +21,14 @@ | ||||
| STATIC EFI_HANDLE  mPrmConfigProtocolHandle; | ||||
| 
 | ||||
| // {5a6cf42b-8bb4-472c-a233-5c4dc4033dc7}
 | ||||
| STATIC CONST EFI_GUID mPrmModuleGuid = {0x5a6cf42b, 0x8bb4, 0x472c, {0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7}}; | ||||
| STATIC CONST EFI_GUID  mPrmModuleGuid = { | ||||
|   0x5a6cf42b, 0x8bb4, 0x472c, { 0xa2, 0x33, 0x5c, 0x4d, 0xc4, 0x03, 0x3d, 0xc7 } | ||||
| }; | ||||
| 
 | ||||
| // {e1466081-7562-430f-896b-b0e523dc335a}
 | ||||
| STATIC CONST EFI_GUID mCheckStaticDataBufferPrmHandlerGuid = {0xe1466081, 0x7562, 0x430f, {0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a}}; | ||||
| STATIC CONST EFI_GUID  mCheckStaticDataBufferPrmHandlerGuid = { | ||||
|   0xe1466081, 0x7562, 0x430f, { 0x89, 0x6b, 0xb0, 0xe5, 0x23, 0xdc, 0x33, 0x5a } | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|   Populates the static data buffer for this PRM module. | ||||
| @ -80,6 +84,7 @@ GetStaticDataBuffer ( | ||||
|   if (StaticDataBuffer == NULL) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|   *StaticDataBuffer = NULL; | ||||
| 
 | ||||
|   //
 | ||||
| @ -144,7 +149,7 @@ ContextBufferModuleConfigLibConstructor ( | ||||
|   //
 | ||||
|   Status = GetStaticDataBuffer (&StaticDataBuffer); | ||||
|   ASSERT_EFI_ERROR (Status); | ||||
|   if (EFI_ERROR (Status) || StaticDataBuffer == NULL) { | ||||
|   if (EFI_ERROR (Status) || (StaticDataBuffer == NULL)) { | ||||
|     goto Done; | ||||
|   } | ||||
| 
 | ||||
| @ -166,6 +171,7 @@ ContextBufferModuleConfigLibConstructor ( | ||||
|     Status = EFI_OUT_OF_RESOURCES; | ||||
|     goto Done; | ||||
|   } | ||||
| 
 | ||||
|   CopyGuid (&PrmContextBuffer->HandlerGuid, &mCheckStaticDataBufferPrmHandlerGuid); | ||||
|   PrmContextBuffer->Signature        = PRM_CONTEXT_BUFFER_SIGNATURE; | ||||
|   PrmContextBuffer->Version          = PRM_CONTEXT_BUFFER_INTERFACE_VERSION; | ||||
| @ -177,6 +183,7 @@ ContextBufferModuleConfigLibConstructor ( | ||||
|     Status = EFI_OUT_OF_RESOURCES; | ||||
|     goto Done; | ||||
|   } | ||||
| 
 | ||||
|   CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid); | ||||
|   PrmConfigProtocol->ModuleContextBuffers.BufferCount = 1; | ||||
|   PrmConfigProtocol->ModuleContextBuffers.Buffer      = PrmContextBuffer; | ||||
| @ -197,9 +204,11 @@ Done: | ||||
|     if (StaticDataBuffer != NULL) { | ||||
|       FreePool (StaticDataBuffer); | ||||
|     } | ||||
| 
 | ||||
|     if (PrmContextBuffer != NULL) { | ||||
|       FreePool (PrmContextBuffer); | ||||
|     } | ||||
| 
 | ||||
|     if (PrmConfigProtocol != NULL) { | ||||
|       FreePool (PrmConfigProtocol); | ||||
|     } | ||||
|  | ||||
| @ -35,8 +35,7 @@ | ||||
|   @retval Others                  An error occurred in the PRM handler. | ||||
| 
 | ||||
| **/ | ||||
| PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) | ||||
| { | ||||
| PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) { | ||||
|   if (ContextBuffer == NULL) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| @ -49,8 +48,9 @@ PRM_HANDLER_EXPORT (CheckStaticDataBufferPrmHandler) | ||||
|   // Verify PRM data buffer signature is valid
 | ||||
|   //
 | ||||
|   if ( | ||||
|     ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE || | ||||
|     ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE) { | ||||
|       (ContextBuffer->Signature != PRM_CONTEXT_BUFFER_SIGNATURE) || | ||||
|       (ContextBuffer->StaticDataBuffer->Header.Signature != PRM_DATA_BUFFER_HEADER_SIGNATURE)) | ||||
|   { | ||||
|     return EFI_NOT_FOUND; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -18,7 +18,9 @@ | ||||
| STATIC EFI_HANDLE  mPrmConfigProtocolHandle; | ||||
| 
 | ||||
| // {0ef93ed7-14ae-425b-928f-b85a6213b57e}
 | ||||
| STATIC CONST EFI_GUID mPrmModuleGuid = {0x0ef93ed7, 0x14ae, 0x425b, {0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e}}; | ||||
| STATIC CONST EFI_GUID  mPrmModuleGuid = { | ||||
|   0x0ef93ed7, 0x14ae, 0x425b, { 0x92, 0x8f, 0xb8, 0x5a, 0x62, 0x13, 0xb5, 0x7e } | ||||
| }; | ||||
| 
 | ||||
| /**
 | ||||
|   Constructor of the PRM configuration library. | ||||
| @ -70,6 +72,7 @@ HardwareAccessModuleConfigLibConstructor ( | ||||
|     Status = EFI_OUT_OF_RESOURCES; | ||||
|     goto Done; | ||||
|   } | ||||
| 
 | ||||
|   CopyGuid (&PrmConfigProtocol->ModuleContextBuffers.ModuleGuid, &mPrmModuleGuid); | ||||
| 
 | ||||
|   // Populate the Runtime MMIO Ranges structure
 | ||||
| @ -95,6 +98,7 @@ Done: | ||||
|     if (RuntimeMmioRanges != NULL) { | ||||
|       FreePool (RuntimeMmioRanges); | ||||
|     } | ||||
| 
 | ||||
|     if (PrmConfigProtocol != NULL) { | ||||
|       FreePool (PrmConfigProtocol); | ||||
|     } | ||||
|  | ||||
| @ -158,12 +158,18 @@ AccessAllMtrrs ( | ||||
|   RangeCount            = 1; | ||||
| 
 | ||||
|   MtrrLibGetRawVariableRanges ( | ||||
|     &Mtrrs->Variables, VariableMtrrCount, | ||||
|     MtrrValidBitsMask, MtrrValidAddressMask, RawVariableRanges | ||||
|     &Mtrrs->Variables, | ||||
|     VariableMtrrCount, | ||||
|     MtrrValidBitsMask, | ||||
|     MtrrValidAddressMask, | ||||
|     RawVariableRanges | ||||
|     ); | ||||
|   MtrrLibApplyVariableMtrrs ( | ||||
|     RawVariableRanges, VariableMtrrCount, | ||||
|     Ranges, ARRAY_SIZE (Ranges), &RangeCount | ||||
|     RawVariableRanges, | ||||
|     VariableMtrrCount, | ||||
|     Ranges, | ||||
|     ARRAY_SIZE (Ranges), | ||||
|     &RangeCount | ||||
|     ); | ||||
| 
 | ||||
|   MtrrLibApplyFixedMtrrs (&Mtrrs->Fixed, Ranges, ARRAY_SIZE (Ranges), &RangeCount); | ||||
| @ -251,8 +257,7 @@ GetMicrocodeSignature ( | ||||
|   @retval Others                  An error occurred in the PRM handler. | ||||
| 
 | ||||
| **/ | ||||
| PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) | ||||
| { | ||||
| PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) { | ||||
|   UINT32  MicrocodeSignature; | ||||
| 
 | ||||
|   MicrocodeSignature = 0; | ||||
| @ -277,8 +282,7 @@ PRM_HANDLER_EXPORT (MsrAccessMicrocodeSignaturePrmHandler) | ||||
|   @retval Others                  An error occurred in the PRM handler. | ||||
| 
 | ||||
| **/ | ||||
| PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) | ||||
| { | ||||
| PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) { | ||||
|   AccessAllMtrrs (); | ||||
| 
 | ||||
|   return EFI_SUCCESS; | ||||
| @ -296,8 +300,7 @@ PRM_HANDLER_EXPORT (MsrAccessMtrrDumpPrmHandler) | ||||
|   @retval Others                  An error occurred in the PRM handler. | ||||
| 
 | ||||
| **/ | ||||
| PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) | ||||
| { | ||||
| PRM_HANDLER_EXPORT (MmioAccessHpetPrmHandler) { | ||||
|   AccessHpetConfiguration (); | ||||
| 
 | ||||
|   return EFI_SUCCESS; | ||||
|  | ||||
| @ -37,8 +37,6 @@ UnitTestRaiseTpl ( | ||||
|   IN EFI_TPL  NewTpl | ||||
|   ); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /**
 | ||||
|   Lowers the task priority to the previous value.   If the new | ||||
|   priority unmasks events at a higher priority, they are dispatched. | ||||
| @ -137,8 +135,6 @@ UnitTestGetMemoryMap ( | ||||
|   OUT UINT32                    *DescriptorVersion | ||||
|   ); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| /**
 | ||||
|   Allocate pool of a particular type. | ||||
| 
 | ||||
|  | ||||
| @ -188,7 +188,7 @@ UnitTestCalculateCrc32 ( | ||||
|   OUT UINT32  *Crc32 | ||||
|   ) | ||||
| { | ||||
|   if (Data == NULL || Crc32 == NULL || DataSize == 0) { | ||||
|   if ((Data == NULL) || (Crc32 == NULL) || (DataSize == 0)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -74,11 +74,10 @@ UnitTestFindProtocolEntry ( | ||||
|   ProtEntry = NULL; | ||||
|   for (Link = mProtocolDatabase.ForwardLink; | ||||
|        Link != &mProtocolDatabase; | ||||
|        Link = Link->ForwardLink) { | ||||
| 
 | ||||
|        Link = Link->ForwardLink) | ||||
|   { | ||||
|     Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE); | ||||
|     if (CompareGuid (&Item->ProtocolID, Protocol)) { | ||||
| 
 | ||||
|       //
 | ||||
|       // This is the protocol entry
 | ||||
|       //
 | ||||
| @ -145,17 +144,15 @@ UnitTestFindProtocolInterface ( | ||||
| 
 | ||||
|   ProtEntry = UnitTestFindProtocolEntry (Protocol, FALSE); | ||||
|   if (ProtEntry != NULL) { | ||||
| 
 | ||||
|     //
 | ||||
|     // Look at each protocol interface for any matches
 | ||||
|     //
 | ||||
|     for (Link = Handle->Protocols.ForwardLink; Link != &Handle->Protocols; Link = Link->ForwardLink) { | ||||
| 
 | ||||
|       //
 | ||||
|       // If this protocol interface matches, remove it
 | ||||
|       //
 | ||||
|       Prot = CR (Link, PROTOCOL_INTERFACE, Link, PROTOCOL_INTERFACE_SIGNATURE); | ||||
|       if (Prot->Interface == Interface && Prot->Protocol == ProtEntry) { | ||||
|       if ((Prot->Interface == Interface) && (Prot->Protocol == ProtEntry)) { | ||||
|         break; | ||||
|       } | ||||
| 
 | ||||
| @ -270,7 +267,6 @@ UnitTestGetNextLocateByRegisterNotify ( | ||||
|   return Handle; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| /**
 | ||||
|   Routine to get the next Handle, when you are searching for a given protocol. | ||||
| 
 | ||||
| @ -368,6 +364,7 @@ UnitTestDisconnectControllersUsingProtocolInterface ( | ||||
|         if (!EFI_ERROR (Status)) { | ||||
|           ItemFound = TRUE; | ||||
|         } | ||||
| 
 | ||||
|         break; | ||||
|       } | ||||
|     } | ||||
| @ -380,7 +377,8 @@ UnitTestDisconnectControllersUsingProtocolInterface ( | ||||
|     for (Link = Prot->OpenList.ForwardLink; Link != &Prot->OpenList;) { | ||||
|       OpenData = CR (Link, OPEN_PROTOCOL_DATA, Link, OPEN_PROTOCOL_DATA_SIGNATURE); | ||||
|       if ((OpenData->Attributes & | ||||
|           (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0) { | ||||
|            (EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL | EFI_OPEN_PROTOCOL_GET_PROTOCOL | EFI_OPEN_PROTOCOL_TEST_PROTOCOL)) != 0) | ||||
|       { | ||||
|         Link = RemoveEntryList (&OpenData->Link); | ||||
|         Prot->OpenListCount--; | ||||
|         FreePool (OpenData); | ||||
| @ -425,7 +423,6 @@ UnitTestRemoveInterfaceFromProtocol ( | ||||
| 
 | ||||
|   Prot = UnitTestFindProtocolInterface (Handle, Protocol, Interface); | ||||
|   if (Prot != NULL) { | ||||
| 
 | ||||
|     ProtEntry = Prot->Protocol; | ||||
| 
 | ||||
|     //
 | ||||
| @ -490,6 +487,7 @@ UnitTestGetProtocolInterface ( | ||||
|       return Prot; | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   return NULL; | ||||
| } | ||||
| 
 | ||||
| @ -529,7 +527,7 @@ UnitTestInstallProtocolInterfaceNotify ( | ||||
|   // returns EFI_INVALID_PARAMETER if InterfaceType is invalid.
 | ||||
|   // Also added check for invalid UserHandle and Protocol pointers.
 | ||||
|   //
 | ||||
|   if (UserHandle == NULL || Protocol == NULL) { | ||||
|   if ((UserHandle == NULL) || (Protocol == NULL)) { | ||||
|     return EFI_INVALID_PARAMETER; | ||||
|   } | ||||
| 
 | ||||
| @ -643,6 +641,7 @@ UnitTestInstallProtocolInterfaceNotify ( | ||||
|   if (Notify) { | ||||
|     UnitTestNotifyProtocolEntry (ProtEntry); | ||||
|   } | ||||
| 
 | ||||
|   Status = EFI_SUCCESS; | ||||
| 
 | ||||
| Done: | ||||
| @ -658,6 +657,7 @@ Done: | ||||
|     if (Prot != NULL) { | ||||
|       UnitTestFreePool (Prot); | ||||
|     } | ||||
| 
 | ||||
|     DEBUG ((DEBUG_ERROR, "InstallProtocolInterface: %g %p failed with %r\n", Protocol, Interface, Status)); | ||||
|   } | ||||
| 
 | ||||
| @ -952,6 +952,7 @@ UnitTestLocateHandle ( | ||||
|         Status = EFI_INVALID_PARAMETER; | ||||
|         break; | ||||
|       } | ||||
| 
 | ||||
|       GetNext = UnitTestGetNextLocateByRegisterNotify; | ||||
|       break; | ||||
| 
 | ||||
| @ -961,6 +962,7 @@ UnitTestLocateHandle ( | ||||
|         Status = EFI_INVALID_PARAMETER; | ||||
|         break; | ||||
|       } | ||||
| 
 | ||||
|       //
 | ||||
|       // Look up the protocol entry and set the head pointer
 | ||||
|       //
 | ||||
| @ -969,6 +971,7 @@ UnitTestLocateHandle ( | ||||
|         Status = EFI_NOT_FOUND; | ||||
|         break; | ||||
|       } | ||||
| 
 | ||||
|       Position.Position = &Position.ProtEntry->Protocols; | ||||
|       break; | ||||
| 
 | ||||
| @ -1023,7 +1026,7 @@ UnitTestLocateHandle ( | ||||
| 
 | ||||
|     *BufferSize = ResultSize; | ||||
| 
 | ||||
|     if (SearchType == ByRegisterNotify && !EFI_ERROR(Status)) { | ||||
|     if ((SearchType == ByRegisterNotify) && !EFI_ERROR (Status)) { | ||||
|       //
 | ||||
|       // If this is a search by register notify and a handle was
 | ||||
|       // returned, update the register notification position
 | ||||
| @ -1159,13 +1162,16 @@ UnitTestOpenProtocol ( | ||||
|       if (EFI_ERROR (Status)) { | ||||
|         return Status; | ||||
|       } | ||||
| 
 | ||||
|       Status =  UnitTestValidateHandle (ControllerHandle); | ||||
|       if (EFI_ERROR (Status)) { | ||||
|         return Status; | ||||
|       } | ||||
| 
 | ||||
|       if (UserHandle == ControllerHandle) { | ||||
|         return EFI_INVALID_PARAMETER; | ||||
|       } | ||||
| 
 | ||||
|       break; | ||||
|     case EFI_OPEN_PROTOCOL_BY_DRIVER: | ||||
|     case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE: | ||||
| @ -1173,16 +1179,19 @@ UnitTestOpenProtocol ( | ||||
|       if (EFI_ERROR (Status)) { | ||||
|         return Status; | ||||
|       } | ||||
| 
 | ||||
|       Status =  UnitTestValidateHandle (ControllerHandle); | ||||
|       if (EFI_ERROR (Status)) { | ||||
|         return Status; | ||||
|       } | ||||
| 
 | ||||
|       break; | ||||
|     case EFI_OPEN_PROTOCOL_EXCLUSIVE: | ||||
|       Status =  UnitTestValidateHandle (ImageHandle); | ||||
|       if (EFI_ERROR (Status)) { | ||||
|         return Status; | ||||
|       } | ||||
| 
 | ||||
|       break; | ||||
|     case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL: | ||||
|     case EFI_OPEN_PROTOCOL_GET_PROTOCOL: | ||||
| @ -1217,6 +1226,7 @@ UnitTestOpenProtocol ( | ||||
|         goto Done; | ||||
|       } | ||||
|     } | ||||
| 
 | ||||
|     if ((OpenData->Attributes & EFI_OPEN_PROTOCOL_EXCLUSIVE) != 0) { | ||||
|       Exclusive = TRUE; | ||||
|     } else if (ExactMatch) { | ||||
| @ -1239,6 +1249,7 @@ UnitTestOpenProtocol ( | ||||
|         Status = EFI_ACCESS_DENIED; | ||||
|         goto Done; | ||||
|       } | ||||
| 
 | ||||
|       break; | ||||
|     case EFI_OPEN_PROTOCOL_BY_DRIVER | EFI_OPEN_PROTOCOL_EXCLUSIVE: | ||||
|     case EFI_OPEN_PROTOCOL_EXCLUSIVE: | ||||
| @ -1246,6 +1257,7 @@ UnitTestOpenProtocol ( | ||||
|         Status = EFI_ACCESS_DENIED; | ||||
|         goto Done; | ||||
|       } | ||||
| 
 | ||||
|       if (ByDriver) { | ||||
|         do { | ||||
|           Disconnect = FALSE; | ||||
| @ -1264,6 +1276,7 @@ UnitTestOpenProtocol ( | ||||
|           } | ||||
|         } while (Disconnect); | ||||
|       } | ||||
| 
 | ||||
|       break; | ||||
|     case EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER: | ||||
|     case EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL: | ||||
| @ -1276,6 +1289,7 @@ UnitTestOpenProtocol ( | ||||
|     Status = EFI_SUCCESS; | ||||
|     goto Done; | ||||
|   } | ||||
| 
 | ||||
|   //
 | ||||
|   // Create new entry
 | ||||
|   //
 | ||||
| @ -1300,7 +1314,7 @@ Done: | ||||
|     // Keep Interface unmodified in case of any Error
 | ||||
|     // except EFI_ALREADY_STARTED and EFI_UNSUPPORTED.
 | ||||
|     //
 | ||||
|     if (!EFI_ERROR (Status) || Status == EFI_ALREADY_STARTED) { | ||||
|     if (!EFI_ERROR (Status) || (Status == EFI_ALREADY_STARTED)) { | ||||
|       //
 | ||||
|       // According to above logic, if 'Prot' is NULL, then the 'Status' must be
 | ||||
|       // EFI_UNSUPPORTED. Here the 'Status' is not EFI_UNSUPPORTED, so 'Prot'
 | ||||
| @ -1479,10 +1493,11 @@ UnitTestLocateHandleBuffer ( | ||||
|   //
 | ||||
|   // Add code to correctly handle expected errors from UnitTestLocateHandle().
 | ||||
|   //
 | ||||
|   if (EFI_ERROR (Status) && Status != EFI_BUFFER_TOO_SMALL) { | ||||
|   if (EFI_ERROR (Status) && (Status != EFI_BUFFER_TOO_SMALL)) { | ||||
|     if (Status != EFI_INVALID_PARAMETER) { | ||||
|       Status = EFI_NOT_FOUND; | ||||
|     } | ||||
| 
 | ||||
|     return Status; | ||||
|   } | ||||
| 
 | ||||
| @ -1609,6 +1624,7 @@ UnitTestUninstallMultipleProtocolInterfaces ( | ||||
|     //
 | ||||
|     Status = UnitTestUninstallProtocolInterface (Handle, Protocol, Interface); | ||||
|   } | ||||
| 
 | ||||
|   VA_END (Args); | ||||
| 
 | ||||
|   //
 | ||||
| @ -1625,6 +1641,7 @@ UnitTestUninstallMultipleProtocolInterfaces ( | ||||
|       Interface = VA_ARG (Args, VOID *); | ||||
|       UnitTestInstallProtocolInterface (&Handle, Protocol, EFI_NATIVE_INTERFACE, Interface); | ||||
|     } | ||||
| 
 | ||||
|     VA_END (Args); | ||||
|     Status = EFI_INVALID_PARAMETER; | ||||
|   } | ||||
|  | ||||
| @ -51,7 +51,6 @@ typedef struct { | ||||
|   LIST_ENTRY    Notify; | ||||
| } PROTOCOL_ENTRY; | ||||
| 
 | ||||
| 
 | ||||
| #define PROTOCOL_INTERFACE_SIGNATURE  SIGNATURE_32('p','i','f','c') | ||||
| 
 | ||||
| ///
 | ||||
| @ -73,7 +72,6 @@ typedef struct { | ||||
|   /// OPEN_PROTOCOL_DATA list
 | ||||
|   LIST_ENTRY        OpenList; | ||||
|   UINTN             OpenListCount; | ||||
| 
 | ||||
| } PROTOCOL_INTERFACE; | ||||
| 
 | ||||
| #define OPEN_PROTOCOL_DATA_SIGNATURE  SIGNATURE_32('p','o','d','l') | ||||
| @ -89,7 +87,6 @@ typedef struct { | ||||
|   UINT32        OpenCount; | ||||
| } OPEN_PROTOCOL_DATA; | ||||
| 
 | ||||
| 
 | ||||
| #define PROTOCOL_NOTIFY_SIGNATURE  SIGNATURE_32('p','r','t','n') | ||||
| 
 | ||||
| ///
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user