aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-27 10:00:23 -0700
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-27 10:00:23 -0700
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 adfae9d1ceb..bfc59a10472 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)
void ata_dev_disable(struct ata_device *dev)
{
- if (ata_dev_enabled(dev) && ata_msg_drv(dev->ap)) {
- ata_dev_printk(dev, KERN_WARNING, "disabled\n");
+ if (ata_dev_enabled(dev)) {
+ if (ata_msg_drv(dev->ap))
+ ata_dev_printk(dev, KERN_WARNING, "disabled\n");
ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
ATA_DNXFER_QUIET);
dev->class++;
@@ -983,11 +984,6 @@ static u64 ata_hpa_resize(struct ata_device *dev)
else
hpa_sectors = ata_read_native_max_address(dev);
- /* if no hpa, both should be equal */
- ata_dev_printk(dev, KERN_INFO, "%s 1: sectors = %lld, "
- "hpa_sectors = %lld\n",
- __FUNCTION__, (long long)sectors, (long long)hpa_sectors);
-
if (hpa_sectors > sectors) {
ata_dev_printk(dev, KERN_INFO,
"Host Protected Area detected:\n"
@@ -1009,7 +1005,11 @@ static u64 ata_hpa_resize(struct ata_device *dev)
return hpa_sectors;
}
}
- }
+ } else if (hpa_sectors < sectors)
+ ata_dev_printk(dev, KERN_WARNING, "%s 1: hpa sectors (%lld) "
+ "is smaller than sectors (%lld)\n", __FUNCTION__,
+ (long long)hpa_sectors, (long long)sectors);
+
return sectors;
}
@@ -2046,10 +2046,6 @@ int ata_dev_configure(struct ata_device *dev)
dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128,
dev->max_sectors);
- /* limit ATAPI DMA to R/W commands only */
- if (ata_device_blacklisted(dev) & ATA_HORKAGE_DMA_RW_ONLY)
- dev->horkage |= ATA_HORKAGE_DMA_RW_ONLY;
-
if (ap->ops->dev_config)
ap->ops->dev_config(dev);
@@ -3780,8 +3776,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
{ "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */
/* Weird ATAPI devices */
- { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 |
- ATA_HORKAGE_DMA_RW_ONLY },
+ { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 },
/* Devices we expect to fail diagnostics */
@@ -4109,6 +4104,7 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
if (idx)
ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
}
+
/**
* ata_check_atapi_dma - Check whether ATAPI DMA can be supported
* @qc: Metadata associated with taskfile to check
@@ -4126,33 +4122,19 @@ static void ata_fill_sg(struct ata_queued_cmd *qc)
int ata_check_atapi_dma(struct ata_queued_cmd *qc)
{
struct ata_port *ap = qc->ap;
- int rc = 0; /* Assume ATAPI DMA is OK by default */
-
- /* some drives can only do ATAPI DMA on read/write */
- if (unlikely(qc->dev->horkage & ATA_HORKAGE_DMA_RW_ONLY)) {
- struct scsi_cmnd *cmd = qc->scsicmd;
- u8 *scsicmd = cmd->cmnd;
-
- switch (scsicmd[0]) {
- case READ_10:
- case WRITE_10:
- case READ_12:
- case WRITE_12:
- case READ_6:
- case WRITE_6:
- /* atapi dma maybe ok */
- break;
- default:
- /* turn off atapi dma */
- return 1;
- }
- }
+
+ /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a
+ * few ATAPI devices choke on such DMA requests.
+ */
+ if (unlikely(qc->nbytes & 15))
+ return 1;
if (ap->ops->check_atapi_dma)
- rc = ap->ops->check_atapi_dma(qc);
+ return ap->ops->check_atapi_dma(qc);
- return rc;
+ return 0;
}
+
/**
* ata_qc_prep - Prepare taskfile for submission
* @qc: Metadata associated with taskfile to be prepared
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index d8070989a39..f7582c9c320 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)
}
ata_port_printk(ap, KERN_ERR, "EH pending after %d "
"tries, giving up\n", ATA_EH_MAX_REPEAT);
+ ap->pflags &= ~ATA_PFLAG_EH_PENDING;
}
/* 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,
unsigned long deadline;
unsigned int action;
ata_reset_fn_t reset;
- int i, did_followup_srst, rc;
+ int i, rc;
/* about to reset */
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,
/* did prereset() screw up? if so, fix up to avoid oopsing */
if (!reset) {
- ata_port_printk(ap, KERN_ERR, "BUG: prereset() requested "
- "invalid reset type\n");
if (softreset)
reset = softreset;
else
@@ -1689,11 +1688,9 @@ static int ata_eh_reset(struct ata_port *ap, int classify,
rc = ata_do_reset(ap, reset, classes, deadline);
- did_followup_srst = 0;
if (reset == hardreset &&
ata_eh_followup_srst_needed(rc, classify, classes)) {
/* okay, let's do follow-up softreset */
- did_followup_srst = 1;
reset = softreset;
if (!reset) {
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index c228df298bd..4ddf00c8c5f 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)
int using_pio = (dev->flags & ATA_DFLAG_PIO);
int nodata = (scmd->sc_data_direction == DMA_NONE);
- if (!using_pio)
- /* Check whether ATAPI DMA is safe */
- if (ata_check_atapi_dma(qc))
- using_pio = 1;
-
memset(qc->cdb, 0, dev->cdb_len);
memcpy(qc->cdb, scmd->cmnd, scmd->cmd_len);
@@ -2401,19 +2396,22 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
}
qc->tf.command = ATA_CMD_PACKET;
+ qc->nbytes = scmd->request_bufflen;
+
+ /* check whether ATAPI DMA is safe */
+ if (!using_pio && ata_check_atapi_dma(qc))
+ using_pio = 1;
- /* no data, or PIO data xfer */
if (using_pio || nodata) {
+ /* no data, or PIO data xfer */
if (nodata)
qc->tf.protocol = ATA_PROT_ATAPI_NODATA;
else
qc->tf.protocol = ATA_PROT_ATAPI;
qc->tf.lbam = (8 * 1024) & 0xff;
qc->tf.lbah = (8 * 1024) >> 8;
- }
-
- /* DMA data xfer */
- else {
+ } else {
+ /* DMA data xfer */
qc->tf.protocol = ATA_PROT_ATAPI_DMA;
qc->tf.feature |= ATAPI_PKT_DMA;
@@ -2422,8 +2420,6 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc)
qc->tf.feature |= ATAPI_DMADIR;
}
- qc->nbytes = scmd->request_bufflen;
-
return 0;
}
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
index 6446735a46e..a8c0cbeca39 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)
.udma_mask = 0x7f,
.port_ops = &hpt372_port_ops
};
- /* HPT374 - UDMA133 */
+ /* HPT374 - UDMA100 */
static const struct ata_port_info info_hpt374 = {
.sht = &hpt37x_sht,
.flags = ATA_FLAG_SLAVE_POSS|ATA_FLAG_SRST,
.pio_mask = 0x1f,
.mwdma_mask = 0x07,
- .udma_mask = 0x7f,
+ .udma_mask = 0x3f,
.port_ops = &hpt374_port_ops
};
diff --git a/drivers/ata/pata_it821x.c b/drivers/ata/pata_it821x.c
index dab4e7cf8cd..12c6e08cc4d 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 = {
.port_start = it821x_port_start,
};
-static void __devinit it821x_disable_raid(struct pci_dev *pdev)
+static void it821x_disable_raid(struct pci_dev *pdev)
{
/* Reset local CPU, and set BIOS not ready */
pci_write_config_byte(pdev, 0x5E, 0x01);