aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2007-01-02 06:18:49 -0500
committerJeff Garzik <jeff@garzik.org>2007-02-09 17:39:30 -0500
commita0cf733b333eeeafb7324e2897448006c693c26c (patch)
tree9a08b3e197cf4d1d17c39ed93cbcdd26fd722316 /drivers/ata/libata-scsi.c
parentcdf56bcf14b9d441777703eef95eef807e4136ec (diff)
libata: straighten out ATA_ID_* constants
* Kill _OFS suffixes in ATA_ID_{SERNO|FW_REV|PROD}_OFS for consistency with other ATA_ID_* constants. * Kill ATA_SERNO_LEN * Add and use ATA_ID_SERNO_LEN, ATA_ID_FW_REV_LEN and ATA_ID_PROD_LEN. This change also makes ata_device_blacklisted() use proper length for fwrev. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c33
1 files changed, 16 insertions, 17 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 57111f842d66..6a99c0824751 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1698,8 +1698,8 @@ unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf,
1698 1698
1699 if (buflen > 35) { 1699 if (buflen > 35) {
1700 memcpy(&rbuf[8], "ATA ", 8); 1700 memcpy(&rbuf[8], "ATA ", 8);
1701 ata_id_string(args->id, &rbuf[16], ATA_ID_PROD_OFS, 16); 1701 ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16);
1702 ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV_OFS, 4); 1702 ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4);
1703 if (rbuf[32] == 0 || rbuf[32] == ' ') 1703 if (rbuf[32] == 0 || rbuf[32] == ' ')
1704 memcpy(&rbuf[32], "n/a ", 4); 1704 memcpy(&rbuf[32], "n/a ", 4);
1705 } 1705 }
@@ -1768,13 +1768,13 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf,
1768 0, 1768 0,
1769 0x80, /* this page code */ 1769 0x80, /* this page code */
1770 0, 1770 0,
1771 ATA_SERNO_LEN, /* page len */ 1771 ATA_ID_SERNO_LEN, /* page len */
1772 }; 1772 };
1773 memcpy(rbuf, hdr, sizeof(hdr)); 1773 memcpy(rbuf, hdr, sizeof(hdr));
1774 1774
1775 if (buflen > (ATA_SERNO_LEN + 4 - 1)) 1775 if (buflen > (ATA_ID_SERNO_LEN + 4 - 1))
1776 ata_id_string(args->id, (unsigned char *) &rbuf[4], 1776 ata_id_string(args->id, (unsigned char *) &rbuf[4],
1777 ATA_ID_SERNO_OFS, ATA_SERNO_LEN); 1777 ATA_ID_SERNO, ATA_ID_SERNO_LEN);
1778 1778
1779 return 0; 1779 return 0;
1780} 1780}
@@ -1799,19 +1799,18 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
1799{ 1799{
1800 int num; 1800 int num;
1801 const int sat_model_serial_desc_len = 68; 1801 const int sat_model_serial_desc_len = 68;
1802 const int ata_model_byte_len = 40;
1803 1802
1804 rbuf[1] = 0x83; /* this page code */ 1803 rbuf[1] = 0x83; /* this page code */
1805 num = 4; 1804 num = 4;
1806 1805
1807 if (buflen > (ATA_SERNO_LEN + num + 3)) { 1806 if (buflen > (ATA_ID_SERNO_LEN + num + 3)) {
1808 /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */ 1807 /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */
1809 rbuf[num + 0] = 2; 1808 rbuf[num + 0] = 2;
1810 rbuf[num + 3] = ATA_SERNO_LEN; 1809 rbuf[num + 3] = ATA_ID_SERNO_LEN;
1811 num += 4; 1810 num += 4;
1812 ata_id_string(args->id, (unsigned char *) rbuf + num, 1811 ata_id_string(args->id, (unsigned char *) rbuf + num,
1813 ATA_ID_SERNO_OFS, ATA_SERNO_LEN); 1812 ATA_ID_SERNO, ATA_ID_SERNO_LEN);
1814 num += ATA_SERNO_LEN; 1813 num += ATA_ID_SERNO_LEN;
1815 } 1814 }
1816 if (buflen > (sat_model_serial_desc_len + num + 3)) { 1815 if (buflen > (sat_model_serial_desc_len + num + 3)) {
1817 /* SAT defined lu model and serial numbers descriptor */ 1816 /* SAT defined lu model and serial numbers descriptor */
@@ -1823,11 +1822,11 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf,
1823 memcpy(rbuf + num, "ATA ", 8); 1822 memcpy(rbuf + num, "ATA ", 8);
1824 num += 8; 1823 num += 8;
1825 ata_id_string(args->id, (unsigned char *) rbuf + num, 1824 ata_id_string(args->id, (unsigned char *) rbuf + num,
1826 ATA_ID_PROD_OFS, ata_model_byte_len); 1825 ATA_ID_PROD, ATA_ID_PROD_LEN);
1827 num += ata_model_byte_len; 1826 num += ATA_ID_PROD_LEN;
1828 ata_id_string(args->id, (unsigned char *) rbuf + num, 1827 ata_id_string(args->id, (unsigned char *) rbuf + num,
1829 ATA_ID_SERNO_OFS, ATA_SERNO_LEN); 1828 ATA_ID_SERNO, ATA_ID_SERNO_LEN);
1830 num += ATA_SERNO_LEN; 1829 num += ATA_ID_SERNO_LEN;
1831 } 1830 }
1832 rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ 1831 rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */
1833 return 0; 1832 return 0;
@@ -1955,15 +1954,15 @@ static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last)
1955 */ 1954 */
1956static int ata_dev_supports_fua(u16 *id) 1955static int ata_dev_supports_fua(u16 *id)
1957{ 1956{
1958 unsigned char model[41], fw[9]; 1957 unsigned char model[ATA_ID_PROD_LEN + 1], fw[ATA_ID_FW_REV_LEN + 1];
1959 1958
1960 if (!libata_fua) 1959 if (!libata_fua)
1961 return 0; 1960 return 0;
1962 if (!ata_id_has_fua(id)) 1961 if (!ata_id_has_fua(id))
1963 return 0; 1962 return 0;
1964 1963
1965 ata_id_c_string(id, model, ATA_ID_PROD_OFS, sizeof(model)); 1964 ata_id_c_string(id, model, ATA_ID_PROD, sizeof(model));
1966 ata_id_c_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw)); 1965 ata_id_c_string(id, fw, ATA_ID_FW_REV, sizeof(fw));
1967 1966
1968 if (strcmp(model, "Maxtor")) 1967 if (strcmp(model, "Maxtor"))
1969 return 1; 1968 return 1;