From 09f2af5c1d398b1dd5b52871d5215eb8e6947036 Mon Sep 17 00:00:00 2001 From: Ken Lautner Date: Tue, 19 Sep 2023 13:20:01 -0700 Subject: [PATCH] Fixed and cleaned up the testpoint stub for MM --- MinPlatformPkg/Include/Library/TestPointLib.h | 9 +- .../TestPointLib/MmTestPointCommunication.c | 52 ++--- .../TestPointStubDxe/TestPointStubDxeMm.c | 194 +++++++----------- 3 files changed, 90 insertions(+), 165 deletions(-) diff --git a/MinPlatformPkg/Include/Library/TestPointLib.h b/MinPlatformPkg/Include/Library/TestPointLib.h index de0a478c5d..f0680a0675 100644 --- a/MinPlatformPkg/Include/Library/TestPointLib.h +++ b/MinPlatformPkg/Include/Library/TestPointLib.h @@ -204,12 +204,9 @@ typedef struct { // On output, actual data buffer size copied. // UINT64 DataSize; - //PHYSICAL_ADDRESS DataBuffer; - // - // On input, data buffer offset to copy. - // On output, next time data buffer offset to copy. - // - //UINT64 DataOffset; + // Empty array that represents the start of the + // data being stored in the comm buffer we're getting + // from the MM environment. UINT8 Data[]; } MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET; diff --git a/MinPlatformPkg/Test/Library/TestPointLib/MmTestPointCommunication.c b/MinPlatformPkg/Test/Library/TestPointLib/MmTestPointCommunication.c index e0e7419d27..3371304f2c 100644 --- a/MinPlatformPkg/Test/Library/TestPointLib/MmTestPointCommunication.c +++ b/MinPlatformPkg/Test/Library/TestPointLib/MmTestPointCommunication.c @@ -207,29 +207,22 @@ MmiHandlerTestPointCopyData ( **/ VOID MmTestPointMmiHandlerGetDataByOffset ( - IN MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *MmiHandlerTestPointParameterGetDataByOffset + IN VOID *MmiHandlerTestPointParameterGetDataByOffset ) { - MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET MmiHandlerTestPointGetDataByOffset; + MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *MmiHandlerTestPointGetDataByOffset; VOID *Data; UINTN DataSize; EFI_STATUS Status; Data = NULL; - CopyMem ( - &MmiHandlerTestPointGetDataByOffset, - MmiHandlerTestPointParameterGetDataByOffset, - MmiHandlerTestPointParameterGetDataByOffset->DataSize - ); - - DEBUG((DEBUG_ERROR, "Struct Buffer Address: %x\n", (UINTN)MmiHandlerTestPointParameterGetDataByOffset)); - DEBUG((DEBUG_ERROR, "Struct Data Buffer Address: %x\n", (UINTN)(MmiHandlerTestPointParameterGetDataByOffset->Data))); - DEBUG((DEBUG_ERROR, "STRUCTSIZE: %x\n", sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET))); + MmiHandlerTestPointGetDataByOffset = (MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *)MmiHandlerTestPointParameterGetDataByOffset; // // Sanity check // + // MU_CHANGE - Removing Sanity check as we are now completely working within the comm buffer /*if (!IsBufferOutsideMmValid((UINTN)&MmiHandlerTestPointParameterGetDataByOffset->Data[0], (UINTN)*Size)) { DEBUG((DEBUG_ERROR, "MmTestPointMmiHandlerGetDataByOffset: MmTestPoint get data in SMRAM or overflow!\n")); MmiHandlerTestPointParameterGetDataByOffset->ReturnStatus = (UINT64)(INT64)(INTN)EFI_ACCESS_DENIED; @@ -239,17 +232,17 @@ MmTestPointMmiHandlerGetDataByOffset ( DataSize = 0; Status = GetAllMmTestPointData (&DataSize, NULL); if (Status != EFI_BUFFER_TOO_SMALL) { - MmiHandlerTestPointParameterGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(INTN)EFI_NOT_FOUND; + MmiHandlerTestPointGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(INTN)EFI_NOT_FOUND; goto Done; } Data = AllocatePool (DataSize); if (Data == NULL) { - MmiHandlerTestPointParameterGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(INTN)EFI_OUT_OF_RESOURCES; + MmiHandlerTestPointGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(INTN)EFI_OUT_OF_RESOURCES; goto Done; } Status = GetAllMmTestPointData (&DataSize, Data); if (EFI_ERROR(Status)) { - MmiHandlerTestPointParameterGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(INTN)Status; + MmiHandlerTestPointGetDataByOffset->Header.ReturnStatus = (UINT64)(INT64)(INTN)Status; goto Done; } @@ -259,27 +252,14 @@ MmTestPointMmiHandlerGetDataByOffset ( // MmiHandlerTestPointCopyData(). // SpeculationBarrier (); - DEBUG((DEBUG_ERROR, "InputSize: %x\n", DataSize)); - /*CopyMem ( - (VOID *)MmiHandlerTestPointGetDataByOffset.Data, - Data, - DataSize - );*/ - /*MmiHandlerTestPointCopyData ( - Data, - DataSize, - (VOID *)(UINTN)MmiHandlerTestPointGetDataByOffset.Data, - &(MmiHandlerTestPointGetDataByOffset.DataSize), - 0 - );*/ - DEBUG((DEBUG_ERROR, "DO WE GET HERE?\n")); + CopyMem ( - (VOID *)(UINTN)MmiHandlerTestPointParameterGetDataByOffset->Data, + MmiHandlerTestPointGetDataByOffset->Data, Data, DataSize ); - MmiHandlerTestPointParameterGetDataByOffset->Header.ReturnStatus = 0; + MmiHandlerTestPointGetDataByOffset->Header.ReturnStatus = 0; Done: if (Data != NULL) { @@ -312,6 +292,7 @@ MmTestPointMmiHandler ( ) { MMI_HANDLER_TEST_POINT_PARAMETER_HEADER *MmiHandlerTestPointParameterHeader; + MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *MmiHandlerTestPointParameterOffset; UINTN TempCommBufferSize; DEBUG((DEBUG_INFO, "MmTestPointMmiHandler Enter\n")); @@ -325,10 +306,6 @@ MmTestPointMmiHandler ( TempCommBufferSize = *CommBufferSize; - DEBUG((DEBUG_ERROR, "CommBuffer Real Address: %x\n", (UINTN)CommBuffer)); - - DEBUG((DEBUG_ERROR, "CommBufferSize: %x, Struct size: %x\n", TempCommBufferSize, sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET))); - if (TempCommBufferSize < sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_HEADER)) { DEBUG((DEBUG_INFO, "MmTestPointMmiHandler: MM communication buffer size invalid!\n")); return EFI_SUCCESS; @@ -353,11 +330,12 @@ MmTestPointMmiHandler ( break; case MMI_HANDLER_TEST_POINT_COMMAND_GET_DATA_BY_OFFSET: DEBUG((DEBUG_INFO, "MmiHandlerTestPointHandlerGetDataByOffset\n")); - /*if (TempCommBufferSize != sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_HEADER)) { + MmiHandlerTestPointParameterOffset = (MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *)CommBuffer; + if (TempCommBufferSize != (sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET) + MmiHandlerTestPointParameterOffset->DataSize)) { DEBUG((DEBUG_INFO, "MmTestPointMmiHandler: MM communication buffer size invalid!\n")); return EFI_SUCCESS; - }*/ - MmTestPointMmiHandlerGetDataByOffset((MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *)(UINTN)CommBuffer); + } + MmTestPointMmiHandlerGetDataByOffset(CommBuffer); break; default: break; diff --git a/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxeMm.c b/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxeMm.c index 42510610d4..cedcb06c8a 100644 --- a/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxeMm.c +++ b/MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxeMm.c @@ -37,16 +37,17 @@ PublishPeiTestPoint ( while (TRUE) { Hob.Raw = GetNextGuidHob (&gAdapterInfoPlatformTestPointGuid, Hob.Raw); if (Hob.Raw == NULL) { - return ; + return; } - TestPoint = GET_GUID_HOB_DATA (Hob); + + TestPoint = GET_GUID_HOB_DATA (Hob); TestPointSize = GET_GUID_HOB_DATA_SIZE (Hob); TestPointLibSetTable (TestPoint, TestPointSize); Hob.Raw = GET_NEXT_HOB (Hob); if (Hob.Raw == NULL) { - return ; + return; } } } @@ -64,77 +65,77 @@ GetTestPointDataMm ( VOID ) { - EFI_STATUS Status; - UINTN CommSize; - UINT8 *CommBuffer; - EFI_MM_COMMUNICATE_HEADER *CommHeader; - MMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO *CommGetInfo; - MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *CommGetData; - EFI_MM_COMMUNICATION_PROTOCOL *MmCommunication; - UINTN MinimalSizeNeeded; - EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable; - UINT32 Index; - EFI_MEMORY_DESCRIPTOR *Entry; - //VOID *Buffer; - UINTN Size; - //UINTN Offset; - //MMI_HANDLER_TEST_POINT_PARAMETER_HEADER_2 *HeaderInfo; - - Status = gBS->LocateProtocol(&gEfiMmCommunicationProtocolGuid, NULL, (VOID **)&MmCommunication); - if (EFI_ERROR(Status)) { + EFI_STATUS Status; + UINTN CommSize; + UINT8 *CommBuffer; + EFI_MM_COMMUNICATE_HEADER *CommHeader; + MMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO *CommGetInfo; + MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *CommGetData; + EFI_MM_COMMUNICATION_PROTOCOL *MmCommunication; + UINTN MinimalSizeNeeded; + EDKII_PI_SMM_COMMUNICATION_REGION_TABLE *PiSmmCommunicationRegionTable; + UINT32 Index; + EFI_MEMORY_DESCRIPTOR *Entry; + UINTN Size; + + Status = gBS->LocateProtocol (&gEfiMmCommunicationProtocolGuid, NULL, (VOID **)&MmCommunication); + if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: Locate MmCommunication protocol - %r\n", Status)); - return ; + return; } MinimalSizeNeeded = EFI_PAGE_SIZE; - Status = EfiGetSystemConfigurationTable( + Status = EfiGetSystemConfigurationTable ( &gEdkiiPiSmmCommunicationRegionTableGuid, (VOID **)&PiSmmCommunicationRegionTable ); - if (EFI_ERROR(Status)) { + if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: Get PiSmmCommunicationRegionTable - %r\n", Status)); - return ; + return; } - ASSERT(PiSmmCommunicationRegionTable != NULL); + + ASSERT (PiSmmCommunicationRegionTable != NULL); Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1); - Size = 0; + Size = 0; for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) { if (Entry->Type == EfiConventionalMemory) { - Size = EFI_PAGES_TO_SIZE((UINTN)Entry->NumberOfPages); + Size = EFI_PAGES_TO_SIZE ((UINTN)Entry->NumberOfPages); if (Size >= MinimalSizeNeeded) { break; } } + Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize); } - ASSERT(Index < PiSmmCommunicationRegionTable->NumberOfEntries); + + ASSERT (Index < PiSmmCommunicationRegionTable->NumberOfEntries); CommBuffer = (UINT8 *)(UINTN)Entry->PhysicalStart; - DEBUG((DEBUG_ERROR, "CommBuffer Address: %x\n", (UINT32)Entry->PhysicalStart)); + DEBUG ((DEBUG_ERROR, "CommBuffer Address: %x\n", (UINT32)Entry->PhysicalStart)); // // Get Size // CommHeader = (EFI_MM_COMMUNICATE_HEADER *)&CommBuffer[0]; - CopyMem(&CommHeader->HeaderGuid, &gAdapterInfoPlatformTestPointGuid, sizeof(gAdapterInfoPlatformTestPointGuid)); - CommHeader->MessageLength = sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO); + CopyMem (&CommHeader->HeaderGuid, &gAdapterInfoPlatformTestPointGuid, sizeof (gAdapterInfoPlatformTestPointGuid)); + CommHeader->MessageLength = sizeof (MMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO); - CommGetInfo = (MMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO *)&CommBuffer[OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data)]; - CommGetInfo->Header.Command = MMI_HANDLER_TEST_POINT_COMMAND_GET_INFO; - CommGetInfo->Header.DataLength = sizeof(*CommGetInfo); + CommGetInfo = (MMI_HANDLER_TEST_POINT_PARAMETER_GET_INFO *)&CommBuffer[OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data)]; + CommGetInfo->Header.Command = MMI_HANDLER_TEST_POINT_COMMAND_GET_INFO; + CommGetInfo->Header.DataLength = sizeof (*CommGetInfo); CommGetInfo->Header.ReturnStatus = (UINT64)-1; - CommGetInfo->DataSize = 0; + CommGetInfo->DataSize = 0; CommSize = OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; - Status = MmCommunication->Communicate(MmCommunication, CommBuffer, &CommSize); - if (EFI_ERROR(Status)) { + Status = MmCommunication->Communicate (MmCommunication, CommBuffer, &CommSize); + if (EFI_ERROR (Status)) { DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: MmCommunication - %r\n", Status)); - return ; + return; } if (CommGetInfo->Header.ReturnStatus != 0) { DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: GetInfo - 0x%0x\n", CommGetInfo->Header.ReturnStatus)); - return ; + return; } mMmTestPointDatabaseSize = (UINTN)CommGetInfo->DataSize; @@ -142,93 +143,41 @@ GetTestPointDataMm ( // // Get Data // - mMmTestPointDatabase = AllocateZeroPool(mMmTestPointDatabaseSize); + mMmTestPointDatabase = AllocateZeroPool (mMmTestPointDatabaseSize); if (mMmTestPointDatabase == NULL) { Status = EFI_OUT_OF_RESOURCES; DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: AllocateZeroPool (0x%x) for dump buffer - %r\n", mMmTestPointDatabaseSize, Status)); - return ; + return; } - //ZeroMem (CommBuffer, Size); - CommHeader = (EFI_MM_COMMUNICATE_HEADER *)&CommBuffer[0]; - CopyMem(&CommHeader->HeaderGuid, &gAdapterInfoPlatformTestPointGuid, sizeof(gAdapterInfoPlatformTestPointGuid)); - CommHeader->MessageLength = sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET) + mMmTestPointDatabaseSize; + CopyMem (&CommHeader->HeaderGuid, &gAdapterInfoPlatformTestPointGuid, sizeof (gAdapterInfoPlatformTestPointGuid)); + // Set message length to the struct size and the size of the MmTestPoint Data + CommHeader->MessageLength = sizeof (MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET) + mMmTestPointDatabaseSize; - CommGetData = (MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF(EFI_MM_COMMUNICATE_HEADER, Data)]; - CommGetData->Header.Command = MMI_HANDLER_TEST_POINT_COMMAND_GET_DATA_BY_OFFSET; - CommGetData->Header.DataLength = sizeof(*CommGetData); + CommGetData = (MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET *)&CommBuffer[OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data)]; + CommGetData->Header.Command = MMI_HANDLER_TEST_POINT_COMMAND_GET_DATA_BY_OFFSET; + CommGetData->Header.DataLength = sizeof (*CommGetData); CommGetData->Header.ReturnStatus = (UINT64)-1; + // Set comm size to the size of the comm header plus the size of the information we are trying to get CommSize = OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; - DEBUG((DEBUG_ERROR, "Offset size: %x, MessageLength: %x, CommSize: %x\n", OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data), (UINTN)CommHeader->MessageLength, CommSize)); - //Buffer = (UINT8 *)CommHeader + CommSize; - Size -= CommSize; - - //CommGetData->DataBuffer = (PHYSICAL_ADDRESS)(UINTN)Buffer; - //CommGetData->DataOffset = 0; - - - - /*CommHeader->MessageLength = Size - OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data); - DEBUG((DEBUG_ERROR, "MessageLength: %x\n", CommHeader->MessageLength)); - - HeaderInfo = (MMI_HANDLER_TEST_POINT_PARAMETER_HEADER_2 *)CommHeader->Data; - HeaderInfo->Command = MMI_HANDLER_TEST_POINT_COMMAND_GET_DATA_BY_OFFSET; - - if (CommHeader->MessageLength > mMmTestPointDatabaseSize) { - CommHeader->MessageLength = mMmTestPointDatabaseSize; - } - - CommSize = OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data) + (UINTN)CommHeader->MessageLength; - - DEBUG((DEBUG_ERROR, "Size: %x, CommSize: %x, MessageLength: %x\n", Size, CommSize, CommHeader->MessageLength)); - - Status = MmCommunication->Communicate(MmCommunication, CommBuffer, &CommSize); - ASSERT_EFI_ERROR(Status); - - CopyMem((UINT8 *)mMmTestPointDatabase, (VOID *)(UINTN)&HeaderInfo->Data[0], (UINTN)CommHeader->MessageLength);*/ + Size -= CommSize; - /*if (Size <= (mMmTestPointDatabaseSize)) { - CommGetData->DataSize = (UINT64)Size; - } else { - CommGetData->DataSize = (UINT64)(mMmTestPointDatabaseSize); - }*/ CommGetData->DataSize = (UINT64)(mMmTestPointDatabaseSize); - DEBUG((DEBUG_ERROR, "Buffer Size: %x\n", Size)); - Status = MmCommunication->Communicate(MmCommunication, CommBuffer, &CommSize); - ASSERT_EFI_ERROR(Status); + Status = MmCommunication->Communicate (MmCommunication, CommBuffer, &CommSize); + ASSERT_EFI_ERROR (Status); if (CommGetData->Header.ReturnStatus != 0) { - FreePool(mMmTestPointDatabase); + FreePool (mMmTestPointDatabase); mMmTestPointDatabase = NULL; DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: GetData - 0x%x\n", CommGetData->Header.ReturnStatus)); - return ; + return; } - CopyMem((UINT8 *)mMmTestPointDatabase, (VOID *)(UINTN)CommGetData->Data, (UINTN)CommGetData->DataSize); - - /*while (CommGetData->DataOffset < mMmTestPointDatabaseSize) { - Offset = (UINTN)CommGetData->DataOffset; - if (Size <= (mMmTestPointDatabaseSize - CommGetData->DataOffset)) { - CommGetData->DataSize = (UINT64)Size; - } else { - CommGetData->DataSize = (UINT64)(mMmTestPointDatabaseSize - CommGetData->DataOffset); - } - Status = MmCommunication->Communicate(MmCommunication, CommBuffer, &CommSize); - ASSERT_EFI_ERROR(Status); - - if (CommGetData->Header.ReturnStatus != 0) { - FreePool(mMmTestPointDatabase); - mMmTestPointDatabase = NULL; - DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: GetData - 0x%x\n", CommGetData->Header.ReturnStatus)); - return ; - } - CopyMem((UINT8 *)mMmTestPointDatabase + Offset, (VOID *)(UINTN)CommGetData->DataBuffer, (UINTN)CommGetData->DataSize); - }*/ - DEBUG ((DEBUG_INFO, "MmTestPointDatabaseSize - 0x%x\n", mMmTestPointDatabaseSize)); + CopyMem ((UINT8 *)mMmTestPointDatabase, (VOID *)(UINTN)CommGetData->Data, (UINTN)mMmTestPointDatabaseSize); - return ; + return; } UINTN @@ -242,19 +191,19 @@ GetTestPointInfoSize ( UINTN ErrorStringMaxSize; CHAR16 ErrorChar; - ErrorString = (CHAR16 *)((UINTN)TestPoint + sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TEST_POINT_FEATURES_ITEM_NUMBER * TestPoint->FeaturesSize); + ErrorString = (CHAR16 *)((UINTN)TestPoint + sizeof (ADAPTER_INFO_PLATFORM_TEST_POINT) + TEST_POINT_FEATURES_ITEM_NUMBER * TestPoint->FeaturesSize); - ErrorStringMaxSize = MaxSize - sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * TEST_POINT_FEATURES_ITEM_NUMBER; + ErrorStringMaxSize = MaxSize - sizeof (ADAPTER_INFO_PLATFORM_TEST_POINT) - TestPoint->FeaturesSize * TEST_POINT_FEATURES_ITEM_NUMBER; // // ErrorString might not be CHAR16 aligned. // - CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar)); + CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar)); for (ErrorStringLength = 0; (ErrorChar != 0) && (ErrorStringLength < (ErrorStringMaxSize/2)); ErrorStringLength++) { ErrorString++; - CopyMem (&ErrorChar, ErrorString, sizeof(ErrorChar)); + CopyMem (&ErrorChar, ErrorString, sizeof (ErrorChar)); } - return sizeof(ADAPTER_INFO_PLATFORM_TEST_POINT) + TEST_POINT_FEATURES_ITEM_NUMBER * TestPoint->FeaturesSize + (ErrorStringLength + 1) * sizeof(CHAR16); + return sizeof (ADAPTER_INFO_PLATFORM_TEST_POINT) + TEST_POINT_FEATURES_ITEM_NUMBER * TestPoint->FeaturesSize + (ErrorStringLength + 1) * sizeof (CHAR16); } VOID @@ -270,10 +219,11 @@ PublishMmTestPoint ( GetTestPointDataMm (); if (mMmTestPointDatabaseSize == 0) { - return ; + return; } + if (mMmTestPointDatabase == NULL) { - return ; + return; } TestPoint = mMmTestPointDatabase; @@ -328,8 +278,8 @@ OnReadyToBoot ( IN VOID *Context ) { - EFI_STATUS Status; - EFI_EVENT ReadyToBootLaterEvent; + EFI_STATUS Status; + EFI_EVENT ReadyToBootLaterEvent; gBS->CloseEvent (Event); @@ -350,8 +300,8 @@ TestPointStubForMm ( VOID ) { - EFI_STATUS Status; - EFI_EVENT ReadyToBootEvent; + EFI_STATUS Status; + EFI_EVENT ReadyToBootEvent; Status = EfiCreateEventReadyToBootEx ( TPL_CALLBACK, @@ -376,12 +326,12 @@ TestPointStubForMm ( EFI_STATUS EFIAPI TestPointStubDxeMmEntryPoint ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable ) { TestPointStubForPei (); TestPointStubForMm (); return EFI_SUCCESS; -} \ No newline at end of file +}