From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.64]) by mx.groups.io with SMTP id smtpd.web12.9799.1633701995129826331 for ; Fri, 08 Oct 2021 07:06:35 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=JBVZMW/i; spf=pass (domain: arm.com, ip: 40.107.22.64, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PFqzSfmtE6R/wPKqMUtwtNq/F5mobCtpd9F5UDLIK2U=; b=JBVZMW/i7vi+7KVIORc59Rkk1AJ9bftlX7opDFWl4LFPeOSjr4ebsym0mPiBYNk44HlxqvjQ3iv2OlpujdRJ5SzsR/i1TucJFRJ+FrV1ijkgLr/CyM7rOBVW2sSCe4Ra1L347ynH3wFoKOZngsjdor5F6n8J4FgUDBQty+U3hAU= Received: from DB9PR02CA0026.eurprd02.prod.outlook.com (2603:10a6:10:1d9::31) by VI1PR08MB4431.eurprd08.prod.outlook.com (2603:10a6:803:fe::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Fri, 8 Oct 2021 14:06:32 +0000 Received: from DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:1d9:cafe::6d) by DB9PR02CA0026.outlook.office365.com (2603:10a6:10:1d9::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Fri, 8 Oct 2021 14:06:32 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT036.mail.protection.outlook.com (10.152.20.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.18 via Frontend Transport; Fri, 8 Oct 2021 14:06:32 +0000 Received: ("Tessian outbound 16951d3c485e:v103"); Fri, 08 Oct 2021 14:06:32 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 9c19d4ff25c598e2 X-CR-MTA-TID: 64aa7808 Received: from 7c81425d7ab0.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id A069508C-BCD2-4815-AF05-EF538810539F.1; Fri, 08 Oct 2021 14:06:25 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 7c81425d7ab0.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 08 Oct 2021 14:06:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Cq6PXaS+QmBHOLC3pIIYi0osezai1HyqNXi2gO6CdN2OXaYNdjmRo1BIKSXP7LwQqN1SINZPR05HV6sDIECgWWgbDeSOtIMFsZnDkPWNU7dCp+CsTCmVDL48YeHIH3s3PHdvXrh1sVnE7SmHoGI/ZdHY5D7qlLLQshvQGDpBhjVJ329tDJfptv2AyOpDkvhJzulbCjjUrTI9106PbRgKnblj8L4k3n/ijJp28Dde3P4WU68kIruHal1uIu4p+aVbuG26ws5xSLitwfPv1PLMSnWveCAAn0JEZUbHVVqF98NXcYIqa8NemybmjWm1Z7QLun/AhcqDIvsvKYq0O+Adng== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=PFqzSfmtE6R/wPKqMUtwtNq/F5mobCtpd9F5UDLIK2U=; b=moHDwRTAwNTU7Vj4no+iTBRURtxLnTPzP5kMHp4pEcYXiV8P1q74ohnLuGZeCUgCV9SbWLfbATl4ciH0QkHUx1ENLdDrf5y/yQhvB3q9D+C2XTSGnFDPB2opcNTmUytoUnVzk6xlIlAlqRpL+C/KNODYAmlDLqBwncv799B5QkwFEsEPoImIFK4R2ZLoTTDN7MFgDJIJG/VgDDsC+TjMRNdO7ibmbcWa8Fs73CdWRREK++7jK3TYtHo5UrfMsd13su0CxPemBaGnpsTIqdW7a2hRLDmylojeMTjOUMYOwn19JwwLhZr6TKY8orFSku76SKlCXpJ1tUH8hrCJllfveg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=PFqzSfmtE6R/wPKqMUtwtNq/F5mobCtpd9F5UDLIK2U=; b=JBVZMW/i7vi+7KVIORc59Rkk1AJ9bftlX7opDFWl4LFPeOSjr4ebsym0mPiBYNk44HlxqvjQ3iv2OlpujdRJ5SzsR/i1TucJFRJ+FrV1ijkgLr/CyM7rOBVW2sSCe4Ra1L347ynH3wFoKOZngsjdor5F6n8J4FgUDBQty+U3hAU= Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM6PR08MB3383.eurprd08.prod.outlook.com (2603:10a6:20b:50::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Fri, 8 Oct 2021 14:06:23 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::54b5:239d:9896:ee65]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::54b5:239d:9896:ee65%4]) with mapi id 15.20.4587.022; Fri, 8 Oct 2021 14:06:23 +0000 Subject: Re: [PATCH v2 04/21] DynamicTablesPkg: Add AmlRdSetEndTagChecksum() To: Pierre.Gondois@arm.com, devel@edk2.groups.io, Alexei.Fedorov@arm.com, nd References: <20211007153210.26608-1-Pierre.Gondois@arm.com> <20211007153210.26608-5-Pierre.Gondois@arm.com> From: "Sami Mujawar" Message-ID: <976865be-3e5d-baf7-e6e7-1460332796d9@arm.com> Date: Fri, 8 Oct 2021 15:06:29 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: <20211007153210.26608-5-Pierre.Gondois@arm.com> X-ClientProxiedBy: LO3P123CA0013.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::18) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 Received: from [10.1.196.43] (217.140.106.52) by LO3P123CA0013.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:ba::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Fri, 8 Oct 2021 14:06:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ce5a42f3-d53a-4c1b-5cfe-08d98a64d4d6 X-MS-TrafficTypeDiagnostic: AM6PR08MB3383:|VI1PR08MB4431: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:8273;OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: sQGeESvLf8357982yCNN1tnROARcjJY9UDiM+J/ny7n3nDbl8auq5/XnkMEWTDwkfVJNLksJ/Tq42GRhSWRWgYfAue2j3Nb/B+MBI5zicLVNAmti3pQWW8Lgx4CaNxv+0zluavkVaDbpc+C6Y6fpgiGgfXstBHTxkBNfJFl/Xg1mqVrwthyXn+gthwO9HrVAvAkhWcIPKXKCPdQy47jNH0LHLBGyqK1EcGdRP0UCVuAnuX1KdpI4EMm1ahe8IfyUJQ5d7jgB1qLcy99wMTmpyUtcLZkXK6VIbhT6qsA2X9jczVI0Rlbrb7gjFUoRe8nAIXs91Ue5RjiBY5iFRKDVD85IFaKM9D1buiU4rW/opIQP9WpX1GNhObHsD9Ykr4DQZLXyohyeG6xVBrTim6mB1D0IoJj1GJ08TD2AD2JZMP5do041vcRWG5omhEYIsBXhj54sq7DQ0UWPOfcfniEEPjmM8ZubwZ6YXiZt7UfHoUOGJjCsyHDxheGwqPWSbga9hwqGrIr+RXnyoC3CiOV00gUBl/3RLgHk3OztKLMOTJjXXeAVzOTIjWWuyN0/Czr+S5EiLbqliRUZnmW42ZtNX3tX7oVdbbO11bumNIzKkwPhYKkrj1yOGwItDl4Uuvnbt8MvxbY+khkArtv0R3W5U9UEqitBTxe/EVUDUQBbyVRCtvuhWHuE96xWVyBjOERheX2/GO5PyWrQdRubSaGB2SQjh83dL7ivq2xCDC0qwR4q+h1uoYFsP2QDAsgwT47cOVoILYroJGVhUR/6QCvS+Q== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(6029001)(4636009)(366004)(8936002)(86362001)(38100700002)(26005)(6862004)(38350700002)(6636002)(44832011)(508600001)(36756003)(53546011)(37006003)(316002)(16576012)(2616005)(66556008)(6486002)(5660300002)(186003)(66476007)(956004)(66946007)(52116002)(2906002)(8676002)(83380400001)(31686004)(31696002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3383 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 4ef8e332-f506-423d-af5f-08d98a64cf61 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MoHKgyTfiti5TGVthrsyO8e2IBtP1AU4dphuWBhuw4EglCMDwwTb0SeqEX5W9V1kjqtcjW4l/+GryvgTxK//X2L9YhsG3zBmEIzYqi2iiPoosdTRlQFp3ZY9XP/gMQiuR5heubuSjs3vITkrT9IhParGE74VBuyX/pPh4rUKUqT7F9MvfgT4PY6/YWg6QIkH1WSoELHXxCdVnKM1KEBHa96cgYXHadICu6Yo1tnzryUCawuNx603Hz8aEXWgojjXvf5J5Q+Zen8jZPbt3cYUZMIHEfqnAtUkFza7JSDgmALGti3Mdpv96wmA5RncUfL3CB6VYY1yZtAr6EzunYV1xVhJ2vg/+lItJiNCMHKBqtHK1F1Ha1H0EUK7XK+rudVb3dLuHLWx0kc7V4yu0IapqKT/4xTeTBi1PyCFfW1oHnYXDyVoB8nDLbxt/nJzJKrfnektsgknkD6Hxusp8BXkfRxLVTQUuzcKNwwjsilzD8ENVqJ624PQreI0IU5SJmYmxxj84EOn2uwT0TKVHiZU0JUUhPLKlw5a8DfuAoX/mJm1RJDwygXfxF/Hjz55OaSy/8uYWWRTQEbh5C6QpLZY5N2JCTQtdnaTLFvjn8nKPJCq24aGcjCD5M+j3s9qaV96ohCjwPSIDzbhQNJN5K3PSThKgykUMkHJBSVHWBnUl/w4H0GYe9kHNNXWbbn/nbxO5vg/0HKPcOUGsbpaVX9N6cKZvZhnAn2zrOH5U3c/HWo= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(6029001)(4636009)(46966006)(36840700001)(356005)(81166007)(6636002)(36860700001)(37006003)(53546011)(8676002)(508600001)(86362001)(2906002)(31696002)(8936002)(31686004)(186003)(70586007)(6862004)(82310400003)(6486002)(70206006)(16576012)(2616005)(956004)(26005)(36756003)(316002)(47076005)(83380400001)(44832011)(336012)(5660300002)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2021 14:06:32.1746 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce5a42f3-d53a-4c1b-5cfe-08d98a64d4d6 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DB5EUR03FT036.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4431 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-GB Hi Pierre, Thank you for this patch. Reviewed-by: Sami Mujawar Regards, Sami Mujawar On 07/10/2021 04:31 PM, Pierre.Gondois@arm.com wrote: > From: Pierre Gondois > > Add AmlRdSetEndTagChecksum(), setting the CheckSum value contained in a > Resource Data element. > > ACPI 6.4, s6.4.2.9 "End Tag": > "This checksum is generated such that adding it to the sum of all the > data bytes will produce a zero sum." > "If the checksum field is zero, the resource data is treated as if the > checksum operation succeeded. Configuration proceeds normally." > > Signed-off-by: Pierre Gondois > --- > .../AmlLib/ResourceData/AmlResourceData.c | 33 +++++++++++++++++++ > .../AmlLib/ResourceData/AmlResourceData.h | 21 ++++++++++++ > 2 files changed, 54 insertions(+) > > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResou= rceData.c b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResource= Data.c > index 8b46c7232df3..41cf0bc45314 100644 > --- a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData= .c > +++ b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData= .c > @@ -101,3 +101,36 @@ AmlRdGetSize ( > return ((ACPI_SMALL_RESOURCE_HEADER*)Header)->Bits.Length + > sizeof (ACPI_SMALL_RESOURCE_HEADER); > } > + > +/** Set the Checksum of an EndTag resource data. > + > + ACPI 6.4, s6.4.2.9 "End Tag": > + "This checksum is generated such that adding it to the sum of all the = data > + bytes will produce a zero sum." > + "If the checksum field is zero, the resource data is treated as if the > + checksum operation succeeded. Configuration proceeds normally." > + > + @param [in] Header Pointer to the first byte of a resource data. > + @param [in] CheckSum Checksum value to set. > + > + @retval EFI_SUCCESS The function completed successfully. > + @retval EFI_INVALID_PARAMETER Invalid parameter. > +**/ > +EFI_STATUS > +EFIAPI > +AmlRdSetEndTagChecksum ( > + IN CONST AML_RD_HEADER * Header, > + IN UINT8 CheckSum > + ) > +{ > + if ((Header =3D=3D NULL) || > + !AmlRdCompareDescId ( > + Header, > + AML_RD_BUILD_SMALL_DESC_ID (ACPI_SMALL_END_TAG_DESCRIPTOR_NAME))= ) { > + ASSERT (0); > + return EFI_INVALID_PARAMETER; > + } > + > + ((EFI_ACPI_END_TAG_DESCRIPTOR*)Header)->Checksum =3D CheckSum; > + return EFI_SUCCESS; > +} > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResou= rceData.h b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResource= Data.h > index 48e4e2aaddb4..e478107dffbd 100644 > --- a/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData= .h > +++ b/DynamicTablesPkg/Library/Common/AmlLib/ResourceData/AmlResourceData= .h > @@ -171,4 +171,25 @@ AmlRdGetSize ( > IN CONST AML_RD_HEADER * Header > ); > > +/** Set the Checksum of an EndTag resource data. > + > + ACPI 6.4, s6.4.2.9 "End Tag": > + "This checksum is generated such that adding it to the sum of all the = data > + bytes will produce a zero sum." > + "If the checksum field is zero, the resource data is treated as if the > + checksum operation succeeded. Configuration proceeds normally." > + > + @param [in] Header Pointer to the first byte of a resource data. > + @param [in] CheckSum Checksum value to set. > + > + @retval EFI_SUCCESS The function completed successfully. > + @retval EFI_INVALID_PARAMETER Invalid parameter. > +**/ > +EFI_STATUS > +EFIAPI > +AmlRdSetEndTagChecksum ( > + IN CONST AML_RD_HEADER * Header, > + IN UINT8 CheckSum > + ); > + > #endif // AML_RESOURCE_DATA_H_ IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you.