aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-13 00:13:48 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-13 00:13:48 -0500
commit3875e1945b55f0eb83fe7359614a801eeb716761 (patch)
tree4567aef3fb7d081cb7d7b7c9bcd94e0e44d39557 /drivers/scsi
parent587005de144acd3007b8e7f2a2a7c6add157c155 (diff)
parentf1b318793dcd2d9ff6b5ac06e7762098fa079cee (diff)
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ahci.c4
-rw-r--r--drivers/scsi/ata_piix.c4
-rw-r--r--drivers/scsi/libata-core.c148
-rw-r--r--drivers/scsi/libata-scsi.c33
-rw-r--r--drivers/scsi/pdc_adma.c1
-rw-r--r--drivers/scsi/sata_mv.c1
-rw-r--r--drivers/scsi/sata_nv.c1
-rw-r--r--drivers/scsi/sata_promise.c1
-rw-r--r--drivers/scsi/sata_qstor.c1
-rw-r--r--drivers/scsi/sata_sil.c24
-rw-r--r--drivers/scsi/sata_sil24.c5
-rw-r--r--drivers/scsi/sata_sis.c1
-rw-r--r--drivers/scsi/sata_svw.c1
-rw-r--r--drivers/scsi/sata_sx4.c1
-rw-r--r--drivers/scsi/sata_uli.c1
-rw-r--r--drivers/scsi/sata_via.c1
-rw-r--r--drivers/scsi/sata_vsc.c1
17 files changed, 115 insertions, 114 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index 24a54a5a91b8..1c2ab3dede71 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -211,7 +211,6 @@ static struct scsi_host_template ahci_sht = {
211 .can_queue = ATA_DEF_QUEUE, 211 .can_queue = ATA_DEF_QUEUE,
212 .this_id = ATA_SHT_THIS_ID, 212 .this_id = ATA_SHT_THIS_ID,
213 .sg_tablesize = AHCI_MAX_SG, 213 .sg_tablesize = AHCI_MAX_SG,
214 .max_sectors = ATA_MAX_SECTORS,
215 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 214 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
216 .emulated = ATA_SHT_EMULATED, 215 .emulated = ATA_SHT_EMULATED,
217 .use_clustering = AHCI_USE_CLUSTERING, 216 .use_clustering = AHCI_USE_CLUSTERING,
@@ -617,7 +616,8 @@ static void ahci_qc_prep(struct ata_queued_cmd *qc)
617 ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0); 616 ata_tf_to_fis(&qc->tf, pp->cmd_tbl, 0);
618 if (is_atapi) { 617 if (is_atapi) {
619 memset(pp->cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32); 618 memset(pp->cmd_tbl + AHCI_CMD_TBL_CDB, 0, 32);
620 memcpy(pp->cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb, ap->cdb_len); 619 memcpy(pp->cmd_tbl + AHCI_CMD_TBL_CDB, qc->cdb,
620 qc->dev->cdb_len);
621 } 621 }
622 622
623 n_elem = 0; 623 n_elem = 0;
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c
index 4933ba284885..4cc1108f721a 100644
--- a/drivers/scsi/ata_piix.c
+++ b/drivers/scsi/ata_piix.c
@@ -185,7 +185,6 @@ static struct scsi_host_template piix_sht = {
185 .can_queue = ATA_DEF_QUEUE, 185 .can_queue = ATA_DEF_QUEUE,
186 .this_id = ATA_SHT_THIS_ID, 186 .this_id = ATA_SHT_THIS_ID,
187 .sg_tablesize = LIBATA_MAX_PRD, 187 .sg_tablesize = LIBATA_MAX_PRD,
188 .max_sectors = ATA_MAX_SECTORS,
189 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 188 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
190 .emulated = ATA_SHT_EMULATED, 189 .emulated = ATA_SHT_EMULATED,
191 .use_clustering = ATA_SHT_USE_CLUSTERING, 190 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -415,9 +414,6 @@ static int piix_sata_probe (struct ata_port *ap)
415 int orig_mask, mask, i; 414 int orig_mask, mask, i;
416 u8 pcs; 415 u8 pcs;
417 416
418 mask = (PIIX_PORT_PRESENT << ap->hard_port_no) |
419 (PIIX_PORT_ENABLED << ap->hard_port_no);
420
421 pci_read_config_byte(pdev, ICH5_PCS, &pcs); 417 pci_read_config_byte(pdev, ICH5_PCS, &pcs);
422 orig_mask = (int) pcs & 0xff; 418 orig_mask = (int) pcs & 0xff;
423 419
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index bfe0a00b1135..5ab220e9907c 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -520,6 +520,49 @@ void ata_dev_id_string(const u16 *id, unsigned char *s,
520 } 520 }
521} 521}
522 522
523/**
524 * ata_dev_id_c_string - Convert IDENTIFY DEVICE page into C string
525 * @id: IDENTIFY DEVICE results we will examine
526 * @s: string into which data is output
527 * @ofs: offset into identify device page
528 * @len: length of string to return. must be an odd number.
529 *
530 * This function is identical to ata_dev_id_string except that it
531 * trims trailing spaces and terminates the resulting string with
532 * null. @len must be actual maximum length (even number) + 1.
533 *
534 * LOCKING:
535 * caller.
536 */
537void ata_dev_id_c_string(const u16 *id, unsigned char *s,
538 unsigned int ofs, unsigned int len)
539{
540 unsigned char *p;
541
542 WARN_ON(!(len & 1));
543
544 ata_dev_id_string(id, s, ofs, len - 1);
545
546 p = s + strnlen(s, len - 1);
547 while (p > s && p[-1] == ' ')
548 p--;
549 *p = '\0';
550}
551
552static u64 ata_id_n_sectors(const u16 *id)
553{
554 if (ata_id_has_lba(id)) {
555 if (ata_id_has_lba48(id))
556 return ata_id_u64(id, 100);
557 else
558 return ata_id_u32(id, 60);
559 } else {
560 if (ata_id_current_chs_valid(id))
561 return ata_id_u32(id, 57);
562 else
563 return id[1] * id[3] * id[6];
564 }
565}
523 566
524/** 567/**
525 * ata_noop_dev_select - Select device 0/1 on ATA bus 568 * ata_noop_dev_select - Select device 0/1 on ATA bus
@@ -609,41 +652,41 @@ void ata_dev_select(struct ata_port *ap, unsigned int device,
609 652
610/** 653/**
611 * ata_dump_id - IDENTIFY DEVICE info debugging output 654 * ata_dump_id - IDENTIFY DEVICE info debugging output
612 * @dev: Device whose IDENTIFY DEVICE page we will dump 655 * @id: IDENTIFY DEVICE page to dump
613 * 656 *
614 * Dump selected 16-bit words from a detected device's 657 * Dump selected 16-bit words from the given IDENTIFY DEVICE
615 * IDENTIFY PAGE page. 658 * page.
616 * 659 *
617 * LOCKING: 660 * LOCKING:
618 * caller. 661 * caller.
619 */ 662 */
620 663
621static inline void ata_dump_id(const struct ata_device *dev) 664static inline void ata_dump_id(const u16 *id)
622{ 665{
623 DPRINTK("49==0x%04x " 666 DPRINTK("49==0x%04x "
624 "53==0x%04x " 667 "53==0x%04x "
625 "63==0x%04x " 668 "63==0x%04x "
626 "64==0x%04x " 669 "64==0x%04x "
627 "75==0x%04x \n", 670 "75==0x%04x \n",
628 dev->id[49], 671 id[49],
629 dev->id[53], 672 id[53],
630 dev->id[63], 673 id[63],
631 dev->id[64], 674 id[64],
632 dev->id[75]); 675 id[75]);
633 DPRINTK("80==0x%04x " 676 DPRINTK("80==0x%04x "
634 "81==0x%04x " 677 "81==0x%04x "
635 "82==0x%04x " 678 "82==0x%04x "
636 "83==0x%04x " 679 "83==0x%04x "
637 "84==0x%04x \n", 680 "84==0x%04x \n",
638 dev->id[80], 681 id[80],
639 dev->id[81], 682 id[81],
640 dev->id[82], 683 id[82],
641 dev->id[83], 684 id[83],
642 dev->id[84]); 685 id[84]);
643 DPRINTK("88==0x%04x " 686 DPRINTK("88==0x%04x "
644 "93==0x%04x\n", 687 "93==0x%04x\n",
645 dev->id[88], 688 id[88],
646 dev->id[93]); 689 id[93]);
647} 690}
648 691
649/* 692/*
@@ -877,12 +920,11 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
877{ 920{
878 struct ata_device *dev = &ap->device[device]; 921 struct ata_device *dev = &ap->device[device];
879 unsigned int major_version; 922 unsigned int major_version;
880 u16 tmp;
881 unsigned long xfer_modes; 923 unsigned long xfer_modes;
882 unsigned int using_edd; 924 unsigned int using_edd;
883 struct ata_taskfile tf; 925 struct ata_taskfile tf;
884 unsigned int err_mask; 926 unsigned int err_mask;
885 int rc; 927 int i, rc;
886 928
887 if (!ata_dev_present(dev)) { 929 if (!ata_dev_present(dev)) {
888 DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n", 930 DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n",
@@ -890,7 +932,8 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
890 return; 932 return;
891 } 933 }
892 934
893 if (ap->flags & (ATA_FLAG_SRST | ATA_FLAG_SATA_RESET)) 935 if (ap->ops->probe_reset ||
936 ap->flags & (ATA_FLAG_SRST | ATA_FLAG_SATA_RESET))
894 using_edd = 0; 937 using_edd = 0;
895 else 938 else
896 using_edd = 1; 939 using_edd = 1;
@@ -970,18 +1013,17 @@ retry:
970 if (!xfer_modes) 1013 if (!xfer_modes)
971 xfer_modes = ata_pio_modes(dev); 1014 xfer_modes = ata_pio_modes(dev);
972 1015
973 ata_dump_id(dev); 1016 ata_dump_id(dev->id);
974 1017
975 /* ATA-specific feature tests */ 1018 /* ATA-specific feature tests */
976 if (dev->class == ATA_DEV_ATA) { 1019 if (dev->class == ATA_DEV_ATA) {
1020 dev->n_sectors = ata_id_n_sectors(dev->id);
1021
977 if (!ata_id_is_ata(dev->id)) /* sanity check */ 1022 if (!ata_id_is_ata(dev->id)) /* sanity check */
978 goto err_out_nosup; 1023 goto err_out_nosup;
979 1024
980 /* get major version */ 1025 /* get major version */
981 tmp = dev->id[ATA_ID_MAJOR_VER]; 1026 major_version = ata_id_major_version(dev->id);
982 for (major_version = 14; major_version >= 1; major_version--)
983 if (tmp & (1 << major_version))
984 break;
985 1027
986 /* 1028 /*
987 * The exact sequence expected by certain pre-ATA4 drives is: 1029 * The exact sequence expected by certain pre-ATA4 drives is:
@@ -1003,12 +1045,8 @@ retry:
1003 if (ata_id_has_lba(dev->id)) { 1045 if (ata_id_has_lba(dev->id)) {
1004 dev->flags |= ATA_DFLAG_LBA; 1046 dev->flags |= ATA_DFLAG_LBA;
1005 1047
1006 if (ata_id_has_lba48(dev->id)) { 1048 if (ata_id_has_lba48(dev->id))
1007 dev->flags |= ATA_DFLAG_LBA48; 1049 dev->flags |= ATA_DFLAG_LBA48;
1008 dev->n_sectors = ata_id_u64(dev->id, 100);
1009 } else {
1010 dev->n_sectors = ata_id_u32(dev->id, 60);
1011 }
1012 1050
1013 /* print device info to dmesg */ 1051 /* print device info to dmesg */
1014 printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n", 1052 printk(KERN_INFO "ata%u: dev %u ATA-%d, max %s, %Lu sectors:%s\n",
@@ -1024,15 +1062,12 @@ retry:
1024 dev->cylinders = dev->id[1]; 1062 dev->cylinders = dev->id[1];
1025 dev->heads = dev->id[3]; 1063 dev->heads = dev->id[3];
1026 dev->sectors = dev->id[6]; 1064 dev->sectors = dev->id[6];
1027 dev->n_sectors = dev->cylinders * dev->heads * dev->sectors;
1028 1065
1029 if (ata_id_current_chs_valid(dev->id)) { 1066 if (ata_id_current_chs_valid(dev->id)) {
1030 /* Current CHS translation is valid. */ 1067 /* Current CHS translation is valid. */
1031 dev->cylinders = dev->id[54]; 1068 dev->cylinders = dev->id[54];
1032 dev->heads = dev->id[55]; 1069 dev->heads = dev->id[55];
1033 dev->sectors = dev->id[56]; 1070 dev->sectors = dev->id[56];
1034
1035 dev->n_sectors = ata_id_u32(dev->id, 57);
1036 } 1071 }
1037 1072
1038 /* print device info to dmesg */ 1073 /* print device info to dmesg */
@@ -1051,7 +1086,6 @@ retry:
1051 ap->id, device, dev->multi_count); 1086 ap->id, device, dev->multi_count);
1052 } 1087 }
1053 1088
1054 ap->host->max_cmd_len = 16;
1055 } 1089 }
1056 1090
1057 /* ATAPI-specific feature tests */ 1091 /* ATAPI-specific feature tests */
@@ -1064,8 +1098,7 @@ retry:
1064 printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id); 1098 printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id);
1065 goto err_out_nosup; 1099 goto err_out_nosup;
1066 } 1100 }
1067 ap->cdb_len = (unsigned int) rc; 1101 dev->cdb_len = (unsigned int) rc;
1068 ap->host->max_cmd_len = (unsigned char) ap->cdb_len;
1069 1102
1070 if (ata_id_cdb_intr(dev->id)) 1103 if (ata_id_cdb_intr(dev->id))
1071 dev->flags |= ATA_DFLAG_CDB_INTR; 1104 dev->flags |= ATA_DFLAG_CDB_INTR;
@@ -1076,6 +1109,12 @@ retry:
1076 ata_mode_string(xfer_modes)); 1109 ata_mode_string(xfer_modes));
1077 } 1110 }
1078 1111
1112 ap->host->max_cmd_len = 0;
1113 for (i = 0; i < ATA_MAX_DEVICES; i++)
1114 ap->host->max_cmd_len = max_t(unsigned int,
1115 ap->host->max_cmd_len,
1116 ap->device[i].cdb_len);
1117
1079 DPRINTK("EXIT, drv_stat = 0x%x\n", ata_chk_status(ap)); 1118 DPRINTK("EXIT, drv_stat = 0x%x\n", ata_chk_status(ap));
1080 return; 1119 return;
1081 1120
@@ -1088,9 +1127,10 @@ err_out:
1088} 1127}
1089 1128
1090 1129
1091static inline u8 ata_dev_knobble(const struct ata_port *ap) 1130static inline u8 ata_dev_knobble(const struct ata_port *ap,
1131 struct ata_device *dev)
1092{ 1132{
1093 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(ap->device->id))); 1133 return ((ap->cbl == ATA_CBL_SATA) && (!ata_id_is_sata(dev->id)));
1094} 1134}
1095 1135
1096/** 1136/**
@@ -1104,13 +1144,11 @@ static inline u8 ata_dev_knobble(const struct ata_port *ap)
1104void ata_dev_config(struct ata_port *ap, unsigned int i) 1144void ata_dev_config(struct ata_port *ap, unsigned int i)
1105{ 1145{
1106 /* limit bridge transfers to udma5, 200 sectors */ 1146 /* limit bridge transfers to udma5, 200 sectors */
1107 if (ata_dev_knobble(ap)) { 1147 if (ata_dev_knobble(ap, &ap->device[i])) {
1108 printk(KERN_INFO "ata%u(%u): applying bridge limits\n", 1148 printk(KERN_INFO "ata%u(%u): applying bridge limits\n",
1109 ap->id, ap->device->devno); 1149 ap->id, i);
1110 ap->udma_mask &= ATA_UDMA5; 1150 ap->udma_mask &= ATA_UDMA5;
1111 ap->host->max_sectors = ATA_MAX_SECTORS; 1151 ap->device[i].max_sectors = ATA_MAX_SECTORS;
1112 ap->host->hostt->max_sectors = ATA_MAX_SECTORS;
1113 ap->device[i].flags |= ATA_DFLAG_LOCK_SECTORS;
1114 } 1152 }
1115 1153
1116 if (ap->ops->dev_config) 1154 if (ap->ops->dev_config)
@@ -1144,8 +1182,11 @@ static int ata_bus_probe(struct ata_port *ap)
1144 1182
1145 rc = ap->ops->probe_reset(ap, classes); 1183 rc = ap->ops->probe_reset(ap, classes);
1146 if (rc == 0) { 1184 if (rc == 0) {
1147 for (i = 0; i < ATA_MAX_DEVICES; i++) 1185 for (i = 0; i < ATA_MAX_DEVICES; i++) {
1186 if (classes[i] == ATA_DEV_UNKNOWN)
1187 classes[i] = ATA_DEV_NONE;
1148 ap->device[i].class = classes[i]; 1188 ap->device[i].class = classes[i];
1189 }
1149 } else { 1190 } else {
1150 printk(KERN_ERR "ata%u: probe reset failed, " 1191 printk(KERN_ERR "ata%u: probe reset failed, "
1151 "disabling port\n", ap->id); 1192 "disabling port\n", ap->id);
@@ -2272,24 +2313,14 @@ static const char * const ata_dma_blacklist [] = {
2272 2313
2273static int ata_dma_blacklisted(const struct ata_device *dev) 2314static int ata_dma_blacklisted(const struct ata_device *dev)
2274{ 2315{
2275 unsigned char model_num[40]; 2316 unsigned char model_num[41];
2276 char *s;
2277 unsigned int len;
2278 int i; 2317 int i;
2279 2318
2280 ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS, 2319 ata_dev_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS,
2281 sizeof(model_num)); 2320 sizeof(model_num));
2282 s = &model_num[0];
2283 len = strnlen(s, sizeof(model_num));
2284
2285 /* ATAPI specifies that empty space is blank-filled; remove blanks */
2286 while ((len > 0) && (s[len - 1] == ' ')) {
2287 len--;
2288 s[len] = 0;
2289 }
2290 2321
2291 for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++) 2322 for (i = 0; i < ARRAY_SIZE(ata_dma_blacklist); i++)
2292 if (!strncmp(ata_dma_blacklist[i], s, len)) 2323 if (!strcmp(ata_dma_blacklist[i], model_num))
2293 return 1; 2324 return 1;
2294 2325
2295 return 0; 2326 return 0;
@@ -2485,7 +2516,7 @@ static void ata_dev_reread_id(struct ata_port *ap, struct ata_device *dev)
2485 2516
2486 swap_buf_le16(dev->id, ATA_ID_WORDS); 2517 swap_buf_le16(dev->id, ATA_ID_WORDS);
2487 2518
2488 ata_dump_id(dev); 2519 ata_dump_id(dev->id);
2489 2520
2490 DPRINTK("EXIT\n"); 2521 DPRINTK("EXIT\n");
2491 2522
@@ -5179,6 +5210,7 @@ EXPORT_SYMBOL_GPL(ata_scsi_release);
5179EXPORT_SYMBOL_GPL(ata_host_intr); 5210EXPORT_SYMBOL_GPL(ata_host_intr);
5180EXPORT_SYMBOL_GPL(ata_dev_classify); 5211EXPORT_SYMBOL_GPL(ata_dev_classify);
5181EXPORT_SYMBOL_GPL(ata_dev_id_string); 5212EXPORT_SYMBOL_GPL(ata_dev_id_string);
5213EXPORT_SYMBOL_GPL(ata_dev_id_c_string);
5182EXPORT_SYMBOL_GPL(ata_dev_config); 5214EXPORT_SYMBOL_GPL(ata_dev_config);
5183EXPORT_SYMBOL_GPL(ata_scsi_simulate); 5215EXPORT_SYMBOL_GPL(ata_scsi_simulate);
5184EXPORT_SYMBOL_GPL(ata_eh_qc_complete); 5216EXPORT_SYMBOL_GPL(ata_eh_qc_complete);
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c
index 26f07a2617f9..86da46502b3e 100644
--- a/drivers/scsi/libata-scsi.c
+++ b/drivers/scsi/libata-scsi.c
@@ -684,23 +684,23 @@ int ata_scsi_slave_config(struct scsi_device *sdev)
684 if (sdev->id < ATA_MAX_DEVICES) { 684 if (sdev->id < ATA_MAX_DEVICES) {
685 struct ata_port *ap; 685 struct ata_port *ap;
686 struct ata_device *dev; 686 struct ata_device *dev;
687 unsigned int max_sectors;
687 688
688 ap = (struct ata_port *) &sdev->host->hostdata[0]; 689 ap = (struct ata_port *) &sdev->host->hostdata[0];
689 dev = &ap->device[sdev->id]; 690 dev = &ap->device[sdev->id];
690 691
691 /* TODO: 1024 is an arbitrary number, not the 692 /* TODO: 2048 is an arbitrary number, not the
692 * hardware maximum. This should be increased to 693 * hardware maximum. This should be increased to
693 * 65534 when Jens Axboe's patch for dynamically 694 * 65534 when Jens Axboe's patch for dynamically
694 * determining max_sectors is merged. 695 * determining max_sectors is merged.
695 */ 696 */
696 if ((dev->flags & ATA_DFLAG_LBA48) && 697 max_sectors = ATA_MAX_SECTORS;
697 ((dev->flags & ATA_DFLAG_LOCK_SECTORS) == 0)) { 698 if (dev->flags & ATA_DFLAG_LBA48)
698 /* 699 max_sectors = 2048;
699 * do not overwrite sdev->host->max_sectors, since 700 if (dev->max_sectors)
700 * other drives on this host may not support LBA48 701 max_sectors = dev->max_sectors;
701 */ 702
702 blk_queue_max_sectors(sdev->request_queue, 2048); 703 blk_queue_max_sectors(sdev->request_queue, max_sectors);
703 }
704 704
705 /* 705 /*
706 * SATA DMA transfers must be multiples of 4 byte, so 706 * SATA DMA transfers must be multiples of 4 byte, so
@@ -1806,15 +1806,12 @@ static int ata_dev_supports_fua(u16 *id)
1806 if (!ata_id_has_fua(id)) 1806 if (!ata_id_has_fua(id))
1807 return 0; 1807 return 0;
1808 1808
1809 model[40] = '\0'; 1809 ata_dev_id_c_string(id, model, ATA_ID_PROD_OFS, sizeof(model));
1810 fw[8] = '\0'; 1810 ata_dev_id_c_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw));
1811
1812 ata_dev_id_string(id, model, ATA_ID_PROD_OFS, sizeof(model) - 1);
1813 ata_dev_id_string(id, fw, ATA_ID_FW_REV_OFS, sizeof(fw) - 1);
1814 1811
1815 if (strncmp(model, "Maxtor", 6)) 1812 if (strcmp(model, "Maxtor"))
1816 return 1; 1813 return 1;
1817 if (strncmp(fw, "BANC1G10", 8)) 1814 if (strcmp(fw, "BANC1G10"))
1818 return 1; 1815 return 1;
1819 1816
1820 return 0; /* blacklisted */ 1817 return 0; /* blacklisted */
@@ -2149,7 +2146,7 @@ static void atapi_request_sense(struct ata_queued_cmd *qc)
2149 ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer)); 2146 ata_sg_init_one(qc, cmd->sense_buffer, sizeof(cmd->sense_buffer));
2150 qc->dma_dir = DMA_FROM_DEVICE; 2147 qc->dma_dir = DMA_FROM_DEVICE;
2151 2148
2152 memset(&qc->cdb, 0, ap->cdb_len); 2149 memset(&qc->cdb, 0, qc->dev->cdb_len);
2153 qc->cdb[0] = REQUEST_SENSE; 2150 qc->cdb[0] = REQUEST_SENSE;
2154 qc->cdb[4] = SCSI_SENSE_BUFFERSIZE; 2151 qc->cdb[4] = SCSI_SENSE_BUFFERSIZE;
2155 2152
@@ -2251,7 +2248,7 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc, const u8 *scsicmd)
2251 if (ata_check_atapi_dma(qc)) 2248 if (ata_check_atapi_dma(qc))
2252 using_pio = 1; 2249 using_pio = 1;
2253 2250
2254 memcpy(&qc->cdb, scsicmd, qc->ap->cdb_len); 2251 memcpy(&qc->cdb, scsicmd, dev->cdb_len);
2255 2252
2256 qc->complete_fn = atapi_qc_complete; 2253 qc->complete_fn = atapi_qc_complete;
2257 2254
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c
index 0f7e45a39fd9..f32af5dc58c4 100644
--- a/drivers/scsi/pdc_adma.c
+++ b/drivers/scsi/pdc_adma.c
@@ -148,7 +148,6 @@ static struct scsi_host_template adma_ata_sht = {
148 .can_queue = ATA_DEF_QUEUE, 148 .can_queue = ATA_DEF_QUEUE,
149 .this_id = ATA_SHT_THIS_ID, 149 .this_id = ATA_SHT_THIS_ID,
150 .sg_tablesize = LIBATA_MAX_PRD, 150 .sg_tablesize = LIBATA_MAX_PRD,
151 .max_sectors = ATA_MAX_SECTORS,
152 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 151 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
153 .emulated = ATA_SHT_EMULATED, 152 .emulated = ATA_SHT_EMULATED,
154 .use_clustering = ENABLE_CLUSTERING, 153 .use_clustering = ENABLE_CLUSTERING,
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index d35460ff5275..e05751e7aad4 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -383,7 +383,6 @@ static struct scsi_host_template mv_sht = {
383 .can_queue = MV_USE_Q_DEPTH, 383 .can_queue = MV_USE_Q_DEPTH,
384 .this_id = ATA_SHT_THIS_ID, 384 .this_id = ATA_SHT_THIS_ID,
385 .sg_tablesize = MV_MAX_SG_CT / 2, 385 .sg_tablesize = MV_MAX_SG_CT / 2,
386 .max_sectors = ATA_MAX_SECTORS,
387 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 386 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
388 .emulated = ATA_SHT_EMULATED, 387 .emulated = ATA_SHT_EMULATED,
389 .use_clustering = ATA_SHT_USE_CLUSTERING, 388 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_nv.c b/drivers/scsi/sata_nv.c
index 94dc2e1a8f30..5168db981dde 100644
--- a/drivers/scsi/sata_nv.c
+++ b/drivers/scsi/sata_nv.c
@@ -234,7 +234,6 @@ static struct scsi_host_template nv_sht = {
234 .can_queue = ATA_DEF_QUEUE, 234 .can_queue = ATA_DEF_QUEUE,
235 .this_id = ATA_SHT_THIS_ID, 235 .this_id = ATA_SHT_THIS_ID,
236 .sg_tablesize = LIBATA_MAX_PRD, 236 .sg_tablesize = LIBATA_MAX_PRD,
237 .max_sectors = ATA_MAX_SECTORS,
238 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 237 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
239 .emulated = ATA_SHT_EMULATED, 238 .emulated = ATA_SHT_EMULATED,
240 .use_clustering = ATA_SHT_USE_CLUSTERING, 239 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_promise.c b/drivers/scsi/sata_promise.c
index a88b563ebcc4..7fa807d7d9e1 100644
--- a/drivers/scsi/sata_promise.c
+++ b/drivers/scsi/sata_promise.c
@@ -117,7 +117,6 @@ static struct scsi_host_template pdc_ata_sht = {
117 .can_queue = ATA_DEF_QUEUE, 117 .can_queue = ATA_DEF_QUEUE,
118 .this_id = ATA_SHT_THIS_ID, 118 .this_id = ATA_SHT_THIS_ID,
119 .sg_tablesize = LIBATA_MAX_PRD, 119 .sg_tablesize = LIBATA_MAX_PRD,
120 .max_sectors = ATA_MAX_SECTORS,
121 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 120 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
122 .emulated = ATA_SHT_EMULATED, 121 .emulated = ATA_SHT_EMULATED,
123 .use_clustering = ATA_SHT_USE_CLUSTERING, 122 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_qstor.c b/drivers/scsi/sata_qstor.c
index 5730167d2e74..bfc1dc8e7779 100644
--- a/drivers/scsi/sata_qstor.c
+++ b/drivers/scsi/sata_qstor.c
@@ -137,7 +137,6 @@ static struct scsi_host_template qs_ata_sht = {
137 .can_queue = ATA_DEF_QUEUE, 137 .can_queue = ATA_DEF_QUEUE,
138 .this_id = ATA_SHT_THIS_ID, 138 .this_id = ATA_SHT_THIS_ID,
139 .sg_tablesize = QS_MAX_PRD, 139 .sg_tablesize = QS_MAX_PRD,
140 .max_sectors = ATA_MAX_SECTORS,
141 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 140 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
142 .emulated = ATA_SHT_EMULATED, 141 .emulated = ATA_SHT_EMULATED,
143 //FIXME .use_clustering = ATA_SHT_USE_CLUSTERING, 142 //FIXME .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_sil.c b/drivers/scsi/sata_sil.c
index bd2887741d78..15346888faf2 100644
--- a/drivers/scsi/sata_sil.c
+++ b/drivers/scsi/sata_sil.c
@@ -140,7 +140,6 @@ static struct scsi_host_template sil_sht = {
140 .can_queue = ATA_DEF_QUEUE, 140 .can_queue = ATA_DEF_QUEUE,
141 .this_id = ATA_SHT_THIS_ID, 141 .this_id = ATA_SHT_THIS_ID,
142 .sg_tablesize = LIBATA_MAX_PRD, 142 .sg_tablesize = LIBATA_MAX_PRD,
143 .max_sectors = ATA_MAX_SECTORS,
144 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 143 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
145 .emulated = ATA_SHT_EMULATED, 144 .emulated = ATA_SHT_EMULATED,
146 .use_clustering = ATA_SHT_USE_CLUSTERING, 145 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -337,22 +336,13 @@ static void sil_scr_write (struct ata_port *ap, unsigned int sc_reg, u32 val)
337static void sil_dev_config(struct ata_port *ap, struct ata_device *dev) 336static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
338{ 337{
339 unsigned int n, quirks = 0; 338 unsigned int n, quirks = 0;
340 unsigned char model_num[40]; 339 unsigned char model_num[41];
341 const char *s;
342 unsigned int len;
343 340
344 ata_dev_id_string(dev->id, model_num, ATA_ID_PROD_OFS, 341 ata_dev_id_c_string(dev->id, model_num, ATA_ID_PROD_OFS,
345 sizeof(model_num)); 342 sizeof(model_num));
346 s = &model_num[0];
347 len = strnlen(s, sizeof(model_num));
348
349 /* ATAPI specifies that empty space is blank-filled; remove blanks */
350 while ((len > 0) && (s[len - 1] == ' '))
351 len--;
352 343
353 for (n = 0; sil_blacklist[n].product; n++) 344 for (n = 0; sil_blacklist[n].product; n++)
354 if (!memcmp(sil_blacklist[n].product, s, 345 if (!strcmp(sil_blacklist[n].product, model_num)) {
355 strlen(sil_blacklist[n].product))) {
356 quirks = sil_blacklist[n].quirk; 346 quirks = sil_blacklist[n].quirk;
357 break; 347 break;
358 } 348 }
@@ -363,16 +353,14 @@ static void sil_dev_config(struct ata_port *ap, struct ata_device *dev)
363 (quirks & SIL_QUIRK_MOD15WRITE))) { 353 (quirks & SIL_QUIRK_MOD15WRITE))) {
364 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n", 354 printk(KERN_INFO "ata%u(%u): applying Seagate errata fix (mod15write workaround)\n",
365 ap->id, dev->devno); 355 ap->id, dev->devno);
366 ap->host->max_sectors = 15; 356 dev->max_sectors = 15;
367 ap->host->hostt->max_sectors = 15;
368 dev->flags |= ATA_DFLAG_LOCK_SECTORS;
369 return; 357 return;
370 } 358 }
371 359
372 /* limit to udma5 */ 360 /* limit to udma5 */
373 if (quirks & SIL_QUIRK_UDMA5MAX) { 361 if (quirks & SIL_QUIRK_UDMA5MAX) {
374 printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n", 362 printk(KERN_INFO "ata%u(%u): applying Maxtor errata fix %s\n",
375 ap->id, dev->devno, s); 363 ap->id, dev->devno, model_num);
376 ap->udma_mask &= ATA_UDMA5; 364 ap->udma_mask &= ATA_UDMA5;
377 return; 365 return;
378 } 366 }
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 228a7fabffff..a0e35a262156 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -285,7 +285,6 @@ static struct scsi_host_template sil24_sht = {
285 .can_queue = ATA_DEF_QUEUE, 285 .can_queue = ATA_DEF_QUEUE,
286 .this_id = ATA_SHT_THIS_ID, 286 .this_id = ATA_SHT_THIS_ID,
287 .sg_tablesize = LIBATA_MAX_PRD, 287 .sg_tablesize = LIBATA_MAX_PRD,
288 .max_sectors = ATA_MAX_SECTORS,
289 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 288 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
290 .emulated = ATA_SHT_EMULATED, 289 .emulated = ATA_SHT_EMULATED,
291 .use_clustering = ATA_SHT_USE_CLUSTERING, 290 .use_clustering = ATA_SHT_USE_CLUSTERING,
@@ -371,7 +370,7 @@ static void sil24_dev_config(struct ata_port *ap, struct ata_device *dev)
371{ 370{
372 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr; 371 void __iomem *port = (void __iomem *)ap->ioaddr.cmd_addr;
373 372
374 if (ap->cdb_len == 16) 373 if (dev->cdb_len == 16)
375 writel(PORT_CS_CDB16, port + PORT_CTRL_STAT); 374 writel(PORT_CS_CDB16, port + PORT_CTRL_STAT);
376 else 375 else
377 writel(PORT_CS_CDB16, port + PORT_CTRL_CLR); 376 writel(PORT_CS_CDB16, port + PORT_CTRL_CLR);
@@ -543,7 +542,7 @@ static void sil24_qc_prep(struct ata_queued_cmd *qc)
543 prb = &cb->atapi.prb; 542 prb = &cb->atapi.prb;
544 sge = cb->atapi.sge; 543 sge = cb->atapi.sge;
545 memset(cb->atapi.cdb, 0, 32); 544 memset(cb->atapi.cdb, 0, 32);
546 memcpy(cb->atapi.cdb, qc->cdb, ap->cdb_len); 545 memcpy(cb->atapi.cdb, qc->cdb, qc->dev->cdb_len);
547 546
548 if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) { 547 if (qc->tf.protocol != ATA_PROT_ATAPI_NODATA) {
549 if (qc->tf.flags & ATA_TFLAG_WRITE) 548 if (qc->tf.flags & ATA_TFLAG_WRITE)
diff --git a/drivers/scsi/sata_sis.c b/drivers/scsi/sata_sis.c
index 2f1815715705..7fd45f86de99 100644
--- a/drivers/scsi/sata_sis.c
+++ b/drivers/scsi/sata_sis.c
@@ -92,7 +92,6 @@ static struct scsi_host_template sis_sht = {
92 .can_queue = ATA_DEF_QUEUE, 92 .can_queue = ATA_DEF_QUEUE,
93 .this_id = ATA_SHT_THIS_ID, 93 .this_id = ATA_SHT_THIS_ID,
94 .sg_tablesize = ATA_MAX_PRD, 94 .sg_tablesize = ATA_MAX_PRD,
95 .max_sectors = ATA_MAX_SECTORS,
96 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 95 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
97 .emulated = ATA_SHT_EMULATED, 96 .emulated = ATA_SHT_EMULATED,
98 .use_clustering = ATA_SHT_USE_CLUSTERING, 97 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c
index f369c3003adf..4aaccd53e736 100644
--- a/drivers/scsi/sata_svw.c
+++ b/drivers/scsi/sata_svw.c
@@ -293,7 +293,6 @@ static struct scsi_host_template k2_sata_sht = {
293 .can_queue = ATA_DEF_QUEUE, 293 .can_queue = ATA_DEF_QUEUE,
294 .this_id = ATA_SHT_THIS_ID, 294 .this_id = ATA_SHT_THIS_ID,
295 .sg_tablesize = LIBATA_MAX_PRD, 295 .sg_tablesize = LIBATA_MAX_PRD,
296 .max_sectors = ATA_MAX_SECTORS,
297 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 296 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
298 .emulated = ATA_SHT_EMULATED, 297 .emulated = ATA_SHT_EMULATED,
299 .use_clustering = ATA_SHT_USE_CLUSTERING, 298 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_sx4.c b/drivers/scsi/sata_sx4.c
index 04465fb86e1d..60ebe5ce32c4 100644
--- a/drivers/scsi/sata_sx4.c
+++ b/drivers/scsi/sata_sx4.c
@@ -187,7 +187,6 @@ static struct scsi_host_template pdc_sata_sht = {
187 .can_queue = ATA_DEF_QUEUE, 187 .can_queue = ATA_DEF_QUEUE,
188 .this_id = ATA_SHT_THIS_ID, 188 .this_id = ATA_SHT_THIS_ID,
189 .sg_tablesize = LIBATA_MAX_PRD, 189 .sg_tablesize = LIBATA_MAX_PRD,
190 .max_sectors = ATA_MAX_SECTORS,
191 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 190 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
192 .emulated = ATA_SHT_EMULATED, 191 .emulated = ATA_SHT_EMULATED,
193 .use_clustering = ATA_SHT_USE_CLUSTERING, 192 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_uli.c b/drivers/scsi/sata_uli.c
index c500f2490902..37a487b7d655 100644
--- a/drivers/scsi/sata_uli.c
+++ b/drivers/scsi/sata_uli.c
@@ -80,7 +80,6 @@ static struct scsi_host_template uli_sht = {
80 .can_queue = ATA_DEF_QUEUE, 80 .can_queue = ATA_DEF_QUEUE,
81 .this_id = ATA_SHT_THIS_ID, 81 .this_id = ATA_SHT_THIS_ID,
82 .sg_tablesize = LIBATA_MAX_PRD, 82 .sg_tablesize = LIBATA_MAX_PRD,
83 .max_sectors = ATA_MAX_SECTORS,
84 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 83 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
85 .emulated = ATA_SHT_EMULATED, 84 .emulated = ATA_SHT_EMULATED,
86 .use_clustering = ATA_SHT_USE_CLUSTERING, 85 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_via.c b/drivers/scsi/sata_via.c
index 2e20887dc88f..ff65a0b0457f 100644
--- a/drivers/scsi/sata_via.c
+++ b/drivers/scsi/sata_via.c
@@ -99,7 +99,6 @@ static struct scsi_host_template svia_sht = {
99 .can_queue = ATA_DEF_QUEUE, 99 .can_queue = ATA_DEF_QUEUE,
100 .this_id = ATA_SHT_THIS_ID, 100 .this_id = ATA_SHT_THIS_ID,
101 .sg_tablesize = LIBATA_MAX_PRD, 101 .sg_tablesize = LIBATA_MAX_PRD,
102 .max_sectors = ATA_MAX_SECTORS,
103 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 102 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
104 .emulated = ATA_SHT_EMULATED, 103 .emulated = ATA_SHT_EMULATED,
105 .use_clustering = ATA_SHT_USE_CLUSTERING, 104 .use_clustering = ATA_SHT_USE_CLUSTERING,
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c
index 4cfc03018ca3..976a6b124af9 100644
--- a/drivers/scsi/sata_vsc.c
+++ b/drivers/scsi/sata_vsc.c
@@ -228,7 +228,6 @@ static struct scsi_host_template vsc_sata_sht = {
228 .can_queue = ATA_DEF_QUEUE, 228 .can_queue = ATA_DEF_QUEUE,
229 .this_id = ATA_SHT_THIS_ID, 229 .this_id = ATA_SHT_THIS_ID,
230 .sg_tablesize = LIBATA_MAX_PRD, 230 .sg_tablesize = LIBATA_MAX_PRD,
231 .max_sectors = ATA_MAX_SECTORS,
232 .cmd_per_lun = ATA_SHT_CMD_PER_LUN, 231 .cmd_per_lun = ATA_SHT_CMD_PER_LUN,
233 .emulated = ATA_SHT_EMULATED, 232 .emulated = ATA_SHT_EMULATED,
234 .use_clustering = ATA_SHT_USE_CLUSTERING, 233 .use_clustering = ATA_SHT_USE_CLUSTERING,