From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DE0081A1E3E for ; Sat, 8 Oct 2016 18:28:37 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 08 Oct 2016 18:28:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,315,1473145200"; d="scan'208";a="888122230" Received: from jyao1-mobl.ccr.corp.intel.com ([10.239.192.129]) by orsmga003.jf.intel.com with ESMTP; 08 Oct 2016 18:28:36 -0700 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Feng Tian , Star Zeng , Liming Gao , Eric Dong , Ruiyu Ni Date: Sun, 9 Oct 2016 09:28:28 +0800 Message-Id: <1475976509-7580-3-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1475976509-7580-1-git-send-email-jiewen.yao@intel.com> References: <1475976509-7580-1-git-send-email-jiewen.yao@intel.com> Subject: [PATCH V2 2/3] MdeModulePkg/CdExpressPei: Use PcdRecoveryFileName PCD. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Oct 2016 01:28:38 -0000 This PCD is used to indicated the recovery file name. The previous name - FvMain.Fv is hardcoded in CdExpressPei. It does not make sense to force the name. Now a platform may use any recovery file name. Cc: Feng Tian Cc: Star Zeng Cc: Liming Gao Cc: Eric Dong Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- MdeModulePkg/Universal/Disk/CdExpressPei/CdExpressPei.inf | 5 ++++- MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c | 16 ++++++++++++++-- MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h | 7 +------ 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/CdExpressPei.inf b/MdeModulePkg/Universal/Disk/CdExpressPei/CdExpressPei.inf index e9d45e5..facad47 100644 --- a/MdeModulePkg/Universal/Disk/CdExpressPei/CdExpressPei.inf +++ b/MdeModulePkg/Universal/Disk/CdExpressPei/CdExpressPei.inf @@ -5,7 +5,7 @@ # finds whether there is Recovery data in the device. If it finds recovery # data, it will install Device Recovery Module PPI. # -# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions @@ -68,6 +68,9 @@ [FeaturePcd] gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport ## CONSUMES +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdRecoveryFileName ## CONSUMES + [Depex] gEfiPeiMemoryDiscoveredPpiGuid AND gEfiPeiBootInRecoveryModePpiGuid diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c index 371ab73..d3cbfaa 100644 --- a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c +++ b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.c @@ -17,6 +17,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "PeiCdExpress.h" PEI_CD_EXPRESS_PRIVATE_DATA *mPrivateData = NULL; +CHAR8 *mRecoveryFileName; +UINTN mRecoveryFileNameSize; /** Installs the Device Recovery Module PPI, Initialize BlockIo Ppi @@ -48,6 +50,16 @@ CdExpressPeimEntry ( return EFI_OUT_OF_RESOURCES; } + mRecoveryFileNameSize = PcdGetSize(PcdRecoveryFileName) / sizeof(CHAR16); + mRecoveryFileName = AllocatePool(mRecoveryFileNameSize); + if (mRecoveryFileName == NULL) { + return EFI_OUT_OF_RESOURCES; + } + Status = UnicodeStrToAsciiStrS(PcdGetPtr(PcdRecoveryFileName), mRecoveryFileName, mRecoveryFileNameSize); + if (EFI_ERROR(Status)) { + return Status; + } + // // Initialize Private Data (to zero, as is required by subsequent operations) // @@ -466,12 +478,12 @@ RetrieveCapsuleFileFromRoot ( } } - if (Index != (sizeof (PEI_RECOVERY_FILE_NAME) - 1)) { + if (Index != mRecoveryFileNameSize - 1) { Buffer += FileRecord->Length; continue; } - if (!StringCmp (FileRecord->FileID, (UINT8 *) PEI_RECOVERY_FILE_NAME, sizeof (PEI_RECOVERY_FILE_NAME) - 1, FALSE)) { + if (!StringCmp (FileRecord->FileID, (UINT8 *)mRecoveryFileName, mRecoveryFileNameSize - 1, FALSE)) { Buffer += FileRecord->Length; continue; } diff --git a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h index 91f34dc..1c8843c 100644 --- a/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h +++ b/MdeModulePkg/Universal/Disk/CdExpressPei/PeiCdExpress.h @@ -1,7 +1,7 @@ /** @file Header file for CD recovery PEIM -Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions @@ -43,11 +43,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define PEI_MEMMORY_PAGE_SIZE 0x1000 // -// Recovery file name (in root directory) -// -#define PEI_RECOVERY_FILE_NAME "FVMAIN.FV" - -// // Following are defined according to ISO-9660 specification // #define PEI_CD_STANDARD_ID "CD001" -- 2.7.4.windows.1