aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libata-core.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-02-12 09:32:58 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-12 14:29:10 -0500
commit6e7846e9c548443c86cfbad9e4defb4bdcfc538b (patch)
treef92fe0c3ca0000ad7d68bb3caae10d2066a7f78e /drivers/scsi/libata-core.c
parent8eabd02c246b808e0e27c3ee9ea17d0349efb06d (diff)
[PATCH] libata: move cdb_len for host to device
cdb_len is per-device property. Sharing cdb_len on ap results in inaccurate configuration on revalidation and hotplugging. This patch makes cdb_len per-device. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/scsi/libata-core.c')
-rw-r--r--drivers/scsi/libata-core.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 5e8a32052a1e..1a373b4d0e22 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -931,7 +931,7 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
931 unsigned int using_edd; 931 unsigned int using_edd;
932 struct ata_taskfile tf; 932 struct ata_taskfile tf;
933 unsigned int err_mask; 933 unsigned int err_mask;
934 int rc; 934 int i, rc;
935 935
936 if (!ata_dev_present(dev)) { 936 if (!ata_dev_present(dev)) {
937 DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n", 937 DPRINTK("ENTER/EXIT (host %u, dev %u) -- nodev\n",
@@ -1087,7 +1087,7 @@ retry:
1087 1087
1088 } 1088 }
1089 1089
1090 ap->host->max_cmd_len = 16; 1090 dev->cdb_len = 16;
1091 } 1091 }
1092 1092
1093 /* ATAPI-specific feature tests */ 1093 /* ATAPI-specific feature tests */
@@ -1100,8 +1100,7 @@ retry:
1100 printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id); 1100 printk(KERN_WARNING "ata%u: unsupported CDB len\n", ap->id);
1101 goto err_out_nosup; 1101 goto err_out_nosup;
1102 } 1102 }
1103 ap->cdb_len = (unsigned int) rc; 1103 dev->cdb_len = (unsigned int) rc;
1104 ap->host->max_cmd_len = (unsigned char) ap->cdb_len;
1105 1104
1106 /* print device info to dmesg */ 1105 /* print device info to dmesg */
1107 printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n", 1106 printk(KERN_INFO "ata%u: dev %u ATAPI, max %s\n",
@@ -1109,6 +1108,12 @@ retry:
1109 ata_mode_string(xfer_modes)); 1108 ata_mode_string(xfer_modes));
1110 } 1109 }
1111 1110
1111 ap->host->max_cmd_len = 0;
1112 for (i = 0; i < ATA_MAX_DEVICES; i++)
1113 ap->host->max_cmd_len = max_t(unsigned int,
1114 ap->host->max_cmd_len,
1115 ap->device[i].cdb_len);
1116
1112 DPRINTK("EXIT, drv_stat = 0x%x\n", ata_chk_status(ap)); 1117 DPRINTK("EXIT, drv_stat = 0x%x\n", ata_chk_status(ap));
1113 return; 1118 return;
1114 1119
@@ -4203,7 +4208,7 @@ static void atapi_packet_task(void *_data)
4203 4208
4204 /* send SCSI cdb */ 4209 /* send SCSI cdb */
4205 DPRINTK("send cdb\n"); 4210 DPRINTK("send cdb\n");
4206 WARN_ON(ap->cdb_len < 12); 4211 WARN_ON(qc->dev->cdb_len < 12);
4207 4212
4208 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA || 4213 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA ||
4209 qc->tf.protocol == ATA_PROT_ATAPI_NODATA) { 4214 qc->tf.protocol == ATA_PROT_ATAPI_NODATA) {
@@ -4217,12 +4222,12 @@ static void atapi_packet_task(void *_data)
4217 */ 4222 */
4218 spin_lock_irqsave(&ap->host_set->lock, flags); 4223 spin_lock_irqsave(&ap->host_set->lock, flags);
4219 ap->flags &= ~ATA_FLAG_NOINTR; 4224 ap->flags &= ~ATA_FLAG_NOINTR;
4220 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); 4225 ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1);
4221 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA) 4226 if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)
4222 ap->ops->bmdma_start(qc); /* initiate bmdma */ 4227 ap->ops->bmdma_start(qc); /* initiate bmdma */
4223 spin_unlock_irqrestore(&ap->host_set->lock, flags); 4228 spin_unlock_irqrestore(&ap->host_set->lock, flags);
4224 } else { 4229 } else {
4225 ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1); 4230 ata_data_xfer(ap, qc->cdb, qc->dev->cdb_len, 1);
4226 4231
4227 /* PIO commands are handled by polling */ 4232 /* PIO commands are handled by polling */
4228 ap->hsm_task_state = HSM_ST; 4233 ap->hsm_task_state = HSM_ST;