summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhang, Chao B <chao.b.zhang@intel.com>2016-05-17 15:35:21 +0800
committerZhang, Chao B <chao.b.zhang@intel.com>2016-05-19 10:32:09 +0800
commit7147077b1685ef62353ec4104a902cb37c4e57ee (patch)
treee30bb28ecbbae3ed3b06e1cc633b2c22cac8a4c9
parent298454472bf4cf088a694bafa3b66503b4f8a39d (diff)
downloadedk2-7147077b1685ef62353ec4104a902cb37c4e57ee.zip
edk2-7147077b1685ef62353ec4104a902cb37c4e57ee.tar.gz
edk2-7147077b1685ef62353ec4104a902cb37c4e57ee.tar.bz2
MdeModulePkg: PeiCore: Fix PEI Multiple Sub-FV Support issue
FirmwareVolmeInfoPpiNotifyCallback is re-enterable during FV process. Since PrivateData->FVCount increases when processing each sub FVs, need to cache Parent FV count in stack before processing any sub FV. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Chao Zhang <chao.b.zhang@intel.com> Reviewed-by: Gao Liming <liming.gao@intel.com>
-rw-r--r--MdeModulePkg/Core/Pei/FwVol/FwVol.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 8f6e2ef..6ca41ee 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/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 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, 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
@@ -545,7 +545,8 @@ FirmwareVolmeInfoPpiNotifyCallback (
EFI_PEI_FILE_HANDLE FileHandle;
VOID *DepexData;
BOOLEAN IsFvInfo2;
-
+ UINTN CurFvCount;
+
Status = EFI_SUCCESS;
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
@@ -610,10 +611,11 @@ FirmwareVolmeInfoPpiNotifyCallback (
PrivateData->Fv[PrivateData->FvCount].FvPpi = FvPpi;
PrivateData->Fv[PrivateData->FvCount].FvHandle = FvHandle;
PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = FvInfo2Ppi.AuthenticationStatus;
+ CurFvCount = PrivateData->FvCount;
DEBUG ((
EFI_D_INFO,
"The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
- (UINT32) PrivateData->FvCount,
+ (UINT32) CurFvCount,
(VOID *) FvInfo2Ppi.FvInfo,
FvInfo2Ppi.FvInfoSize,
FvHandle
@@ -647,8 +649,8 @@ FirmwareVolmeInfoPpiNotifyCallback (
}
}
- DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, PrivateData->FvCount - 1, FvHandle));
- ProcessFvFile (PrivateData, &PrivateData->Fv[PrivateData->FvCount - 1], FileHandle);
+ DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, CurFvCount, FvHandle));
+ ProcessFvFile (PrivateData, &PrivateData->Fv[CurFvCount], FileHandle);
}
} while (FileHandle != NULL);
} else {
@@ -2216,7 +2218,8 @@ ThirdPartyFvPpiNotifyCallback (
UINTN FvIndex;
EFI_PEI_FILE_HANDLE FileHandle;
VOID *DepexData;
-
+ UINTN CurFvCount;
+
PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS (PeiServices);
FvPpi = (EFI_PEI_FIRMWARE_VOLUME_PPI*) Ppi;
@@ -2264,10 +2267,11 @@ ThirdPartyFvPpiNotifyCallback (
PrivateData->Fv[PrivateData->FvCount].FvPpi = FvPpi;
PrivateData->Fv[PrivateData->FvCount].FvHandle = FvHandle;
PrivateData->Fv[PrivateData->FvCount].AuthenticationStatus = AuthenticationStatus;
+ CurFvCount = PrivateData->FvCount;
DEBUG ((
EFI_D_INFO,
"The %dth FV start address is 0x%11p, size is 0x%08x, handle is 0x%p\n",
- (UINT32) PrivateData->FvCount,
+ (UINT32) CurFvCount,
(VOID *) FvInfo,
FvInfoSize,
FvHandle
@@ -2301,8 +2305,8 @@ ThirdPartyFvPpiNotifyCallback (
}
}
- DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, PrivateData->FvCount - 1, FvHandle));
- ProcessFvFile (PrivateData, &PrivateData->Fv[PrivateData->FvCount - 1], FileHandle);
+ DEBUG ((EFI_D_INFO, "Found firmware volume Image File %p in FV[%d] %p\n", FileHandle, CurFvCount, FvHandle));
+ ProcessFvFile (PrivateData, &PrivateData->Fv[CurFvCount], FileHandle);
}
} while (FileHandle != NULL);
} while (TRUE);