From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (NAM02-SN1-obe.outbound.protection.outlook.com [40.107.77.78]) by mx.groups.io with SMTP id smtpd.web09.3492.1618954561167488170 for ; Tue, 20 Apr 2021 14:36:01 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@nvidia.com header.s=selector2 header.b=CK+6cnn5; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: nvidia.com, ip: 40.107.77.78, mailfrom: jrahn@nvidia.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iVaNI2WWprispIQSlY/Qw4gkpBa1eQsxyAGQucxlKx1GU6100NPePI/CSV/gh+rAIgUbE1S0GvvOziJQB7JQsVS+swZ+nIG5UDV8HeMkwbxsDD4pEmFCuTbqEOyQTAiLPiZdNa80D6nufXnis3NLH+uS64LB8JqcOrXV1pwNAOM4cBwHLgmHJq6BvP3sp/FN5yclOWzBMagS3z7m0xR6h4mpamZLL3vH9EP6/x3x1LNA0fS+660mN5wTKGtGtIZAflhaPa5i0Gt5vA7XWmfOjj6Cbp0uCNNwc8sffBQpz3xwm2VxqU3rmP5EjtXj3DxFOYg83PXn0pYpURxtaKM5dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kRJs5VsNPCOHiRBV0rRr2My/RmRNiXZ/yoEmOhpUHq0=; b=ngB0hLNFAEDRqKuzIwGuh0X0OhAhNWx1WdTzd5trqjHOzARZpRGyud/Ml1X8jT5fgSxG2yD94GYJB1P5llc3L6oJMH61im3ntEqT0cHrOFJ2pilxK2xrcJS664oiMuYz8pA6WCAgUclvNqbDtW1ZgKmYZOgo6cZ3ifR2/off/XGv55Mi46gUxBLmyiP01s/vBxkCDVzSt3DpfJbg7U6/BrK8ZqDrtOILK/K0P/J/QoV4G2Q34b771N2SkBI1GjAqDuBMQ7s76GWwScw4ZxzqGfC3y/9qM7/NmScb/Lohd1oiZ824z50/95MtU9PpJIO8WH3GsnSPQXBdWz+0V8HLFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.112.32) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=nvidia.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=kRJs5VsNPCOHiRBV0rRr2My/RmRNiXZ/yoEmOhpUHq0=; b=CK+6cnn5QtTVA8KkrttKPPldSaOabnNYXdsE1h2izVyfJ5pnWrCJwP6onuZF3FLza8/HzYojRIvg3fhNabU4jTPO8q+E4TU4Brp8nsewlhrCZRj5ThQe+IWJe1AagkRpuqcoB0FfJND5IvY75gp27h5gsJi3jy+jrq+FS+GaIHJJOcMINEoj4FH0DNIAi2DHagMX/m5UfVXcSgib8IIIj2oJpQKFlbuVtYoZE9QZxc5jYFd0Ibhmj+lJjo70srQXQE05aXZlXPYgfDC7pET5PMXk556quPU4+JXdX8XeKupOY2v1mqoF1k5O7y1fYcaYFbTFKiVB0hKgBznT6bs0eg== Received: from DM5PR04CA0025.namprd04.prod.outlook.com (2603:10b6:3:12b::11) by BN8PR12MB3393.namprd12.prod.outlook.com (2603:10b6:408:46::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.19; Tue, 20 Apr 2021 21:35:59 +0000 Received: from DM6NAM11FT050.eop-nam11.prod.protection.outlook.com (2603:10b6:3:12b:cafe::b2) by DM5PR04CA0025.outlook.office365.com (2603:10b6:3:12b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.18 via Frontend Transport; Tue, 20 Apr 2021 21:35:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.112.32) smtp.mailfrom=nvidia.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.112.32 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.112.32; helo=mail.nvidia.com; Received: from mail.nvidia.com (216.228.112.32) by DM6NAM11FT050.mail.protection.outlook.com (10.13.173.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4065.21 via Frontend Transport; Tue, 20 Apr 2021 21:35:59 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Apr 2021 14:35:58 -0700 Received: from HQMAIL111.nvidia.com (172.20.187.18) by HQMAIL105.nvidia.com (172.20.187.12) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 20 Apr 2021 21:35:57 +0000 Received: from JRAHN-LT.nvidia.com (172.20.145.6) by mail.nvidia.com (172.20.187.18) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 20 Apr 2021 21:35:57 +0000 From: "John Rahn" To: CC: Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu Subject: [PATCH v1 1/1] FmpDevicePkg: FmpDeviceLib interface change for Driver Unload support Date: Tue, 20 Apr 2021 14:35:57 -0700 Message-ID: <20210420213557.9498-2-jrahn@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210420213557.9498-1-jrahn@nvidia.com> References: <20210420213557.9498-1-jrahn@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public Return-Path: JRahn@nvidia.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c8a9f4bc-e06c-4a26-dc2d-08d904444a0a X-MS-TrafficTypeDiagnostic: BN8PR12MB3393: X-Microsoft-Antispam-PRVS: X-MS-Exchange-Transport-Forked: True X-MS-Oob-TLC-OOBClassifiers: OLM:7691; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: cQBV9RfQ89FUh3SGiB/mMSAjcvuXsDx3W3/DWLvETXqgzeo3r+i2sN48rBGoqdU2EjdCt1ecAeBJoRSA9GpD72em8o6TBwkmfNTd24xDH8kXoMK+4CLNnFiJUedzre9pXfOYWlcsHYjcvsurIa96ycCHpvzy7MorQez79HJ/aR1jrQe+LVsgl+cp9d9A9gUNV3xCRlJccSHyrDB7GqidInxhqw0Uxd1G0Z2SuLmClGcX8D4FJ5b7lCQ1t/Wi4WH6OZdmQzUPnV2smug2RbL2Bosys6doi42RjltGHl6ktBvWHDCxkBffOKsX+MfRdX5LHtCzcsUNFcz1FMRtl2aKJXQJmfp9J5h6cx6D626F93wL5+EN/OlPCgPlhoZI50NNRYeJC5nvVulO+GatbDCHnZpRvTS4Xw+/Q9K64nJrMWIVY8hFJ1XoVXrTuh+Sk6ndDD2lUdrsjo1+g3pVpWoJXd6jh77CvebksEYkzoYOsn36nEYuO1GqWsyr3T5jVqgOx4J9lV3ZnKojizJkZBtQczo8QZcLRUtuaEYx5bSfqOAwpA/QgzANwSLPB53X1JUQUSQPRbFKeR/TOtJT4JdCxFn0SQbYxSPgU6VxMt46AN95WkILTD858pfVfCKC75u4wUbAI/Prv1b5p8SsjYamHaedtsCNfK8j8w8J+05PwTjGKy3wnLOdwsIEaeNNE6EHPtPMkVERkdSEsAmvV3OTiNwkoWfuL/4vYog00frEWI4= X-Forefront-Antispam-Report: CIP:216.228.112.32;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:schybrid01.nvidia.com;CAT:NONE;SFS:(4636009)(136003)(39860400002)(396003)(346002)(376002)(46966006)(36840700001)(86362001)(82310400003)(6916009)(83380400001)(2906002)(7696005)(8936002)(316002)(19627235002)(4326008)(966005)(478600001)(5660300002)(186003)(1076003)(47076005)(356005)(26005)(36860700001)(54906003)(7636003)(36756003)(2616005)(82740400003)(336012)(426003)(70586007)(70206006)(8676002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2021 21:35:59.4869 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c8a9f4bc-e06c-4a26-dc2d-08d904444a0a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.112.32];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT050.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN8PR12MB3393 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable https://bugzilla.tianocore.org/show_bug.cgi?id=3D3342 FmpDeviceLib interface for Driver Unload is missing Add FmpDeviceLibUnloadImage function declaration and NULL sample. Add FmpDxeUnloadImage function. Replace UNLOAD_IMAGE function in FmpDxe sample with FmpDxeUnloadImage. Cc: Liming Gao Cc: Michael D Kinney Cc: Guomin Jiang Cc: Wei6 Xu Signed-off-by: John Rahn --- FmpDevicePkg/FmpDxe/FmpDxe.inf | 2 +- FmpDevicePkg/Include/Library/FmpDeviceLib.h | 21 ++++++++++++++++= + FmpDevicePkg/FmpDxe/FmpDxe.c | 21 ++++++++++++++++= + FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c | 24 ++++++++++++++++= ++++ 4 files changed, 67 insertions(+), 1 deletion(-) diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.inf b/FmpDevicePkg/FmpDxe/FmpDxe.in= f index eeb904a09148..2de9e3e4f2ad 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.inf +++ b/FmpDevicePkg/FmpDxe/FmpDxe.inf @@ -17,7 +17,7 @@ [Defines] MODULE_TYPE =3D DXE_DRIVER VERSION_STRING =3D 1.0 ENTRY_POINT =3D FmpDxeEntryPoint - UNLOAD_IMAGE =3D UninstallFmpInstance + UNLOAD_IMAGE =3D BZ3342FmpDxeUnloadImage =20 # # The following information is for reference only and not required by the = build tools. diff --git a/FmpDevicePkg/Include/Library/FmpDeviceLib.h b/FmpDevicePkg/Inc= lude/Library/FmpDeviceLib.h index 6abd99fa1f47..d9da5b940886 100644 --- a/FmpDevicePkg/Include/Library/FmpDeviceLib.h +++ b/FmpDevicePkg/Include/Library/FmpDeviceLib.h @@ -104,6 +104,27 @@ RegisterFmpUninstaller ( IN FMP_DEVICE_LIB_REGISTER_FMP_UNINSTALLER FmpUninstaller ); =20 +/** + Function that unloads a Firmware Management Device Library based driver = instance when + the FmpDeviceLib supports the driver binding model. + If the FmpDeviceLib does not support the UEFI driver model, the FmpDevic= eLib Unload Image + should return EFI_UNSUPPORTED. + + @param[in] =C2=A0ImageHandle =C2=A0The driver handle managing the Firmwa= re Management Protocol instance to unload. + + @retval EFI_SUCCESS =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Dri= ver image was removed successfully. + @retval EFI_UNSUPPORTED =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The device is= not managed by a driver that follows + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the UEFI Driver Model. + @retval EFI_INVALID_PARAMETER =C2=A0 =C2=A0 ImageHandle is NULL. + @retval EFI_INVALID_PARAMETER =C2=A0 =C2=A0 ImageHandle does not match d= river image handle. + @retval other =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 Driver image was not removed. +**/ +EFI_STATUS +EFIAPI +BZ3342FmpDeviceLibUnloadImage ( + IN EFI_HANDLE ImageHandle + ); + /** 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 diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c index 6b0675ea38f8..6680a381b8fe 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.c +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c @@ -1813,6 +1813,27 @@ UninstallFmpInstance ( return EFI_SUCCESS; } =20 +/** + Unloads the application and its installed protocol. + + @param ImageHandle =C2=A0 =C2=A0 =C2=A0 Handle that identifies the image= to be unloaded. + + @retval EFI_SUCCESS =C2=A0 =C2=A0 =C2=A0The image has been unloaded. + +**/ +EFI_STATUS +EFIAPI +BZ3342FmpDxeUnloadImage ( + IN EFI_HANDLE =C2=A0 =C2=A0 =C2=A0ImageHandle + ) +{ + if (mFmpSingleInstance) { + return UninstallFmpInstance (ImageHandle); + } else { + return BZ3342FmpDeviceLibUnloadImage (ImageHandle); + } +} + /** Unloads the application and its installed protocol. =20 diff --git a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c b/FmpDevi= cePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c index f4f57b29bdb1..4d2cbc64b7c6 100644 --- a/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c +++ b/FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c @@ -41,6 +41,30 @@ RegisterFmpInstaller ( return EFI_UNSUPPORTED; } =20 +/** + Function that unloads a Firmware Management Device Library based driver = instance when + the FmpDeviceLib supports the driver binding model. + If the FmpDeviceLib does not support the UEFI driver model, the FmpDevic= eLib Unload Image + should return EFI_UNSUPPORTED. + + @param[in] =C2=A0ImageHandle =C2=A0The driver handle managing the Firmwa= re Management Protocol instance to unload. + + @retval EFI_SUCCESS =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Dri= ver image was removed successfully. + @retval EFI_UNSUPPORTED =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The device is= not managed by a driver that follows + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0the UEFI Driver Mode= l. + @retval EFI_INVALID_PARAMETER =C2=A0 =C2=A0 ImageHandle is NULL. + @retval EFI_INVALID_PARAMETER =C2=A0 =C2=A0 ImageHandle does not match d= river image handle. + @retval other =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 Driver image was not removed. +**/ +EFI_STATUS +EFIAPI +BZ3342FmpDeviceLibUnloadImage ( + IN EFI_HANDLE ImageHandle + ) +{ + return EFI_UNSUPPORTED; +} + /** 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 --=20 2.17.1