mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 16:44:10 +02:00
SecurityPkg: Build gEdkiiTcg2AcpiCommunicateBufferHobGuid
Install a callback of gEfiPeiMemoryDiscoveredPpiGuid to build the gEdkiiTcg2AcpiCommunicateBufferHobGuid in the Tcg2ConfigPei PEIM. The HOB contains a buffer reserved by MmUnblockMemoryLib. The buffer will be used in Tcg2Acpi driver to retrive information from standalone mm environment. Signed-off-by: Dun Tan <dun.tan@intel.com>
This commit is contained in:
parent
cb6ba975ae
commit
9a76c7945b
@ -47,6 +47,7 @@
|
||||
Tpm12CommandLib
|
||||
Tpm12DeviceLib
|
||||
HobLib
|
||||
MmUnblockMemoryLib
|
||||
|
||||
[Guids]
|
||||
## SOMETIMES_CONSUMES ## Variable:L"TCG2_CONFIGURATION"
|
||||
@ -56,10 +57,12 @@
|
||||
gEfiTpmDeviceInstanceNoneGuid ## SOMETIMES_CONSUMES ## GUID # TPM device identifier
|
||||
gEdkiiTpmInstanceHobGuid
|
||||
gEdkiiTcgPhysicalPresenceInterfaceVerHobGuid
|
||||
gEdkiiTcg2AcpiCommunicateBufferHobGuid
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES
|
||||
gPeiTpmInitializationDonePpiGuid ## SOMETIMES_PRODUCES
|
||||
gEfiPeiMemoryDiscoveredPpiGuid
|
||||
|
||||
[Pcd]
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## PRODUCES
|
||||
|
@ -9,6 +9,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <PiPei.h>
|
||||
|
||||
#include <Guid/TpmInstance.h>
|
||||
#include <Guid/Tcg2AcpiCommunicateBuffer.h>
|
||||
#include <Guid/TpmNvsMm.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
@ -17,6 +19,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/HobLib.h>
|
||||
#include <Library/MmUnblockMemoryLib.h>
|
||||
|
||||
#include <Ppi/ReadOnlyVariable2.h>
|
||||
#include <Ppi/TpmInitialized.h>
|
||||
@ -51,6 +54,53 @@ DetectTpmDevice (
|
||||
IN UINT8 SetupTpmDevice
|
||||
);
|
||||
|
||||
/**
|
||||
Build gEdkiiTcg2AcpiCommunicateBufferHobGuid.
|
||||
|
||||
@param[in] PeiServices General purpose services available to every PEIM.
|
||||
@param[in] NotifyDescriptor The notification structure this PEIM registered on install.
|
||||
@param[in] Ppi The memory discovered PPI. Not used.
|
||||
|
||||
@retval EFI_SUCCESS The function completed successfully.
|
||||
@retval others Failed to build Tcg2AcpiCommunicateBuffer Hob.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
BuildTcg2AcpiCommunicateBufferHob (
|
||||
IN EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor,
|
||||
IN VOID *Ppi
|
||||
)
|
||||
{
|
||||
TCG2_ACPI_COMMUNICATE_BUFFER *Tcg2AcpiCommunicateBufferHob;
|
||||
EFI_STATUS Status;
|
||||
VOID *Buffer;
|
||||
UINTN Pages;
|
||||
|
||||
Pages = sizeof (TCG_NVS);
|
||||
Buffer = AllocateRuntimePages (Pages);
|
||||
ASSERT (Buffer != NULL);
|
||||
|
||||
Status = MmUnblockMemoryRequest ((UINTN)Buffer, Pages);
|
||||
if ((Status != EFI_UNSUPPORTED) && EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
Tcg2AcpiCommunicateBufferHob = BuildGuidHob (&gEdkiiTcg2AcpiCommunicateBufferHobGuid, sizeof (TCG2_ACPI_COMMUNICATE_BUFFER));
|
||||
ASSERT (Tcg2AcpiCommunicateBufferHob != NULL);
|
||||
Tcg2AcpiCommunicateBufferHob->Tcg2AcpiCommunicateBuffer = (UINTN)Buffer;
|
||||
Tcg2AcpiCommunicateBufferHob->Pages = Pages;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_PEI_NOTIFY_DESCRIPTOR mPostMemNotifyList = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEfiPeiMemoryDiscoveredPpiGuid,
|
||||
BuildTcg2AcpiCommunicateBufferHob
|
||||
};
|
||||
|
||||
/**
|
||||
The entry point for Tcg2 configuration driver.
|
||||
|
||||
@ -155,6 +205,8 @@ Tcg2ConfigPeimEntryPoint (
|
||||
);
|
||||
ASSERT (Hob != NULL);
|
||||
|
||||
PeiServicesNotifyPpi (&mPostMemNotifyList);
|
||||
|
||||
//
|
||||
// Selection done
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user