diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-04 11:44:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-04-04 11:44:40 -0400 |
commit | bb4899dbef2650288d20251a736243472f050d8b (patch) | |
tree | dde7f4d5f1c465fee1d39eecb9151e65280ce06b /drivers/ata | |
parent | 36e337d0244ddcf4317f7d7c1144b9adfc8e5e3a (diff) | |
parent | 6f23a31d1cbe791a1ce86ffa9b23251ab0a1ef45 (diff) |
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata: Limit ATAPI DMA to R/W commands only for TORiSAN DVD drives (take 3)
libata: Limit max sector to 128 for TORiSAN DVD drives (take 3)
libata: Clear tf before doing request sense (take 3)
libata: reorder HSM_ST_FIRST for easier decoding (take 3)
libata bugfix: preserve LBA bit for HDIO_DRIVE_TASK
2.6.21 fix lba48 bug in libata fill_result_tf()
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/libata-core.c | 33 | ||||
-rw-r--r-- | drivers/ata/libata-eh.c | 22 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 2 |
3 files changed, 44 insertions, 13 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 87b47bd3182f..0abd72d0dec2 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -1784,6 +1784,13 @@ int ata_dev_configure(struct ata_device *dev) | |||
1784 | dev->max_sectors = ATA_MAX_SECTORS; | 1784 | dev->max_sectors = ATA_MAX_SECTORS; |
1785 | } | 1785 | } |
1786 | 1786 | ||
1787 | if (ata_device_blacklisted(dev) & ATA_HORKAGE_MAX_SEC_128) | ||
1788 | dev->max_sectors = min(ATA_MAX_SECTORS_128, dev->max_sectors); | ||
1789 | |||
1790 | /* limit ATAPI DMA to R/W commands only */ | ||
1791 | if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY) | ||
1792 | dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY; | ||
1793 | |||
1787 | if (ap->ops->dev_config) | 1794 | if (ap->ops->dev_config) |
1788 | ap->ops->dev_config(ap, dev); | 1795 | ap->ops->dev_config(ap, dev); |
1789 | 1796 | ||
@@ -3352,6 +3359,10 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
3352 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, | 3359 | { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, |
3353 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, | 3360 | { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, |
3354 | 3361 | ||
3362 | /* Weird ATAPI devices */ | ||
3363 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | | ||
3364 | ATA_HORKAGE_DMA_RW_ONLY }, | ||
3365 | |||
3355 | /* Devices we expect to fail diagnostics */ | 3366 | /* Devices we expect to fail diagnostics */ |
3356 | 3367 | ||
3357 | /* Devices where NCQ should be avoided */ | 3368 | /* Devices where NCQ should be avoided */ |
@@ -3679,6 +3690,26 @@ int ata_check_atapi_dma(struct ata_queued_cmd *qc) | |||
3679 | struct ata_port *ap = qc->ap; | 3690 | struct ata_port *ap = qc->ap; |
3680 | int rc = 0; /* Assume ATAPI DMA is OK by default */ | 3691 | int rc = 0; /* Assume ATAPI DMA is OK by default */ |
3681 | 3692 | ||
3693 | /* some drives can only do ATAPI DMA on read/write */ | ||
3694 | if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) { | ||
3695 | struct scsi_cmnd *cmd = qc->scsicmd; | ||
3696 | u8 *scsicmd = cmd->cmnd; | ||
3697 | |||
3698 | switch (scsicmd[0]) { | ||
3699 | case READ_10: | ||
3700 | case WRITE_10: | ||
3701 | case READ_12: | ||
3702 | case WRITE_12: | ||
3703 | case READ_6: | ||
3704 | case WRITE_6: | ||
3705 | /* atapi dma maybe ok */ | ||
3706 | break; | ||
3707 | default: | ||
3708 | /* turn off atapi dma */ | ||
3709 | return 1; | ||
3710 | } | ||
3711 | } | ||
3712 | |||
3682 | if (ap->ops->check_atapi_dma) | 3713 | if (ap->ops->check_atapi_dma) |
3683 | rc = ap->ops->check_atapi_dma(qc); | 3714 | rc = ap->ops->check_atapi_dma(qc); |
3684 | 3715 | ||
@@ -4722,8 +4753,8 @@ static void fill_result_tf(struct ata_queued_cmd *qc) | |||
4722 | { | 4753 | { |
4723 | struct ata_port *ap = qc->ap; | 4754 | struct ata_port *ap = qc->ap; |
4724 | 4755 | ||
4725 | ap->ops->tf_read(ap, &qc->result_tf); | ||
4726 | qc->result_tf.flags = qc->tf.flags; | 4756 | qc->result_tf.flags = qc->tf.flags; |
4757 | ap->ops->tf_read(ap, &qc->result_tf); | ||
4727 | } | 4758 | } |
4728 | 4759 | ||
4729 | /** | 4760 | /** |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index c89664a77a9c..39f556c02992 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -982,26 +982,27 @@ static int ata_eh_read_log_10h(struct ata_device *dev, | |||
982 | * RETURNS: | 982 | * RETURNS: |
983 | * 0 on success, AC_ERR_* mask on failure | 983 | * 0 on success, AC_ERR_* mask on failure |
984 | */ | 984 | */ |
985 | static unsigned int atapi_eh_request_sense(struct ata_device *dev, | 985 | static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) |
986 | unsigned char *sense_buf) | ||
987 | { | 986 | { |
987 | struct ata_device *dev = qc->dev; | ||
988 | unsigned char *sense_buf = qc->scsicmd->sense_buffer; | ||
988 | struct ata_port *ap = dev->ap; | 989 | struct ata_port *ap = dev->ap; |
989 | struct ata_taskfile tf; | 990 | struct ata_taskfile tf; |
990 | u8 cdb[ATAPI_CDB_LEN]; | 991 | u8 cdb[ATAPI_CDB_LEN]; |
991 | 992 | ||
992 | DPRINTK("ATAPI request sense\n"); | 993 | DPRINTK("ATAPI request sense\n"); |
993 | 994 | ||
994 | ata_tf_init(dev, &tf); | ||
995 | |||
996 | /* FIXME: is this needed? */ | 995 | /* FIXME: is this needed? */ |
997 | memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); | 996 | memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); |
998 | 997 | ||
999 | /* XXX: why tf_read here? */ | 998 | /* initialize sense_buf with the error register, |
1000 | ap->ops->tf_read(ap, &tf); | 999 | * for the case where they are -not- overwritten |
1001 | 1000 | */ | |
1002 | /* fill these in, for the case where they are -not- overwritten */ | ||
1003 | sense_buf[0] = 0x70; | 1001 | sense_buf[0] = 0x70; |
1004 | sense_buf[2] = tf.feature >> 4; | 1002 | sense_buf[2] = qc->result_tf.feature >> 4; |
1003 | |||
1004 | /* some devices time out if garbage left in tf */ | ||
1005 | ata_tf_init(dev, &tf); | ||
1005 | 1006 | ||
1006 | memset(cdb, 0, ATAPI_CDB_LEN); | 1007 | memset(cdb, 0, ATAPI_CDB_LEN); |
1007 | cdb[0] = REQUEST_SENSE; | 1008 | cdb[0] = REQUEST_SENSE; |
@@ -1165,8 +1166,7 @@ static unsigned int ata_eh_analyze_tf(struct ata_queued_cmd *qc, | |||
1165 | 1166 | ||
1166 | case ATA_DEV_ATAPI: | 1167 | case ATA_DEV_ATAPI: |
1167 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { | 1168 | if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { |
1168 | tmp = atapi_eh_request_sense(qc->dev, | 1169 | tmp = atapi_eh_request_sense(qc); |
1169 | qc->scsicmd->sense_buffer); | ||
1170 | if (!tmp) { | 1170 | if (!tmp) { |
1171 | /* ATA_QCFLAG_SENSE_VALID is used to | 1171 | /* ATA_QCFLAG_SENSE_VALID is used to |
1172 | * tell atapi_qc_complete() that sense | 1172 | * tell atapi_qc_complete() that sense |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 6cc817a10204..e9364434182c 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -333,7 +333,7 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg) | |||
333 | scsi_cmd[8] = args[3]; | 333 | scsi_cmd[8] = args[3]; |
334 | scsi_cmd[10] = args[4]; | 334 | scsi_cmd[10] = args[4]; |
335 | scsi_cmd[12] = args[5]; | 335 | scsi_cmd[12] = args[5]; |
336 | scsi_cmd[13] = args[6] & 0x0f; | 336 | scsi_cmd[13] = args[6] & 0x4f; |
337 | scsi_cmd[14] = args[0]; | 337 | scsi_cmd[14] = args[0]; |
338 | 338 | ||
339 | /* Good values for timeout and retries? Values below | 339 | /* Good values for timeout and retries? Values below |