aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/ahci.c24
-rw-r--r--drivers/ata/libata-core.c62
-rw-r--r--drivers/ata/libata-scsi.c67
-rw-r--r--drivers/ata/libata-sff.c37
-rw-r--r--drivers/ata/pata_isapnp.c1
5 files changed, 135 insertions, 56 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 7baeaffefe7a..545f330e59a5 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -426,6 +426,30 @@ static const struct pci_device_id ahci_pci_tbl[] = {
426 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */ 426 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */
427 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */ 427 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */
428 { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci }, /* MCP67 */ 428 { PCI_VDEVICE(NVIDIA, 0x055b), board_ahci }, /* MCP67 */
429 { PCI_VDEVICE(NVIDIA, 0x07f0), board_ahci }, /* MCP73 */
430 { PCI_VDEVICE(NVIDIA, 0x07f1), board_ahci }, /* MCP73 */
431 { PCI_VDEVICE(NVIDIA, 0x07f2), board_ahci }, /* MCP73 */
432 { PCI_VDEVICE(NVIDIA, 0x07f3), board_ahci }, /* MCP73 */
433 { PCI_VDEVICE(NVIDIA, 0x07f4), board_ahci }, /* MCP73 */
434 { PCI_VDEVICE(NVIDIA, 0x07f5), board_ahci }, /* MCP73 */
435 { PCI_VDEVICE(NVIDIA, 0x07f6), board_ahci }, /* MCP73 */
436 { PCI_VDEVICE(NVIDIA, 0x07f7), board_ahci }, /* MCP73 */
437 { PCI_VDEVICE(NVIDIA, 0x07f8), board_ahci }, /* MCP73 */
438 { PCI_VDEVICE(NVIDIA, 0x07f9), board_ahci }, /* MCP73 */
439 { PCI_VDEVICE(NVIDIA, 0x07fa), board_ahci }, /* MCP73 */
440 { PCI_VDEVICE(NVIDIA, 0x07fb), board_ahci }, /* MCP73 */
441 { PCI_VDEVICE(NVIDIA, 0x0ad0), board_ahci }, /* MCP77 */
442 { PCI_VDEVICE(NVIDIA, 0x0ad1), board_ahci }, /* MCP77 */
443 { PCI_VDEVICE(NVIDIA, 0x0ad2), board_ahci }, /* MCP77 */
444 { PCI_VDEVICE(NVIDIA, 0x0ad3), board_ahci }, /* MCP77 */
445 { PCI_VDEVICE(NVIDIA, 0x0ad4), board_ahci }, /* MCP77 */
446 { PCI_VDEVICE(NVIDIA, 0x0ad5), board_ahci }, /* MCP77 */
447 { PCI_VDEVICE(NVIDIA, 0x0ad6), board_ahci }, /* MCP77 */
448 { PCI_VDEVICE(NVIDIA, 0x0ad7), board_ahci }, /* MCP77 */
449 { PCI_VDEVICE(NVIDIA, 0x0ad8), board_ahci }, /* MCP77 */
450 { PCI_VDEVICE(NVIDIA, 0x0ad9), board_ahci }, /* MCP77 */
451 { PCI_VDEVICE(NVIDIA, 0x0ada), board_ahci }, /* MCP77 */
452 { PCI_VDEVICE(NVIDIA, 0x0adb), board_ahci }, /* MCP77 */
429 453
430 /* SiS */ 454 /* SiS */
431 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */ 455 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 4733f009c7c9..047eabd75363 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1727,7 +1727,7 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
1727 1727
1728 /* sanity check */ 1728 /* sanity check */
1729 rc = -EINVAL; 1729 rc = -EINVAL;
1730 reason = "device reports illegal type"; 1730 reason = "device reports invalid type";
1731 1731
1732 if (class == ATA_DEV_ATA) { 1732 if (class == ATA_DEV_ATA) {
1733 if (!ata_id_is_ata(id) && !ata_id_is_cfa(id)) 1733 if (!ata_id_is_ata(id) && !ata_id_is_cfa(id))
@@ -1900,6 +1900,13 @@ int ata_dev_configure(struct ata_device *dev)
1900 if (ata_msg_probe(ap)) 1900 if (ata_msg_probe(ap))
1901 ata_dump_id(id); 1901 ata_dump_id(id);
1902 1902
1903 /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
1904 ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
1905 sizeof(fwrevbuf));
1906
1907 ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
1908 sizeof(modelbuf));
1909
1903 /* ATA-specific feature tests */ 1910 /* ATA-specific feature tests */
1904 if (dev->class == ATA_DEV_ATA) { 1911 if (dev->class == ATA_DEV_ATA) {
1905 if (ata_id_is_cfa(id)) { 1912 if (ata_id_is_cfa(id)) {
@@ -1914,13 +1921,6 @@ int ata_dev_configure(struct ata_device *dev)
1914 1921
1915 dev->n_sectors = ata_id_n_sectors(id); 1922 dev->n_sectors = ata_id_n_sectors(id);
1916 1923
1917 /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */
1918 ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV,
1919 sizeof(fwrevbuf));
1920
1921 ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD,
1922 sizeof(modelbuf));
1923
1924 if (dev->id[59] & 0x100) 1924 if (dev->id[59] & 0x100)
1925 dev->multi_count = dev->id[59] & 0xff; 1925 dev->multi_count = dev->id[59] & 0xff;
1926 1926
@@ -2009,7 +2009,9 @@ int ata_dev_configure(struct ata_device *dev)
2009 2009
2010 /* print device info to dmesg */ 2010 /* print device info to dmesg */
2011 if (ata_msg_drv(ap) && print_info) 2011 if (ata_msg_drv(ap) && print_info)
2012 ata_dev_printk(dev, KERN_INFO, "ATAPI, max %s%s\n", 2012 ata_dev_printk(dev, KERN_INFO,
2013 "ATAPI: %s, %s, max %s%s\n",
2014 modelbuf, fwrevbuf,
2013 ata_mode_string(xfer_mask), 2015 ata_mode_string(xfer_mask),
2014 cdb_intr_string); 2016 cdb_intr_string);
2015 } 2017 }
@@ -3059,22 +3061,28 @@ static int ata_bus_post_reset(struct ata_port *ap, unsigned int devmask,
3059 } 3061 }
3060 } 3062 }
3061 3063
3062 /* if device 1 was found in ata_devchk, wait for 3064 /* if device 1 was found in ata_devchk, wait for register
3063 * register access, then wait for BSY to clear 3065 * access briefly, then wait for BSY to clear.
3064 */ 3066 */
3065 while (dev1) { 3067 if (dev1) {
3066 u8 nsect, lbal; 3068 int i;
3067 3069
3068 ap->ops->dev_select(ap, 1); 3070 ap->ops->dev_select(ap, 1);
3069 nsect = ioread8(ioaddr->nsect_addr); 3071
3070 lbal = ioread8(ioaddr->lbal_addr); 3072 /* Wait for register access. Some ATAPI devices fail
3071 if ((nsect == 1) && (lbal == 1)) 3073 * to set nsect/lbal after reset, so don't waste too
3072 break; 3074 * much time on it. We're gonna wait for !BSY anyway.
3073 if (time_after(jiffies, deadline)) 3075 */
3074 return -EBUSY; 3076 for (i = 0; i < 2; i++) {
3075 msleep(50); /* give drive a breather */ 3077 u8 nsect, lbal;
3076 } 3078
3077 if (dev1) { 3079 nsect = ioread8(ioaddr->nsect_addr);
3080 lbal = ioread8(ioaddr->lbal_addr);
3081 if ((nsect == 1) && (lbal == 1))
3082 break;
3083 msleep(50); /* give drive a breather */
3084 }
3085
3078 rc = ata_wait_ready(ap, deadline); 3086 rc = ata_wait_ready(ap, deadline);
3079 if (rc) { 3087 if (rc) {
3080 if (rc != -ENODEV) 3088 if (rc != -ENODEV)
@@ -3769,6 +3777,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3769 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 3777 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA },
3770 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, 3778 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA },
3771 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, 3779 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA },
3780 { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */
3772 3781
3773 /* Weird ATAPI devices */ 3782 /* Weird ATAPI devices */
3774 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | 3783 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 |
@@ -3791,6 +3800,8 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
3791 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, 3800 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, },
3792 { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, 3801 { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, },
3793 { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, 3802 { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, },
3803 /* Drives which do spurious command completion */
3804 { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, },
3794 3805
3795 /* Devices with NCQ limits */ 3806 /* Devices with NCQ limits */
3796 3807
@@ -6313,7 +6324,8 @@ int ata_host_register(struct ata_host *host, struct scsi_host_template *sht)
6313 /* init sata_spd_limit to the current value */ 6324 /* init sata_spd_limit to the current value */
6314 if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { 6325 if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) {
6315 int spd = (scontrol >> 4) & 0xf; 6326 int spd = (scontrol >> 4) & 0xf;
6316 ap->hw_sata_spd_limit &= (1 << spd) - 1; 6327 if (spd)
6328 ap->hw_sata_spd_limit &= (1 << spd) - 1;
6317 } 6329 }
6318 ap->sata_spd_limit = ap->hw_sata_spd_limit; 6330 ap->sata_spd_limit = ap->hw_sata_spd_limit;
6319 6331
@@ -6433,6 +6445,9 @@ int ata_host_activate(struct ata_host *host, int irq,
6433 if (rc) 6445 if (rc)
6434 devm_free_irq(host->dev, irq, host); 6446 devm_free_irq(host->dev, irq, host);
6435 6447
6448 /* Used to print device info at probe */
6449 host->irq = irq;
6450
6436 return rc; 6451 return rc;
6437} 6452}
6438 6453
@@ -6818,6 +6833,7 @@ EXPORT_SYMBOL_GPL(ata_check_status);
6818EXPORT_SYMBOL_GPL(ata_altstatus); 6833EXPORT_SYMBOL_GPL(ata_altstatus);
6819EXPORT_SYMBOL_GPL(ata_exec_command); 6834EXPORT_SYMBOL_GPL(ata_exec_command);
6820EXPORT_SYMBOL_GPL(ata_port_start); 6835EXPORT_SYMBOL_GPL(ata_port_start);
6836EXPORT_SYMBOL_GPL(ata_sff_port_start);
6821EXPORT_SYMBOL_GPL(ata_interrupt); 6837EXPORT_SYMBOL_GPL(ata_interrupt);
6822EXPORT_SYMBOL_GPL(ata_do_set_mode); 6838EXPORT_SYMBOL_GPL(ata_do_set_mode);
6823EXPORT_SYMBOL_GPL(ata_data_xfer); 6839EXPORT_SYMBOL_GPL(ata_data_xfer);
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index b3900cfbd880..c228df298bd8 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1363,12 +1363,22 @@ static void ata_scsi_qc_complete(struct ata_queued_cmd *qc)
1363 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE 1363 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE
1364 * cache 1364 * cache
1365 */ 1365 */
1366 if (ap->ops->error_handler && 1366 if (ap->ops->error_handler && !need_sense) {
1367 !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) && 1367 switch (qc->tf.command) {
1368 ((qc->tf.feature == SETFEATURES_WC_ON) || 1368 case ATA_CMD_SET_FEATURES:
1369 (qc->tf.feature == SETFEATURES_WC_OFF))) { 1369 if ((qc->tf.feature == SETFEATURES_WC_ON) ||
1370 ap->eh_info.action |= ATA_EH_REVALIDATE; 1370 (qc->tf.feature == SETFEATURES_WC_OFF)) {
1371 ata_port_schedule_eh(ap); 1371 ap->eh_info.action |= ATA_EH_REVALIDATE;
1372 ata_port_schedule_eh(ap);
1373 }
1374 break;
1375
1376 case ATA_CMD_INIT_DEV_PARAMS: /* CHS translation changed */
1377 case ATA_CMD_SET_MULTI: /* multi_count changed */
1378 ap->eh_info.action |= ATA_EH_REVALIDATE;
1379 ata_port_schedule_eh(ap);
1380 break;
1381 }
1372 } 1382 }
1373 1383
1374 /* For ATA pass thru (SAT) commands, generate a sense block if 1384 /* For ATA pass thru (SAT) commands, generate a sense block if
@@ -2506,22 +2516,21 @@ ata_scsi_map_proto(u8 byte1)
2506 return ATA_PROT_NODATA; 2516 return ATA_PROT_NODATA;
2507 2517
2508 case 6: /* DMA */ 2518 case 6: /* DMA */
2519 case 10: /* UDMA Data-in */
2520 case 11: /* UDMA Data-Out */
2509 return ATA_PROT_DMA; 2521 return ATA_PROT_DMA;
2510 2522
2511 case 4: /* PIO Data-in */ 2523 case 4: /* PIO Data-in */
2512 case 5: /* PIO Data-out */ 2524 case 5: /* PIO Data-out */
2513 return ATA_PROT_PIO; 2525 return ATA_PROT_PIO;
2514 2526
2515 case 10: /* Device Reset */
2516 case 0: /* Hard Reset */ 2527 case 0: /* Hard Reset */
2517 case 1: /* SRST */ 2528 case 1: /* SRST */
2518 case 2: /* Bus Idle */ 2529 case 8: /* Device Diagnostic */
2519 case 7: /* Packet */ 2530 case 9: /* Device Reset */
2520 case 8: /* DMA Queued */ 2531 case 7: /* DMA Queued */
2521 case 9: /* Device Diagnostic */ 2532 case 12: /* FPDMA */
2522 case 11: /* UDMA Data-in */ 2533 case 15: /* Return Response Info */
2523 case 12: /* UDMA Data-Out */
2524 case 13: /* FPDMA */
2525 default: /* Reserved */ 2534 default: /* Reserved */
2526 break; 2535 break;
2527 } 2536 }
@@ -2552,10 +2561,6 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2552 if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0) 2561 if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0)
2553 goto invalid_fld; 2562 goto invalid_fld;
2554 2563
2555 if (cdb[1] & 0xe0)
2556 /* PIO multi not supported yet */
2557 goto invalid_fld;
2558
2559 /* 2564 /*
2560 * 12 and 16 byte CDBs use different offsets to 2565 * 12 and 16 byte CDBs use different offsets to
2561 * provide the various register values. 2566 * provide the various register values.
@@ -2600,12 +2605,26 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
2600 tf->device = cdb[8]; 2605 tf->device = cdb[8];
2601 tf->command = cdb[9]; 2606 tf->command = cdb[9];
2602 } 2607 }
2603 /* 2608
2604 * If slave is possible, enforce correct master/slave bit 2609 /* enforce correct master/slave bit */
2605 */ 2610 tf->device = dev->devno ?
2606 if (qc->ap->flags & ATA_FLAG_SLAVE_POSS) 2611 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1;
2607 tf->device = qc->dev->devno ? 2612
2608 tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1; 2613 /* sanity check for pio multi commands */
2614 if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf))
2615 goto invalid_fld;
2616
2617 if (is_multi_taskfile(tf)) {
2618 unsigned int multi_count = 1 << (cdb[1] >> 5);
2619
2620 /* compare the passed through multi_count
2621 * with the cached multi_count of libata
2622 */
2623 if (multi_count != dev->multi_count)
2624 ata_dev_printk(dev, KERN_WARNING,
2625 "invalid multi_count %u ignored\n",
2626 multi_count);
2627 }
2609 2628
2610 /* READ/WRITE LONG use a non-standard sect_size */ 2629 /* READ/WRITE LONG use a non-standard sect_size */
2611 qc->sect_size = ATA_SECT_SIZE; 2630 qc->sect_size = ATA_SECT_SIZE;
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index e35d13466c69..ce84805ba5f1 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -80,25 +80,25 @@ u8 ata_dummy_irq_on (struct ata_port *ap) { return 0; }
80u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 80u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq)
81{ 81{
82 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY; 82 unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
83 u8 host_stat, post_stat, status; 83 u8 host_stat = 0, post_stat = 0, status;
84 84
85 status = ata_busy_wait(ap, bits, 1000); 85 status = ata_busy_wait(ap, bits, 1000);
86 if (status & bits) 86 if (status & bits)
87 if (ata_msg_err(ap)) 87 if (ata_msg_err(ap))
88 printk(KERN_ERR "abnormal status 0x%X\n", status); 88 printk(KERN_ERR "abnormal status 0x%X\n", status);
89 89
90 /* get controller status; clear intr, err bits */ 90 if (ap->ioaddr.bmdma_addr) {
91 host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 91 /* get controller status; clear intr, err bits */
92 iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, 92 host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
93 ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 93 iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR,
94 94 ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
95 post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
96 95
96 post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS);
97 }
97 if (ata_msg_intr(ap)) 98 if (ata_msg_intr(ap))
98 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 99 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n",
99 __FUNCTION__, 100 __FUNCTION__,
100 host_stat, post_stat, status); 101 host_stat, post_stat, status);
101
102 return status; 102 return status;
103} 103}
104 104
@@ -516,6 +516,27 @@ void ata_bmdma_post_internal_cmd(struct ata_queued_cmd *qc)
516 ata_bmdma_stop(qc); 516 ata_bmdma_stop(qc);
517} 517}
518 518
519/**
520 * ata_sff_port_start - Set port up for dma.
521 * @ap: Port to initialize
522 *
523 * Called just after data structures for each port are
524 * initialized. Allocates space for PRD table if the device
525 * is DMA capable SFF.
526 *
527 * May be used as the port_start() entry in ata_port_operations.
528 *
529 * LOCKING:
530 * Inherited from caller.
531 */
532
533int ata_sff_port_start(struct ata_port *ap)
534{
535 if (ap->ioaddr.bmdma_addr)
536 return ata_port_start(ap);
537 return 0;
538}
539
519#ifdef CONFIG_PCI 540#ifdef CONFIG_PCI
520 541
521static int ata_resources_present(struct pci_dev *pdev, int port) 542static int ata_resources_present(struct pci_dev *pdev, int port)
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c
index 1f647b648204..5525518204e6 100644
--- a/drivers/ata/pata_isapnp.c
+++ b/drivers/ata/pata_isapnp.c
@@ -77,7 +77,6 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev
77 struct ata_host *host; 77 struct ata_host *host;
78 struct ata_port *ap; 78 struct ata_port *ap;
79 void __iomem *cmd_addr, *ctl_addr; 79 void __iomem *cmd_addr, *ctl_addr;
80 int rc;
81 80
82 if (pnp_port_valid(idev, 0) == 0) 81 if (pnp_port_valid(idev, 0) == 0)
83 return -ENODEV; 82 return -ENODEV;