[libata] Add support for VPD page b1
authorMatthew Wilcox <matthew@wil.cx>
Thu, 19 Jun 2008 19:13:38 +0000 (13:13 -0600)
committerJeff Garzik <jgarzik@redhat.com>
Mon, 14 Jul 2008 19:59:33 +0000 (15:59 -0400)
SCSI VPD page b1 reports the nominal rotation speed and physical size
of the device.  Devices that conform to ATA-8 can return this information
in words 217 and 168 of the identify data.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
drivers/ata/libata-scsi.c

index b578b11..479c29e 100644 (file)
@@ -1857,7 +1857,9 @@ static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf)
        const u8 pages[] = {
                0x00,   /* page 0x00, this page */
                0x80,   /* page 0x80, unit serial no page */
-               0x83    /* page 0x83, device ident page */
+               0x83,   /* page 0x83, device ident page */
+               0x89,   /* page 0x89, ata info page */
+               0xb1,   /* page 0xb1, block device characteristics page */
        };
 
        rbuf[3] = sizeof(pages);        /* number of supported VPD pages */
@@ -1978,6 +1980,19 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf)
        return 0;
 }
 
+static unsigned int ata_scsiop_inq_b1(struct ata_scsi_args *args, u8 *rbuf)
+{
+       rbuf[1] = 0xb1;
+       rbuf[3] = 0x3c;
+       if (ata_id_major_version(args->id) > 7) {
+               rbuf[4] = args->id[217] >> 8;
+               rbuf[5] = args->id[217];
+               rbuf[7] = args->id[168] & 0xf;
+       }
+
+       return 0;
+}
+
 /**
  *     ata_scsiop_noop - Command handler that simply returns success.
  *     @args: device IDENTIFY data / SCSI command of interest.
@@ -2999,6 +3014,9 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd,
                case 0x89:
                        ata_scsi_rbuf_fill(&args, ata_scsiop_inq_89);
                        break;
+               case 0xb1:
+                       ata_scsi_rbuf_fill(&args, ata_scsiop_inq_b1);
+                       break;
                default:
                        ata_scsi_invalid_field(cmd, done);
                        break;