From nobody Fri Apr 19 01:18:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+45328+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45328+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1565574318; cv=none; d=zoho.com; s=zohoarc; b=Lu6V9Y+qFfItAeSimKvsuvi5WULCsDX2atY6baT4UOQtLqypOu4/hfHdHY53DNuG5CK+VJrcrKoijzXziYj+vTVsZ4O2CyrCD6tRgQdf48SnSUenACl9aiGgTS46+WpkC4uUjunujAbrBdDoru3o/5eWGJ1P8cBYifQYNcYTTu8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565574318; h=Content-Transfer-Encoding:Cc:Date:From:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To:ARC-Authentication-Results; bh=fP4ZS3k/AlAha1CiPdqVzEoR/2umdGw7+pNMdbIZBgM=; b=mo0hPwJAJsGSOjcrCa+Ledgxd3SAeHSQnPZQEd/+90tHjrHqjVsDSZFbmbBByGX3jUS/neBkqg1l8NKoNJeaKgyCKdRdSIBUrOACaJAG+61NO67T8KS+7KUi43j4adh29/QpPMMedS8YaYIIInQ0UeZVJX22bgAcZKczp/1412Q= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+45328+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1565574317966339.01031113182114; Sun, 11 Aug 2019 18:45:17 -0700 (PDT) Return-Path: X-Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Sun, 11 Aug 2019 18:45:16 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Aug 2019 18:45:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,375,1559545200"; d="scan'208";a="327208219" X-Received: from unknown (HELO jjin9-MOBL.ccr.corp.intel.com) ([10.239.192.132]) by orsmga004.jf.intel.com with ESMTP; 11 Aug 2019 18:45:14 -0700 From: "Eric Jin" To: devel@edk2.groups.io Cc: Zailiang Sun , Yi Qian , Michael D Kinney , Liming Gao Subject: [edk2-devel] [edk2-platforms][PATCH] Vlv2TbltDevicePkg/FmpDeviceLib: Implement new APIs Date: Mon, 12 Aug 2019 09:44:54 +0800 Message-Id: <20190812014454.44628-1-eric.jin@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,eric.jin@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1565574317; bh=5U1boJhY0Gh1C3iiiCTd7E4u8umkHb6R9jrmBpRvnJA=; h=Cc:Date:From:Reply-To:Subject:To; b=i5qHrO94tr9emm73KGQRNpkWyeGzPn+InAwcdeHXLfoRqkzZgfIrGOm3grIBprthWtM DSCkwYEr0fhuXP/SmiD6/o7WlQHH6o9eDH592zRe+W0friz05i8Av6jpZimKm3otQWE8z AkH4k6AzrGbFemIv7BKZ1+Ii52+6WGrohQU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Implement new APIs defined in FmpDeviceLib * RegisterFmpUninstaller() * FmpDeviceSetContext() * FmpDeviceGetHardwareInstance() Cc: Zailiang Sun Cc: Yi Qian Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Eric Jin Reviewed-by: Zailiang Sun --- .../Library/FmpDeviceLib/FmpDeviceLib.c | 95 ++++++++++++++++++ .../Library/FmpDeviceLibSample/FmpDeviceLib.c | 99 ++++++++++++++++++- 2 files changed, 192 insertions(+), 2 deletions(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDe= viceLib/FmpDeviceLib.c b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/L= ibrary/FmpDeviceLib/FmpDeviceLib.c index 57185d8d09..d8c9036012 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib= /FmpDeviceLib.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib= /FmpDeviceLib.c @@ -66,6 +66,73 @@ RegisterFmpInstaller ( return EFI_UNSUPPORTED; } =20 +/** + Provide a function to uninstall the Firmware Management Protocol instanc= e from a + device handle when the device is managed by a driver that follows the UE= FI + Driver Model. If the device is not managed by a driver that follows the= UEFI + Driver Model, then EFI_UNSUPPORTED is returned. + + @param[in] FmpUninstaller Function that installs the Firmware Management + Protocol. + + @retval EFI_SUCCESS The device is managed by a driver that follows = the + UEFI Driver Model. FmpUinstaller must be calle= d on + each Driver Binding Stop(). + @retval EFI_UNSUPPORTED The device is not managed by a driver that foll= ows + the UEFI Driver Model. + @retval other The Firmware Management Protocol for this firmw= are + device is not installed. The firmware device is + still locked using FmpDeviceLock(). + +**/ +EFI_STATUS +EFIAPI +RegisterFmpUninstaller ( + IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller + ) +{ + // + // This is a system firmware update that does not use Driver Binding Pro= tocol + // + return EFI_UNSUPPORTED; +} + +/** + Set the device context for the FmpDeviceLib services when the device is + managed by a driver that follows the UEFI Driver Model. If the device i= s not + managed by a driver that follows the UEFI Driver Model, then EFI_UNSUPPO= RTED + is returned. Once a device context is set, the FmpDeviceLib services + operate on the currently set device context. + + @param[in] Handle Device handle for the FmpDeviceLib services. + If Handle is NULL, then Context is freed. + @param[in, out] Context Device context for the FmpDeviceLib services. + If Context is NULL, then a new context is alloc= ated + for Handle and the current device context is se= t and + returned in Context. If Context is not NULL, t= hen + the current device context is set. + + @retval EFI_SUCCESS The device is managed by a driver that follows = the + UEFI Driver Model. + @retval EFI_UNSUPPORTED The device is not managed by a driver that foll= ows + the UEFI Driver Model. + @retval other The Firmware Management Protocol for this firmw= are + device is not installed. The firmware device is + still locked using FmpDeviceLock(). + +**/ +EFI_STATUS +EFIAPI +FmpDeviceSetContext ( + IN EFI_HANDLE Handle, + IN OUT VOID **Context + ) +{ + // + // This is a system firmware update that does not use Driver Binding Pro= tocol + // + return EFI_UNSUPPORTED; +} =20 /** Returns the size, in bytes, of the firmware image currently stored in the @@ -289,6 +356,34 @@ FmpDeviceGetVersion ( return EFI_SUCCESS; } =20 +/** + Returns the value used to fill in the HardwareInstance field of the + EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImage= Info() + service of the Firmware Management Protocol. If EFI_SUCCESS is returned= , then + the firmware device supports a method to report the HardwareInstance val= ue. + If the value can not be reported for the firmware device, then EFI_UNSUP= PORTED + must be returned. EFI_DEVICE_ERROR is returned if an error occurs attem= pting + to retrieve the HardwareInstance value for the firmware device. + + @param[out] HardwareInstance The hardware instance value for the firmwa= re + device. + + @retval EFI_SUCCESS The hardware instance for the current firmware + devide is returned in HardwareInstance. + @retval EFI_UNSUPPORTED The firmware device does not support a method = to + report the hardware instance value. + @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the h= ardware + instance value. + +**/ +EFI_STATUS +EFIAPI +FmpDeviceGetHardwareInstance ( + OUT UINT64 *HardwareInstance + ) +{ + return EFI_UNSUPPORTED; +} =20 /** Retrieves a copy of the current firmware image of the device. diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDe= viceLibSample/FmpDeviceLib.c b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Cap= sule/Library/FmpDeviceLibSample/FmpDeviceLib.c index 80ce83a14b..db0f238ea5 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib= Sample/FmpDeviceLib.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/Feature/Capsule/Library/FmpDeviceLib= Sample/FmpDeviceLib.c @@ -1,8 +1,8 @@ /** =20 -Copyright (c) 2016, Microsoft Corporation +Copyright (c) 2016, Microsoft Corporation. All rights reserved.
+Copyright (c) 2019, Intel Corporation. All rights reserved.
=20 -All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -43,6 +43,73 @@ IN FMP_DEVICE_LIB_REGISTER_FMP_INSTALLER Func return EFI_UNSUPPORTED; } =20 +/** + Provide a function to uninstall the Firmware Management Protocol instanc= e from a + device handle when the device is managed by a driver that follows the UE= FI + Driver Model. If the device is not managed by a driver that follows the= UEFI + Driver Model, then EFI_UNSUPPORTED is returned. + + @param[in] FmpUninstaller Function that installs the Firmware Management + Protocol. + + @retval EFI_SUCCESS The device is managed by a driver that follows = the + UEFI Driver Model. FmpUinstaller must be calle= d on + each Driver Binding Stop(). + @retval EFI_UNSUPPORTED The device is not managed by a driver that foll= ows + the UEFI Driver Model. + @retval other The Firmware Management Protocol for this firmw= are + device is not installed. The firmware device is + still locked using FmpDeviceLock(). + +**/ +EFI_STATUS +EFIAPI +RegisterFmpUninstaller ( + IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller + ) +{ + // + // This is a system firmware update that does not use Driver Binding Pro= tocol + // + return EFI_UNSUPPORTED; +} + +/** + Set the device context for the FmpDeviceLib services when the device is + managed by a driver that follows the UEFI Driver Model. If the device i= s not + managed by a driver that follows the UEFI Driver Model, then EFI_UNSUPPO= RTED + is returned. Once a device context is set, the FmpDeviceLib services + operate on the currently set device context. + + @param[in] Handle Device handle for the FmpDeviceLib services. + If Handle is NULL, then Context is freed. + @param[in, out] Context Device context for the FmpDeviceLib services. + If Context is NULL, then a new context is alloc= ated + for Handle and the current device context is se= t and + returned in Context. If Context is not NULL, t= hen + the current device context is set. + + @retval EFI_SUCCESS The device is managed by a driver that follows = the + UEFI Driver Model. + @retval EFI_UNSUPPORTED The device is not managed by a driver that foll= ows + the UEFI Driver Model. + @retval other The Firmware Management Protocol for this firmw= are + device is not installed. The firmware device is + still locked using FmpDeviceLock(). + +**/ +EFI_STATUS +EFIAPI +FmpDeviceSetContext ( + IN EFI_HANDLE Handle, + OUT VOID **Context + ) +{ + // + // This is a system firmware update that does not use Driver Binding Pro= tocol + // + return EFI_UNSUPPORTED; +} =20 /** Used to get the size of the image in bytes. @@ -201,6 +268,34 @@ IN OUT UINT32* Version return EFI_UNSUPPORTED; } =20 +/** + Returns the value used to fill in the HardwareInstance field of the + EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImage= Info() + service of the Firmware Management Protocol. If EFI_SUCCESS is returned= , then + the firmware device supports a method to report the HardwareInstance val= ue. + If the value can not be reported for the firmware device, then EFI_UNSUP= PORTED + must be returned. EFI_DEVICE_ERROR is returned if an error occurs attem= pting + to retrieve the HardwareInstance value for the firmware device. + + @param[out] HardwareInstance The hardware instance value for the firmwa= re + device. + + @retval EFI_SUCCESS The hardware instance for the current firmware + devide is returned in HardwareInstance. + @retval EFI_UNSUPPORTED The firmware device does not support a method = to + report the hardware instance value. + @retval EFI_DEVICE_ERROR An error occurred attempting to retrieve the h= ardware + instance value. + +**/ +EFI_STATUS +EFIAPI +FmpDeviceGetHardwareInstance ( + OUT UINT64 *HardwareInstance + ) +{ + return EFI_UNSUPPORTED; +} =20 /** Retrieves a copy of the current firmware image of the device. --=20 2.20.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#45328): https://edk2.groups.io/g/devel/message/45328 Mute This Topic: https://groups.io/mt/32836316/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-