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=QtBO7+V5; spf=pass (domain: arm.com, ip: 40.107.0.48, mailfrom: sami.mujawar@arm.com) Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.48]) by groups.io with SMTP; Fri, 23 Aug 2019 03:56:58 -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=cc8AFgzhriEfT9IVhX16kZ6VOCuKfW8y+4RIMXwteCA=; b=QtBO7+V5iJShaJs52Nv/lvMBKeQW1TKNpKq5cG+vtnghsUTDXtaDLxTu7YRgWvxjEqA6bQTg6FBr3Z/32JJ0D4TlgNtF6BghT1XIvEdDuj6zDYrFZc+GF5FtSMRVXxwO/z+lqkZMxyqHh8D646YmLVk4vnp8J4YJKz3rknr3WzU= Received: from HE1PR0802CA0003.eurprd08.prod.outlook.com (2603:10a6:3:bd::13) by VE1PR08MB4957.eurprd08.prod.outlook.com (2603:10a6:803:110::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Fri, 23 Aug 2019 10:56:53 +0000 Received: from AM5EUR03FT054.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::206) by HE1PR0802CA0003.outlook.office365.com (2603:10a6:3:bd::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2199.14 via Frontend Transport; Fri, 23 Aug 2019 10:56:53 +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 AM5EUR03FT054.mail.protection.outlook.com (10.152.16.212) 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 10:56:50 +0000 Received: ("Tessian outbound 4ee777a495a5:v27"); Fri, 23 Aug 2019 10:56:47 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 08628c56ba17078c X-CR-MTA-TID: 64aa7808 Received: from e69b3d0a8de5.1 (ip-172-16-0-2.eu-west-1.compute.internal [104.47.12.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com id A884B08A-6CDB-450B-827C-A06A5CCA0CEC.1; Fri, 23 Aug 2019 10:56:39 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04lp2053.outbound.protection.outlook.com [104.47.12.53]) by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id e69b3d0a8de5.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 23 Aug 2019 10:56:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SAnGVgwKAhJW1efybDwhd35E79DReSjvhO03kh0xwQ2qV6FTOVSXzWYKvkNUr2E8LLDNfyIjkQSgjVKHvh2Mg4iCSIYtqUT5dzL3aO6quB3XcHOeV6fFQvoN2jeBFrQTymIOuCH6gZ5m+JedMDIY9/70lfEuUCzDq4Atwt2gjFHiKfTNimLdyve72aUaJkgcXPdviUC8kcXx4YDExlX9TKgC+vxsRejwWOCzz0pJs8f5a1B8sNCh2RJY5geC23a6/KxSXzTOo1403FiG7FcBgCsSgOvQA+gMyXyNXY4mlnyqnLsLIo/WYBBF52BPg3A3UksZPgxxDgFCU+ZCvzR/Ww== 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=cc8AFgzhriEfT9IVhX16kZ6VOCuKfW8y+4RIMXwteCA=; b=izWk02RSGsDITEMorzZofRZlyt2VDbZADOCTdRSTHRKV522mkxFw1e9fCsgqzv+hMoHty0BOPRVc2N2A3HtCGk9VVCGDa9yPARk+EEW6BVQCBYkwCDa/jCzF1f/aDnC4qE+ltiAh38rctr1apLxleQs3im36dZesvjeYM/BSD/QR7C9VLP47rkwk6tA839qhjHro8n+F+iAyDtd6+HqJUmJRafg6qJOIcBxeyOwh/KlQS7eQBm1tVqWgKToHfqE471R6+U8Yw8isANKfDclrpBOtG7V6tEb+l+cUmxkT/7TQZF1siltU/OWHqZDGVUIWvylCB5o+nN9BkCD8JautUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=temperror (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=temperror action=none header.from=arm.com; dkim=none (message not signed); 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=cc8AFgzhriEfT9IVhX16kZ6VOCuKfW8y+4RIMXwteCA=; b=QtBO7+V5iJShaJs52Nv/lvMBKeQW1TKNpKq5cG+vtnghsUTDXtaDLxTu7YRgWvxjEqA6bQTg6FBr3Z/32JJ0D4TlgNtF6BghT1XIvEdDuj6zDYrFZc+GF5FtSMRVXxwO/z+lqkZMxyqHh8D646YmLVk4vnp8J4YJKz3rknr3WzU= Received: from VE1PR08CA0006.eurprd08.prod.outlook.com (2603:10a6:803:104::19) by AM5PR0802MB2594.eurprd08.prod.outlook.com (2603:10a6:203:99::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2178.16; Fri, 23 Aug 2019 10:56:36 +0000 Received: from AM5EUR03FT011.eop-EUR03.prod.protection.outlook.com (2a01:111:f400:7e08::203) by VE1PR08CA0006.outlook.office365.com (2603:10a6:803:104::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2199.14 via Frontend Transport; Fri, 23 Aug 2019 10:56:36 +0000 Authentication-Results-Original: spf=temperror (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;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 nebula.arm.com (40.67.248.234) by AM5EUR03FT011.mail.protection.outlook.com (10.152.16.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.2199.13 via Frontend Transport; Fri, 23 Aug 2019 10:56:35 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1415.2; Fri, 23 Aug 2019 10:56:20 +0000 Received: from E107187.Arm.com (10.1.195.55) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Fri, 23 Aug 2019 10:56:20 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , Subject: [PATCH v1 04/19] DynamicTablesPkg: Fix serial port subtype warning Date: Fri, 23 Aug 2019 11:55:24 +0100 Message-ID: <20190823105539.13260-5-sami.mujawar@arm.com> X-Mailer: git-send-email 2.11.0.windows.3 In-Reply-To: <20190823105539.13260-1-sami.mujawar@arm.com> References: <20190823105539.13260-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;IPV:NLI;CTRY:IE;EFV:NLI;SFV:NSPM;SFS:(10009020)(4636009)(396003)(376002)(136003)(346002)(39860400002)(2980300002)(189003)(199004)(2906002)(36756003)(50226002)(50466002)(86362001)(336012)(63370400001)(446003)(63350400001)(16586007)(356004)(305945005)(186003)(26005)(486006)(48376002)(6916009)(47776003)(54906003)(53936002)(2616005)(81156014)(81166006)(53416004)(5660300002)(2351001)(44832011)(4326008)(476003)(76176011)(8676002)(316002)(126002)(426003)(8936002)(11346002)(1076003)(14444005)(7696005)(478600001)(51416003)(70206006)(70586007);DIR:OUT;SFP:1101;SCL:1;SRVR:AM5PR0802MB2594;H:nebula.arm.com;FPR:;SPF:TempError;LANG:en;PTR:InfoDomainNonexistent;MX:1;A:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f83cd1f3-2296-491d-27e1-08d727b89a20 X-Microsoft-Antispam-Untrusted: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600166)(711020)(4605104)(1401327)(2017052603328);SRVR:AM5PR0802MB2594; X-MS-TrafficTypeDiagnostic: AM5PR0802MB2594:|VE1PR08MB4957: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true X-MS-Oob-TLC-OOBClassifiers: OLM:10000;OLM:10000; X-Forefront-PRVS: 0138CD935C X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info-Original: CFPtmXY6FxoXloc0actfqGEMmzHa8rhxg1syzoXzp9AjpW5LwMFRtxANntxTxIH+X+Nvp4cYswpuL+eeAbSHF8WF/75DxspZzDGI1FpH7bACmkJXCYHtbaVt/VBc0NkjTZK422dBMP4CwGxOHk5wXyBtqgvV63p5/buWaGBlt2tPD+szfeGK2j2Kv69bXsbNJ6FShfHSD1khUPiEaKFp8BnXGh+2q2vZHt3auxsVNksKiZ31u5i0oCulu2en6hvmtg3/nc/cCNrBuKrhxPXlcCXMDR7P9VKvQa2pTuU12EJ+emOXzszsX5DL2Vgby760Fhhd6xMroNYhaCdA3PW9NeURC61Q9K+YaRRN653JCaBmfTJBMXYbsygxLkRsrF7PgeZZXiJqiAJuZ0AZp5ieSQ5up2U9MIyaYRU6N/BxixA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2594 Original-Authentication-Results: spf=temperror (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=temperror action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT054.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)(396003)(376002)(39860400002)(346002)(136003)(2980300002)(189003)(199004)(53416004)(86362001)(48376002)(26005)(476003)(50226002)(336012)(2906002)(36906005)(4326008)(316002)(6916009)(63350400001)(126002)(36756003)(1076003)(63370400001)(426003)(50466002)(2616005)(22756006)(478600001)(11346002)(8676002)(54906003)(5660300002)(486006)(8936002)(16586007)(47776003)(81166006)(2351001)(81156014)(305945005)(186003)(26826003)(70586007)(70206006)(44832011)(76176011)(7696005)(51416003)(446003)(76130400001)(14444005);DIR:OUT;SFP:1101;SCL:1;SRVR:VE1PR08MB4957;H:64aa7808-outbound-1.mta.getcheckrecipient.com;FPR:;SPF:TempError;LANG:en;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;MX:1;A:1; X-MS-Office365-Filtering-Correlation-Id-Prvs: 01c6c2eb-2917-4d79-294b-08d727b890c1 X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(5600166)(710020)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328);SRVR:VE1PR08MB4957; NoDisclaimer: True X-Forefront-PRVS: 0138CD935C X-Microsoft-Antispam-Message-Info: 9Uq3cnITchBc9qHjlNNlaqZl75+PX6JwR+jS92l6NLBB5EZwTAx1x6urOq6VNHwizTrhx4fZW8yMbxkod6O5F1OtytsPKscMVF+RV7h5OmM8S/UbpVlUYmOhGRo37TuXXbaFc2Q0lqAVN4g/qOjoekglLYOuMLiXDjYpxwLYgKIsJ9yTKI1RFYc6PpfS5BfNzjL/vafAcrA2841zH8kTDILUamg0RObmP1ANjKog/Le0RKmFlRPBrEDyRk5ePQWnXlSUSflm5lMDjjNznI2samRcoHtaXtmzQW/1pbzjPUhbW/1/xb1xUhHhmCo0448Nnrt0SW2j8w27sU9LSVGoBVxIWAevr990clRM9pj2mMWchNRfyaCpCDszWMCcNvVNMNKFbTMSyWYGtO+5wKfzJvt64/NisV4X3Ebbcb6BnH8= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2019 10:56:50.8748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f83cd1f3-2296-491d-27e1-08d727b89a20 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: VE1PR08MB4957 Content-Type: text/plain The VS2017 compiler reports 'warning C4244: '=': 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/SpcrGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSpcrLibArm/SpcrGenerator.c index 1404279f828d5c06bb7605cb2fe6d864ef7a080e..4b2580da7df9b4472ae9bcc3df2138a9e13004d0 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) != 0) { + Status = EFI_INVALID_PARAMETER; + DEBUG (( + DEBUG_ERROR, + "ERROR: SPCR: Invalid Port Sybtype (must be < 256). Status = %r\n", + Status + )); + goto error_handler; + } + // Update the serial port subtype - AcpiSpcr.InterfaceType = SerialPortInfo->PortSubtype; + AcpiSpcr.InterfaceType = (UINT8)SerialPortInfo->PortSubtype; // Update the base address AcpiSpcr.BaseAddress.Address = SerialPortInfo->BaseAddress; -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'