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.74]) by mx.groups.io with SMTP id smtpd.web11.76175.1597785419478366587 for ; Tue, 18 Aug 2020 14:17:00 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=E9MK4dFM; spf=pass (domain: outlook.com, ip: 40.92.4.74, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kbBio8pmVm66LAII5a2hwMhC1JeUWfdkiklzNpDnOMyVQ4iIkAJXE00Ok9GW1x+rnwJ2LRujV6s1jiRptZV1j8ZglUQYWTllsniM0UwqnY0st1iXymWTHDfqUFgtDa3UxeVdDoo4W69xKwNheZZ9EtiZdvnKrDFYRHlCwFTlX77jeu/Rjq7euEM2ihv1x3LRMLNB0wrmDfNDvM13Omm8nWUJJbowAdk8W8FPyJAvl81cUJgdE3x/zKdP+x1inPo78rIYroJeyloAR3FzAYIRI4jvG8AV6Rno4OUnun1/KQ6nUdLaRdsRM20guYN/6BJE8iPuj4F+5DA3QxkikwvbDA== 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=ZzAKo8ffQ6lteO5vaeTFrLNqMG2zv0rnw7xkPfpHKCE=; b=cXUnu5GJAf2E6pKpGc+Qk3a8h2b7+g4pdosMNZhaHNdVQgSafri3bbSrPiVSBDK7xXNcNcSKfC+E2s5cofVA8JUy+7yN2yuR3lP22lW5JO3pYIXGaXbt7Mli7C9eZ5NGqfEwFzIFiGnbPwQB4dzs3Rc4BUt9//9+kKZYax8bQX1rmMekskFcN3naV1b11bPGaHVMTxAlH32F+suf7PvgXJwT7VS8A/rMf4vm0AVW6qeyTqLNnJmzfPgwRbPlBMUwPslIQJz2Nuidma+JQD5MyOR8tfJzLJQv9U2Z4rFUBoGdYFsQQvMVFj9+G1oyKZDTvnJnZ0jfPxQQKpFwQa2dLw== 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=ZzAKo8ffQ6lteO5vaeTFrLNqMG2zv0rnw7xkPfpHKCE=; b=E9MK4dFMP5hdbkxU2bEyNwf2A8YWoIDMvH9XbhimoBrqwMHJydQgQm9O5I3+DZozhBt1qIkydkemvL14KxoBGiRrBh/qbrPOdf9S37qLLxJ+0xCugRQRPnRxn+Um2BD6gB59utf3cu+UB11feMgxxcE83ulM7bRb/wjA8tOFp2T7yC9SkmeS9SXq1NqGZRHUEkIUKK/WpcrAXnwV8n1n94QRbeB2tLJV4I4pNpLsx0YS0zq9YL59V8ZRWxC4YQQ1y1ZPMSt9vyLRQ9spiaFbzAVoKP0GD33UG4MR/Y8Hqdf8Hb1Dqjpk312qXh4nhi6Ze1hasQswgG/6QSZOSCyLFg== Received: from SN1NAM02FT007.eop-nam02.prod.protection.outlook.com (10.152.72.53) by SN1NAM02HT152.eop-nam02.prod.protection.outlook.com (10.152.73.53) 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:16:58 +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:16:58 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:DD667146F82B4395C5F0F10CDDFBF6AE7AA0D0FE31A4A7332C104E681B9DDF86;UpperCasedChecksum:BDD2A8BAAADD42CFEDE8FA2309DDD88FB052AEF54A488711847537CA33F9F54A;SizeAsReceived:7700;Count:47 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:16:58 +0000 From: "Michael Kubacki" To: devel@edk2.groups.io CC: Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu , Zhiguang Liu Subject: [PATCH v3 0/6] Extend Last Attempt Status Usage Date: Tue, 18 Aug 2020 14:16:23 -0700 Message-ID: X-Mailer: git-send-email 2.28.0.windows.1 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-1-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:16:57 +0000 X-Mailer: git-send-email 2.28.0.windows.1 X-Microsoft-Original-Message-ID: <20200818211629.1193-1-michael.kubacki@outlook.com> X-TMN: [ZGKHUzkKh2rUoNqC6so1jBivhlJQUMn9P85EK+obFBti/PPBKolHnV4d+ONzdkHk] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: ba0f1425-58c4-41df-9a9f-08d843bc0a0f X-MS-TrafficTypeDiagnostic: SN1NAM02HT152: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X+LkgDjnIp2oYtzmiILLUkOYKIJFOnxGmJCGkCG3a7TF2n1yqie0PScUjRm9q7GEjdXmWY4RzfP+ib35Sk7qr5glxF3NPYGvb4aeEoQy8dan447bTJde3V/n7iGtoImdeUa2zuVol+uOJsGALzV5ZF1PvtpO++N9n3eJWe+GbEEtKBXCxtW9li5CuT0v9KPtjtfSMOcflBJ6mqCBPlmZt+kWodTAuXg0PqJ6w4xkRG4rLxREvcMp2cH63RYRITDt 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: CKOpkK0belzdN0+0nG27i8vqx8TWy/IMo8gMS40kmtEjnPXxMcluyp50i2IADSTU4+ZaLU1sU4dsQY3BtScW/CiUe32D4IhRzxC46lN8gKTN+GIkO+U/SbyHBa6I1EA6cPCce4g9899bWO/Zlzb6r4kDrQ2R7bICGcImYCMtCjzPyDeB71Vg50n2ewf1DoOj28zdbuI6yIKY8MHom0GGHQ== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ba0f1425-58c4-41df-9a9f-08d843bc0a0f X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2020 21:16:57.8670 (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: SN1NAM02HT152 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Michael Kubacki REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2802 This patch series adds more granularity to Last Attempt Status codes reported during FMP check image and set image operations that greatly improve precision of the status codes. The unsuccessful vendor range (0x1000 - 0x4000) was introduced in UEFI Specification 2.8. At a high-level, two subranges are defined within that range in this patch series: 1. The FMP Reserved range - reserved for components implemented in FmpDevicePkg. 2. The FMP Device Library Reserved range - reserved for FmpDeviceLib instance-specific usage. The ranges are described in a public header file LastAttemptStatus.h while the specific codes used within FmpDevicePkg implementation are defined in a private header file FmpLastAttemptStatus.h. FmpDeviceLib instances should use the range definition from the public header file to define Last Attempt Status codes local to their library instance. Of note, there's multiple approaches to assigning private status codes in the FMP Reserved range. For example, individual components could define their last attempt status codes locally with the range allocated to the component defined in a package-wide private header file. However, one goal of the granularity being introduced is to provide straightforward traceability to an error source. For that reason, it was chosen to define a constant set of codes at the package level in FmpLastAttemptStatus.h. For example, if a new FmpDependencyLib instance is added, it would not be able to reassign status code values in the pre-existing FMP Dependency range; it would reuse codes for the same error source and be able to add new codes onto the range for its usage. I wanted to highlight this for any feedback. V3 changes: 1. Enhanced range definitions in LastAttemptStatus.h with more completeness providing length, min, and max values. 2. Moved the actual Last Attempt Status code assignments to a private header file PrivateInclude/FmpLastAttemptStatus.h. 3. Changed the value of LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL_VENDOR_RANGE_MAX to 0x3FFF instead of 0x4000 even though 0x4000 is defined in the UEFI specification. The length is 0x4000 but the max allowed value should be 0x3FFF. This change was made now to prevent implementation compatibility issues in the future. 4. Included "DEVICE" in the following macro name to clearly associate it with the FmpDeviceLib library class: LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_ERROR_xxx 5. Included a map to help the reader better visualize the range definitions in LastAttemptStatus.h. 6. Included additional documentation describing the enum in FmpLastAttemptStatus.h. An explicit statement stating that new codes should be added onto the end of ranges to preserve the values was added. 7. Simplified error handling logic in FmpDxe for FmpDeviceLib calls that return Last Attempt Status. 8. V2 had a single memory allocation failure code used for different memory allocations in CheckFmpDependency () in FmpDependencyLib. Each potential allocation failure was assigned a unique code. V2 changes: 1. Consolidate all previous incremental updates to=20 LastAttemptStatus.h into one patch (patch 2) 2. Move LastAttemptStatus.h from Include to PrivateInclude 3. Correct patch 1 subject from "FmpDevicePkg" to "MdePkg" Cc: Liming Gao Cc: Michael D Kinney Cc: Guomin Jiang Cc: Wei6 Xu Cc: Zhiguang Liu Signed-off-by: Michael Kubacki Michael Kubacki (6): MdePkg/SystemResourceTable.h: Add vendor range values FmpDevicePkg: Add Last Attempt Status header files FmpDevicePkg/FmpDxe: Add check image path Last Attempt Status capability FmpDevicePkg/FmpDxe: Improve set image path Last Attempt Status granularity FmpDevicePkg: Add Last Attempt Status support to dependency libs FmpDevicePkg/FmpDeviceLib: Add Last Attempt Status to Check/Set API FmpDevicePkg/FmpDxe/FmpDxe.c = | 176 +++++++++++++++++--- FmpDevicePkg/Library/FmpDependencyCheckLib/FmpDependencyCheckLib.c = | 39 +++-- FmpDevicePkg/Library/FmpDependencyCheckLibNull/FmpDependencyCheckLibNull.c= | 9 +- FmpDevicePkg/Library/FmpDependencyLib/FmpDependencyLib.c = | 96 +++++++++-- FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c = | 48 ++++-- FmpDevicePkg/Test/UnitTest/Library/FmpDependencyLib/EvaluateDependencyUnit= Test.c | 7 +- FmpDevicePkg/FmpDxe/FmpDxe.h = | 4 +- FmpDevicePkg/Include/LastAttemptStatus.h = | 96 +++++++++++ FmpDevicePkg/Include/Library/FmpDependencyCheckLib.h = | 8 +- FmpDevicePkg/Include/Library/FmpDependencyLib.h = | 44 +++-- FmpDevicePkg/Include/Library/FmpDeviceLib.h = | 48 ++++-- FmpDevicePkg/PrivateInclude/FmpLastAttemptStatus.h = | 80 +++++++++ MdePkg/Include/Guid/SystemResourceTable.h = | 13 ++ 13 files changed, 575 insertions(+), 93 deletions(-) create mode 100644 FmpDevicePkg/Include/LastAttemptStatus.h create mode 100644 FmpDevicePkg/PrivateInclude/FmpLastAttemptStatus.h --=20 2.28.0.windows.1