From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web11.1491.1589822339791973407 for ; Mon, 18 May 2020 10:19:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=nhiOhgAU; spf=pass (domain: nuviainc.com, ip: 209.85.221.65, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f65.google.com with SMTP id e1so12796962wrt.5 for ; Mon, 18 May 2020 10:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wxG5AxdFy0WjMGH5qCz+1jJRKOF+lf4sTVkc3a3/35E=; b=nhiOhgAUSgZ/5s6ZNuEP/zNPdx1WtD0t42EmVlt0o0X6gDcCyRY1Jj+S8UOwXUphZL rxS48zkvX8M8Aec9ZoU0VPW9K6z1yRG8UASq+4cKkzSnT3ywC5h96Z4ImmXjoZelaC3Q FJq1k9+BxvdRPaS79UcEUfRNh3Gs0Q/YixHN77kvuHSnM6KNVq0mvsKkQngFTkJg98vA 4Bc5qZyYgaHfnbOJRL9fSjDel/4hMf3hG3cYNLtUfNsnVt3rXsUQKkpiNygy8YvDPOmQ edW6PzMz/QAx4kArafH/EyvTwU0ff/C1fX5YndxrimRv955IjhLJBtFechB0FROIbsd5 pCJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=wxG5AxdFy0WjMGH5qCz+1jJRKOF+lf4sTVkc3a3/35E=; b=Cl17+hPLOtuPRWr1CJJJLjft+HVee0hlG8JSTFCweOIwS1LabXsbFYstB6+LPPX1+f Y9wHGdKckBvbUfRZ2xFVvZD8aHNFGQ2UJ0VqE6Ld55rzBf1C+hUnm0IUQ8ngDL5Qc41q hK5KU6TcszIV8u5j8USAUiEFMbgfyAeBLIKe5oE6MpiOaVnMnDCtgn9u1svskMCxRfvm k++qji2PZQYekomj/Pp89MTclnRd9lxgdw/1PRSzR4aymA2UuJIuEnk/qA0khcJ31xIv O9u+KkDxxpzXv0cxLV8wXMKJJ1EKHGpzjdJMNUQowls4uWlPQ106ioU8awcZx43m3vcM 7Xhw== X-Gm-Message-State: AOAM531a5yMpdv71uOrl8YY3PQl/HJxKOmh9WjM3R23C12CwtkmVIwLr atOxQ1ApZ6h3RzsKBjCvoPT6hw== X-Google-Smtp-Source: ABdhPJzIVrSCnfLQbDMknXDL2yM6J648ApLqZBACla8AoeWKk8Y2or+ad0P8TszXNVA5zh44ZiDSaQ== X-Received: by 2002:a5d:56c6:: with SMTP id m6mr20519297wrw.78.1589822338376; Mon, 18 May 2020 10:18:58 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id d6sm12652607wrj.90.2020.05.18.10.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 May 2020 10:18:57 -0700 (PDT) Date: Mon, 18 May 2020 18:18:55 +0100 From: "Leif Lindholm" To: Ard Biesheuvel Cc: devel@edk2.groups.io, graeme.gregory@linaro.org, tanmay.jagdale@linaro.org Subject: Re: [PATCH] ArmPkg/PlatformBootManagerLib: reject 'default' parity and stop bit count Message-ID: <20200518171855.GD10467@vanye> References: <20200518171148.6113-1-ard.biesheuvel@arm.com> MIME-Version: 1.0 In-Reply-To: <20200518171148.6113-1-ard.biesheuvel@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, May 18, 2020 at 19:11:48 +0200, 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 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/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, ErrOut. > // > + ASSERT (FixedPcdGet8 (PcdUartDefaultParity) > 0); > + ASSERT (FixedPcdGet8 (PcdUartDefaultStopBits) > 0); > ASSERT (FixedPcdGet8 (PcdDefaultTerminalType) == 4); > CopyGuid (&mSerialConsole.TermType.Guid, &gEfiTtyTermGuid); > > -- > 2.17.1 >