Typos in commit log?
Propated -> propagated
Instropecting -> introspecting

Thanks,
Star
-----Original Message-----
From: Julien Grall [mailto:julien.gr...@linaro.org] 
Sent: Saturday, November 25, 2017 12:21 AM
To: Zeng, Star <star.z...@intel.com>; Dong, Eric <eric.d...@intel.com>; 
pankaj.ban...@nxp.com; ler...@redhat.com; leif.lindh...@linaro.org
Cc: edk2-devel@lists.01.org; Julien Grall <julien.gr...@linaro.org>
Subject: [PATCH v2 3/3] MdeModulePkg/SerialDxe: Do not fail reset when 
SetAttributes is not supported

After commit 91cc526b15 "MdeModulePkg/SerialDxe: Fix not able to change
serial attributes", serial is initialized using the reset method that
will call SetAttributes.

However, SetAttributes may return EFI_INVALID_PARAMETER when a driver
does not support some parameters. This will be propated by the reset
function and lead to UEFI failing to get the console setup.

For instance, this is the case when using the Xen console driver.

Fix it by instropecting the result and return EFI_SUCCESS when the
SetAttributes report an invalid parameter (i.e EFI_INVALID_PARAMETER).

Contributed-under: Tianocore Contribution Agreement 1.1
Signed-off-by: Julien Grall <julien.gr...@linaro.org>
---
 MdeModulePkg/Universal/SerialDxe/SerialIo.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/MdeModulePkg/Universal/SerialDxe/SerialIo.c 
b/MdeModulePkg/Universal/SerialDxe/SerialIo.c
index 08b95a4a33..53d2785fed 100644
--- a/MdeModulePkg/Universal/SerialDxe/SerialIo.c
+++ b/MdeModulePkg/Universal/SerialDxe/SerialIo.c
@@ -239,6 +239,15 @@ SerialReset (
                    (EFI_STOP_BITS_TYPE) This->Mode->StopBits
                    );
 
+  //
+  // The serial device may not support some of the attributes. To prevent
+  // later failure, always return EFI_SUCCESS when SetAttributes is returning
+  // EFI_INVALID_PARAMETER.
+  //
+  if (Status == EFI_INVALID_PARAMETER) {
+    return EFI_SUCCESS;
+  }
+
   return Status;
 }
 
-- 
2.11.0

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to