summaryrefslogtreecommitdiffstats
path: root/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
diff options
context:
space:
mode:
authorZhiguang Liu <zhiguang.liu@intel.com>2021-06-10 15:08:13 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-06-24 09:16:22 +0000
commit27cb64fffc8669ce1992c6dd24909e14bc24ee16 (patch)
tree1bd2257a74bba2bfb656e1451650fe448e2bf6ae /UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
parentb208d37c73a71be20e007ca4917b3a25c732b605 (diff)
downloadedk2-27cb64fffc8669ce1992c6dd24909e14bc24ee16.tar.gz
edk2-27cb64fffc8669ce1992c6dd24909e14bc24ee16.tar.bz2
edk2-27cb64fffc8669ce1992c6dd24909e14bc24ee16.zip
UefiPayloadPkg: Fix up UPL Pcd database
Edk2 bootloader will pass the pei pcd database, and UPL also contain a PCD database. Dxe PCD driver has the assumption that the two PCD database can be catenated and the local token number should be successive。 This patch will manually fix up the UPL PCD database to meet that assumption. Cc: Maurice Ma <maurice.ma@intel.com> Cc: Guo Dong <guo.dong@intel.com> Cc: Benjamin You <benjamin.you@intel.com> Reviewed-by: Guo Dong <guo.dong@intel.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Diffstat (limited to 'UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c')
-rw-r--r--UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
index f5d70c59f8..0b6cb47cd0 100644
--- a/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
+++ b/UefiPayloadPkg/UefiPayloadEntry/LoadDxeCore.c
@@ -114,20 +114,23 @@ LoadPeCoffImage (
}
/**
- This function searchs a given file type within a valid FV.
+ This function searchs a given file type with a given Guid within a valid FV.
+ If input Guid is NULL, will locate the first section having the given file type
@param FvHeader A pointer to firmware volume header that contains the set of files
to be searched.
@param FileType File type to be searched.
+ @param Guid Will ignore if it is NULL.
@param FileHeader A pointer to the discovered file, if successful.
@retval EFI_SUCCESS Successfully found FileType
@retval EFI_NOT_FOUND File type can't be found.
**/
EFI_STATUS
-FvFindFile (
+FvFindFileByTypeGuid (
IN EFI_FIRMWARE_VOLUME_HEADER *FvHeader,
IN EFI_FV_FILETYPE FileType,
+ IN EFI_GUID *Guid OPTIONAL,
OUT EFI_FFS_FILE_HEADER **FileHeader
)
{
@@ -171,8 +174,10 @@ FvFindFile (
// Look for file type
//
if (File->Type == FileType) {
- *FileHeader = File;
- return EFI_SUCCESS;
+ if (Guid == NULL || CompareGuid(&File->Name, Guid)) {
+ *FileHeader = File;
+ return EFI_SUCCESS;
+ }
}
}
@@ -266,7 +271,7 @@ LoadDxeCore (
//
// DXE FV is inside Payload FV. Here find DXE FV from Payload FV
//
- Status = FvFindFile (PayloadFv, EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE, &FileHeader);
+ Status = FvFindFileByTypeGuid (PayloadFv, EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE, NULL, &FileHeader);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -283,7 +288,7 @@ LoadDxeCore (
//
// Find DXE core file from DXE FV
//
- Status = FvFindFile (DxeCoreFv, EFI_FV_FILETYPE_DXE_CORE, &FileHeader);
+ Status = FvFindFileByTypeGuid (DxeCoreFv, EFI_FV_FILETYPE_DXE_CORE, NULL, &FileHeader);
if (EFI_ERROR (Status)) {
return Status;
}
@@ -330,7 +335,7 @@ UniversalLoadDxeCore (
//
// Find DXE core file from DXE FV
//
- Status = FvFindFile (DxeFv, EFI_FV_FILETYPE_DXE_CORE, &FileHeader);
+ Status = FvFindFileByTypeGuid (DxeFv, EFI_FV_FILETYPE_DXE_CORE, NULL, &FileHeader);
if (EFI_ERROR (Status)) {
return Status;
}