diff options
Diffstat (limited to 'Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg')
5 files changed, 109 insertions, 28 deletions
diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/FwVol/FwVol.c index 8009546acd..bc14d8dc7b 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -2,7 +2,7 @@ Pei Core Firmware File System service routines.
Copyright (c) 2015 HP Development Company, L.P.
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -523,8 +523,10 @@ PeiInitializeFv ( // Post a call-back for the FvInfoPPI and FvInfo2PPI services to expose
// additional Fvs to PeiCore.
//
- Status = PeiServicesNotifyPpi (mNotifyOnFvInfoList);
- ASSERT_EFI_ERROR (Status);
+ // bugbug: Platform workaround
+ //
+ //Status = PeiServicesNotifyPpi (mNotifyOnFvInfoList);
+ //ASSERT_EFI_ERROR (Status);
}
@@ -559,6 +561,11 @@ FirmwareVolmeInfoPpiNotifyCallback ( VOID *DepexData;
BOOLEAN IsFvInfo2;
UINTN CurFvCount;
+ EFI_FV_INFO FvInfo;
+ EFI_FV_INFO TempFvInfo;
+ BOOLEAN CheckFvName;
+ UINTN Index;
+ EFI_PEI_FV_HANDLE OrgFvHandle;
Status = EFI_SUCCESS;
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
@@ -614,6 +621,12 @@ FirmwareVolmeInfoPpiNotifyCallback ( //
// Check whether the FV has already been processed.
//
+ CheckFvName = TRUE;
+ FvPpi->GetVolumeInfo (FvPpi, FvHandle, &FvInfo);
+ if (CompareGuid (&FvInfo.FvName, &gZeroGuid)) {
+ CheckFvName = FALSE;
+ }
+
for (FvIndex = 0; FvIndex < PrivateData->FvCount; FvIndex ++) {
if (PrivateData->Fv[FvIndex].FvHandle == FvHandle) {
if (IsFvInfo2 && (FvInfo2Ppi.AuthenticationStatus != PrivateData->Fv[FvIndex].AuthenticationStatus)) {
@@ -623,6 +636,34 @@ FirmwareVolmeInfoPpiNotifyCallback ( DEBUG ((EFI_D_INFO, "The Fv %p has already been processed!\n", FvInfo2Ppi.FvInfo));
return EFI_SUCCESS;
}
+ //
+ // bugbug: Platform workaround
+ //
+ if (CheckFvName) {
+ PrivateData->Fv[FvIndex].FvPpi->GetVolumeInfo (PrivateData->Fv[FvIndex].FvPpi, PrivateData->Fv[FvIndex].FvHandle, &TempFvInfo);
+ if (CompareGuid (&FvInfo.FvName, &TempFvInfo.FvName)) {
+ //
+ // They are same. Switch its data from original Handle to new Handle.
+ //
+ OrgFvHandle = PrivateData->Fv[FvIndex].FvHandle;
+ PrivateData->Fv[FvIndex].FvHandle = FvHandle;
+ PrivateData->Fv[FvIndex].FvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) FvInfo2Ppi.FvInfo;
+ PrivateData->Fv[FvIndex].FvPpi = FvPpi;
+ if (PrivateData->Fv[FvIndex].ScanFv) {
+ for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv) && (PrivateData->Fv[FvIndex].FvFileHandles[Index] != NULL); Index ++) {
+ PrivateData->Fv[FvIndex].FvFileHandles[Index] = (EFI_PEI_FILE_HANDLE *) (VOID *) ((UINTN) (VOID *) PrivateData->Fv[FvIndex].FvFileHandles[Index] - (UINTN) (VOID *) OrgFvHandle + (UINTN) (VOID *) FvHandle);
+ }
+ if (PrivateData->CurrentPeimFvCount == FvIndex) {
+ PrivateData->CurrentFileHandle =(EFI_PEI_FILE_HANDLE *) (VOID *) ((UINTN) (VOID *) PrivateData->CurrentFileHandle - (UINTN) (VOID *) OrgFvHandle + (UINTN) (VOID *) FvHandle);
+ for (Index = 0; Index < FixedPcdGet32 (PcdPeiCoreMaxPeimPerFv) && (PrivateData->CurrentFvFileHandles[Index] != NULL); Index ++) {
+ PrivateData->CurrentFvFileHandles[Index] = (EFI_PEI_FILE_HANDLE *) (VOID *) ((UINTN) (VOID *) PrivateData->CurrentFvFileHandles[Index] - (UINTN) (VOID *) OrgFvHandle + (UINTN) (VOID *) FvHandle);
+ }
+ }
+ }
+ DEBUG ((EFI_D_INFO, "The Fv has been migrated from %p to %p!\n", OrgFvHandle, FvHandle));
+ return EFI_SUCCESS;
+ }
+ }
}
if (PrivateData->FvCount >= PcdGet32 (PcdPeiCoreMaxFvSupported)) {
@@ -2160,6 +2201,15 @@ PeiReinitializeFv ( EFI_STATUS Status;
//
+ // Post a call-back for the FvInfoPPI and FvInfo2PPI services to expose
+ // additional Fvs to PeiCore.
+ //
+ // bugbug: Platform Workaround
+ //
+ Status = PeiServicesNotifyPpi (mNotifyOnFvInfoList);
+ ASSERT_EFI_ERROR (Status);
+
+ //
// Locate old build-in Ffs2 EFI_PEI_FIRMWARE_VOLUME_PPI which
// in flash.
//
diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/PeiMain.inf b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/PeiMain.inf index 7d9cdaa2f0..8c267fdf14 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/PeiMain.inf +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/PeiMain.inf @@ -6,7 +6,7 @@ # 2) Dispatch PEIM from discovered FV.
# 3) Handoff control to DxeIpl to load DXE core and enter DXE phase.
#
-# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -81,7 +81,8 @@ ## CONSUMES ## UNDEFINED # Locate ppi
## CONSUMES ## GUID # Used to compare with FV's file system guid and get the FV's file system format
gEfiFirmwareFileSystem3Guid
-
+ gZeroGuid
+
[Ppis]
gEfiPeiStatusCodePpiGuid ## SOMETIMES_CONSUMES # PeiReportStatusService is not ready if this PPI doesn't exist
gEfiPeiResetPpiGuid ## SOMETIMES_CONSUMES # PeiResetService is not ready if this PPI doesn't exist
diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Ppi/Ppi.c index 082c379458..768508f58e 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Ppi/Ppi.c +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Ppi/Ppi.c @@ -1,7 +1,7 @@ /** @file
EFI PEI Core PPI services
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -749,8 +749,10 @@ ProcessPpiListFromSec ( //
// It is a notification PPI.
//
- Status = InternalPeiNotifyPpi (PeiServices, (CONST EFI_PEI_NOTIFY_DESCRIPTOR *) PpiList, TRUE);
- ASSERT_EFI_ERROR (Status);
+ // bugbug: Platform workaround
+ //
+ //Status = InternalPeiNotifyPpi (PeiServices, (CONST EFI_PEI_NOTIFY_DESCRIPTOR *) PpiList, TRUE);
+ //ASSERT_EFI_ERROR (Status);
} else {
//
// It is a normal PPI.
diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Security/Security.c b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Security/Security.c index 763126057d..83c40456d1 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Security/Security.c +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Core/Pei/Security/Security.c @@ -1,7 +1,7 @@ /** @file
EFI PEI Core Security services
-Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -35,7 +35,10 @@ InitializeSecurityServices ( IN PEI_CORE_INSTANCE *OldCoreData
)
{
- if (OldCoreData == NULL) {
+ //
+ // bugbug: Platform workaround
+ //
+ if (OldCoreData != NULL) {
PeiServicesNotifyPpi (&mNotifyList);
}
return;
diff --git a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/PCD/Pei/Pcd.c b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/PCD/Pei/Pcd.c index 8d9328b544..8e95e8311a 100644 --- a/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/PCD/Pei/Pcd.c +++ b/Platform/BroxtonPlatformPkg/Common/SampleCode/MdeModulePkg/Universal/PCD/Pei/Pcd.c @@ -1,7 +1,7 @@ /** @file
All Pcd Ppi services are implemented here.
-Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
@@ -344,30 +344,55 @@ PcdPeimInit ( )
{
EFI_STATUS Status;
+ EFI_PEI_PPI_DESCRIPTOR *PeiPpiDescriptor;
BuildPcdDatabase (FileHandle);
//
- // Install PCD_PPI and EFI_PEI_PCD_PPI.
+ // Add shadow callback and PostMem logic so we can reinstall the Ppis before CAR is removed.
//
- Status = PeiServicesInstallPpi (&mPpiList[0]);
- ASSERT_EFI_ERROR (Status);
-
- //
- // Install GET_PCD_INFO_PPI and EFI_GET_PCD_INFO_PPI.
+ // bugbug: Platform workaround
//
- Status = PeiServicesInstallPpi (&mPpiList2[0]);
- ASSERT_EFI_ERROR (Status);
-
- Status = PeiServicesNotifyPpi (&mEndOfPeiSignalPpiNotifyList[0]);
- ASSERT_EFI_ERROR (Status);
+ Status = (*PeiServices)->RegisterForShadow (FileHandle);
+ if (Status == EFI_ALREADY_STARTED) {
+ Status = PeiServicesLocatePpi (
+ &gPcdPpiGuid, // GUID
+ 0, // INSTANCE
+ &PeiPpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
+ NULL // PPI
+ );
+ if (Status == EFI_SUCCESS) {
+ Status = PeiServicesReInstallPpi (PeiPpiDescriptor, &mPpiList[0]);
+ }
+ Status = PeiServicesLocatePpi (
+ &gEfiPeiPcdPpiGuid, // GUID
+ 0, // INSTANCE
+ &PeiPpiDescriptor, // EFI_PEI_PPI_DESCRIPTOR
+ NULL // PPI
+ );
+ if (Status == EFI_SUCCESS) {
+ Status = PeiServicesReInstallPpi (PeiPpiDescriptor, &mPpiList[1]);
+ }
+
+ Status = PeiServicesNotifyPpi (&mEndOfPeiSignalPpiNotifyList[0]);
+ ASSERT_EFI_ERROR (Status);
- Status = PeiRegisterCallBackOnSet (
- &gEfiMdeModulePkgTokenSpaceGuid,
- PcdToken(PcdSetNvStoreDefaultId),
- PcdSetNvStoreDefaultIdCallBack
- );
- ASSERT_EFI_ERROR (Status);
+ //
+ // Install GET_PCD_INFO_PPI and EFI_GET_PCD_INFO_PPI.
+ //
+ Status = PeiServicesInstallPpi (&mPpiList2[0]);
+ ASSERT_EFI_ERROR (Status);
+ } else {
+ Status = PeiServicesInstallPpi (&mPpiList[0]);
+ ASSERT_EFI_ERROR (Status);
+
+ Status = PeiRegisterCallBackOnSet (
+ &gEfiMdeModulePkgTokenSpaceGuid,
+ PcdToken(PcdSetNvStoreDefaultId),
+ PcdSetNvStoreDefaultIdCallBack
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
return Status;
}
|