Skip to content

Commit

Permalink
Added some additional logic checks and fixed debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kenlautner committed Aug 29, 2023
1 parent 7a2a0a9 commit bc6b936
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions MinPlatformPkg/Test/TestPointStubDxe/TestPointStubDxeMm.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ OnEndOfDxe (

Status = gBS->LocateProtocol(&gEfiMmCommunicationProtocolGuid, NULL, (VOID **)&MmCommunication);
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: Locate MmCommunication protocol - %r\n", Status));
DEBUG ((DEBUG_ERROR, "MmiHandlerTestPoint: Locate MmCommunication protocol - %r\n", Status));
return ;
}

Expand All @@ -284,10 +284,14 @@ OnEndOfDxe (
(VOID **)&PiSmmCommunicationRegionTable
);
if (EFI_ERROR(Status)) {
DEBUG ((DEBUG_INFO, "MmiHandlerTestPoint: Get PiSmmCommunicationRegionTable - %r\n", Status));
DEBUG ((DEBUG_ERROR, "MmiHandlerTestPoint: Get PiSmmCommunicationRegionTable - %r\n", Status));
return ;
}
if (PiSmmCommunicationRegionTable == NULL) {
DEBUG ((DEBUG_ERROR, "Failed to get the PiSmmCommunicationRegionTable.\n"));
ASSERT(PiSmmCommunicationRegionTable != NULL);
return ;
}
ASSERT(PiSmmCommunicationRegionTable != NULL);
Entry = (EFI_MEMORY_DESCRIPTOR *)(PiSmmCommunicationRegionTable + 1);
Size = 0;
for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; Index++) {
Expand All @@ -300,13 +304,16 @@ OnEndOfDxe (
Entry = (EFI_MEMORY_DESCRIPTOR *)((UINT8 *)Entry + PiSmmCommunicationRegionTable->DescriptorSize);
}
ASSERT(Index < PiSmmCommunicationRegionTable->NumberOfEntries);
if (Size < MinimalSizeNeeded) {
DEBUG ((DEBUG_ERROR, "Failed to find any entries in the PiSmmCommunicationRegionTable.\n"));
return ;
}

CommSize = OFFSET_OF (EFI_MM_COMMUNICATE_HEADER, Data) + sizeof(MMI_HANDLER_TEST_POINT_PARAMETER_GET_DATA_BY_OFFSET);

Size -= CommSize;
mMmCommBuffer = AllocateRuntimeZeroPool(Size);

DEBUG ((DEBUG_INFO, "TEST TO SEE IF WE GET HERE\n"));
//
// Request to unblock the newly allocated cache region to be accessible from inside MM
//
Expand Down

0 comments on commit bc6b936

Please sign in to comment.