]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/SerialDxe/SerialIo.c
MdeModulePkg/BdsDxe: Revert "fall back to UI loop before hanging"
[mirror_edk2.git] / MdeModulePkg / Universal / SerialDxe / SerialIo.c
index 19fc889c25aff4999d975c1b9d0a4f34ca5c1b08..e18cc7ed515dcbd45b4b5e989f969c191d960192 100644 (file)
@@ -66,8 +66,9 @@ SerialReset (
                            value of DefaultStopBits will use the device's default number of\r
                            stop bits.\r
 \r
-  @retval EFI_SUCCESS      The device was reset.\r
-  @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.\r
+  @retval EFI_SUCCESS           The device was reset.\r
+  @retval EFI_INVALID_PARAMETER One or more attributes has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The serial device is not functioning correctly.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -239,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
@@ -264,8 +274,9 @@ SerialReset (
                            value of DefaultStopBits will use the device's default number of\r
                            stop bits.\r
 \r
-  @retval EFI_SUCCESS      The device was reset.\r
-  @retval EFI_DEVICE_ERROR The serial device is not functioning correctly.\r
+  @retval EFI_SUCCESS           The device was reset.\r
+  @retval EFI_INVALID_PARAMETER One or more attributes has an unsupported value.\r
+  @retval EFI_DEVICE_ERROR      The serial device is not functioning correctly.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -323,8 +334,10 @@ SerialSetAttributes (
       DataBits = OriginalDataBits;\r
       StopBits = OriginalStopBits;\r
       Status = EFI_SUCCESS;\r
+    } else if (Status == EFI_INVALID_PARAMETER || Status == EFI_UNSUPPORTED) {\r
+      return EFI_INVALID_PARAMETER;\r
     } else {\r
-      return Status;\r
+      return EFI_DEVICE_ERROR;\r
     }\r
   }\r
 \r