From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-AM5-obe.outbound.protection.outlook.com (EUR02-AM5-obe.outbound.protection.outlook.com [40.107.0.53]) by mx.groups.io with SMTP id smtpd.web10.9262.1589966188220755985 for ; Wed, 20 May 2020 02:16:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=idSQzqb9; spf=pass (domain: arm.com, ip: 40.107.0.53, 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=qKoDqXTUN9rWUDEXzG9KVbxv96sPcuwPivWPihJjnuA=; b=idSQzqb9bUI9d7w/83scPlP5PYjZgJXTGjwhWm5sEdBMcfT3yKdoE2B4x4H4CC7sTHFW1XRchl6Gq7xCSWHYxJTgH69DB1vwoQbdSUXGEgBEy3nhr2lQHUdDspD8DPllr1k+C014cFxOenpSU/5338h7ekhsQmono2a9imuHvFk= Received: from AM6P195CA0066.EURP195.PROD.OUTLOOK.COM (2603:10a6:209:87::43) by DB8PR08MB5051.eurprd08.prod.outlook.com (2603:10a6:10:bf::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.25; Wed, 20 May 2020 09:16:25 +0000 Received: from VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:87:cafe::de) by AM6P195CA0066.outlook.office365.com (2603:10a6:209:87::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Wed, 20 May 2020 09:16:25 +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=bestguesspass 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 VE1EUR03FT038.mail.protection.outlook.com (10.152.19.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3021.23 via Frontend Transport; Wed, 20 May 2020 09:16:25 +0000 Received: ("Tessian outbound 14e212f6ce41:v57"); Wed, 20 May 2020 09:16:24 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: e84aa8a20e8168c3 X-CR-MTA-TID: 64aa7808 Received: from 8dab7b1d1e2b.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 90F4B036-079E-40D7-BC80-B9F947CCB562.1; Wed, 20 May 2020 09:16:18 +0000 Received: from EUR02-VE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 8dab7b1d1e2b.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 20 May 2020 09:16:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IEhwdRjMhTmhZ9jz6QwA2rq/FCsLvpC9uPNATcyBHaW0qXytulPQUn+8Z5odn45RpBOTRvgsTIzpT5g17YbtYZy00m/JJHW3oV895wVuls52NpMIggy2V+qBiP3ibD/R5bEzpcrh+0z5bWAroNB7j0+mjE1mwZhYgbyosQewR2ec4ZhcbdSw3Np7+FMWKATK6022jZDguHz9CBAG8VYaoZkavp1xcvOrfezrX34Rsiiie44UaQE1hZqoC24PyFFjBqJkRqb8wC+3OkJGHbx+knE5pP37sDVX6vLzlEA4oSA+Sqfv/hiDmsZt+XMoJUWuqmu33ItY9G/y8/h4bRmtAA== 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=qKoDqXTUN9rWUDEXzG9KVbxv96sPcuwPivWPihJjnuA=; b=k5dU798Fy5U2Y04ycUkGFcvv2yv6kAVoQXU3r/q0ct3uucMfya9LjMZKGB3tvbdjXVTyeKPmhmaIfz+nfar1c4te6pO3H8AS2ACBC+thVWG4EcvNWwiou3uKJfAdvFuFd1SL6ijXetdbdRmkWXclRKYzxQZ4jSd72dHKXgd75oQt9yQ8Pv+AxnuCzEyrxhvFBreIXSA0MAiWhASR4DqO1E+rt/mkZOPROZKPr+kaoLj8454e14R352tZiBEeYdf9asdXRakYdimFwQyw/PchOpi2x8DBXZhzua55siTyTYDGnSV1o+loEt6iFlKeiatVlCkvgQhCVAOlM2eOFCK0wA== 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=qKoDqXTUN9rWUDEXzG9KVbxv96sPcuwPivWPihJjnuA=; b=idSQzqb9bUI9d7w/83scPlP5PYjZgJXTGjwhWm5sEdBMcfT3yKdoE2B4x4H4CC7sTHFW1XRchl6Gq7xCSWHYxJTgH69DB1vwoQbdSUXGEgBEy3nhr2lQHUdDspD8DPllr1k+C014cFxOenpSU/5338h7ekhsQmono2a9imuHvFk= Received: from DB7PR08MB3097.eurprd08.prod.outlook.com (2603:10a6:5:1d::27) by DB7PR08MB3899.eurprd08.prod.outlook.com (2603:10a6:10:7f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3000.20; Wed, 20 May 2020 09:16:15 +0000 Received: from DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::587:15d3:8425:65f9]) by DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::587:15d3:8425:65f9%6]) with mapi id 15.20.3000.034; Wed, 20 May 2020 09:16:15 +0000 From: "Sami Mujawar" To: Leif Lindholm , "devel@edk2.groups.io" , "lersek@redhat.com" CC: Ard Biesheuvel , "graeme.gregory@linaro.org" , "tanmay.jagdale@linaro.org" Subject: Re: [edk2-devel] [PATCH] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Thread-Topic: [edk2-devel] [PATCH] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Thread-Index: AQHWLTeJc7O8CHKokUm6jWj9a7khfaivLhcAgAAVLgCAAWn7gA== Date: Wed, 20 May 2020 09:16:15 +0000 Message-ID: References: <20200518171148.6113-1-ard.biesheuvel@arm.com> <6f410b08-f868-8b38-60fd-2b863a89658e@redhat.com> <20200519111550.GM10467@vanye> In-Reply-To: <20200519111550.GM10467@vanye> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: c5e516e3-f648-42c4-95d1-2f2a6def3b57.1 Authentication-Results-Original: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [2a00:23c6:548a:4800:2de5:cb71:ca2e:45] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 08e7dcbc-4bc9-4e5f-2e07-08d7fc9e7867 x-ms-traffictypediagnostic: DB7PR08MB3899:|DB8PR08MB5051: x-ld-processed: f34e5979-57d9-4aaa-ad4d-b122a662184d,ExtAddr x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:10000;OLM:10000; x-forefront-prvs: 04097B7F7F X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: g6ZR2/OnLJxT5Ae0i16FGtwwcc+F/bsn3bkJGLOGhrYrlzyC/FPvsDaxtYDPsIgaL2BuE3wsa3yqms5Gz18iU0Zvdm5i5+mvW9HCji1IS5QbYj4arOve2OJG+GlQAu/lE9zjtAed6F9Bd4k+NIwAC9Zb4WWFBV3Vsx0j6x90H7Q2ot3yVvjfd0C4Tsa7JIyOcxx+R//C95EQRnbSwmnAJE+L3dQNbM232ogV/n9NY3V1kZnJvqW3jUpgYPqU0+DTqfCaPrqwOOpQOClf4IGJsY04iMo0YfuNW/z8VMHoz0lwHEZZOq9s0Cv4GJmy/OQ9j2UD2ESVxQxskgf8e45Ir3Q48jPrgXSMiGpY9bZD9rCCdpXkDrHz5dBDibRJbh8MWgnM9jh6nugrBlRn09O82r1XuSlj1tc8vOqcMjk5WMdN6Pazw5JGIungxdsqts5MsPkU/pM9UShRsUexir5WSt3TO3FZHPpvh8Fnn+YqnPd6v41usCpoT0LH08xyF7uBRF5JOC0OWGOQEtuFt84z1g== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR08MB3097.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(366004)(39860400002)(396003)(136003)(346002)(376002)(53546011)(186003)(966005)(52536014)(7696005)(64756008)(8676002)(66446008)(4326008)(66556008)(86362001)(5660300002)(6506007)(76116006)(66946007)(8936002)(66476007)(9686003)(55016002)(71200400001)(2906002)(54906003)(316002)(33656002)(478600001)(110136005);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: PUSmc1fwSUxL19FL2JWvEprAl9GEQYH/CRE/G61egU/tHeC6oJI6lLwS/Z3mNtrvtdpzSHzPs4ITxFuB0wZkXexUuIUniDwjXzzOehEdpJ0ZInkl3NoejYHJPMNjVNr+tGGRblEQQcvWNXBl6n684sf+pIf6vLOzl5cX1Vf0JTrsbEbvW0+NzG5c09I6wsSvual0vBIse+HgZYPb7C9iltSm1AIVMZs14oFK5Gcp0lMYWZvlUOw12Pxu4EzUyhAe6Vbvpbz+hRBh4LM046k5S8KO6sGHIxwIqrM4OtbXvxFSeT9eE7lrsshS4D/3LdoG8W0mfhqJKR0dB2GYp0ySvzPntVDcWk1tONptxpZr2ISMnGtrAv0J+5wdnDRF+4ku8Y+rAEJixmOxt6MYdHKM9vsbmSB9dh3HazUCDbI6glCKMbPLzmHASxkXoG/PC1Pf1CqilmPrOB5niTSqlr1y7MtJap8Jfwc9RThxOw4lz0oZCKgvcTbm/GkND8AUb4iEdrQl8UFnD7R6f2PVu8IIf40VHPl+Lu8eDi0MOCFCyQo= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR08MB3899 Original-Authentication-Results: nuviainc.com; dkim=none (message not signed) header.d=none;nuviainc.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT038.eop-EUR03.prod.protection.outlook.com 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;SFTY:;SFS:(4636009)(396003)(39860400002)(376002)(136003)(346002)(46966005)(107886003)(336012)(70206006)(86362001)(316002)(52536014)(6506007)(186003)(26005)(82310400002)(53546011)(7696005)(5660300002)(966005)(47076004)(110136005)(8936002)(54906003)(4326008)(70586007)(2906002)(81166007)(82740400003)(8676002)(36906005)(9686003)(478600001)(33656002)(55016002)(356005);DIR:OUT;SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 482a9d61-295c-4f90-10a7-08d7fc9e72de X-Forefront-PRVS: 04097B7F7F X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4FFf1KI+cjgZxFxpIhir0KR4LVnebN7vMhAMoCNR37UvIcIt9Wfh2xlREax0TEGUnjUBfoKqAj1YZHL3bEgCb4E6t/qJkNMEM9tAJJwkH2D7eTI6OnaHM0/LRs57E8dj39N3mU96xk9MHDWYiksV33mu5azTwrOzFFN8lbQGOPa0z8fB7pWL35PoQFJHnkYhwrbeD8zf3imXHr1qOthfDiqJj8kwL8hU1iRbSsOVq+ysPBF8Bz1CjvlpniT/wIeCxXvxzZirFYpFrsKbnUB49/3PWKYkiPv6UQWNKykNDzLSx1xC70qmMhc884LfKkUDOa3iXBAbna38FySuGILYJn879CevRe9X9zOlM4LlIZQ79jcrV3WYwzXCH9T0PaGrhtma23EPlGnKeJPeeV8unVGPbBbsQwPNEMZdJbRbPWslonjCdyagBtaP56d27CdfcEvyY0vdyRHUlUsxOCL7cd7eNY+d7MPFEgucXjToxXhYUurje+GcyvQHtSI8pseA82P06YgRO481DMNb6YK422724yF2JNFTNP90AjafQ5fnEwupTzkMduIzGnPlt6Xd3CRNuWDYt7x0/2UAAOpvsA== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2020 09:16:25.0196 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 08e7dcbc-4bc9-4e5f-2e07-08d7fc9e7867 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: DB8PR08MB5051 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Leif, Please find my response marked inline as [SAMI] Regards, Sami Mujawar -----Original Message----- From: Leif Lindholm Sent: 19 May 2020 12:16 PM To: devel@edk2.groups.io; lersek@redhat.com Cc: Ard Biesheuvel ; graeme.gregory@linaro.org; ta= nmay.jagdale@linaro.org; Sami Mujawar Subject: Re: [edk2-devel] [PATCH] ArmPkg/PlatformBootManagerLib: reject 'd= efault' parity and stop bit count +Sami On Tue, May 19, 2020 at 12:00:02 +0200, Laszlo Ersek wrote: > On 05/18/20 19:11, Ard Biesheuvel wrote: > > In the ArmPkg version of PlatformBootManagerLib, we construct a > > serial device path based on the default settings for baud rate, > > parity and the number of stop bits, to ensure that a serial console > > is available even on the very first boot. > > > > This assumes that PcdUartDefaultParity or PcdUartDefaultStopBits are > > not set to '0', meaning 'the default', as there is no default for > > these when constructing a device path. > > > > So add a couple of ASSERT()s to make sure that we catch this > > condition, since it otherwise ignores the bogus device path > > silently, which is rather tedious to debug,. > > > > Signed-off-by: Ard Biesheuvel > > --- > > ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > index e6e788e0f107..a030d510aa62 100644 > > --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > > @@ -583,6 +583,8 @@ PlatformBootManagerBeforeConsole ( > > // > > // Add the hardcoded serial console device path to ConIn, ConOut, E= rrOut. > > // > > + ASSERT (FixedPcdGet8 (PcdUartDefaultParity) > 0); ASSERT > > + (FixedPcdGet8 (PcdUartDefaultStopBits) > 0); > > ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) =3D=3D 4); > > CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid); > > > > > > Given that these are fixed PCDs, I'd recommend STATIC_ASSERT(). We've > recently put STATIC_ASSERT() to use (in > "OvmfPkg/MptScsiDxe/MptScsi.c") in combination with a fixed PCD: > > STATIC_ASSERT ( > FixedPcdGet8 (PcdMptScsiMaxTargetLimit) < 255, > "Req supports 255 targets only (max target is 254)" > ); > > Just an idea of course; if that's out of scope for now, I have nothing > against this patch. That sounds useful, but should then probably get applied to the TerminalTy= pe as well, so could come in as a separate patch on top. Sami: could this be an alternative resolution for https://edk2.groups.io/g/devel/message/59740 ? [SAMI] For https://edk2.groups.io/g/devel/message/59740 we need a conditional che= ck, as we need to decide between using the PL011UartInteger value or comput= ing it using the UART clock and baud rate. I tried the following and it fixes the VS2017 warning without the need of = a pragma statement. - if (FixedPcdGet32 (PL011UartInteger) !=3D 0) { - Integer =3D FixedPcdGet32 (PL011UartInteger); + Integer =3D FixedPcdGet32 (PL011UartInteger); + if (Integer !=3D 0) { Fractional =3D FixedPcdGet32 (PL011UartFractional); } else { // If BAUD rate is zero then replace it with the system default value The disassembly output (using GCC Objdump) for the above code, with or wit= hout this change appears to be the same. Please let me know if this is more suitable, I can submit a patch with thi= s change. [/SAMI] Regards, Leif > Thanks, > Laszlo > > >=20 > 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.