linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Tejun Heo <tj@kernel.org>,
	James Bottomley <jbottomley@parallels.com>,
	linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org,
	Hannes Reinecke <hare@suse.de>
Subject: [PATCH 3/4] libata-scsi: Update SATL for ZAC drives
Date: Wed, 30 Jul 2014 09:55:10 +0200	[thread overview]
Message-ID: <1406706911-79510-4-git-send-email-hare@suse.de> (raw)
In-Reply-To: <1406706911-79510-1-git-send-email-hare@suse.de>

ZAC (zoned-access command) drives translate into ZBC (Zoned block
command) device type for SCSI. So implement the correct mappings
into libata-scsi and update the SCSI command set versions.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/ata/libata-scsi.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index bea6e7f..1db6eab 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1969,6 +1969,7 @@ static void ata_scsi_rbuf_fill(struct ata_scsi_args *args,
 static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 {
 	const u8 versions[] = {
+		0x00,
 		0x60,	/* SAM-3 (no version claimed) */
 
 		0x03,
@@ -1977,6 +1978,20 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 		0x02,
 		0x60	/* SPC-3 (no version claimed) */
 	};
+	const u8 versions_zbc[] = {
+		0x00,
+		0xA0,	/* SAM-5 (no version claimed) */
+
+		0x04,
+		0xC0,	/* SBC-3 (no version claimed) */
+
+		0x04,
+		0x60,	/* SPC-4 (no version claimed) */
+
+		0x60,
+		0x20,   /* ZBC (no version claimed) */
+	};
+
 	u8 hdr[] = {
 		TYPE_DISK,
 		0,
@@ -1991,6 +2006,11 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 	if (ata_id_removeable(args->id))
 		hdr[1] |= (1 << 7);
 
+	if (args->dev->class == ATA_DEV_ZAC) {
+		hdr[0] = TYPE_ZBC;
+		hdr[2] = 0x6; /* ZBC is defined in SPC-4 */
+	}
+
 	memcpy(rbuf, hdr, sizeof(hdr));
 	memcpy(&rbuf[8], "ATA     ", 8);
 	ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
@@ -2003,7 +2023,10 @@ static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf)
 	if (rbuf[32] == 0 || rbuf[32] == ' ')
 		memcpy(&rbuf[32], "n/a ", 4);
 
-	memcpy(rbuf + 59, versions, sizeof(versions));
+	if (args->dev->class == ATA_DEV_ZAC)
+		memcpy(rbuf + 58, versions_zbc, sizeof(versions_zbc));
+	else
+		memcpy(rbuf + 58, versions, sizeof(versions));
 
 	return 0;
 }
-- 
1.7.12.4


  parent reply	other threads:[~2014-07-30  7:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-30  7:55 [PATCHv4 0/4] Initial SMR drive support Hannes Reinecke
2014-07-30  7:55 ` [PATCH 1/4] libata: consolidate ata_dev_classify() Hannes Reinecke
2014-09-05 23:42   ` Tejun Heo
2014-09-06  8:21     ` Hannes Reinecke
2014-09-06 12:52       ` Tejun Heo
2014-09-07 11:24         ` Hannes Reinecke
2014-09-07 16:02           ` Tejun Heo
2014-07-30  7:55 ` [PATCH 2/4] libata: Implement ATA_DEV_ZAC Hannes Reinecke
2014-07-30  7:55 ` Hannes Reinecke [this message]
2014-09-05 23:44   ` [PATCH 3/4] libata-scsi: Update SATL for ZAC drives Tejun Heo
2014-07-30  7:55 ` [PATCH 4/4] sd: Optionally attach to ZBC devices Hannes Reinecke
  -- strict thread matches above, loose matches on Subject: below --
2014-07-29 14:45 [PATCHv3 0/4] Initial SMR drive support Hannes Reinecke
2014-07-29 14:45 ` [PATCH 3/4] libata-scsi: Update SATL for ZAC drives Hannes Reinecke
2014-07-29 17:12   ` Christoph Hellwig
2014-07-30  6:18     ` Hannes Reinecke
2014-07-21  8:27 [PATCHv2 0/4] Initial SMR drive support Hannes Reinecke
2014-07-21  8:27 ` [PATCH 3/4] libata-scsi: Update SATL for ZAC drives Hannes Reinecke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1406706911-79510-4-git-send-email-hare@suse.de \
    --to=hare@suse.de \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).