StandaloneMmPkg: Fix check buffer address failed issue from TF-A
There are two scene communicate with StandaloneMm(MM): 1 edk2 -> TF-A -> MM, communicate MM use non-secure buffer which specify by EFI_SECURE_PARTITION_BOOT_INFO.SpNsCommBufBase; 2 RAS scene: fiq -> TF-A -> MM, use secure buffer which specify by EFI_SECURE_PARTITION_BOOT_INFO.SpShareBufBase; For now, the second scene will failed because check buffer address. This patch add CheckBufferAddr() to support check address for secure buffer. Signed-off-by: Ming Huang <huangming@linux.alibaba.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
This commit is contained in:
@@ -106,6 +106,7 @@ StandaloneMmCpuInitialize (
|
||||
UINTN Index;
|
||||
UINTN ArraySize;
|
||||
VOID *HobStart;
|
||||
EFI_MMRAM_HOB_DESCRIPTOR_BLOCK *MmramRangesHob;
|
||||
|
||||
ASSERT (SystemTable != NULL);
|
||||
mMmst = SystemTable;
|
||||
@@ -188,6 +189,26 @@ StandaloneMmCpuInitialize (
|
||||
CopyMem (&mNsCommBuffer, NsCommBufMmramRange, sizeof (EFI_MMRAM_DESCRIPTOR));
|
||||
DEBUG ((DEBUG_INFO, "mNsCommBuffer: 0x%016lx - 0x%lx\n", mNsCommBuffer.CpuStart, mNsCommBuffer.PhysicalSize));
|
||||
|
||||
Status = GetGuidedHobData (
|
||||
HobStart,
|
||||
&gEfiMmPeiMmramMemoryReserveGuid,
|
||||
(VOID **)&MmramRangesHob
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((DEBUG_ERROR, "MmramRangesHob data extraction failed - 0x%x\n", Status));
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// As CreateHobListFromBootInfo(), the base and size of buffer shared with
|
||||
// privileged Secure world software is in second one.
|
||||
//
|
||||
CopyMem (
|
||||
&mSCommBuffer,
|
||||
&MmramRangesHob->Descriptor[0] + 1,
|
||||
sizeof (EFI_MMRAM_DESCRIPTOR)
|
||||
);
|
||||
|
||||
//
|
||||
// Extract the MP information from the Hoblist
|
||||
//
|
||||
|
Reference in New Issue
Block a user