From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.92.42.52]) by mx.groups.io with SMTP id smtpd.web11.3390.1601086825151938970 for ; Fri, 25 Sep 2020 19:20:25 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=O8XQtxji; spf=pass (domain: outlook.com, ip: 40.92.42.52, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GFthRvUmlM2X5nL6tabxOOKB4zRFsjui4x5kSjd4Zfjsh07JCzL8IUhBK1uJLrJgb4GCUjQ4veM5tt8MBmAIf9J2OxmR5t9Loa0h82KSlCRXqIID1hdm5enhj2fPKm3Bgck1qV1xBDb1jG71c+LF0nuAth+XqhCwrbwt2fV3A2XZBRqspoXqkm8Kr7BsJTh8fCTxSlyl/1+wMPNseBr92tO4lwC+ss3ITxXl1NhB+koQ6lzQIBGlsEEpRYsKX0HF9P779nb2fl3KyKySgi3gA/aW10sTqf9YqBVkXcivfbBmR8rexJ69Tfh8+GF186y2idu94iG+M9Y8qWTBOwhxug== 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=EWnEBox1bGuHpm2g5xRZmQdc8k8JqjiGHbeZDaHD7Dc=; b=VLwLLHaaAGWO3ROe4jo6fKDGR/0OF5Kq+wXJrvLIod6IFyEk604D8Oqvb/1PMrz8F9BMhntNeoEy7+br+gWXlU9h7JEphIbrxonzJpIHybu7hKh+Ime08xSuSRqvbAzwWTKoZgZE6AKAuK8jabBfQoggC+2C5pREZP2eBlZXhcrwPjqiIH1bXnimdd0ClQiVsJWX/K9gZexkMofGzVLWbVnrhKOOTX5AemyA7hN99jxktO1BYINpTA2Q9du2s+glnmA759c0Yeu9EkvZsSbhvq53sLJ08j+Jx1BJUvWkElO8iWWV22ObsxJ9x+epnjMJnygJnX9cL0KIPMtBQ8ykQw== 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=EWnEBox1bGuHpm2g5xRZmQdc8k8JqjiGHbeZDaHD7Dc=; b=O8XQtxjirRw13PKSJqG764fLzyGmY0br4upirzytdkdEPWHIfvWe7U6B4c/m0+DtAxRdyOA2Htls6z4nX5j3BlW65S+nZ52FfcCRCOZ1W6hLm+CEdZ51re4uZgO4Teg0VL4dx0NOx+4YPKtZOpUQq7hAP9OrCajAOMGFmbZrZ09MzSIheFwVDIlCTXkbSmio3AQYZG1Np/4qdJAdkRvX9QCP+8hJYW/z8dZ4ujsQKd8pIQJNI1FXqfMsCsVlEclvjjlFxcv3HN5hC4XRCuppkbQQ3KsIet2XwlsbJc6gr7TswlNoPchmeT7G4n654nwLL2PuCW9TZ2Xs9AtFGPnf2Q== Received: from MW2NAM10FT023.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::47) by MW2NAM10HT210.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21; Sat, 26 Sep 2020 02:20:24 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e87::4c) by MW2NAM10FT023.mail.protection.outlook.com (2a01:111:e400:7e87::154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3412.21 via Frontend Transport; Sat, 26 Sep 2020 02:20:24 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:434D745AB3377A9F89FBCF18C3F6B768EF739DF64DEB96FBAFA5F0FB16BBD399;UpperCasedChecksum:DA81EB21ECD21F8115648B83C9CE9BFCD2347D3FEE1205418C4B4FF4759BFF4F;SizeAsReceived:7805;Count:49 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::eda9:ccc8:2ef:2471]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::eda9:ccc8:2ef:2471%7]) with mapi id 15.20.3391.026; Sat, 26 Sep 2020 02:20:24 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu Subject: [PATCH v4 4/6] FmpDevicePkg/FmpDxe: Improve set image path Last Attempt Status granularity Date: Fri, 25 Sep 2020 19:19:42 -0700 Message-ID: X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200926021944.3575-1-michael.kubacki@outlook.com> References: <20200926021944.3575-1-michael.kubacki@outlook.com> X-ClientProxiedBy: CO2PR04CA0154.namprd04.prod.outlook.com (2603:10b6:104::32) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200926021944.3575-5-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:1:9df7:74f4:6652:1fbe) by CO2PR04CA0154.namprd04.prod.outlook.com (2603:10b6:104::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3391.14 via Frontend Transport; Sat, 26 Sep 2020 02:20:23 +0000 X-Mailer: git-send-email 2.28.0.windows.1 X-Microsoft-Original-Message-ID: <20200926021944.3575-5-michael.kubacki@outlook.com> X-TMN: [PNLKBowWRdPZO5Q8Ujr6ssRSmGyB0ibjG2Fe4+9Y6bCndnghn1hZw3asellNiboa] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 57759b90-2499-4f16-4d98-08d861c2b99b X-MS-TrafficTypeDiagnostic: MW2NAM10HT210: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JilM8FrSQvlOKanG/cH6oHrkC/P7iIT9sNhST4H8LLhJgeeE4jotnfow2w3pZSfozHZouFwtQc1Ds7iv45W8Xy/UtWrk0tSwjeOHALfF+nQsE0hU9Bd37cuCSEEy0it4LvY74cClB4HeCjOa1Z8erGvXnic7RBtw4oEoUFkb2H/sygh465RhR/386UuP64aXujoQJHhLZZXwcPfOo9bv1A== X-MS-Exchange-AntiSpam-MessageData: 0JThE39AsWk5MofVWogYK/jqUtZgjg6foPhbFWNtp0jnh9S6gkoMlWkX+l+nD4t7nNTtXQXluo2woh3uJ20CQERfW02FqVahx1EPbHv1M/896nowjNta2psaQWigcNp/hQ+mW5tdkmX1Zq+A9CZkPVERZvfwSHOEGp0JQv0DJCoLTxfXqosLo1xYbC/oeeAY27zAx8d3Tkh5B6QKrnn09Q== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 57759b90-2499-4f16-4d98-08d861c2b99b X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2020 02:20:24.0436 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT023.eop-nam10.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: MW2NAM10HT210 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 --- 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 858cffd8e5bd..68aacc518a40 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