]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Universal/SerialDxe/SerialIo.c
MdeModulePkg/SerialDxe: Fix return valued in SerialSetAttributes
authorJulien Grall <julien.grall@linaro.org>
Wed, 29 Nov 2017 17:28:22 +0000 (01:28 +0800)
committerStar Zeng <star.zeng@intel.com>
Thu, 30 Nov 2017 01:11:49 +0000 (09:11 +0800)
commit13d378fc82d4c10eff48bec383cd679cec6c4fdb
tree9b97903988751b73daa75b0b7471346ad77d6e4c
parentb462f25a21e17e3daf3cec880d3de2a6193af8a2
MdeModulePkg/SerialDxe: Fix return valued in SerialSetAttributes

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>
MdeModulePkg/Universal/SerialDxe/SerialIo.c
MdePkg/Include/Protocol/SerialIo.h