public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Samer El-Haj-Mahmoud" <samer.el-haj-mahmoud@arm.com>
To: devel@edk2.groups.io
Cc: Leif Lindholm <leif@nuviainc.com>,
	Ard Biesheuvel <ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 1/1] ArmPlatformPkg/PL011UartLib : Fix SetControl() SCT conformance
Date: Sun, 20 Dec 2020 14:22:38 -0500	[thread overview]
Message-ID: <20201220192238.26365-1-Samer.El-Haj-Mahmoud@arm.com> (raw)

REF: https://github.com/pftf/RPi4/issues/87

The PL011UartLib SetControl() is failing the SCT test for
SerialIoBBTestConformance (00605CBC-3965-4B61-A254-2B2B723172EA),
which is trying to set bits that are not supported per UEFI spec.

Add proper argument check for valid bits, and confirm that test passes.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
---
 ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
index 3c58a0f39acb..ec6056f5fdfd 100644
--- a/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
+++ b/ArmPlatformPkg/Library/PL011UartLib/PL011UartLib.c
@@ -269,6 +269,21 @@ PL011UartSetControl (
 {
   UINT32  Bits;
 
+
+  //
+  // Per UEFI spec, the control bits that can be set are :
+  //     EFI_SERIAL_DATA_TERMINAL_READY
+  //     EFI_SERIAL_REQUEST_TO_SEND
+  //     EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE
+  //     EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE
+  //     EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE
+  //
+  if ((Control & (~(EFI_SERIAL_REQUEST_TO_SEND | EFI_SERIAL_DATA_TERMINAL_READY |
+                    EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE | EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE |
+                    EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE))) != 0) {
+    return EFI_UNSUPPORTED;
+  }
+
   if ((Control & mInvalidControlBits) != 0) {
     return RETURN_UNSUPPORTED;
   }
-- 
2.25.1


                 reply	other threads:[~2020-12-20 19:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201220192238.26365-1-Samer.El-Haj-Mahmoud@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox