From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=bDhf5Ohc; spf=pass (domain: arm.com, ip: 40.107.8.44, mailfrom: alexei.fedorov@arm.com) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.44]) by groups.io with SMTP; Fri, 23 Aug 2019 04:53:57 -0700 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=gijlfnTYpm5E/t5dJdLQAV4F21I0IERIC/i69OHmQvY=; b=bDhf5OhcD2QFBaYHhN5qyB7wqGaPyM6a4u0rvIkFXdz/qaK18NqoynPrPE57aiIkCTvEhPg09uA099+S9XL9j91KJ6wj5QOYj3JOYqzZNNPBySvu09dpT/ocXSzCYx0KXLYl5DQ5JVb8/AQ/6Z6T+y4DsLhxk3SiyKIvW4v4Ips= Received: from DB6PR0801CA0045.eurprd08.prod.outlook.com (2603:10a6:4:2b::13) by HE1PR0801MB1849.eurprd08.prod.outlook.com (2603:10a6:3:89::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Fri, 23 Aug 2019 11:53:53 +0000 Received: from DB5EUR03FT055.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e0a::207) by DB6PR0801CA0045.outlook.office365.com (2603:10a6:4:2b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.15 via Frontend Transport; Fri, 23 Aug 2019 11:53:52 +0000 Authentication-Results: spf=temperror (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=temperror action=none header.from=arm.com; Received-SPF: TempError (protection.outlook.com: error in processing during lookup of arm.com: DNS Timeout) Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT055.mail.protection.outlook.com (10.152.21.30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 11:53:50 +0000 Received: ("Tessian outbound 8b8b6ad907d7:v27"); Fri, 23 Aug 2019 11:53:48 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: f7cefc490b9b99e9 X-CR-MTA-TID: 64aa7808 Received: from 07b8291b1d02.2 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.5.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id A7FEF89C-9BD7-4FE1-A95D-1DC5BC0EBDC0.1; Fri, 23 Aug 2019 11:53:43 +0000 Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-he1eur02lp2057.outbound.protection.outlook.com [104.47.5.57]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 07b8291b1d02.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 23 Aug 2019 11:53:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KVyCMTOU9/wnLR688P2DOTPxNLijhFpRnYAUIlWjQd2ftEmasH7LHTFiXxGKtMGCe5jGG8ikcWtBD+/TfRR+NqlpTpPN5qE2fyG+Znf+SCsD1ETzey9Sh8K5IrhKWpxNTUye2xEdnhCwwzcBk/zIgyjRbs5wErSS2us8qUnuMxpscampPEIE4uJUXUMRgOYGb55jKLJduLaIWJb3kiM0P1QjY9gNdXZqQjudnrROLe2KYv43XuFk+r1Tk/buOciMp68glRlL+WZZ+KLhzbn16ACRkv95zU+xWUCzUrhSyL/8bdOtwB1zaMcgfole44uAiaZCgUGwL4+fxMp4me8KHA== 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=tAFjqQayk63QeuUFw/R4Bbm51m5kO+9+fgATuUGphrM=; b=PoMmj6R7yAk3tf1LMdTFUzTeXsRLXLYH79hgifa5JDzlxzqJF1kTIwtm0cIXWeWidSvMR0yEpYFy8oicHbjpqcIVOyXUmVRCf8o34AdJ+Os5BtfE+fUX52LJd2agpQ74ddMK5BiTBx5pIFcwCqNZ97jn5Fz1e8ju6wZZStNTQVkncLlKwE2LdM65d6NwK9XUIb5zYZ1Dm95E4/nQLcZDc/VYH2VJc8jD5SrKnXnOXOX9O7HDi+G4XtWsRjnaOOJ2eoyEVumeg7KwWYihJnAvYuAR0cW94QsgIplvIspCnWgpdrFmy/w9mITFMbbuplqY8DceUfzI1Xisvzivn8eyHw== 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=tAFjqQayk63QeuUFw/R4Bbm51m5kO+9+fgATuUGphrM=; b=Mb6dSpjMnBOvscsHcBbtyMjd/dpeecmvSaRvmrw4Tmq28S+3JVsS71s8vj0qZkKz3juzv1yz/5VmN7UU57hhnvm70/AtG4lz+BJHIlL1uSToeKRbUTKUbvwcZSrVYB/Qqu9CMR4IgdyIF8cyWvHhzpFNhN9BoVqPZ1EByR94W90= Received: from AM5PR0801MB1732.eurprd08.prod.outlook.com (10.169.244.21) by AM5PR0801MB1906.eurprd08.prod.outlook.com (10.168.156.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.18; Fri, 23 Aug 2019 11:53:42 +0000 Received: from AM5PR0801MB1732.eurprd08.prod.outlook.com ([fe80::50d7:cef5:ee39:2e83]) by AM5PR0801MB1732.eurprd08.prod.outlook.com ([fe80::50d7:cef5:ee39:2e83%9]) with mapi id 15.20.2178.020; Fri, 23 Aug 2019 11:53:42 +0000 From: "Alexei Fedorov" To: "devel@edk2.groups.io" , Sami Mujawar Subject: Re: [edk2-devel] [PATCH v1 04/19] DynamicTablesPkg: Fix serial port subtype warning Thread-Topic: [edk2-devel] [PATCH v1 04/19] DynamicTablesPkg: Fix serial port subtype warning Thread-Index: AQHVWaGEUt4hLqfC8EGCm8u2c224c6cIn4CC Date: Fri, 23 Aug 2019 11:53:42 +0000 Message-ID: References: <20190823105539.13260-1-sami.mujawar@arm.com>,<20190823105539.13260-5-sami.mujawar@arm.com> In-Reply-To: <20190823105539.13260-5-sami.mujawar@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: Authentication-Results-Original: spf=none (sender IP is ) smtp.mailfrom=Alexei.Fedorov@arm.com; x-originating-ip: [217.140.106.49] x-ms-publictraffictype: Email X-MS-Office365-Filtering-Correlation-Id: ce1c4681-1c44-4a8a-efd2-08d727c090a8 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(4618075)(2017052603328)(7193020);SRVR:AM5PR0801MB1906; X-MS-TrafficTypeDiagnostic: AM5PR0801MB1906:|HE1PR0801MB1849: X-MS-Exchange-PUrlCount: 3 x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true x-ms-oob-tlc-oobclassifiers: OLM:1079;OLM:1079; x-forefront-prvs: 0138CD935C X-Forefront-Antispam-Report-Untrusted: SFV:NSPM;SFS:(10009020)(4636009)(346002)(396003)(136003)(376002)(39860400002)(366004)(189003)(199004)(76176011)(19627405001)(26005)(2501003)(9686003)(66066001)(186003)(3846002)(102836004)(25786009)(105004)(6116002)(2906002)(55016002)(99286004)(66946007)(476003)(14444005)(53546011)(7696005)(446003)(76116006)(236005)(66446008)(478600001)(256004)(966005)(11346002)(66476007)(66556008)(64756008)(8936002)(8676002)(53936002)(52536014)(606006)(6636002)(229853002)(486006)(33656002)(6506007)(81166006)(74316002)(6246003)(6306002)(316002)(7736002)(71190400001)(71200400001)(54896002)(5660300002)(81156014)(86362001)(110136005)(14454004)(6436002);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0801MB1906;H:AM5PR0801MB1732.eurprd08.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: fqf11U4VO1Qf9O0ORlKULr08o2EmwYnYMlNoLMcSwLHp8XpBVAlP0JXKYagDg1hxv4R041Dv15Q508lK+A8yS/afGerQBzSw/pPop+LqbPrvJRckGUuGXGS2AVkNkk58Ml5vSWjiKWy7l/x5WYC5q/EggsCJrCWHEMMxIKujdBnsN3a3Z3iJrqXQ69A1trPyjNNe7rI5A2/CLSsYYDRv7/sPvWva1R1IvmwIn/NOOKP9znPh3x1YVpJjR25ysxXYOE1O5jA7KcNfNAiiwECXX9eM9fWaXXV+Hx2ZKpsQMMSoePn0ON2JkD1lY627v7TAo8o82S27Pmk8ffXXQ/7Q6r3u6gUpzVEgodmjC0R3Awos0/FX/vjt2jC8PnTY9kVCpUB4J2ioDUXiVXGKYCrYMBErA9RvNLwcWx+rFP6eBTM= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0801MB1906 Original-Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Alexei.Fedorov@arm.com; Return-Path: Alexei.Fedorov@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT055.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123;IPV:CAL;SCL:-1;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(376002)(39860400002)(396003)(346002)(136003)(2980300002)(40434004)(199004)(189003)(66066001)(26826003)(478600001)(229853002)(16586007)(110136005)(86362001)(99286004)(8676002)(356004)(8936002)(966005)(14444005)(14454004)(81166006)(33656002)(76176011)(70206006)(71190400001)(5660300002)(7696005)(486006)(126002)(236005)(55016002)(54896002)(9686003)(76130400001)(6306002)(25786009)(5024004)(81156014)(70586007)(6636002)(2906002)(2501003)(102836004)(52536014)(63350400001)(336012)(105004)(26005)(63370400001)(186003)(6506007)(446003)(11346002)(606006)(53546011)(3846002)(74316002)(7736002)(22756006)(6116002)(476003)(6246003)(316002)(19627405001);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR0801MB1849;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;A:1;MX:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: de844423-fd2f-4957-7781-08d727c08b6e X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(710020)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020);SRVR:HE1PR0801MB1849; X-Forefront-PRVS: 0138CD935C X-Microsoft-Antispam-Message-Info: fNa8O1SNWPeI+ohqFV9zHVxsbjQAu4DsBWoitBSniqcA9DRwHr5V3EvJ2OS7gX0cf+P48RXFsOYNlNrxHg9qKu3DEhqVrmjy7A9SSoahKINDFSed746A6+eRhKOs/M6QpD6Tte0HTCRm9FCcwW7piHY+yT30drIFwNcy4Qr3AmtsONUd5cTl8ayhry4UgP2QfkfOM28vcz5mqpgx91rve1qNdQvJQN7id+q3krD/jhvfA3CmJ5XETM+yAqwgy6MiIhTbAaQm64yhNdFotxkEo8mOgcDcRlPMkXvVAijc3G+wdlvRnMmlIxyjBvb3gQ9n3Cpouy6JIJE26ggorO70XOubTHNURByA+aWO0vmp9zGpZqN4rOTZ+ng2Nt8Ok7TJPsh355a8vOntk9k1Q+5HsKzqBVcjYQF+158+7ZwHA1Y= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2019 11:53:50.9698 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ce1c4681-1c44-4a8a-efd2-08d727c090a8 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-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1849 Content-Language: en-GB Content-Type: multipart/alternative; boundary="_000_AM5PR0801MB1732DE76F574E938A90068249AA40AM5PR0801MB1732_" --_000_AM5PR0801MB1732DE76F574E938A90068249AA40AM5PR0801MB1732_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Alexei Fedorov Alexei ________________________________ From: devel@edk2.groups.io on behalf of Sami Mujawa= r via Groups.Io Sent: 23 August 2019 11:55 To: devel@edk2.groups.io Cc: Sami Mujawar ; ard.biesheuvel@linaro.org ; leif.lindholm@linaro.org ; = Matteo Carlini ; Stephanie Hughes-Fitt ; nd Subject: [edk2-devel] [PATCH v1 04/19] DynamicTablesPkg: Fix serial port s= ubtype warning The VS2017 compiler reports 'warning C4244: '=3D': conversion from 'UINT16' to 'UINT8', possible loss of data' for the SPCR InterfaceType field assignment. The SPCR InterfaceType field uses the same encoding as that of the DBG2 table Port Subtype field. However SPCR.InterfaceType is 8-bit while the Port Subtype field in DBG2 table is 16-bit. Since the Configuration Manager represents the Serial port information using the struct CM_ARM_SERIAL_PORT_INFO, the PortSubtype member in this struct is 16-bit. To fix the warning an explicit type case is added. A validation is also added to ensure that the Serial Port Subtype value provided by the Configuration Manager is within the 8-bit range (less than 256). Signed-off-by: Sami Mujawar --- DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 15 +++= +++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerato= r.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c index 1404279f828d5c06bb7605cb2fe6d864ef7a080e..4b2580da7df9b4472ae9bcc3df= 2138a9e13004d0 100644 --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c @@ -217,8 +217,21 @@ BuildSpcrTable ( goto error_handler; } + // The SPCR InterfaceType uses the same encoding as that of the + // DBG2 table Port Subtype field. However InterfaceType is 8-bit + // while the Port Subtype field in the DBG2 table is 16-bit. + if ((SerialPortInfo->PortSubtype & 0xFF00) !=3D 0) { + Status =3D EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: SPCR: Invalid Port Sybtype (must be < 256). Status =3D %r\n= ", + Status + )); + goto error_handler; + } + // Update the serial port subtype - AcpiSpcr.InterfaceType =3D SerialPortInfo->PortSubtype; + AcpiSpcr.InterfaceType =3D (UINT8)SerialPortInfo->PortSubtype; // Update the base address AcpiSpcr.BaseAddress.Address =3D SerialPortInfo->BaseAddress; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in= any medium. Thank you. --_000_AM5PR0801MB1732DE76F574E938A90068249AA40AM5PR0801MB1732_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Alexei Fedorov <Alexei.Fedorov@arm.com>

Alexei


From: devel@edk2.groups.io= <devel@edk2.groups.io> on behalf of Sami Mujawar via Groups.Io <s= ami.mujawar=3Darm.com@groups.io>
Sent: 23 August 2019 11:55
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Sami Mujawar <Sami.Mujawar@arm.com>; ard.biesheuvel@linar= o.org <ard.biesheuvel@linaro.org>; leif.lindholm@linaro.org <leif.= lindholm@linaro.org>; Matteo Carlini <Matteo.Carlini@arm.com>; Ste= phanie Hughes-Fitt <Stephanie.Hughes-Fitt@arm.com>; nd <nd@arm.com= >
Subject: [edk2-devel] [PATCH v1 04/19] DynamicTablesPkg: Fix serial= port subtype warning
 
The VS2017 compiler reports 'warning C4244: '=3D'= : conversion
from 'UINT16' to 'UINT8', possible loss of data' for the
SPCR InterfaceType field assignment.

The SPCR InterfaceType field uses the same encoding as that
of the DBG2 table Port Subtype field. However SPCR.InterfaceType
is 8-bit while the Port Subtype field in DBG2 table is 16-bit.

Since the Configuration Manager represents the Serial port
information using the struct CM_ARM_SERIAL_PORT_INFO, the
PortSubtype member in this struct is 16-bit.

To fix the warning an explicit type case is added. A validation
is also added to ensure that the Serial Port Subtype value
provided by the Configuration Manager is within the 8-bit
range (less than 256).

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
---
 DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c | 1= 5 ++++++++++++++-  1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerato= r.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
index 1404279f828d5c06bb7605cb2fe6d864ef7a080e..4b2580da7df9b4472ae9bcc3df= 2138a9e13004d0 100644
--- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c
+++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGen= erator.c
@@ -217,8 +217,21 @@ BuildSpcrTable (
     goto error_handler;
   }
 
+  // The SPCR InterfaceType uses the same encoding as that of th= e
+  // DBG2 table Port Subtype field. However InterfaceType is 8-b= it
+  // while the Port Subtype field in the DBG2 table is 16-bit. +  if ((SerialPortInfo->PortSubtype & 0xFF00) !=3D 0) { +    Status =3D EFI_INVALID_PARAMETER;
+    DEBUG ((
+      DEBUG_ERROR,
+      "ERROR: SPCR: Invalid Port Sybtyp= e (must be < 256). Status =3D %r\n",
+      Status
+      ));
+    goto error_handler;
+  }
+
   // Update the serial port subtype
-  AcpiSpcr.InterfaceType =3D SerialPortInfo->PortSubtype;
+  AcpiSpcr.InterfaceType =3D (UINT8)SerialPortInfo->PortSubty= pe;
 
   // Update the base address
   AcpiSpcr.BaseAddress.Address =3D SerialPortInfo->BaseAddre= ss;
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'





IMPORTANT NOTICE: The contents of this email and any attachments are confi= dential and may also be privileged. If you are not the intended recipient, = please notify the sender immediately and do not disclose the contents to an= y other person, use it for any purpose, or store or copy the information in any medium. Thank you. --_000_AM5PR0801MB1732DE76F574E938A90068249AA40AM5PR0801MB1732_--