From nobody Fri Apr 26 05:10:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59815+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59815+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1589891049; cv=none; d=zohomail.com; s=zohoarc; b=f2e1DC3pJf3OVlZaNIJNbX0DixplLR/2/QWLQ0uIP+J8uWwx3IEa8pG5kbxwX/ZqeTHDM6uyn1ytCc6QEqyKVX8NAu8bruub9i6DhRG6THCeIKlhRl2N4E4DkOIX3HstQ0hYpjlt6RqXc03BniIzHwYFAVmPSHsiIVNK95uqMkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589891049; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=ebEbwZR/w7pwRrnMW6FwBixL9GzjvEIqfWrJiePYeR0=; b=k5XloT3QTJREHbrNjSK44Z0F+Hlj9zak7LdOAvwjAxNL9zYRdQ6u0nIDzJGBR9rXB775LMBv2XfpiJrn7KPbW6RsXX0P+Qp2vW9MrCiutDmT+GlZzsdx3CMNkcsSj/Lfwe8oKCwC3RMf8sjBJqwPGI+yi0vPk2w8s1hsU+kAvco= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59815+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589891049911318.3176957113237; Tue, 19 May 2020 05:24:09 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id xpS4YY1788612xjsZHcVApQu; Tue, 19 May 2020 05:24:09 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.10644.1589891048922235814 for ; Tue, 19 May 2020 05:24:09 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8F39C30E; Tue, 19 May 2020 05:24:08 -0700 (PDT) X-Received: from e123331-lin.nice.arm.com (unknown [10.37.8.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 084E13F52E; Tue, 19 May 2020 05:24:05 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, graeme.gregory@linaro.org, tanmay.jagdale@linaro.org, lersek@redhat.com, sami.mujawar@arm.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH v2 1/2] ArmPkg/PlatformBootManagerLib: use static assertion for console type Date: Tue, 19 May 2020 14:23:50 +0200 Message-Id: <20200519122351.18405-2-ard.biesheuvel@arm.com> In-Reply-To: <20200519122351.18405-1-ard.biesheuvel@arm.com> References: <20200519122351.18405-1-ard.biesheuvel@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@arm.com X-Gm-Message-State: YDqKUK1cY97F6AvXqQGXFzoYx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589891049; bh=+C3DIWU/NSifbuHa3EGUNwtoIOE/T5WEgOap8ncYZOs=; h=Cc:Date:From:Reply-To:Subject:To; b=JqJROg+FwlIXocg/uDkuNim46kERbh2wuouclfwBW+Qqp78bq4wGjoOsXLdew1JeD6j 2bSvWF6f01DlDUi+MebdrbPGeQ/OON0RVsUxrPWx+AAMnFjlMRVmtKArGKLOte4bq+yLT ATgAFzjPX8q2fKrkWrc2H9KCsvBICcHtCu4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Replace the runtime ASSERT with the build time STATIC_ASSERT on the check that ensures that the terminal type we use for the serial console matches the one we explicitly add to the ConIn/ConOut/StdErr variables. This helps catch serial console issues early, even in RELEASE builds, reducing the risk of ending up with no console at all, which can be tricky to debug on bare metal. Signed-off-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Li= brary/PlatformBootManagerLib/PlatformBm.c index e6e788e0f107..f713605c02b2 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -583,7 +583,9 @@ PlatformBootManagerBeforeConsole ( // // Add the hardcoded serial console device path to ConIn, ConOut, ErrOut. // - ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) =3D=3D 4); + STATIC_ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) =3D=3D 4, + "PcdDefaultTerminalType must be TTYTERM"); + CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid); =20 EfiBootManagerUpdateConsoleVariable (ConIn, --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59815): https://edk2.groups.io/g/devel/message/59815 Mute This Topic: https://groups.io/mt/74323489/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 05:10:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+59816+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59816+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1589891052; cv=none; d=zohomail.com; s=zohoarc; b=fHAww03LvYxx/vKJLbJYu6o5CVYJ74V8HItSkQ9z1OSZsVEOvoPGFGDOrSorkcjtpz4BF1PWzfmRJVnXKpNwmlCo7OEXYRi2LMCUbQQLqs9ybcLVmZ3JLnR4pqlYm8ADV+7cyk1tLf5lrB7zr7AFUCI4ANsBxniV0ZpZ4WB4u84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589891052; h=Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:Message-ID:Reply-To:References:Sender:Subject:To; bh=WpVIFM7T/eWfia9TbHvEuM8BoLbbZiBHrN3wsnP0doU=; b=K0i6LsHXW8yEMd8t4qhhSNNp+g9LTFHYk/DpUJapcTOxFHH1fkvddp/6rNbQ9+atGHoP3zqSxyDdJknkU2WwUUPKvRw34NxzYlYGniuB1+8ZRUa83pLQ701dHcLqwSwbgBHfwnA8tZkdH36XS3kEQDYrwqpHa5gu8rs8wtTKbEg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+59816+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589891052134138.82941014440416; Tue, 19 May 2020 05:24:12 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id XzH5YY1788612xsfe2iOlfgo; Tue, 19 May 2020 05:24:11 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.10646.1589891051085895695 for ; Tue, 19 May 2020 05:24:11 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB55E30E; Tue, 19 May 2020 05:24:10 -0700 (PDT) X-Received: from e123331-lin.nice.arm.com (unknown [10.37.8.132]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id EE4E43F52E; Tue, 19 May 2020 05:24:08 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, graeme.gregory@linaro.org, tanmay.jagdale@linaro.org, lersek@redhat.com, sami.mujawar@arm.com, Ard Biesheuvel Subject: [edk2-devel] [PATCH v2 2/2] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Date: Tue, 19 May 2020 14:23:51 +0200 Message-Id: <20200519122351.18405-3-ard.biesheuvel@arm.com> In-Reply-To: <20200519122351.18405-1-ard.biesheuvel@arm.com> References: <20200519122351.18405-1-ard.biesheuvel@arm.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,ard.biesheuvel@arm.com X-Gm-Message-State: Gm47jdGcMwxvQ43rRGHIOpBpx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589891051; bh=wvKgPFN8bc1XbbdLKUlMoCH9RyxznAzf+RE8h1hzimE=; h=Cc:Date:From:Reply-To:Subject:To; b=C0KQlZwEAdscK0aWWv10jDhwNCy/VTnNduFTxPf3QjddyUean8B+av2HH4tX3nrIXU4 j0p/w6ns7KbhPkV0wKO4rG6nwbfmmXF2AYTPUv3lpWzPxaBp+ujnfB9xSl0Kr7vfO6hPl 1uuRD0XhUwX/ltzcXyDqSJhb/uj35yuSkq8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 STATIC_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 Reviewed-by: Laszlo Ersek Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Li= brary/PlatformBootManagerLib/PlatformBm.c index f713605c02b2..3411219fbfdb 100644 --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -585,6 +585,10 @@ PlatformBootManagerBeforeConsole ( // STATIC_ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) =3D=3D 4, "PcdDefaultTerminalType must be TTYTERM"); + STATIC_ASSERT (FixedPcdGet8 (PcdUartDefaultParity) !=3D 0, + "PcdUartDefaultParity must be set to an actual value, not 'default'"); + STATIC_ASSERT (FixedPcdGet8 (PcdUartDefaultStopBits) !=3D 0, + "PcdUartDefaultStopBits must be set to an actual value, not 'default'"= ); =20 CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid); =20 --=20 2.17.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#59816): https://edk2.groups.io/g/devel/message/59816 Mute This Topic: https://groups.io/mt/74323490/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-