]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/SerialDxe: Do not fail reset when SetAttributes is not supported
authorJulien Grall <julien.grall@linaro.org>
Wed, 29 Nov 2017 17:28:23 +0000 (01:28 +0800)
committerStar Zeng <star.zeng@intel.com>
Thu, 30 Nov 2017 01:11:53 +0000 (09:11 +0800)
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 propagated 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 introspecting 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.grall@linaro.org>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
MdeModulePkg/Universal/SerialDxe/SerialIo.c

index ee10ec7e05eadcb1a5ffc2fc3bd8d0a8d678851e..e18cc7ed515dcbd45b4b5e989f969c191d960192 100644 (file)
@@ -240,6 +240,15 @@ SerialReset (
                    (EFI_STOP_BITS_TYPE) This->Mode->StopBits\r
                    );\r
 \r
+  //\r
+  // The serial device may not support some of the attributes. To prevent\r
+  // later failure, always return EFI_SUCCESS when SetAttributes is returning\r
+  // EFI_INVALID_PARAMETER.\r
+  //\r
+  if (Status == EFI_INVALID_PARAMETER) {\r
+    return EFI_SUCCESS;\r
+  }\r
+\r
   return Status;\r
 }\r
 \r