Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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()

+49 -15
+32 -1
drivers/ata/libata-core.c
··· 1784 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 1794 if (ap->ops->dev_config) 1788 1795 ap->ops->dev_config(ap, dev); 1789 1796 ··· 3359 3352 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 3360 3353 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, 3361 3354 3355 + /* Weird ATAPI devices */ 3356 + { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | 3357 + ATA_HORKAGE_DMA_RW_ONLY }, 3358 + 3362 3359 /* Devices we expect to fail diagnostics */ 3363 3360 3364 3361 /* Devices where NCQ should be avoided */ ··· 3689 3678 { 3690 3679 struct ata_port *ap = qc->ap; 3691 3680 int rc = 0; /* Assume ATAPI DMA is OK by default */ 3681 + 3682 + /* some drives can only do ATAPI DMA on read/write */ 3683 + if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) { 3684 + struct scsi_cmnd *cmd = qc->scsicmd; 3685 + u8 *scsicmd = cmd->cmnd; 3686 + 3687 + switch (scsicmd[0]) { 3688 + case READ_10: 3689 + case WRITE_10: 3690 + case READ_12: 3691 + case WRITE_12: 3692 + case READ_6: 3693 + case WRITE_6: 3694 + /* atapi dma maybe ok */ 3695 + break; 3696 + default: 3697 + /* turn off atapi dma */ 3698 + return 1; 3699 + } 3700 + } 3692 3701 3693 3702 if (ap->ops->check_atapi_dma) 3694 3703 rc = ap->ops->check_atapi_dma(qc); ··· 4753 4722 { 4754 4723 struct ata_port *ap = qc->ap; 4755 4724 4756 - ap->ops->tf_read(ap, &qc->result_tf); 4757 4725 qc->result_tf.flags = qc->tf.flags; 4726 + ap->ops->tf_read(ap, &qc->result_tf); 4758 4727 } 4759 4728 4760 4729 /**
+11 -11
drivers/ata/libata-eh.c
··· 982 982 * RETURNS: 983 983 * 0 on success, AC_ERR_* mask on failure 984 984 */ 985 - static unsigned int atapi_eh_request_sense(struct ata_device *dev, 986 - unsigned char *sense_buf) 985 + static unsigned int atapi_eh_request_sense(struct ata_queued_cmd *qc) 987 986 { 987 + struct ata_device *dev = qc->dev; 988 + unsigned char *sense_buf = qc->scsicmd->sense_buffer; 988 989 struct ata_port *ap = dev->ap; 989 990 struct ata_taskfile tf; 990 991 u8 cdb[ATAPI_CDB_LEN]; 991 992 992 993 DPRINTK("ATAPI request sense\n"); 993 994 994 - ata_tf_init(dev, &tf); 995 - 996 995 /* FIXME: is this needed? */ 997 996 memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); 998 997 999 - /* XXX: why tf_read here? */ 1000 - ap->ops->tf_read(ap, &tf); 1001 - 1002 - /* fill these in, for the case where they are -not- overwritten */ 998 + /* initialize sense_buf with the error register, 999 + * for the case where they are -not- overwritten 1000 + */ 1003 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 1007 memset(cdb, 0, ATAPI_CDB_LEN); 1007 1008 cdb[0] = REQUEST_SENSE; ··· 1166 1165 1167 1166 case ATA_DEV_ATAPI: 1168 1167 if (!(qc->ap->pflags & ATA_PFLAG_FROZEN)) { 1169 - tmp = atapi_eh_request_sense(qc->dev, 1170 - qc->scsicmd->sense_buffer); 1168 + tmp = atapi_eh_request_sense(qc); 1171 1169 if (!tmp) { 1172 1170 /* ATA_QCFLAG_SENSE_VALID is used to 1173 1171 * tell atapi_qc_complete() that sense
+1 -1
drivers/ata/libata-scsi.c
··· 333 333 scsi_cmd[8] = args[3]; 334 334 scsi_cmd[10] = args[4]; 335 335 scsi_cmd[12] = args[5]; 336 - scsi_cmd[13] = args[6] & 0x0f; 336 + scsi_cmd[13] = args[6] & 0x4f; 337 337 scsi_cmd[14] = args[0]; 338 338 339 339 /* Good values for timeout and retries? Values below
+1
include/linux/ata.h
··· 40 40 ATA_MAX_DEVICES = 2, /* per bus/port */ 41 41 ATA_MAX_PRD = 256, /* we could make these 256/256 */ 42 42 ATA_SECT_SIZE = 512, 43 + ATA_MAX_SECTORS_128 = 128, 43 44 ATA_MAX_SECTORS = 256, 44 45 ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */ 45 46
+4 -2
include/linux/libata.h
··· 311 311 ATA_HORKAGE_DIAGNOSTIC = (1 << 0), /* Failed boot diag */ 312 312 ATA_HORKAGE_NODMA = (1 << 1), /* DMA problems */ 313 313 ATA_HORKAGE_NONCQ = (1 << 2), /* Don't use NCQ */ 314 + ATA_HORKAGE_MAX_SEC_128 = (1 << 3), /* Limit max sects to 128 */ 315 + ATA_HORKAGE_DMA_RW_ONLY = (1 << 4), /* ATAPI DMA for RW only */ 314 316 }; 315 317 316 318 enum hsm_task_states { 317 319 HSM_ST_IDLE, /* no command on going */ 320 + HSM_ST_FIRST, /* (waiting the device to) 321 + write CDB or first data block */ 318 322 HSM_ST, /* (waiting the device to) transfer data */ 319 323 HSM_ST_LAST, /* (waiting the device to) complete command */ 320 324 HSM_ST_ERR, /* error */ 321 - HSM_ST_FIRST, /* (waiting the device to) 322 - write CDB or first data block */ 323 325 }; 324 326 325 327 enum ata_completion_errors {