diff options
| -rw-r--r-- | drivers/ata/libata-core.c | 6 | ||||
| -rw-r--r-- | drivers/ata/libata-scsi.c | 7 | ||||
| -rw-r--r-- | drivers/ata/sata_nv.c | 53 | ||||
| -rw-r--r-- | drivers/ata/sata_promise.c | 20 | ||||
| -rw-r--r-- | drivers/ata/sata_via.c | 4 | ||||
| -rw-r--r-- | include/linux/libata.h | 2 |
6 files changed, 58 insertions, 34 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 82af7011f2dd..622350d9b2e3 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
| @@ -4024,6 +4024,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = { | |||
| 4024 | 4024 | ||
| 4025 | /* Weird ATAPI devices */ | 4025 | /* Weird ATAPI devices */ |
| 4026 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, | 4026 | { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 }, |
| 4027 | { "QUANTUM DAT DAT72-000", NULL, ATA_HORKAGE_ATAPI_MOD16_DMA }, | ||
| 4027 | 4028 | ||
| 4028 | /* Devices we expect to fail diagnostics */ | 4029 | /* Devices we expect to fail diagnostics */ |
| 4029 | 4030 | ||
| @@ -4444,7 +4445,8 @@ int atapi_check_dma(struct ata_queued_cmd *qc) | |||
| 4444 | /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a | 4445 | /* Don't allow DMA if it isn't multiple of 16 bytes. Quite a |
| 4445 | * few ATAPI devices choke on such DMA requests. | 4446 | * few ATAPI devices choke on such DMA requests. |
| 4446 | */ | 4447 | */ |
| 4447 | if (unlikely(qc->nbytes & 15)) | 4448 | if (!(qc->dev->horkage & ATA_HORKAGE_ATAPI_MOD16_DMA) && |
| 4449 | unlikely(qc->nbytes & 15)) | ||
| 4448 | return 1; | 4450 | return 1; |
| 4449 | 4451 | ||
| 4450 | if (ap->ops->check_atapi_dma) | 4452 | if (ap->ops->check_atapi_dma) |
| @@ -5934,7 +5936,7 @@ static void ata_port_detach(struct ata_port *ap) | |||
| 5934 | * to us. Restore SControl and disable all existing devices. | 5936 | * to us. Restore SControl and disable all existing devices. |
| 5935 | */ | 5937 | */ |
| 5936 | __ata_port_for_each_link(link, ap) { | 5938 | __ata_port_for_each_link(link, ap) { |
| 5937 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol); | 5939 | sata_scr_write(link, SCR_CONTROL, link->saved_scontrol & 0xff0); |
| 5938 | ata_link_for_each_dev(dev, link) | 5940 | ata_link_for_each_dev(dev, link) |
| 5939 | ata_dev_disable(dev); | 5941 | ata_dev_disable(dev); |
| 5940 | } | 5942 | } |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index bbb30d882f05..3fa75eac135d 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
| @@ -190,7 +190,7 @@ static ssize_t ata_scsi_park_show(struct device *device, | |||
| 190 | struct ata_port *ap; | 190 | struct ata_port *ap; |
| 191 | struct ata_link *link; | 191 | struct ata_link *link; |
| 192 | struct ata_device *dev; | 192 | struct ata_device *dev; |
| 193 | unsigned long flags; | 193 | unsigned long flags, now; |
| 194 | unsigned int uninitialized_var(msecs); | 194 | unsigned int uninitialized_var(msecs); |
| 195 | int rc = 0; | 195 | int rc = 0; |
| 196 | 196 | ||
| @@ -208,10 +208,11 @@ static ssize_t ata_scsi_park_show(struct device *device, | |||
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | link = dev->link; | 210 | link = dev->link; |
| 211 | now = jiffies; | ||
| 211 | if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && | 212 | if (ap->pflags & ATA_PFLAG_EH_IN_PROGRESS && |
| 212 | link->eh_context.unloaded_mask & (1 << dev->devno) && | 213 | link->eh_context.unloaded_mask & (1 << dev->devno) && |
| 213 | time_after(dev->unpark_deadline, jiffies)) | 214 | time_after(dev->unpark_deadline, now)) |
| 214 | msecs = jiffies_to_msecs(dev->unpark_deadline - jiffies); | 215 | msecs = jiffies_to_msecs(dev->unpark_deadline - now); |
| 215 | else | 216 | else |
| 216 | msecs = 0; | 217 | msecs = 0; |
| 217 | 218 | ||
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index fae3841de0d8..6f1460614325 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
| @@ -307,10 +307,10 @@ static int nv_scr_write(struct ata_link *link, unsigned int sc_reg, u32 val); | |||
| 307 | 307 | ||
| 308 | static void nv_nf2_freeze(struct ata_port *ap); | 308 | static void nv_nf2_freeze(struct ata_port *ap); |
| 309 | static void nv_nf2_thaw(struct ata_port *ap); | 309 | static void nv_nf2_thaw(struct ata_port *ap); |
| 310 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
| 311 | unsigned long deadline); | ||
| 310 | static void nv_ck804_freeze(struct ata_port *ap); | 312 | static void nv_ck804_freeze(struct ata_port *ap); |
| 311 | static void nv_ck804_thaw(struct ata_port *ap); | 313 | static void nv_ck804_thaw(struct ata_port *ap); |
| 312 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
| 313 | unsigned long deadline); | ||
| 314 | static int nv_adma_slave_config(struct scsi_device *sdev); | 314 | static int nv_adma_slave_config(struct scsi_device *sdev); |
| 315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); | 315 | static int nv_adma_check_atapi_dma(struct ata_queued_cmd *qc); |
| 316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); | 316 | static void nv_adma_qc_prep(struct ata_queued_cmd *qc); |
| @@ -405,17 +405,8 @@ static struct scsi_host_template nv_swncq_sht = { | |||
| 405 | .slave_configure = nv_swncq_slave_config, | 405 | .slave_configure = nv_swncq_slave_config, |
| 406 | }; | 406 | }; |
| 407 | 407 | ||
| 408 | /* OSDL bz3352 reports that some nv controllers can't determine device | ||
| 409 | * signature reliably and nv_hardreset is implemented to work around | ||
| 410 | * the problem. This was reported on nf3 and it's unclear whether any | ||
| 411 | * other controllers are affected. However, the workaround has been | ||
| 412 | * applied to all variants and there isn't much to gain by trying to | ||
| 413 | * find out exactly which ones are affected at this point especially | ||
| 414 | * because NV has moved over to ahci for newer controllers. | ||
| 415 | */ | ||
| 416 | static struct ata_port_operations nv_common_ops = { | 408 | static struct ata_port_operations nv_common_ops = { |
| 417 | .inherits = &ata_bmdma_port_ops, | 409 | .inherits = &ata_bmdma_port_ops, |
| 418 | .hardreset = nv_hardreset, | ||
| 419 | .scr_read = nv_scr_read, | 410 | .scr_read = nv_scr_read, |
| 420 | .scr_write = nv_scr_write, | 411 | .scr_write = nv_scr_write, |
| 421 | }; | 412 | }; |
| @@ -429,12 +420,22 @@ static struct ata_port_operations nv_generic_ops = { | |||
| 429 | .hardreset = ATA_OP_NULL, | 420 | .hardreset = ATA_OP_NULL, |
| 430 | }; | 421 | }; |
| 431 | 422 | ||
| 423 | /* OSDL bz3352 reports that nf2/3 controllers can't determine device | ||
| 424 | * signature reliably. Also, the following thread reports detection | ||
| 425 | * failure on cold boot with the standard debouncing timing. | ||
| 426 | * | ||
| 427 | * http://thread.gmane.org/gmane.linux.ide/34098 | ||
| 428 | * | ||
| 429 | * Debounce with hotplug timing and request follow-up SRST. | ||
| 430 | */ | ||
| 432 | static struct ata_port_operations nv_nf2_ops = { | 431 | static struct ata_port_operations nv_nf2_ops = { |
| 433 | .inherits = &nv_common_ops, | 432 | .inherits = &nv_common_ops, |
| 434 | .freeze = nv_nf2_freeze, | 433 | .freeze = nv_nf2_freeze, |
| 435 | .thaw = nv_nf2_thaw, | 434 | .thaw = nv_nf2_thaw, |
| 435 | .hardreset = nv_nf2_hardreset, | ||
| 436 | }; | 436 | }; |
| 437 | 437 | ||
| 438 | /* CK804 finally gets hardreset right */ | ||
| 438 | static struct ata_port_operations nv_ck804_ops = { | 439 | static struct ata_port_operations nv_ck804_ops = { |
| 439 | .inherits = &nv_common_ops, | 440 | .inherits = &nv_common_ops, |
| 440 | .freeze = nv_ck804_freeze, | 441 | .freeze = nv_ck804_freeze, |
| @@ -443,7 +444,7 @@ static struct ata_port_operations nv_ck804_ops = { | |||
| 443 | }; | 444 | }; |
| 444 | 445 | ||
| 445 | static struct ata_port_operations nv_adma_ops = { | 446 | static struct ata_port_operations nv_adma_ops = { |
| 446 | .inherits = &nv_common_ops, | 447 | .inherits = &nv_ck804_ops, |
| 447 | 448 | ||
| 448 | .check_atapi_dma = nv_adma_check_atapi_dma, | 449 | .check_atapi_dma = nv_adma_check_atapi_dma, |
| 449 | .sff_tf_read = nv_adma_tf_read, | 450 | .sff_tf_read = nv_adma_tf_read, |
| @@ -467,7 +468,7 @@ static struct ata_port_operations nv_adma_ops = { | |||
| 467 | }; | 468 | }; |
| 468 | 469 | ||
| 469 | static struct ata_port_operations nv_swncq_ops = { | 470 | static struct ata_port_operations nv_swncq_ops = { |
| 470 | .inherits = &nv_common_ops, | 471 | .inherits = &nv_generic_ops, |
| 471 | 472 | ||
| 472 | .qc_defer = ata_std_qc_defer, | 473 | .qc_defer = ata_std_qc_defer, |
| 473 | .qc_prep = nv_swncq_qc_prep, | 474 | .qc_prep = nv_swncq_qc_prep, |
| @@ -1553,6 +1554,17 @@ static void nv_nf2_thaw(struct ata_port *ap) | |||
| 1553 | iowrite8(mask, scr_addr + NV_INT_ENABLE); | 1554 | iowrite8(mask, scr_addr + NV_INT_ENABLE); |
| 1554 | } | 1555 | } |
| 1555 | 1556 | ||
| 1557 | static int nv_nf2_hardreset(struct ata_link *link, unsigned int *class, | ||
| 1558 | unsigned long deadline) | ||
| 1559 | { | ||
| 1560 | bool online; | ||
| 1561 | int rc; | ||
| 1562 | |||
| 1563 | rc = sata_link_hardreset(link, sata_deb_timing_hotplug, deadline, | ||
| 1564 | &online, NULL); | ||
| 1565 | return online ? -EAGAIN : rc; | ||
| 1566 | } | ||
| 1567 | |||
| 1556 | static void nv_ck804_freeze(struct ata_port *ap) | 1568 | static void nv_ck804_freeze(struct ata_port *ap) |
| 1557 | { | 1569 | { |
| 1558 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; | 1570 | void __iomem *mmio_base = ap->host->iomap[NV_MMIO_BAR]; |
| @@ -1605,21 +1617,6 @@ static void nv_mcp55_thaw(struct ata_port *ap) | |||
| 1605 | ata_sff_thaw(ap); | 1617 | ata_sff_thaw(ap); |
| 1606 | } | 1618 | } |
| 1607 | 1619 | ||
| 1608 | static int nv_hardreset(struct ata_link *link, unsigned int *class, | ||
| 1609 | unsigned long deadline) | ||
| 1610 | { | ||
| 1611 | int rc; | ||
| 1612 | |||
| 1613 | /* SATA hardreset fails to retrieve proper device signature on | ||
| 1614 | * some controllers. Request follow up SRST. For more info, | ||
| 1615 | * see http://bugzilla.kernel.org/show_bug.cgi?id=3352 | ||
| 1616 | */ | ||
| 1617 | rc = sata_sff_hardreset(link, class, deadline); | ||
| 1618 | if (rc) | ||
| 1619 | return rc; | ||
| 1620 | return -EAGAIN; | ||
| 1621 | } | ||
| 1622 | |||
| 1623 | static void nv_adma_error_handler(struct ata_port *ap) | 1620 | static void nv_adma_error_handler(struct ata_port *ap) |
| 1624 | { | 1621 | { |
| 1625 | struct nv_adma_port_priv *pp = ap->private_data; | 1622 | struct nv_adma_port_priv *pp = ap->private_data; |
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c index 750d8cdc00cd..ba9a2570a742 100644 --- a/drivers/ata/sata_promise.c +++ b/drivers/ata/sata_promise.c | |||
| @@ -153,6 +153,10 @@ static void pdc_freeze(struct ata_port *ap); | |||
| 153 | static void pdc_sata_freeze(struct ata_port *ap); | 153 | static void pdc_sata_freeze(struct ata_port *ap); |
| 154 | static void pdc_thaw(struct ata_port *ap); | 154 | static void pdc_thaw(struct ata_port *ap); |
| 155 | static void pdc_sata_thaw(struct ata_port *ap); | 155 | static void pdc_sata_thaw(struct ata_port *ap); |
| 156 | static int pdc_pata_softreset(struct ata_link *link, unsigned int *class, | ||
| 157 | unsigned long deadline); | ||
| 158 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
| 159 | unsigned long deadline); | ||
| 156 | static void pdc_error_handler(struct ata_port *ap); | 160 | static void pdc_error_handler(struct ata_port *ap); |
| 157 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); | 161 | static void pdc_post_internal_cmd(struct ata_queued_cmd *qc); |
| 158 | static int pdc_pata_cable_detect(struct ata_port *ap); | 162 | static int pdc_pata_cable_detect(struct ata_port *ap); |
| @@ -186,6 +190,7 @@ static struct ata_port_operations pdc_sata_ops = { | |||
| 186 | .scr_read = pdc_sata_scr_read, | 190 | .scr_read = pdc_sata_scr_read, |
| 187 | .scr_write = pdc_sata_scr_write, | 191 | .scr_write = pdc_sata_scr_write, |
| 188 | .port_start = pdc_sata_port_start, | 192 | .port_start = pdc_sata_port_start, |
| 193 | .hardreset = pdc_sata_hardreset, | ||
| 189 | }; | 194 | }; |
| 190 | 195 | ||
| 191 | /* First-generation chips need a more restrictive ->check_atapi_dma op */ | 196 | /* First-generation chips need a more restrictive ->check_atapi_dma op */ |
| @@ -200,6 +205,7 @@ static struct ata_port_operations pdc_pata_ops = { | |||
| 200 | .freeze = pdc_freeze, | 205 | .freeze = pdc_freeze, |
| 201 | .thaw = pdc_thaw, | 206 | .thaw = pdc_thaw, |
| 202 | .port_start = pdc_common_port_start, | 207 | .port_start = pdc_common_port_start, |
| 208 | .softreset = pdc_pata_softreset, | ||
| 203 | }; | 209 | }; |
| 204 | 210 | ||
| 205 | static const struct ata_port_info pdc_port_info[] = { | 211 | static const struct ata_port_info pdc_port_info[] = { |
| @@ -693,6 +699,20 @@ static void pdc_sata_thaw(struct ata_port *ap) | |||
| 693 | readl(host_mmio + hotplug_offset); /* flush */ | 699 | readl(host_mmio + hotplug_offset); /* flush */ |
| 694 | } | 700 | } |
| 695 | 701 | ||
| 702 | static int pdc_pata_softreset(struct ata_link *link, unsigned int *class, | ||
| 703 | unsigned long deadline) | ||
| 704 | { | ||
| 705 | pdc_reset_port(link->ap); | ||
| 706 | return ata_sff_softreset(link, class, deadline); | ||
| 707 | } | ||
| 708 | |||
| 709 | static int pdc_sata_hardreset(struct ata_link *link, unsigned int *class, | ||
| 710 | unsigned long deadline) | ||
| 711 | { | ||
| 712 | pdc_reset_port(link->ap); | ||
| 713 | return sata_sff_hardreset(link, class, deadline); | ||
| 714 | } | ||
| 715 | |||
| 696 | static void pdc_error_handler(struct ata_port *ap) | 716 | static void pdc_error_handler(struct ata_port *ap) |
| 697 | { | 717 | { |
| 698 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) | 718 | if (!(ap->pflags & ATA_PFLAG_FROZEN)) |
diff --git a/drivers/ata/sata_via.c b/drivers/ata/sata_via.c index 62367fe4d5dc..c18935f0bda2 100644 --- a/drivers/ata/sata_via.c +++ b/drivers/ata/sata_via.c | |||
| @@ -602,8 +602,10 @@ static int svia_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 602 | rc = vt8251_prepare_host(pdev, &host); | 602 | rc = vt8251_prepare_host(pdev, &host); |
| 603 | break; | 603 | break; |
| 604 | default: | 604 | default: |
| 605 | return -EINVAL; | 605 | rc = -EINVAL; |
| 606 | } | 606 | } |
| 607 | if (rc) | ||
| 608 | return rc; | ||
| 607 | 609 | ||
| 608 | svia_configure(pdev); | 610 | svia_configure(pdev); |
| 609 | 611 | ||
diff --git a/include/linux/libata.h b/include/linux/libata.h index f5441edee55f..c7665a4134c5 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -373,6 +373,8 @@ enum { | |||
| 373 | ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ | 373 | ATA_HORKAGE_IVB = (1 << 8), /* cbl det validity bit bugs */ |
| 374 | ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */ | 374 | ATA_HORKAGE_STUCK_ERR = (1 << 9), /* stuck ERR on next PACKET */ |
| 375 | ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ | 375 | ATA_HORKAGE_BRIDGE_OK = (1 << 10), /* no bridge limits */ |
| 376 | ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands | ||
| 377 | not multiple of 16 bytes */ | ||
| 376 | 378 | ||
| 377 | /* DMA mask for user DMA control: User visible values; DO NOT | 379 | /* DMA mask for user DMA control: User visible values; DO NOT |
| 378 | renumber */ | 380 | renumber */ |
