aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/ata/libata-core.c21
-rw-r--r--drivers/ata/libata-scsi.c33
-rw-r--r--drivers/ata/pata_ali.c4
-rw-r--r--drivers/ata/pata_hpt366.c4
-rw-r--r--drivers/ata/pata_hpt37x.c5
-rw-r--r--drivers/ata/pata_it821x.c5
-rw-r--r--drivers/ata/pata_serverworks.c4
-rw-r--r--drivers/ata/sata_sil.c4
-rw-r--r--include/linux/ata.h11
9 files changed, 45 insertions, 46 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2869469790b0..7d4b002568e7 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -3187,7 +3187,8 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
3187 const u16 *new_id) 3187 const u16 *new_id)
3188{ 3188{
3189 const u16 *old_id = dev->id; 3189 const u16 *old_id = dev->id;
3190 unsigned char model[2][41], serial[2][21]; 3190 unsigned char model[2][ATA_ID_PROD_LEN + 1];
3191 unsigned char serial[2][ATA_ID_SERNO_LEN + 1];
3191 u64 new_n_sectors; 3192 u64 new_n_sectors;
3192 3193
3193 if (dev->class != new_class) { 3194 if (dev->class != new_class) {
@@ -3196,10 +3197,10 @@ static int ata_dev_same_device(struct ata_device *dev, unsigned int new_class,
3196 return 0; 3197 return 0;
3197 } 3198 }
3198 3199
3199 ata_id_c_string(old_id, model[0], ATA_ID_PROD_OFS, sizeof(model[0])); 3200 ata_id_c_string(old_id, model[0], ATA_ID_PROD, sizeof(model[0]));
3200 ata_id_c_string(new_id, model[1], ATA_ID_PROD_OFS, sizeof(model[1])); 3201 ata_id_c_string(new_id, model[1], ATA_ID_PROD, sizeof(model[1]));
3201 ata_id_c_string(old_id, serial[0], ATA_ID_SERNO_OFS, sizeof(serial[0])); 3202 ata_id_c_string(old_id, serial[0], ATA_ID_SERNO, sizeof(serial[0]));
3202 ata_id_c_string(new_id, serial[1], ATA_ID_SERNO_OFS, sizeof(serial[1])); 3203 ata_id_c_string(new_id, serial[1], ATA_ID_SERNO, sizeof(serial[1]));
3203 new_n_sectors = ata_id_n_sectors(new_id); 3204 new_n_sectors = ata_id_n_sectors(new_id);
3204 3205
3205 if (strcmp(model[0], model[1])) { 3206 if (strcmp(model[0], model[1])) {
@@ -3338,15 +3339,13 @@ static int ata_strim(char *s, size_t len)
3338 3339
3339unsigned long ata_device_blacklisted(const struct ata_device *dev) 3340unsigned long ata_device_blacklisted(const struct ata_device *dev)
3340{ 3341{
3341 unsigned char model_num[40]; 3342 unsigned char model_num[ATA_ID_PROD_LEN];
3342 unsigned char model_rev[16]; 3343 unsigned char model_rev[ATA_ID_FW_REV_LEN];
3343 unsigned int nlen, rlen; 3344 unsigned int nlen, rlen;
3344 const struct ata_blacklist_entry *ad = ata_device_blacklist; 3345 const struct ata_blacklist_entry *ad = ata_device_blacklist;
3345 3346
3346 ata_id_string(dev->id, model_num, ATA_ID_PROD_OFS, 3347 ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
3347 sizeof(model_num)); 3348 ata_id_string(dev->id, model_rev, ATA_ID_FW_REV, sizeof(model_rev));
3348 ata_id_string(dev->id, model_rev, ATA_ID_FW_REV_OFS,
3349 sizeof(model_rev));
3350 nlen = ata_strim(model_num, sizeof(model_num)); 3349 nlen = ata_strim(model_num, sizeof(model_num));
3351 rlen = ata_strim(model_rev, sizeof(model_rev)); 3350 rlen = ata_strim(model_rev, sizeof(model_rev));
3352 3351
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;
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c
index 2035417fc1ab..76e386043dcd 100644
--- a/drivers/ata/pata_ali.c
+++ b/drivers/ata/pata_ali.c
@@ -153,11 +153,11 @@ static void ali_early_error_handler(struct ata_port *ap)
153 153
154static unsigned long ali_20_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask) 154static unsigned long ali_20_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
155{ 155{
156 char model_num[40]; 156 char model_num[ATA_ID_PROD_LEN];
157 /* No DMA on anything but a disk for now */ 157 /* No DMA on anything but a disk for now */
158 if (adev->class != ATA_DEV_ATA) 158 if (adev->class != ATA_DEV_ATA)
159 mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); 159 mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA);
160 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); 160 ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
161 if (strstr(model_num, "WDC")) 161 if (strstr(model_num, "WDC"))
162 return mask &= ~ATA_MASK_UDMA; 162 return mask &= ~ATA_MASK_UDMA;
163 return ata_pci_default_filter(ap, adev, mask); 163 return ata_pci_default_filter(ap, adev, mask);
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index 8cf167e59dee..81deb2c3824c 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -151,12 +151,12 @@ static const char *bad_ata66_3[] = {
151 151
152static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[]) 152static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[])
153{ 153{
154 unsigned char model_num[40]; 154 unsigned char model_num[ATA_ID_PROD_LEN];
155 char *s; 155 char *s;
156 unsigned int len; 156 unsigned int len;
157 int i = 0; 157 int i = 0;
158 158
159 ata_id_string(dev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); 159 ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
160 s = &model_num[0]; 160 s = &model_num[0];
161 len = strnlen(s, sizeof(model_num)); 161 len = strnlen(s, sizeof(model_num));
162 162
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 3ad0e51cb2ab..ff767755e98b 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -349,13 +349,12 @@ static u32 hpt37x_find_mode(struct ata_port *ap, int speed)
349 349
350static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[]) 350static int hpt_dma_blacklisted(const struct ata_device *dev, char *modestr, const char *list[])
351{ 351{
352 unsigned char model_num[40]; 352 unsigned char model_num[ATA_ID_PROD_LEN];
353 char *s; 353 char *s;
354 unsigned int len; 354 unsigned int len;
355 int i = 0; 355 int i = 0;
356 356
357 ata_id_string(dev->id, model_num, ATA_ID_PROD_OFS, 357 ata_id_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
358 sizeof(model_num));
359 s = &model_num[0]; 358 s = &model_num[0];
360 len = strnlen(s, sizeof(model_num)); 359 len = strnlen(s, sizeof(model_num));
361 360
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index e8afd486434a..c84dfaede89c 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -531,15 +531,14 @@ static int it821x_smart_set_mode(struct ata_port *ap, struct ata_device **unused
531 531
532static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev) 532static void it821x_dev_config(struct ata_port *ap, struct ata_device *adev)
533{ 533{
534 unsigned char model_num[40]; 534 unsigned char model_num[ATA_ID_PROD_LEN];
535 char *s; 535 char *s;
536 unsigned int len; 536 unsigned int len;
537 537
538 /* This block ought to be a library routine as it is in several 538 /* This block ought to be a library routine as it is in several
539 drivers now */ 539 drivers now */
540 540
541 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, 541 ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
542 sizeof(model_num));
543 s = &model_num[0]; 542 s = &model_num[0];
544 len = strnlen(s, sizeof(model_num)); 543 len = strnlen(s, sizeof(model_num));
545 544
diff --git a/drivers/ata/pata_serverworks.c b/drivers/ata/pata_serverworks.c
index 80191978d481..bf9452728d19 100644
--- a/drivers/ata/pata_serverworks.c
+++ b/drivers/ata/pata_serverworks.c
@@ -218,7 +218,7 @@ static unsigned long serverworks_osb4_filter(const struct ata_port *ap, struct a
218static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask) 218static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long mask)
219{ 219{
220 const char *p; 220 const char *p;
221 char model_num[40]; 221 char model_num[ATA_ID_PROD_LEN];
222 int len, i; 222 int len, i;
223 223
224 /* Disk, UDMA */ 224 /* Disk, UDMA */
@@ -226,7 +226,7 @@ static unsigned long serverworks_csb_filter(const struct ata_port *ap, struct at
226 return ata_pci_default_filter(ap, adev, mask); 226 return ata_pci_default_filter(ap, adev, mask);
227 227
228 /* Actually do need to check */ 228 /* Actually do need to check */
229 ata_id_string(adev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); 229 ata_id_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num));
230 /* Precuationary - why not do this in the libata core ?? */ 230 /* Precuationary - why not do this in the libata core ?? */
231 231
232 len = strlen(model_num); 232 len = strlen(model_num);
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 7808d0369d91..d27ab312cdfb 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -541,9 +541,9 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
541{ 541{
542 int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO; 542 int print_info = ap->eh_context.i.flags & ATA_EHI_PRINTINFO;
543 unsigned int n, quirks = 0; 543 unsigned int n, quirks = 0;
544 unsigned char model_num[41]; 544 unsigned char model_num[ATA_ID_PROD_LEN + 1];
545 545
546 ata_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS, sizeof(model_num)); 546 ata_id_c_string(dev->id, model_num, ATA_ID_PROD, sizeof(model_num));
547 547
548 for (n = 0; sil_blacklist[n].product; n++) 548 for (n = 0; sil_blacklist[n].product; n++)
549 if (!strcmp(sil_blacklist[n].product, model_num)) { 549 if (!strcmp(sil_blacklist[n].product, model_num)) {
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 1df941648a57..3a50739e25a6 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -44,9 +44,9 @@ enum {
44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 44 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
45 45
46 ATA_ID_WORDS = 256, 46 ATA_ID_WORDS = 256,
47 ATA_ID_SERNO_OFS = 10, 47 ATA_ID_SERNO = 10,
48 ATA_ID_FW_REV_OFS = 23, 48 ATA_ID_FW_REV = 23,
49 ATA_ID_PROD_OFS = 27, 49 ATA_ID_PROD = 27,
50 ATA_ID_OLD_PIO_MODES = 51, 50 ATA_ID_OLD_PIO_MODES = 51,
51 ATA_ID_FIELD_VALID = 53, 51 ATA_ID_FIELD_VALID = 53,
52 ATA_ID_MWDMA_MODES = 63, 52 ATA_ID_MWDMA_MODES = 63,
@@ -58,8 +58,11 @@ enum {
58 ATA_ID_MAJOR_VER = 80, 58 ATA_ID_MAJOR_VER = 80,
59 ATA_ID_PIO4 = (1 << 1), 59 ATA_ID_PIO4 = (1 << 1),
60 60
61 ATA_ID_SERNO_LEN = 20,
62 ATA_ID_FW_REV_LEN = 8,
63 ATA_ID_PROD_LEN = 40,
64
61 ATA_PCI_CTL_OFS = 2, 65 ATA_PCI_CTL_OFS = 2,
62 ATA_SERNO_LEN = 20,
63 ATA_UDMA0 = (1 << 0), 66 ATA_UDMA0 = (1 << 0),
64 ATA_UDMA1 = ATA_UDMA0 | (1 << 1), 67 ATA_UDMA1 = ATA_UDMA0 | (1 << 1),
65 ATA_UDMA2 = ATA_UDMA1 | (1 << 2), 68 ATA_UDMA2 = ATA_UDMA1 | (1 << 2),