/* Check the HostAdapter status and re-interpret it in EFI_STATUS. */
EFI_STATUS CheckHostAdapterStatus(IN UINT8 HostAdapterStatus)
/* Check the HostAdapter status and re-interpret it in EFI_STATUS. */
EFI_STATUS CheckHostAdapterStatus(IN UINT8 HostAdapterStatus)
{
  switch (HostAdapterStatus) {
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OK:
      return EFI_SUCCESS;
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_SELECTION_TIMEOUT:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_TIMEOUT_COMMAND:
      return EFI_TIMEOUT;
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_MESSAGE_REJECT:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PARITY_ERROR:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_REQUEST_SENSE_FAILED:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_DATA_OVERRUN_UNDERRUN:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_RESET:
      return EFI_NOT_READY;
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_BUS_FREE:
    case EFI_EXT_SCSI_STATUS_HOST_ADAPTER_PHASE_ERROR:
      return EFI_DEVICE_ERROR;
    default:
      return EFI_SUCCESS;
  }
}