From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.115; helo=mga14.intel.com; envelope-from=zhichao.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 07AB0211E3486 for ; Thu, 21 Mar 2019 19:22:44 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Mar 2019 19:22:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,255,1549958400"; d="scan'208";a="330869020" Received: from gaozhic-mobl.ccr.corp.intel.com ([10.239.196.107]) by fmsmga005.fm.intel.com with ESMTP; 21 Mar 2019 19:22:42 -0700 From: Zhichao Gao To: edk2-devel@lists.01.org Cc: Liming Gao , Michael D Kinney Date: Fri, 22 Mar 2019 10:22:36 +0800 Message-Id: <20190322022236.544-3-zhichao.gao@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: <20190322022236.544-1-zhichao.gao@intel.com> References: <20190322022236.544-1-zhichao.gao@intel.com> Subject: [PATCH 2/2] FmpDevicePkg/FmpDxe: Change the default Image Type ID X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2019 02:22:44 -0000 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1638 Change the default Image Type id from gEfiCallerIdGuid to PcdFmpDeviceImageDefaultTypeIdGuid. If the pcd is not initialized as a valid GUID value, the driver will ASSERT and fall back to gEfiCallerIdGuid. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhichao Gao Cc: Liming Gao Cc: Michael D Kinney --- FmpDevicePkg/FmpDxe/FmpDxe.c | 26 ++++++++++++++++++-------- FmpDevicePkg/FmpDxe/FmpDxe.inf | 3 ++- FmpDevicePkg/FmpDxe/FmpDxeLib.inf | 3 ++- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c index 57eac5ac14..5dee59e378 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.c +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c @@ -4,7 +4,7 @@ information provided through PCDs and libraries. Copyright (c) 2016, Microsoft Corporation. All rights reserved.
- Copyright (c) 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -152,7 +152,10 @@ FmpDxeProgress ( /** Returns a pointer to the ImageTypeId GUID value. An attempt is made to get the GUID value from the FmpDeviceLib. If the FmpDeviceLib does not provide - a GUID value, then gEfiCallerIdGuid is returned. + a GUID value, then PcdFmpDeviceImageDefaultTypeIdGuid is returned. + + If the PcdFmpDeviceImageDefaultTypeIdGuid is not initialize as a EFI_GUID, + then ASSERT(). @return The ImageTypeId GUID @@ -167,16 +170,23 @@ GetImageTypeIdGuid ( FmpDeviceLibGuid = NULL; Status = FmpDeviceGetImageTypeIdGuidPtr (&FmpDeviceLibGuid); - if (EFI_ERROR (Status)) { + + if (EFI_ERROR(Status) || FmpDeviceLibGuid == NULL) { if (Status != EFI_UNSUPPORTED) { DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid error %r\n", Status)); } - return &gEfiCallerIdGuid; - } - if (FmpDeviceLibGuid == NULL) { - DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid GUID\n")); - return &gEfiCallerIdGuid; + if (FmpDeviceLibGuid == NULL) { + DEBUG ((DEBUG_ERROR, "FmpDxe: FmpDeviceLib GetImageTypeIdGuidPtr() returned invalid GUID\n")); + } + if (PcdGetSize (PcdFmpDeviceImageDefaultTypeIdGuid) == sizeof (EFI_GUID)) { + FmpDeviceLibGuid = (EFI_GUID *)PcdGetPtr (PcdFmpDeviceImageDefaultTypeIdGuid); + } else { + DEBUG ((DEBUG_ERROR, "FmpDxe %s: FmpDeviceLib did not return a GUID and PcdFmpDeviceImageDefaultTypeIdGuid is undefined\n", mImageIdName)); + ASSERT (FALSE); + FmpDeviceLibGuid = &gEfiCallerIdGuid; + } } + return FmpDeviceLibGuid; } diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.inf b/FmpDevicePkg/FmpDxe/FmpDxe.inf index 228e53658a..52807ca2cb 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.inf +++ b/FmpDevicePkg/FmpDxe/FmpDxe.inf @@ -4,7 +4,7 @@ # information provided through PCDs and libraries. # # Copyright (c) 2016, Microsoft Corporation. All rights reserved.
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -84,6 +84,7 @@ gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr ## CONSUMES gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## SOMETIMES_PRODUCES + gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid ## SOMETIMES_CONSUMES [Depex] gEfiVariableWriteArchProtocolGuid AND gEdkiiVariableLockProtocolGuid diff --git a/FmpDevicePkg/FmpDxe/FmpDxeLib.inf b/FmpDevicePkg/FmpDxe/FmpDxeLib.inf index 5484531155..57189a77d1 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxeLib.inf +++ b/FmpDevicePkg/FmpDxe/FmpDxeLib.inf @@ -4,7 +4,7 @@ # information provided through PCDs and libraries. # # Copyright (c) 2016, Microsoft Corporation. All rights reserved.
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
# # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: @@ -84,6 +84,7 @@ gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr ## CONSUMES gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest ## CONSUMES gEfiMdeModulePkgTokenSpaceGuid.PcdTestKeyUsed ## SOMETIMES_PRODUCES + gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageDefaultTypeIdGuid ## SOMETIMES_CONSUMES [Depex] gEfiVariableWriteArchProtocolGuid AND gEdkiiVariableLockProtocolGuid -- 2.16.2.windows.1