[PATCH 1/4] scsi: Fix a bunch of SCSI definitions.

Marek Vasut marex at denx.de
Sun Oct 29 13:07:15 CET 2023


On 10/29/23 08:23, Hector Martin wrote:
> 0x9e isn't Read Capacity, it's a service action and the read capacity
> command is a subcommand.
> 
> READ16 is not 0x48, it's 0x88. 0x48 is SANITIZE and that sounds like we
> might have been destroying data instead of reading data. No bueno.
> 
> Signed-off-by: Hector Martin <marcan at marcan.st>
> ---
>   drivers/ata/ahci.c  | 9 ++++++---
>   drivers/scsi/scsi.c | 4 ++--
>   include/scsi.h      | 8 ++++++--
>   3 files changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
> index 2062197afcd3..b252e9e525db 100644
> --- a/drivers/ata/ahci.c
> +++ b/drivers/ata/ahci.c
> @@ -906,15 +906,18 @@ static int ahci_scsi_exec(struct udevice *dev, struct scsi_cmd *pccb)
>   	case SCSI_RD_CAPAC10:
>   		ret = ata_scsiop_read_capacity10(uc_priv, pccb);
>   		break;
> -	case SCSI_RD_CAPAC16:
> -		ret = ata_scsiop_read_capacity16(uc_priv, pccb);
> -		break;
>   	case SCSI_TST_U_RDY:
>   		ret = ata_scsiop_test_unit_ready(uc_priv, pccb);
>   		break;
>   	case SCSI_INQUIRY:
>   		ret = ata_scsiop_inquiry(uc_priv, pccb);
>   		break;
> +	case SCSI_SRV_ACTION_IN:
> +		if ((pccb->cmd[1] & 0x1f) == SCSI_SAI_RD_CAPAC16) {
> +			ret = ata_scsiop_read_capacity16(uc_priv, pccb);
> +			break;
> +		}

Would it make sense to add an else branch here and report unknown 
subcommand there ?

With that:
Reviewed-by: Marek Vasut <marex at denx.de>


More information about the U-Boot mailing list