From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.92.40.95]) by mx.groups.io with SMTP id smtpd.web10.692.1597091320627258671 for ; Mon, 10 Aug 2020 13:28:40 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=WsNUCfjv; spf=pass (domain: outlook.com, ip: 40.92.40.95, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P3a1s2A1llRIYM93hKNzX6hNMAo+tF8TdgDJqn70LY2tTUjo5jSWBulGVMe52ppp2Awu+ckhWgdlE9tsjxYjvNKZS2yJ+/lKTKg8Tw6IkvlX0ZLzK7osLlWgXk9pR6bsDNnav48HykbXSjaOxibhjCI1dzHfHF1Nbor3ByAPJ9xi/sKYQk5hw13oYKgmMxPYIaE2FK7KDnWncpP9kEIqvQkaR6wS13tEV3ByejvAsDVdTx5d4prX7Uuo+Qrm0Nu27NPhlNqlHbUtsTiPo4SrXZGLLCmfmkPrIIs1Wkl2pH/F1033cIDYEugFgueCUKUVMsrQxLXHaXAjWKwTkRfwPg== 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=qf9fdcqP0cJlU4gUPQhgcJ5CmRxC/Jskhol4cLM4phk=; b=CtWODvs869yaxGzhCHkP0dX3O9mFelXUoCBxvb+vLsuKc27JaPzlQMFmXnos2h9kT1nBgQaekxRyci0qdh8Tnz5g1uJXn+QtjyPHzp+dsScoNY6p4m8uPDeCOv0drhJNf0Ft/XJnndHIg7G6Txv23/QdvpYd4P32giphBhkY7mOMRckwWR/lz4arQRi3LCegA/6fptbd3sKJOP3ZLhmERYvfbmeE+QpfUD02WLInH9dVcB2ymbzITPbRNNOZj8NKaC5Qi66+WZ6S1wlobOpQfi8V5O9o0mcDBdS2dGuRsF+ygVVFFxcjSoYsQemN0zEUq5LmUfrZzMgLDNOC0n+jNA== 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=qf9fdcqP0cJlU4gUPQhgcJ5CmRxC/Jskhol4cLM4phk=; b=WsNUCfjvK4vO54r2+wllKl8pcEuMLK9BOY2aXN13uKAKQbq9FE1+roKLAxfsZ63C2kAe9gH0FdJXVWzaW2SZK1XXHRNVT0Uh/dV3KG2yf61GI7ovyCtK2loGZqWVtFs0m5JAj8Tl+AlYGJECCqkqfpj0lDm/lFN+2o+wpky6RtHXv6ZscdWLFmuTK+goIeq+VxVYrml5BgzIYvS/e8l1WEIG3wp9ONyspKlmvNG83AG8YbtouaZKgebdj8c8J0vDeQB5rFkyhlKK4WQnhPHxzMoT9nEdkPYuGWTbe/4UB4fxqaZGo1UCmRfU90iiFNDnLGGrmcSVj3olMAKext8QHg== Received: from MW2NAM10FT048.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::49) by MW2NAM10HT229.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e87::465) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16; Mon, 10 Aug 2020 20:28:39 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:7e87::44) by MW2NAM10FT048.mail.protection.outlook.com (2a01:111:e400:7e87::98) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.16 via Frontend Transport; Mon, 10 Aug 2020 20:28:39 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:46A7231CAC014F3CDBB4811728F08E7E8B4D93BB3CFAB37B37F30C7126E2E908;UpperCasedChecksum:C9F715D78D16C7A62A6A6C4A1E565BFA7ABCF57CB30D71880BABEDBCD52BD6D2;SizeAsReceived:7814;Count:49 Received: from MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::9856:570e:1735:974e]) by MWHPR07MB3440.namprd07.prod.outlook.com ([fe80::9856:570e:1735:974e%7]) with mapi id 15.20.3261.024; Mon, 10 Aug 2020 20:28:39 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu Subject: [PATCH v2 4/6] FmpDevicePkg/FmpDxe: Improve set image path Last Attempt Status granularity Date: Mon, 10 Aug 2020 13:27:51 -0700 Message-ID: X-Mailer: git-send-email 2.28.0.windows.1 In-Reply-To: <20200810202753.1318-1-michael.kubacki@outlook.com> References: <20200810202753.1318-1-michael.kubacki@outlook.com> X-ClientProxiedBy: MWHPR13CA0008.namprd13.prod.outlook.com (2603:10b6:300:16::18) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <20200810202753.1318-5-michael.kubacki@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from localhost.localdomain (2001:4898:80e8:1:cc6:648f:7db1:5bf9) by MWHPR13CA0008.namprd13.prod.outlook.com (2603:10b6:300:16::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3283.10 via Frontend Transport; Mon, 10 Aug 2020 20:28:39 +0000 X-Mailer: git-send-email 2.28.0.windows.1 X-Microsoft-Original-Message-ID: <20200810202753.1318-5-michael.kubacki@outlook.com> X-TMN: [9ePiz7C4cRFr7dVjWl0YzYO9ATo2wCzGAsHwT2iFOBHgvMPP71esIGjvAoQNS2BR] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 49 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: a105e3a5-dad1-4b14-a232-08d83d6bf72e X-MS-TrafficTypeDiagnostic: MW2NAM10HT229: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: T2hOT+740pkGhGTA39eBv5vFXp5tys67Bhj00Ar2Xe7N7Xqm1XcMzomCmRoPcI1j2F1KWmK/FJLb41qHDBWXX9cmizRBXdfXx3PlJoYuwIMJaDVLf3vOjD+Im7d6l0GUd2zqnIqBQp6VBF+0Y68AC/qVEubY4liqdzdNlzHzb7MM3hu8+4ZOBgHnLac0pok8vOx0WHLwC8IcQPNPe/EKeA== 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;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: 2hsldNYg6f9TJnJr2ni/k8h8XLwlHeAlbsaar17QHa1ntvbDrsG/AFBk0CDfzjSJ3BwXuZZ2kPSvzt9Kpo3tfvlj8mlvSJEBiWzPTIQ99ayTfA+5R/USf7US2NfFomnnxTJ3FgH/GgoC3zpMWMdJ90Y1xL10Q9JjQocoS9kMXF6a/JY5SdMvm4Ja6YQgV74wyDfqGHyDFZH8dtH5UkUFqQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a105e3a5-dad1-4b14-a232-08d83d6bf72e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Aug 2020 20:28:39.2717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: MW2NAM10FT048.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: MW2NAM10HT229 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 dc714f7e9cd4..aeb888c86bc3 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; } @@ -1373,6 +1381,7 @@ SetTheImage ( =20 cleanup: mProgressFunc =3D NULL; + DEBUG ((DEBUG_INFO, "FmpDxe(%s): SetTheImage() LastAttemptStatus: %u.\n"= , mImageIdName, LastAttemptStatus)); SetLastAttemptStatusInVariable (Private, LastAttemptStatus); =20 if (Progress !=3D NULL) { --=20 2.28.0.windows.1