From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (NAM12-DM6-obe.outbound.protection.outlook.com [40.92.22.48]) by mx.groups.io with SMTP id smtpd.web08.6704.1604632588244522427 for ; Thu, 05 Nov 2020 19:16:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=ViM49UDN; spf=pass (domain: outlook.com, ip: 40.92.22.48, mailfrom: michael.kubacki@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DE+baa/xjN+N/+4Hbke27h84J3b/E4M20ZGYqDCQ5O+wTCL1nZjdRViNZ37GH0AGfvbVpik/VyCcNJKUAh3ROPNgrFjt/ynkhEBzNSWxveUqU2d9LJkagOx5TFmNGL1BKw7YWlqzlTICjJuRYxGrhjT1e5MERGs6239YmMrZ9ySwxnLSeBEXKgN6IJ5/3jA6rNMFg7PvDE+SFdj+/p+AtrdJ9lRsiGPoWIOJPel448HXPi8L/mv7RY/aW8VNSVqh5U5ZjwMKh0N1BRkLKhhwp43KkYkVrdIFLwWAyYxAVklI7DFla7mFB3iSNiB4kNH1QvuUrx+TlPt63lzPgdST4g== 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=9B+ajmDtCNzzBBN7W73ZLDspA0YH1gXYBKYhDjKsLjQ=; b=XN8DSzoju6QfH5SCVhucbjpJ5ZZYMteTVBKqjnLkqMw+UeVp6/kM9tDRa60BCy/Z3kF5quBJDyrqwg5p7+PcJWDhvDCo65fYohs1hJ0I3Z6fKqaP3unu8if4q5B/kYR9Cuiha5Nj9PKgz8/xeC+lNchkPEIX7fCXZ1A52VzJdhdktD/X05xMkthexRYZIrat1hl8yKJq/MULkNr8bDmUp1ZSRU00JpB+g8JN8T39NphadC7tD6AhD4NR+eR0nzunK9Lw/VcCcuuV+7geD9Djj1ML3Lv8wJzXnTNO4ua/dsgJotuFkpIIxocaGfnyqJn05B0dTnGH/pB9cyIj/JZdjQ== 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=9B+ajmDtCNzzBBN7W73ZLDspA0YH1gXYBKYhDjKsLjQ=; b=ViM49UDNSN8SJ/2NF4wpXwfPCtt/mgXfGtQ8xFFY40dp18R+3NTwC45lUzT71pITf7CQDSCSylUOK0b0IOnyn8+cknlzVe+GjIF11A0+VxbBxv/QTryx70WacFNpvnlzCHPi7OrrUT7cvKeFhrsjJ4Bx1IG+OSqthAKH1ZCuWxrp2OB0D1VZNJ+pQWiVl9Q81slXkT295txwEFhp4zKBoHISFojB84wRzDe4et1HZ28KRxycsk+aGw/d2wth10FXEZkaWuiemG11TkG5eSMEfIa27N/cJdz+2fXsUN7iXP9TWZ16GzU98503BcbyIQdy8UC3KV2DiQsiMfN5nxJABA== Received: from DM6NAM12FT047.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::51) by DM6NAM12HT014.eop-nam12.prod.protection.outlook.com (2a01:111:e400:fc64::181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.18; Fri, 6 Nov 2020 03:16:27 +0000 Received: from MWHPR07MB3440.namprd07.prod.outlook.com (2a01:111:e400:fc64::4f) by DM6NAM12FT047.mail.protection.outlook.com (2a01:111:e400:fc64::319) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.7 via Frontend Transport; Fri, 6 Nov 2020 03:16:27 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:1B4A13275C0F719D48C61DCF4EB27A61A01FEAD8A2BF3D02FBD0CE6912C50739;UpperCasedChecksum:8CEA3555BBFA840D0D0676229E4E237511F8134D8B72E22CA304185B30C72296;SizeAsReceived:9016;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.3541.021; Fri, 6 Nov 2020 03:16:27 +0000 Subject: Re: [PATCH v1 1/1] FmpDevicePkg/FmpDxe: Call FmpDeviceLib WithStatus() functions From: "Michael Kubacki" To: devel@edk2.groups.io, Liming Gao , Michael D Kinney , Guomin Jiang , Wei6 Xu References: Message-ID: Date: Thu, 5 Nov 2020 19:16:27 -0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 In-Reply-To: X-TMN: [BMog/QNRgwiZCCRSOwEqvPwGl4a1e7yMa9iaUlXWlL9ANHK/oSG9oW6YkOElTfID] X-ClientProxiedBy: MWHPR1201CA0002.namprd12.prod.outlook.com (2603:10b6:301:4a::12) To MWHPR07MB3440.namprd07.prod.outlook.com (2603:10b6:301:69::28) Return-Path: michael.kubacki@outlook.com X-Microsoft-Original-Message-ID: <25a611d4-4566-1d2a-53b2-ddac0ec86885@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [IPv6:2001:4898:d8:39:2070:957b:ad07:364d] (2001:4898:80e8:b:a08d:957b:ad07:364d) by MWHPR1201CA0002.namprd12.prod.outlook.com (2603:10b6:301:4a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3541.21 via Frontend Transport; Fri, 6 Nov 2020 03:16:26 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9165d673-7691-4c8a-8151-08d882025911 X-MS-TrafficTypeDiagnostic: DM6NAM12HT014: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y4IWCnG3Y3F+PLIsFdtXQStnG6FDsB+OSDIOT+cUp+t/4qku9uoga8HXXqZUqFItTCig3CSVX8kjOg+TJ8huN3Cwk+Yr+FG7gfdl+PFpN1vig2bJ+Tk0+XvYmZaVHVSckzYlQ7n3cwDG/EAMeIV2RqKzer5XcbqWix+2BZ8ahxKhSSGKzSxd15vdoZABkDcrBF3tO0bxzMxexuZdGWGlQHBLhkk5vSnyVPGf8Ehq6lrnkZ/em2tfh8crxzRUmVv8 X-MS-Exchange-AntiSpam-MessageData: Lvl1SlTOQBnWzsJdzmtR9O2/TWFYXQ3pg9tYQclOtgHQKwhJjU/QwG6LbKT7ktDZcgJeOznqP8q2LitT9rEVOms0bGvsnJ9zysrZR2cTMXAaFmedmNBX9TYN8CuUZS1SJ0pfeebYjhuOXTMFEbhwoBtW4Wd9tN3wdcwCmQzGmGimOMxmRdFUhfzwQUdoiSbPyiAz9eQgaZHNkUc0ciHJOA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9165d673-7691-4c8a-8151-08d882025911 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2020 03:16:27.2188 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: DM6NAM12FT047.eop-nam12.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: DM6NAM12HT014 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Hi FmpDevicePkg maintainers, Please let me know your feedback on this patch. Note that it is required to complete the Last Attempt Status support already merged in the following patch series: https://edk2.groups.io/g/devel/message/66418 Thanks, Michael On 10/30/2020 2:12 PM, michael.kubacki@outlook.com wrote: > From: Michael Kubacki > > Commit 6ad819c introduced two new functions in FmpDeviceLib: > 1. FmpDeviceCheckImageWithStatus () > 2. FmpDeviceSetImageWithStatus () > > These functions allow an FmpDeviceLib implementation to return a > Last Attempt Status code value within the Device Library range from > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE to > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE. > > To maintain backward compatibility, commit 6ad819c did not update > the FmpDxe driver to invoke these functions. FmpDeviceLib instances > should update their FmpDeviceCheckImage () function to simply call > FmpDeviceCheckImageWithStatus (). Similarly, FmpDeviceSetImage () > should simply call FmpDeviceSetImageWithStatus (). This is > demonstrated in the implementation of these functions in > FmpDevicePkg/Library/FmpDeviceLibNull/FmpDeviceLib.c. By doing so, > the library can remain compatible with FmpDxe implementations before > and after this transition. > > This commit updates FmpDxe to call the WithStatus () version of > these functions enabling the Last Attempt Status code returned to > be accessible to FmpDxe. > > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Guomin Jiang > Cc: Wei6 Xu > Signed-off-by: Michael Kubacki > --- > FmpDevicePkg/FmpDxe/FmpDxe.c | 40 ++++++++++++++++++-- > 1 file changed, 36 insertions(+), 4 deletions(-) > > diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c > index de7f1fe53e32..6b0675ea38f8 100644 > --- a/FmpDevicePkg/FmpDxe/FmpDxe.c > +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c > @@ -1025,9 +1025,24 @@ CheckTheImageInternal ( > // > // FmpDeviceLib CheckImage function to do any specific checks > // > - Status = FmpDeviceCheckImage ((((UINT8 *)Image) + AllHeaderSize), RawSize, ImageUpdatable); > + Status = FmpDeviceCheckImageWithStatus ((((UINT8 *) Image) + AllHeaderSize), RawSize, ImageUpdatable, LastAttemptStatus); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "FmpDxe(%s): CheckTheImage() - FmpDeviceLib CheckImage failed. Status = %r\n", mImageIdName, Status)); > + > + // > + // LastAttemptStatus returned from the device library should fall within the designated error range > + // [LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE, LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE] > + // > + if ((*LastAttemptStatus < LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE) || > + (*LastAttemptStatus > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE)) { > + DEBUG ( > + (DEBUG_ERROR, > + "FmpDxe(%s): CheckTheImage() - LastAttemptStatus %d from FmpDeviceCheckImageWithStatus() is invalid.\n", > + mImageIdName, > + *LastAttemptStatus) > + ); > + *LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL; > + } > } > > cleanup: > @@ -1353,16 +1368,33 @@ SetTheImage ( > // > //Copy the requested image to the firmware using the FmpDeviceLib > // > - Status = FmpDeviceSetImage ( > - (((UINT8 *)Image) + AllHeaderSize), > + Status = FmpDeviceSetImageWithStatus ( > + (((UINT8 *) Image) + AllHeaderSize), > ImageSize - AllHeaderSize, > VendorCode, > FmpDxeProgress, > IncomingFwVersion, > - AbortReason > + AbortReason, > + &LastAttemptStatus > ); > if (EFI_ERROR (Status)) { > DEBUG ((DEBUG_ERROR, "FmpDxe(%s): SetTheImage() SetImage from FmpDeviceLib failed. Status = %r.\n", mImageIdName, Status)); > + > + // > + // LastAttemptStatus returned from the device library should fall within the designated error range > + // [LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE, LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE] > + // > + if ((LastAttemptStatus < LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MIN_ERROR_CODE_VALUE) || > + (LastAttemptStatus > LAST_ATTEMPT_STATUS_DEVICE_LIBRARY_MAX_ERROR_CODE_VALUE)) { > + DEBUG ( > + (DEBUG_ERROR, > + "FmpDxe(%s): SetTheImage() - LastAttemptStatus %d from FmpDeviceSetImageWithStatus() is invalid.\n", > + mImageIdName, > + LastAttemptStatus) > + ); > + LastAttemptStatus = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL; > + } > + > goto cleanup; > } > >