From nobody Sat Apr 20 11:01:44 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+59753+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+59753+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1589821922; cv=none; d=zohomail.com; s=zohoarc; b=AO9EeDwwoeNFEjAdudtb2E59r3fuX/kBnw5KYspv+1xta1/QFIhvo91CHxxEH/D0Y6VAyzH8zM3GjMx43RoEo/1wKwYGUjkXPn5zPloP5WnVKsdaXnZ8cxa++p4WW50d5b92xCVhv+e100/Pf9Pm8wh5GAzZ94afdSCDueCNLYA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589821922; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=yijSW6N02XKCdTNHMRai0OZ+oRZ4lO5CEXbgVvSv9j4=; b=hDE+dXdtbWYv+TmlzJwrGAxdGznWmIJmGl/6h9zGk+BcMn89DgAp4dSHF84rwfXGExBGw3+iUlfgjGw4Sk3fgYFvkChBhljk9g55Gt+NU2+wyCrKckmpVyBfT1A98dWXHqQUEOFee4TkuBGwtyUOW87h767EsKoSq+tpu0THE2c= 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+59753+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1589821922314994.1379436894531; Mon, 18 May 2020 10:12:02 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id boOWYY1788612xMatp2JN9rV; Mon, 18 May 2020 10:12:01 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.1380.1589821920922732852 for ; Mon, 18 May 2020 10:12:01 -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 3C763106F; Mon, 18 May 2020 10:12:00 -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 0BE2D3F305; Mon, 18 May 2020 10:11:58 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: leif@nuviainc.com, graeme.gregory@linaro.org, tanmay.jagdale@linaro.org, Ard Biesheuvel Subject: [edk2-devel] [PATCH] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Date: Mon, 18 May 2020 19:11:48 +0200 Message-Id: <20200518171148.6113-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: wi072PtsEEEC2p9g4XugUZMex1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1589821921; bh=+q1O0LIdbxE+iuDvSfrfu34xR0PUyiveWLhof1iDoQI=; h=Cc:Date:From:Reply-To:Subject:To; b=Xd/Huih86prCu6Qfwm6M+fMUVFXU1nTgFPzIUJvpEy7DGG/tjAN1RAhOEuV6NZ/sDsf RbsqH3BmXh0Bql1bNpNINg6Zfg3ErO+H2KqNx29s6Mo9x8XojEgZSRK3AZMCRe5zBvfWr l/Uwc5TRUrsZdn5/wp6xaVxsvi8YDf9DX/8= 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 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: Leif Lindholm --- ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Li= brary/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, ErrOut. // + ASSERT (FixedPcdGet8 (PcdUartDefaultParity) > 0); + ASSERT (FixedPcdGet8 (PcdUartDefaultStopBits) > 0); ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) =3D=3D 4); 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 (#59753): https://edk2.groups.io/g/devel/message/59753 Mute This Topic: https://groups.io/mt/74297223/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-