SerialSetAttributes is meant to match the behavior of the function
EFI_SERIAL_IO_PROTOCOL.SetAttributes() in the UEFI spec (v2.7). This
means the function can only return:
- EFI_SUCCESS
- EFI_INVALID_PARAMETER
- EFI_DEVICE_ERROR
However the function SerialPortSetAttributes may also validly return
EFI_UNSUPPORTED. For instance this is the case of the Xen Console
driver.
EFI_UNSUPPORTED could be also interpreted as "One or more of the attributes
has an unsupported value". So return EFI_INVALID_PARAMETER in that case.
Lastly, to prevent another return slipping in the future, all the errors
but EFI_INVALID_PARAMETER and EFI_UNSUPPORTED will return
EFI_DEVICE_ERROR.
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>
value of DefaultStopBits will use the device's default number of\r
stop bits.\r
\r
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
value of DefaultStopBits will use the device's default number of\r
stop bits.\r
\r
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
DataBits = OriginalDataBits;\r
StopBits = OriginalStopBits;\r
Status = EFI_SUCCESS;\r
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
+ return EFI_DEVICE_ERROR;\r
value of DefaultStopBits will use the device's default number of\r
stop bits.\r
\r
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