diff mbox

[2/3] libata-scsi: Fix ZBC management out command translation

Message ID BL2PR04MB1969643BA42447A6F3F8DB249F490@BL2PR04MB1969.namprd04.prod.outlook.com
State Not Applicable
Delegated to: David Miller
Headers show

Commit Message

Damien Le Moal May 18, 2016, 12:53 a.m. UTC
The subcommand for NCQ NON-DATA must be specified in
the feature (low byte), not the high-order count byte.
Also, the reset_all variable name is misleading as it
is the "all" bit also applicable to open, close, and
finish actions. So rename that variable and remove
unnecessary mask.

Signed-off-by: Damien Le Moal <damien.lemoal@hgst.com>
---
  drivers/ata/libata-scsi.c | 10 +++++-----
  1 file changed, 5 insertions(+), 5 deletions(-)

  	u16 fp = (u16)-1;
@@ -3533,20 +3533,20 @@ static unsigned int ata_scsi_zbc_out_xlat(struct 
ata_queued_cmd *qc)
  	if (block > dev->n_sectors)
  		goto out_of_range;

-	reset_all = cdb[14] & 0x1;
+	all = cdb[14] & 0x1;

  	if (ata_ncq_enabled(qc->dev) &&
  	    ata_fpdma_zac_mgmt_out_supported(qc->dev)) {
  		tf->protocol = ATA_PROT_NCQ;
  		tf->command = ATA_CMD_NCQ_NON_DATA;
-		tf->hob_nsect = ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT;
+		tf->feature = ATA_SUBCMD_NCQ_NON_DATA_ZAC_MGMT_OUT;
  		tf->nsect = qc->tag << 3;
-		tf->auxiliary = sa | (reset_all & 0x1) << 8;
+		tf->auxiliary = sa | (all << 8);
  	} else {
  		tf->protocol = ATA_PROT_NODATA;
  		tf->command = ATA_CMD_ZAC_MGMT_OUT;
  		tf->feature = sa;
-		tf->hob_feature = reset_all & 0x1;
+		tf->hob_feature = all;
  	}
  	tf->lbah = (block >> 16) & 0xff;
  	tf->lbam = (block >> 8) & 0xff;
diff mbox

Patch

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 8b375c7..dfb6a10 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -3506,7 +3506,7 @@  static unsigned int ata_scsi_zbc_out_xlat(struct 
ata_queued_cmd *qc)
  	struct scsi_cmnd *scmd = qc->scsicmd;
  	struct ata_device *dev = qc->dev;
  	const u8 *cdb = scmd->cmnd;
-	u8 reset_all, sa;
+	u8 all, sa;
  	u64 block;
  	u32 n_block;