From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM02-CY1-obe.outbound.protection.outlook.com (NAM02-CY1-obe.outbound.protection.outlook.com [40.92.4.13]) by mx.groups.io with SMTP id smtpd.web10.76087.1597785440378563190 for ; Tue, 18 Aug 2020 14:17:20 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=bO9SVJmO; spf=pass (domain: outlook.com, ip: 40.92.4.13, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GpK6UzrHuokcHG8AUzEt5/lYr1VHxk0uOxi5Fp2FDoS10Ju1V/XcbczlmqJbxg2kLHZFrbPVJ1YTyri+zmiRlRs+8N64ZXc6NDQHjJjZroNYUbnfo4QbuXUmtsCTjXi861P4GEmRFu2y7wOJK4+/bn8YHjAr5qllXDBDT/+BZPmgJw+VbmsgugTrQaCokrV+2nEbyisCI4jx04OVEgJGW8lsPQJccSSg8kuYT8FjHEEragx+TJH+hW27MVF/mAJeIETP8Cb/JTZLXFjzr39FqND3SU48GdtXI+jXMAYkNPwPTADWRIO13LN/npdkvbQOKnZgT9xB7pDbdWpadKUIrA== 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=QDOFYgeujXffPz3KPVIp7L83go/yk9D255eUfuWea0o=; b=ALJKWDVr/tpbxBKhfoHiI3XLlexnx6vZ7ufWE3UsF4Fhqb4CArbIyFY9truZsFl25YXW7e5f7Jl5nk8IUtIJcMLhOeVoiFGSoH7QWF0ea/eosHvCr0JiHuYwjmIvV+wR9Sec3ZtAXCrOqXsBEiyLlCluFDbCuJpWc9PNV/86jSIskVcMfLjqI/tcwYRqkerk5MQH6UAxHpeA7mBVxHojnP66GyZKyH2tkyvxlf5As9yHTQu4lpXKT16/LtcEkftLR87Dxu3yFQuqFXcTW0Ote9FGKsEaaxouoVAY7uzEvnCvqTUB68oCenujVpg8HFpSUqreXIyRHyEXIeiaR/qrSQ== 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=QDOFYgeujXffPz3KPVIp7L83go/yk9D255eUfuWea0o=; b=bO9SVJmOjn/OnZZDQwDN02U8iPNVZY1SCy91vdYaeYYAtW3N+yJfDtWq2w44druQKHlxlhrtAtsrdlX5ehv2VfhOLi1yKAkIjYGi2JM903ny7vdjfueWisE/QSePRNNKCTNAR6UK2qeARgPLcvk/WKuhtypvIbe/+5DBA6YxBc6K8kBJn9fDuPVldnDwCcuNvtK7js8I/JDkedg3XEc+CI8j/Y3ihGsW3qN7ZkoUd8wtBCj8MS6xLk9e6T8Tc5xQMu4jN7vict1sv/OHGaeO5h2FmGGU2C+XDpdFlFO+OKbK6KtwuCz8G9Nyup/ewdIgNCR2hXmRmUkYDjxof+8mTQ== Received: from SN1NAM02FT007.eop-nam02.prod.protection.outlook.com (10.152.72.60) by SN1NAM02HT043.eop-nam02.prod.protection.outlook.com (10.152.73.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16; Tue, 18 Aug 2020 21:17:14 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e44::4e) by SN1NAM02FT007.mail.protection.outlook.com (2a01:111:e400:7e44::88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.16 via Frontend Transport; Tue, 18 Aug 2020 21:17:14 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:748269F538E8A6D82BCD07EE09AAB04F6CB7EA4E8B6745751EC0070882619570;UpperCasedChecksum:A64F588DBB41BE4B572D490222D3AECB1BD9AD7672A3AAC9846F458400EEDF75;SizeAsReceived:7819;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.3283.027; Tue, 18 Aug 2020 21:17:14 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu Subject: [PATCH v3 4/6] FmpDevicePkg/FmpDxe: Improve set image path Last Attempt Status granularity Date: Tue, 18 Aug 2020 14:16:27 -0700 Message-ID: X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200818211629.1193-1-michael.kubacki@outlook.com> References: <20200818211629.1193-1-michael.kubacki@outlook.com> X-ClientProxiedBy: MWHPR14CA0033.namprd14.prod.outlook.com (2603:10b6:300:12b::19) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200818211629.1193-5-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:1:e4ef:ebe4:8509:47e7) by MWHPR14CA0033.namprd14.prod.outlook.com (2603:10b6:300:12b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3305.24 via Frontend Transport; Tue, 18 Aug 2020 21:17:13 +0000 X-Mailer: git-send-email 2.28.0.windows.1 X-Microsoft-Original-Message-ID: <20200818211629.1193-5-michael.kubacki@outlook.com> X-TMN: [Ffyr4JbYWJEGVoVf5rfFeFal8kYl6jCLlXLZNDG+P03u7lNgapwLlhllCD9NyIo/] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: c7ad2a71-45c8-4905-9d89-08d843bc13cf X-MS-TrafficTypeDiagnostic: SN1NAM02HT043: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wcURrvZlhaf6dW91zTuLGSgSYi/WItNHkvP0/P6cYuYtsq0XwXhX4o1e14+A3lsJhkOhtIdyFkXtjTiXVuXkqTVgR74xRHlRvMN8eUFLdS75dfsa1+jf/YGqTuZc0LsEv3SIrppmjMH4Gt/xym1j1vgmBC5IciPp46LIaXmLOgt0FQ3MJaBpPSUcF+CQjt52oBI0GlEWHWQiWy1VR8S7qg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR07MB3440.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: +fc0BNiLAGk8OfvpenNnd4c+StD+gF4sBlFZj2izqo6yABjIhyLOdYIZ4wbPRgpI95HfV62msGbvUedm0KX9XNcFBPWr/oIBDag4A7eLWHX1DmM+kyi+VxC2pEV4NjdL5rFr36CsgEo1T4np1oucFKEfm8d+R7Jkcm6RsHX/AUIrAJW/rxT0prcW0Zwd6uiw+o9o4UDZQzGH0E+pjmAcng== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7ad2a71-45c8-4905-9d89-08d843bc13cf X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2020 21:17:13.9900 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: SN1NAM02FT007.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: SN1NAM02HT043 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 75ae2b0a1c7e..f85f9e28753b 100644 --- a/FmpDevicePkg/FmpDxe/FmpDxe.c +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c @@ -1141,6 +1141,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 @@ -1166,6 +1167,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; } @@ -1173,12 +1175,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 @@ -1194,6 +1193,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; } @@ -1221,6 +1221,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; } @@ -1241,6 +1242,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) { @@ -1261,10 +1263,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) @@ -1280,10 +1284,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) @@ -1305,12 +1311,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; } @@ -1375,6 +1383,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