aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-27 13:00:23 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-27 13:00:23 -0400
commit75ca0d22668a36fc83e17407d369b528a22c562c (patch)
tree81934436cdeb95d4a51d95481a1c6b973609d38e /drivers
parent7af5f532a23c421ab9a70b1a9a78c722d26d95ff (diff)
parent40a1d531f6c894b298e784fd2090d87633e4989a (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: kill ATA_HORKAGE_DMA_RW_ONLY libata: use PIO for non-16 byte aligned ATAPI commands libata: call ata_check_atapi_dma() with qc better prepared libata: fix infinite EH waiting bug libata: fix ata_dev_disable() pata_it821x: fix section mismatch warning libata: remove unused variable from ata_eh_reset() libata: be less verbose about hpa libata: kill non-sense warning message libata: kill the infamous abnormal status message HPT374 is UDMA100 not UDMA133
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c56
-rw-r--r--drivers/ata/libata-eh.c7
-rw-r--r--drivers/ata/libata-scsi.c20
-rw-r--r--drivers/ata/pata_hpt37x.c4
-rw-r--r--drivers/ata/pata_it821x.c2
5 files changed, 32 insertions, 57 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index adfae9d1ceb1..bfc59a104728 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -600,8 +600,9 @@ static const char *sata_spd_string(unsigned int spd)
600 600
601void ata_dev_disable(struct ata_device *dev) 601void ata_dev_disable(struct ata_device *dev)
602{ 602{
603 if (ata_dev_enabled(dev) && ata_msg_drv(dev->ap)) { 603 if (ata_dev_enabled(dev)) {
604 ata_dev_printk(dev, KERN_WARNING, "disabled\n"); 604 if (ata_msg_drv(dev->ap))
605 ata_dev_printk(dev, KERN_WARNING, "disabled\n");
605 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | 606 ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
606 ATA_DNXFER_QUIET); 607 ATA_DNXFER_QUIET);
607 dev->class++; 608 dev->class++;
@@ -983,11 +984,6 @@ static u64 ata_hpa_resize(struct ata_device *dev)
983 else 984 else
984 hpa_sectors = ata_read_native_max_address(dev); 985 hpa_sectors = ata_read_native_max_address(dev);
985 986
986 /* if no hpa, both should be equal */
987 ata_dev_printk(dev, KERN_INFO, "%s 1: sectors = %lld, "
988 "hpa_sectors = %lld\n",
989 __FUNCTION__, (long long)sectors, (long long)hpa_sectors);
990
991 if (hpa_sectors > sectors) { 987 if (hpa_sectors > sectors) {
992 ata_dev_printk(dev, KERN_INFO, 988 ata_dev_printk(dev, KERN_INFO,
993 "Host Protected Area detected:\n" 989 "Host Protected Area detected:\n"
@@ -1009,7 +1005,11 @@ static u64 ata_hpa_resize(struct ata_device *dev)
1009 return hpa_sectors; 1005 return hpa_sectors;
1010 } 1006 }
1011 } 1007 }
1012 } 1008 } else if (hpa_sectors < sectors)
1009 ata_dev_printk(dev, KERN_WARNING, "%s 1: hpa sectors (%lld) "
1010 "is smaller than sectors (%lld)\n", __FUNCTION__,
1011 (long long)hpa_sectors, (long long)sectors);
1012
1013 return sectors; 1013 return sectors;
1014} 1014}
1015 1015
@@ -2046,10 +2046,6 @@ int ata_dev_configure(struct ata_device *dev)
2046 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, 2046 dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
2047 dev->max_sectors); 2047 dev->max_sectors);
2048 2048
2049 /* limit ATAPI DMA to R/W commands only */
2050 if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY)
2051 dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY;
2052
2053 if (ap->ops->dev_config) 2049 if (ap->ops->dev_config)
2054 ap->ops->dev_config(dev); 2050 ap->ops->dev_config(dev);
2055 2051
@@ -3780,8 +3776,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3780 { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */ 3776 { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */
3781 3777
3782 /* Weird ATAPI devices */ 3778 /* Weird ATAPI devices */
3783 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | 3779 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
3784 ATA_HORKAGE_DMA_RW_ONLY },
3785 3780
3786 /* Devices we expect to fail diagnostics */ 3781 /* Devices we expect to fail diagnostics */
3787 3782
@@ -4109,6 +4104,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
4109 if (idx) 4104 if (idx)
4110 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); 4105 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
4111} 4106}
4107
4112/** 4108/**
4113 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported 4109 * ata_check_atapi_dma - Check whether ATAPI DMA can be supported
4114 * @qc: Metadata associated with taskfile to check 4110 * @qc: Metadata associated with taskfile to check
@@ -4126,33 +4122,19 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
4126int ata_check_atapi_dma(struct ata_queued_cmd *qc) 4122int ata_check_atapi_dma(struct ata_queued_cmd *qc)
4127{ 4123{
4128 struct ata_port *ap = qc->ap; 4124 struct ata_port *ap = qc->ap;
4129 int rc = 0; /* Assume ATAPI DMA is OK by default */ 4125
4130 4126 /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a
4131 /* some drives can only do ATAPI DMA on read/write */ 4127 * few ATAPI devices choke on such DMA requests.
4132 if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) { 4128 */
4133 struct scsi_cmnd *cmd = qc->scsicmd; 4129 if (unlikely(qc->nbytes & 15))
4134 u8 *scsicmd = cmd->cmnd; 4130 return 1;
4135
4136 switch (scsicmd[0]) {
4137 case READ_10:
4138 case WRITE_10:
4139 case READ_12:
4140 case WRITE_12:
4141 case READ_6:
4142 case WRITE_6:
4143 /* atapi dma maybe ok */
4144 break;
4145 default:
4146 /* turn off atapi dma */
4147 return 1;
4148 }
4149 }
4150 4131
4151 if (ap->ops->check_atapi_dma) 4132 if (ap->ops->check_atapi_dma)
4152 rc = ap->ops->check_atapi_dma(qc); 4133 return ap->ops->check_atapi_dma(qc);
4153 4134
4154 return rc; 4135 return 0;
4155} 4136}
4137
4156/** 4138/**
4157 * ata_qc_prep - Prepare taskfile for submission 4139 * ata_qc_prep - Prepare taskfile for submission
4158 * @qc: Metadata associated with taskfile to be prepared 4140 * @qc: Metadata associated with taskfile to be prepared
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d8070989a39f..f7582c9c320e 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -336,6 +336,7 @@ void ata_scsi_error(struct Scsi_Host *host)
336 } 336 }
337 ata_port_printk(ap, KERN_ERR, "EH pending after %d " 337 ata_port_printk(ap, KERN_ERR, "EH pending after %d "
338 "tries, giving up\n", ATA_EH_MAX_REPEAT); 338 "tries, giving up\n", ATA_EH_MAX_REPEAT);
339 ap->pflags &= ~ATA_PFLAG_EH_PENDING;
339 } 340 }
340 341
341 /* this run is complete, make sure EH info is clear */ 342 /* this run is complete, make sure EH info is clear */
@@ -1616,7 +1617,7 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1616 unsigned long deadline; 1617 unsigned long deadline;
1617 unsigned int action; 1618 unsigned int action;
1618 ata_reset_fn_t reset; 1619 ata_reset_fn_t reset;
1619 int i, did_followup_srst, rc; 1620 int i, rc;
1620 1621
1621 /* about to reset */ 1622 /* about to reset */
1622 ata_eh_about_to_do(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK); 1623 ata_eh_about_to_do(ap, NULL, ehc->i.action & ATA_EH_RESET_MASK);
@@ -1665,8 +1666,6 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1665 1666
1666 /* did prereset() screw up? if so, fix up to avoid oopsing */ 1667 /* did prereset() screw up? if so, fix up to avoid oopsing */
1667 if (!reset) { 1668 if (!reset) {
1668 ata_port_printk(ap, KERN_ERR, "BUG: prereset() requested "
1669 "invalid reset type\n");
1670 if (softreset) 1669 if (softreset)
1671 reset = softreset; 1670 reset = softreset;
1672 else 1671 else
@@ -1689,11 +1688,9 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
1689 1688
1690 rc = ata_do_reset(ap, reset, classes, deadline); 1689 rc = ata_do_reset(ap, reset, classes, deadline);
1691 1690
1692 did_followup_srst = 0;
1693 if (reset == hardreset && 1691 if (reset == hardreset &&
1694 ata_eh_followup_srst_needed(rc, classify, classes)) { 1692 ata_eh_followup_srst_needed(rc, classify, classes)) {
1695 /* okay, let's do follow-up softreset */ 1693 /* okay, let's do follow-up softreset */
1696 did_followup_srst = 1;
1697 reset = softreset; 1694 reset = softreset;
1698 1695
1699 if (!reset) { 1696 if (!reset) {
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c228df298bd8..4ddf00c8c5f5 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2384,11 +2384,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2384 int using_pio = (dev->flags & ATA_DFLAG_PIO); 2384 int using_pio = (dev->flags & ATA_DFLAG_PIO);
2385 int nodata = (scmd->sc_data_direction == DMA_NONE); 2385 int nodata = (scmd->sc_data_direction == DMA_NONE);
2386 2386
2387 if (!using_pio)
2388 /* Check whether ATAPI DMA is safe */
2389 if (ata_check_atapi_dma(qc))
2390 using_pio = 1;
2391
2392 memset(qc->cdb, 0, dev->cdb_len); 2387 memset(qc->cdb, 0, dev->cdb_len);
2393 memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len); 2388 memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len);
2394 2389
@@ -2401,19 +2396,22 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2401 } 2396 }
2402 2397
2403 qc->tf.command = ATA_CMD_PACKET; 2398 qc->tf.command = ATA_CMD_PACKET;
2399 qc->nbytes = scmd->request_bufflen;
2400
2401 /* check whether ATAPI DMA is safe */
2402 if (!using_pio && ata_check_atapi_dma(qc))
2403 using_pio = 1;
2404 2404
2405 /* no data, or PIO data xfer */
2406 if (using_pio || nodata) { 2405 if (using_pio || nodata) {
2406 /* no data, or PIO data xfer */
2407 if (nodata) 2407 if (nodata)
2408 qc->tf.protocol = ATA_PROT_ATAPI_NODATA; 2408 qc->tf.protocol = ATA_PROT_ATAPI_NODATA;
2409 else 2409 else
2410 qc->tf.protocol = ATA_PROT_ATAPI; 2410 qc->tf.protocol = ATA_PROT_ATAPI;
2411 qc->tf.lbam = (8 * 1024) & 0xff; 2411 qc->tf.lbam = (8 * 1024) & 0xff;
2412 qc->tf.lbah = (8 * 1024) >> 8; 2412 qc->tf.lbah = (8 * 1024) >> 8;
2413 } 2413 } else {
2414 2414 /* DMA data xfer */
2415 /* DMA data xfer */
2416 else {
2417 qc->tf.protocol = ATA_PROT_ATAPI_DMA; 2415 qc->tf.protocol = ATA_PROT_ATAPI_DMA;
2418 qc->tf.feature |= ATAPI_PKT_DMA; 2416 qc->tf.feature |= ATAPI_PKT_DMA;
2419 2417
@@ -2422,8 +2420,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
2422 qc->tf.feature |= ATAPI_DMADIR; 2420 qc->tf.feature |= ATAPI_DMADIR;
2423 } 2421 }
2424 2422
2425 qc->nbytes = scmd->request_bufflen;
2426
2427 return 0; 2423 return 0;
2428} 2424}
2429 2425
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 6446735a46e0..a8c0cbeca399 100644
--- a/drivers/ata/pata_hpt37x.c
+++ b/drivers/ata/pata_hpt37x.c
@@ -931,13 +931,13 @@ static int hpt37x_init_one(struct pci_dev *dev, const struct pci_device_id *id)
931 .udma_mask = 0x7f, 931 .udma_mask = 0x7f,
932 .port_ops = &hpt372_port_ops 932 .port_ops = &hpt372_port_ops
933 }; 933 };
934 /* HPT374 - UDMA133 */ 934 /* HPT374 - UDMA100 */
935 static const struct ata_port_info info_hpt374 = { 935 static const struct ata_port_info info_hpt374 = {
936 .sht = &hpt37x_sht, 936 .sht = &hpt37x_sht,
937 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST, 937 .flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
938 .pio_mask = 0x1f, 938 .pio_mask = 0x1f,
939 .mwdma_mask = 0x07, 939 .mwdma_mask = 0x07,
940 .udma_mask = 0x7f, 940 .udma_mask = 0x3f,
941 .port_ops = &hpt374_port_ops 941 .port_ops = &hpt374_port_ops
942 }; 942 };
943 943
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index dab4e7cf8cda..12c6e08cc4d1 100644
--- a/drivers/ata/pata_it821x.c
+++ b/drivers/ata/pata_it821x.c
@@ -690,7 +690,7 @@ static struct ata_port_operations it821x_passthru_port_ops = {
690 .port_start = it821x_port_start, 690 .port_start = it821x_port_start,
691}; 691};
692 692
693static void __devinit it821x_disable_raid(struct pci_dev *pdev) 693static void it821x_disable_raid(struct pci_dev *pdev)
694{ 694{
695 /* Reset local CPU, and set BIOS not ready */ 695 /* Reset local CPU, and set BIOS not ready */
696 pci_write_config_byte(pdev, 0x5E, 0x01); 696 pci_write_config_byte(pdev, 0x5E, 0x01);