mirror of https://github.com/acidanthera/audk.git
SecurityPkg Tcg(2)Pei: Remove the using of PcdPeiCoreMaxFvSupported
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1405 Background as below. Problem: As static configuration from the PCDs, the binary PeiCore (for example in FSP binary with dispatch mode) could not predict how many FVs, Files or PPIs for different platforms. Burden: Platform developers need configure the PCDs accordingly for different platforms. To solve the problem and remove the burden, we can update PeiCore to remove the using of PcdPeiCoreMaxFvSupported, PcdPeiCoreMaxPeimPerFv and PcdPeiCoreMaxPpiSupported by extending buffer dynamically for FV, File and PPI management. This patch removes the using of PcdPeiCoreMaxFvSupported in Tcg(2)Pei. Cc: Chao Zhang <chao.b.zhang@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
This commit is contained in:
parent
b62fe5708b
commit
aa8c6e2ad3
|
@ -71,10 +71,17 @@ EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList = {
|
|||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// Number of firmware blobs to grow by each time we run out of room
|
||||
//
|
||||
#define FIRMWARE_BLOB_GROWTH_STEP 4
|
||||
|
||||
EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredBaseFvInfo;
|
||||
UINT32 mMeasuredMaxBaseFvIndex = 0;
|
||||
UINT32 mMeasuredBaseFvIndex = 0;
|
||||
|
||||
EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredChildFvInfo;
|
||||
UINT32 mMeasuredMaxChildFvIndex = 0;
|
||||
UINT32 mMeasuredChildFvIndex = 0;
|
||||
|
||||
/**
|
||||
|
@ -615,12 +622,19 @@ MeasureFvImage (
|
|||
//
|
||||
// Add new FV into the measured FV list.
|
||||
//
|
||||
ASSERT (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
if (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
|
||||
if (mMeasuredBaseFvIndex >= mMeasuredMaxBaseFvIndex) {
|
||||
mMeasuredBaseFvInfo = ReallocatePool (
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * mMeasuredMaxBaseFvIndex,
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredMaxBaseFvIndex + FIRMWARE_BLOB_GROWTH_STEP),
|
||||
mMeasuredBaseFvInfo
|
||||
);
|
||||
ASSERT (mMeasuredBaseFvInfo != NULL);
|
||||
mMeasuredMaxBaseFvIndex = mMeasuredMaxBaseFvIndex + FIRMWARE_BLOB_GROWTH_STEP;
|
||||
}
|
||||
|
||||
mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobBase = FvBase;
|
||||
mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobLength = FvLength;
|
||||
mMeasuredBaseFvIndex++;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -724,8 +738,15 @@ FirmwareVolmeInfoPpiNotifyCallback (
|
|||
//
|
||||
if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
|
||||
|
||||
ASSERT (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
if (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
|
||||
if (mMeasuredChildFvIndex >= mMeasuredMaxChildFvIndex) {
|
||||
mMeasuredChildFvInfo = ReallocatePool (
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * mMeasuredMaxChildFvIndex,
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredMaxChildFvIndex + FIRMWARE_BLOB_GROWTH_STEP),
|
||||
mMeasuredChildFvInfo
|
||||
);
|
||||
ASSERT (mMeasuredChildFvInfo != NULL);
|
||||
mMeasuredMaxChildFvIndex = mMeasuredMaxChildFvIndex + FIRMWARE_BLOB_GROWTH_STEP;
|
||||
}
|
||||
//
|
||||
// Check whether FV is in the measured child FV list.
|
||||
//
|
||||
|
@ -737,7 +758,6 @@ FirmwareVolmeInfoPpiNotifyCallback (
|
|||
mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase = (EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo;
|
||||
mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobLength = Fv->FvInfoSize;
|
||||
mMeasuredChildFvIndex++;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -761,11 +781,6 @@ PeimEntryMP (
|
|||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
mMeasuredBaseFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
ASSERT (mMeasuredBaseFvInfo != NULL);
|
||||
mMeasuredChildFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
ASSERT (mMeasuredChildFvInfo != NULL);
|
||||
|
||||
if (PcdGet8 (PcdTpm2ScrtmPolicy) == 1) {
|
||||
Status = MeasureCRTMVersion ();
|
||||
}
|
||||
|
|
|
@ -83,7 +83,6 @@
|
|||
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2InitializationPolicy ## CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2SelfTestPolicy ## SOMETIMES_CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpm2ScrtmPolicy ## CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported ## CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice ## SOMETIMES_CONSUMES
|
||||
## SOMETIMES_CONSUMES
|
||||
## SOMETIMES_PRODUCES
|
||||
|
|
|
@ -57,10 +57,17 @@ EFI_PEI_PPI_DESCRIPTOR mTpmInitializationDonePpiList = {
|
|||
NULL
|
||||
};
|
||||
|
||||
//
|
||||
// Number of firmware blobs to grow by each time we run out of room
|
||||
//
|
||||
#define FIRMWARE_BLOB_GROWTH_STEP 4
|
||||
|
||||
EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredBaseFvInfo;
|
||||
UINT32 mMeasuredMaxBaseFvIndex = 0;
|
||||
UINT32 mMeasuredBaseFvIndex = 0;
|
||||
|
||||
EFI_PLATFORM_FIRMWARE_BLOB *mMeasuredChildFvInfo;
|
||||
UINT32 mMeasuredMaxChildFvIndex = 0;
|
||||
UINT32 mMeasuredChildFvIndex = 0;
|
||||
|
||||
EFI_PEI_FIRMWARE_VOLUME_INFO_MEASUREMENT_EXCLUDED_PPI *mMeasurementExcludedFvPpi;
|
||||
|
@ -424,12 +431,19 @@ MeasureFvImage (
|
|||
//
|
||||
// Add new FV into the measured FV list.
|
||||
//
|
||||
ASSERT (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
if (mMeasuredBaseFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
|
||||
if (mMeasuredBaseFvIndex >= mMeasuredMaxBaseFvIndex) {
|
||||
mMeasuredBaseFvInfo = ReallocatePool (
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * mMeasuredMaxBaseFvIndex,
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredMaxBaseFvIndex + FIRMWARE_BLOB_GROWTH_STEP),
|
||||
mMeasuredBaseFvInfo
|
||||
);
|
||||
ASSERT (mMeasuredBaseFvInfo != NULL);
|
||||
mMeasuredMaxBaseFvIndex = mMeasuredMaxBaseFvIndex + FIRMWARE_BLOB_GROWTH_STEP;
|
||||
}
|
||||
|
||||
mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobBase = FvBase;
|
||||
mMeasuredBaseFvInfo[mMeasuredBaseFvIndex].BlobLength = FvLength;
|
||||
mMeasuredBaseFvIndex++;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
@ -537,8 +551,15 @@ FirmwareVolmeInfoPpiNotifyCallback (
|
|||
//
|
||||
if (Fv->ParentFvName != NULL || Fv->ParentFileName != NULL ) {
|
||||
|
||||
ASSERT (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
if (mMeasuredChildFvIndex < PcdGet32 (PcdPeiCoreMaxFvSupported)) {
|
||||
if (mMeasuredChildFvIndex >= mMeasuredMaxChildFvIndex) {
|
||||
mMeasuredChildFvInfo = ReallocatePool (
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * mMeasuredMaxChildFvIndex,
|
||||
sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * (mMeasuredMaxChildFvIndex + FIRMWARE_BLOB_GROWTH_STEP),
|
||||
mMeasuredChildFvInfo
|
||||
);
|
||||
ASSERT (mMeasuredChildFvInfo != NULL);
|
||||
mMeasuredMaxChildFvIndex = mMeasuredMaxChildFvIndex + FIRMWARE_BLOB_GROWTH_STEP;
|
||||
}
|
||||
//
|
||||
// Check whether FV is in the measured child FV list.
|
||||
//
|
||||
|
@ -550,7 +571,6 @@ FirmwareVolmeInfoPpiNotifyCallback (
|
|||
mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobBase = (EFI_PHYSICAL_ADDRESS) (UINTN) Fv->FvInfo;
|
||||
mMeasuredChildFvInfo[mMeasuredChildFvIndex].BlobLength = Fv->FvInfoSize;
|
||||
mMeasuredChildFvIndex++;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -707,11 +727,6 @@ PeimEntryMP (
|
|||
);
|
||||
// Do not check status, because it is optional
|
||||
|
||||
mMeasuredBaseFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
ASSERT (mMeasuredBaseFvInfo != NULL);
|
||||
mMeasuredChildFvInfo = (EFI_PLATFORM_FIRMWARE_BLOB *) AllocateZeroPool (sizeof (EFI_PLATFORM_FIRMWARE_BLOB) * PcdGet32 (PcdPeiCoreMaxFvSupported));
|
||||
ASSERT (mMeasuredChildFvInfo != NULL);
|
||||
|
||||
Status = Tpm12RequestUseTpm ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
|
|
|
@ -81,7 +81,6 @@
|
|||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInstanceGuid ## CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmInitializationPolicy ## CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdTpmScrtmPolicy ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreMaxFvSupported ## CONSUMES
|
||||
gEfiSecurityPkgTokenSpaceGuid.PcdStatusCodeSubClassTpmDevice ## SOMETIMES_CONSUMES
|
||||
|
||||
[Depex]
|
||||
|
|
Loading…
Reference in New Issue