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.92.5.101]) by mx.groups.io with SMTP id smtpd.web11.8888.1603152023039163265 for ; Mon, 19 Oct 2020 17:00:23 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=TiCtCf5m; spf=pass (domain: outlook.com, ip: 40.92.5.101, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IYrYPjCIXqFqIGRM+pKsIJWHTlMFeRwNfY3rxVS3KceWas6SKIcErLBSANUeiVl/lOneAxUAUlLWCmQBYNBXgNxg8qAJqKj76mgibTLcs6/jOFpGK5A3QIHpbdsBZwaFLcg+YGgjw6XSKKZ6dfTZ3llNs4Z3faj2Gx2FxugbapsDCkj0t9IV9KM/IXj6ShVtb6jqI9UhbdU7G/L1LfUtTcwHlHdfgXRzUIsdnqen0OxPALDA25Yy9wjGwtcj5Chv4kFZHe5koTRngmn7c+572t8ex/jVim4N8O4VOTNVVH0Dh7WA/wlSz09G+DCIS2054AsjgPWCbnVpsWcdi8GPZw== 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=0epb7qOU20gFyqzZJj5Mc1Tuc0DfXEVr6RF3XAgcREA=; b=G/eT4DIsmKgJOYeqjc+b7VIrXkMYrv3jYC0qDB/FZjgaz8R0mNJDPNAnNoIp/LV1lT0GfrG2P8t+NOGrB6WmmZ4rGC/HmoLUiaY0j1vGlqls2nwHXH4cDCeq6WAavL4WcFNyeiFRVzGMqOu6Hmzb1RD3cT5ypiWHc06CDbeHQ7bf6GntX42juq6kIw67UbgC6YCImXKchNATdTpuByd8OlZPy8U9lP3H3KFSQ57b2bPhVqF0MH5rsi7XBb7NXcu/wjfjeuBF9PYEy8h1PhHMw7tWLlLfQXI0l8mHEku+I3mUmGhmDMP1nhyhn0JOuA5zYVEoZVc1PUeGZevVm5swQw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0epb7qOU20gFyqzZJj5Mc1Tuc0DfXEVr6RF3XAgcREA=; b=TiCtCf5mpU9v9roL0omaqLs2LlQqATmxvdQkc7cTOiJYJXzp5myXrlMd+/FHoXyDT2R/6ENIyj6ntBtmjsOwtDJvEo7KlF4bQiMlJMCVF7qb8N+aveDC4FBgYRu4TjxvrP2LNn6expWiBfZF39U67FMJt/EbXylozde3lLOCKhaOjvVMA28u0FSpFpUHyKz1VdfbUGIqPBa/1o3IwjX52H4jhejBBA1ajCCJvJOa4Pss6oy2NLSS8F3ydKJ/6LMtPYenKgh5WrCGQakLm1db5hAUk7DnBuprOsbNYzz0DSyLO5+xumPskttizN20nDU3+k2Qe6SwiWLCIuN2vyXbBA== Received: from CY1NAM02FT029.eop-nam02.prod.protection.outlook.com (10.152.74.52) by CY1NAM02HT183.eop-nam02.prod.protection.outlook.com (10.152.74.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.23; Tue, 20 Oct 2020 00:00:21 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e45::4e) by CY1NAM02FT029.mail.protection.outlook.com (2a01:111:e400:7e45::399) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 00:00:21 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:29966178BD9C5A7B01D1C3C09EDE63D6AC09200005F6FC7BF13B8BE77C6E4FFA;UpperCasedChecksum:0EDAA46D4052E4F6CB5519C9AEADAC157FBEAC03D88DC9FDC9DB09324BE3FAA1;SizeAsReceived:7743;Count:47 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::858f:bd50:1b65:e803]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::858f:bd50:1b65:e803%7]) with mapi id 15.20.3477.028; Tue, 20 Oct 2020 00:00:14 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu Subject: [PATCH v6 4/6] FmpDevicePkg/FmpDxe: Improve set image path Last Attempt Status granularity Date: Mon, 19 Oct 2020 16:59:37 -0700 Message-ID: X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20201019235939.2320-1-michael.kubacki@outlook.com> References: <20201019235939.2320-1-michael.kubacki@outlook.com> X-TMN: [pBlyD9bgfTSHIuCryZGv+LBsRfnGAjkiZIBdVtVzuxUX2jImM5ZNhl5jbTijN0h4] X-ClientProxiedBy: MWHPR14CA0067.namprd14.prod.outlook.com (2603:10b6:300:81::29) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20201019235939.2320-5-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:2:819c:275:72be:ff50) by MWHPR14CA0067.namprd14.prod.outlook.com (2603:10b6:300:81::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3477.21 via Frontend Transport; Tue, 20 Oct 2020 00:00:14 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b3036b21-d449-4512-926e-08d8748b1f01 X-MS-TrafficTypeDiagnostic: CY1NAM02HT183: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N0rUl7RE4B7emzu9AqMWVPyO9MQOeKFkyWevOBNhtmyXC5lWXVh37UVH4m5iIE0o4J0YS5Xb1iOV6asVRR8QBXYex1cB441x4kCyrKFoLUphKfu6bectIEQbMBAmPI+0Tqzt0vjlszSw1EnkIx6KAwrvcDnFdz/L9QhEng6YYmdKUAJzVTun3Bvl5Sjp6MbkUTNAssrgXWyrr7y8BSfEnQ== X-MS-Exchange-AntiSpam-MessageData: s3eb8QWFRK2l7AHJTlnpsk0x/gPxR13WXTxLJ6rhvNWpe+/OkhyoYWFTDiXyvSOS6nMaCdi7VwKt8VHFzePhbo06zVVV3E2shqxcjtSNqqHFOEAgy7CeeeSp7Xf6gzMezIDLpxlN6aO3pbWOKx71YbmuZsuWMydFfkzglUZqjyww4UKbLlRscTvrR9RQmNcRvX/CfO5l0APJiO9Pm5wyzQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b3036b21-d449-4512-926e-08d8748b1f01 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2020 00:00:14.4636 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: CY1NAM02FT029.eop-nam02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1NAM02HT183 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Michael Kubacki Increases the level of granularity for Last Attempt Status codes returned from SetTheImage() in FmpDxe. This allows better identification of the error that occurred in the set image operation using Last Attempt Status codes. Cc: Liming Gao Cc: Michael D Kinney Cc: Guomin Jiang Cc: Wei6 Xu Signed-off-by: Michael Kubacki Acked-by: Liming Gao Reviewed-by: Wei6 Xu --- FmpDevicePkg/FmpDxe/FmpDxe.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c index bc11faa2bfaa..b7fd9c93aea0 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.c +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c @@ -1138,6 +1138,7 @@ SetTheImage ( if (This =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - This is NULL.\n", mI= mageIdName)); Status =3D EFI_INVALID_PARAMETER; + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_PROTOCOL_ARG_MI= SSING; goto cleanup; } =20 @@ -1163,6 +1164,7 @@ SetTheImage ( // if (Private->FmpDeviceLocked) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - Device is already lo= cked. Can't update.\n", mImageIdName)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_DEVICE_LOCKED; Status =3D EFI_UNSUPPORTED; goto cleanup; } @@ -1170,12 +1172,9 @@ SetTheImage ( // // Call check image to verify the image // - Status =3D CheckTheImage (This, ImageIndex, Image, ImageSize, &Updateabl= e); + Status =3D CheckTheImageInternal (This, ImageIndex, Image, ImageSize, &U= pdateable, &LastAttemptStatus); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - Check The Image fail= ed with %r.\n", mImageIdName, Status)); - if (Status =3D=3D EFI_SECURITY_VIOLATION) { - LastAttemptStatus =3D LAST_ATTEMPT_STATUS_ERROR_AUTH_ERROR; - } goto cleanup; } =20 @@ -1191,6 +1190,7 @@ SetTheImage ( FmpHeader =3D GetFmpHeader ( (EFI_FIRMWARE_IMAGE_AUTHENTICATION *)Image,= ImageSize, DependenciesSize, &FmpPayloadSize ); if (FmpHeader =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - GetFmpHeader failed.= \n", mImageIdName)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_FMP_HEADER; Status =3D EFI_ABORTED; goto cleanup; } @@ -1218,6 +1218,7 @@ SetTheImage ( =20 if (Progress =3D=3D NULL) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - Invalid progress cal= lback\n", mImageIdName)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_PROGRESS_CALLBA= CK_ERROR; Status =3D EFI_INVALID_PARAMETER; goto cleanup; } @@ -1238,6 +1239,7 @@ SetTheImage ( Status =3D CheckSystemPower (&BooleanValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - CheckSystemPower - A= PI call failed %r.\n", mImageIdName, Status)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_CHECK_POWER_API= ; goto cleanup; } if (!BooleanValue) { @@ -1258,10 +1260,12 @@ SetTheImage ( Status =3D CheckSystemThermal (&BooleanValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - CheckSystemThermal -= API call failed %r.\n", mImageIdName, Status)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_CHECK_SYS_THERM= AL_API; goto cleanup; } if (!BooleanValue) { Status =3D EFI_ABORTED; + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_THERMAL; DEBUG ( (DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - CheckSystemThermal - returned False. U= pdate not allowed due to System Thermal.\n", mImageIdName) @@ -1277,10 +1281,12 @@ SetTheImage ( Status =3D CheckSystemEnvironment (&BooleanValue); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - CheckSystemEnvironme= nt - API call failed %r.\n", mImageIdName, Status)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_CHECK_SYS_ENV_A= PI; goto cleanup; } if (!BooleanValue) { Status =3D EFI_ABORTED; + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_SYSTEM_ENV; DEBUG ( (DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - CheckSystemEnvironment - returned False= . Update not allowed due to System Environment.\n", mImageIdName) @@ -1302,12 +1308,14 @@ SetTheImage ( Status =3D GetFmpPayloadHeaderSize (FmpHeader, FmpPayloadSize, &FmpHeade= rSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - GetFmpPayloadHeaderS= ize failed %r.\n", mImageIdName, Status)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_FMP_HEADER_= SIZE; goto cleanup; } =20 AllHeaderSize =3D GetAllHeaderSize ((EFI_FIRMWARE_IMAGE_AUTHENTICATION *= )Image, FmpHeaderSize + DependenciesSize); if (AllHeaderSize =3D=3D 0) { DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() - GetAllHeaderSize fai= led.\n", mImageIdName)); + LastAttemptStatus =3D LAST_ATTEMPT_STATUS_DRIVER_ERROR_GET_ALL_HEADER_= SIZE; Status =3D EFI_ABORTED; goto cleanup; } @@ -1372,6 +1380,7 @@ SetTheImage ( mProgressFunc =3D NULL; =20 if (Private !=3D NULL) { + DEBUG ((DEBUG_INFO, "FmpDxe(%s): SetTheImage() LastAttemptStatus: %u.\= n", mImageIdName, LastAttemptStatus)); SetLastAttemptStatusInVariable (Private, LastAttemptStatus); } =20 --=20 2.28.0.windows.1