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

Merge branch 'linus-plus-plus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'linus-plus-plus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev:
libata: limit post SRST nsect/lbal wait to ~100ms
libata: force PIO on IOMEGA ZIP 250 ATAPI
libata passthru: update cached device paramters
libata passthru: always enforce correct DEV bit
libata passthru: map UDMA protocols
libata passthru: support PIO multi commands
libata passthru: update protocol numbers
libata: Correct abuse of language
libata-core/sff: Fix multiple assumptions about DMA
ahci: Add MCP73/MCP77 support to AHCI driver
libata: fix hw_sata_spd_limit initialization
libata: print device model and firmware revision for ATAPI devices
libata: fix probe time irq printouts
libata: disable NCQ for HITACHI HTS541680J9SA00/SB21C7EP
remove unused variable in pata_isapnp

+138 -57
+24
drivers/ata/ahci.c
··· 426 426 { PCI_VDEVICE(NVIDIA, 0x0559), board_ahci }, /* MCP67 */ 427 427 { PCI_VDEVICE(NVIDIA, 0x055a), board_ahci }, /* MCP67 */ 428 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 454 /* SiS */ 431 455 { PCI_VDEVICE(SI, 0x1184), board_ahci }, /* SiS 966 */
+39 -23
drivers/ata/libata-core.c
··· 1727 1727 1728 1728 /* sanity check */ 1729 1729 rc = -EINVAL; 1730 - reason = "device reports illegal type"; 1730 + reason = "device reports invalid type"; 1731 1731 1732 1732 if (class == ATA_DEV_ATA) { 1733 1733 if (!ata_id_is_ata(id) && !ata_id_is_cfa(id)) ··· 1900 1900 if (ata_msg_probe(ap)) 1901 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 1910 /* ATA-specific feature tests */ 1904 1911 if (dev->class == ATA_DEV_ATA) { 1905 1912 if (ata_id_is_cfa(id)) { ··· 1920 1913 snprintf(revbuf, 7, "ATA-%d", ata_id_major_version(id)); 1921 1914 1922 1915 dev->n_sectors = ata_id_n_sectors(id); 1923 - 1924 - /* SCSI only uses 4-char revisions, dump full 8 chars from ATA */ 1925 - ata_id_c_string(dev->id, fwrevbuf, ATA_ID_FW_REV, 1926 - sizeof(fwrevbuf)); 1927 - 1928 - ata_id_c_string(dev->id, modelbuf, ATA_ID_PROD, 1929 - sizeof(modelbuf)); 1930 1916 1931 1917 if (dev->id[59] & 0x100) 1932 1918 dev->multi_count = dev->id[59] & 0xff; ··· 2009 2009 2010 2010 /* print device info to dmesg */ 2011 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 2015 ata_mode_string(xfer_mask), 2014 2016 cdb_intr_string); 2015 2017 } ··· 3061 3059 } 3062 3060 } 3063 3061 3064 - /* if device 1 was found in ata_devchk, wait for 3065 - * register access, then wait for BSY to clear 3062 + /* if device 1 was found in ata_devchk, wait for register 3063 + * access briefly, then wait for BSY to clear. 3066 3064 */ 3067 - while (dev1) { 3068 - u8 nsect, lbal; 3065 + if (dev1) { 3066 + int i; 3069 3067 3070 3068 ap->ops->dev_select(ap, 1); 3071 - nsect = ioread8(ioaddr->nsect_addr); 3072 - lbal = ioread8(ioaddr->lbal_addr); 3073 - if ((nsect == 1) && (lbal == 1)) 3074 - break; 3075 - if (time_after(jiffies, deadline)) 3076 - return -EBUSY; 3077 - msleep(50); /* give drive a breather */ 3078 - } 3079 - if (dev1) { 3069 + 3070 + /* Wait for register access. Some ATAPI devices fail 3071 + * to set nsect/lbal after reset, so don't waste too 3072 + * much time on it. We're gonna wait for !BSY anyway. 3073 + */ 3074 + for (i = 0; i < 2; i++) { 3075 + u8 nsect, lbal; 3076 + 3077 + nsect = ioread8(ioaddr->nsect_addr); 3078 + lbal = ioread8(ioaddr->lbal_addr); 3079 + if ((nsect == 1) && (lbal == 1)) 3080 + break; 3081 + msleep(50); /* give drive a breather */ 3082 + } 3083 + 3080 3084 rc = ata_wait_ready(ap, deadline); 3081 3085 if (rc) { 3082 3086 if (rc != -ENODEV) ··· 3777 3769 { "_NEC DV5800A", NULL, ATA_HORKAGE_NODMA }, 3778 3770 { "SAMSUNG CD-ROM SN-124","N001", ATA_HORKAGE_NODMA }, 3779 3771 { "Seagate STT20000A", NULL, ATA_HORKAGE_NODMA }, 3772 + { "IOMEGA ZIP 250 ATAPI", NULL, ATA_HORKAGE_NODMA }, /* temporary fix */ 3780 3773 3781 3774 /* Weird ATAPI devices */ 3782 3775 { "TORiSAN DVD-ROM DRD-N216", NULL, ATA_HORKAGE_MAX_SEC_128 | ··· 3800 3791 { "HTS541060G9SA00", "MB3OC60D", ATA_HORKAGE_NONCQ, }, 3801 3792 { "HTS541080G9SA00", "MB4OC60D", ATA_HORKAGE_NONCQ, }, 3802 3793 { "HTS541010G9SA00", "MBZOC60D", ATA_HORKAGE_NONCQ, }, 3794 + /* Drives which do spurious command completion */ 3795 + { "HTS541680J9SA00", "SB2IC7EP", ATA_HORKAGE_NONCQ, }, 3803 3796 3804 3797 /* Devices with NCQ limits */ 3805 3798 ··· 6324 6313 /* init sata_spd_limit to the current value */ 6325 6314 if (sata_scr_read(ap, SCR_CONTROL, &scontrol) == 0) { 6326 6315 int spd = (scontrol >> 4) & 0xf; 6327 - ap->hw_sata_spd_limit &= (1 << spd) - 1; 6316 + if (spd) 6317 + ap->hw_sata_spd_limit &= (1 << spd) - 1; 6328 6318 } 6329 6319 ap->sata_spd_limit = ap->hw_sata_spd_limit; 6330 6320 ··· 6444 6432 /* if failed, just free the IRQ and leave ports alone */ 6445 6433 if (rc) 6446 6434 devm_free_irq(host->dev, irq, host); 6435 + 6436 + /* Used to print device info at probe */ 6437 + host->irq = irq; 6447 6438 6448 6439 return rc; 6449 6440 } ··· 6833 6818 EXPORT_SYMBOL_GPL(ata_altstatus); 6834 6819 EXPORT_SYMBOL_GPL(ata_exec_command); 6835 6820 EXPORT_SYMBOL_GPL(ata_port_start); 6821 + EXPORT_SYMBOL_GPL(ata_sff_port_start); 6836 6822 EXPORT_SYMBOL_GPL(ata_interrupt); 6837 6823 EXPORT_SYMBOL_GPL(ata_do_set_mode); 6838 6824 EXPORT_SYMBOL_GPL(ata_data_xfer);
+43 -24
drivers/ata/libata-scsi.c
··· 1363 1363 * schedule EH_REVALIDATE operation to update the IDENTIFY DEVICE 1364 1364 * cache 1365 1365 */ 1366 - if (ap->ops->error_handler && 1367 - !need_sense && (qc->tf.command == ATA_CMD_SET_FEATURES) && 1368 - ((qc->tf.feature == SETFEATURES_WC_ON) || 1369 - (qc->tf.feature == SETFEATURES_WC_OFF))) { 1370 - ap->eh_info.action |= ATA_EH_REVALIDATE; 1371 - ata_port_schedule_eh(ap); 1366 + if (ap->ops->error_handler && !need_sense) { 1367 + switch (qc->tf.command) { 1368 + case ATA_CMD_SET_FEATURES: 1369 + if ((qc->tf.feature == SETFEATURES_WC_ON) || 1370 + (qc->tf.feature == SETFEATURES_WC_OFF)) { 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 1384 /* For ATA pass thru (SAT) commands, generate a sense block if ··· 2516 2506 return ATA_PROT_NODATA; 2517 2507 2518 2508 case 6: /* DMA */ 2509 + case 10: /* UDMA Data-in */ 2510 + case 11: /* UDMA Data-Out */ 2519 2511 return ATA_PROT_DMA; 2520 2512 2521 2513 case 4: /* PIO Data-in */ 2522 2514 case 5: /* PIO Data-out */ 2523 2515 return ATA_PROT_PIO; 2524 2516 2525 - case 10: /* Device Reset */ 2526 2517 case 0: /* Hard Reset */ 2527 2518 case 1: /* SRST */ 2528 - case 2: /* Bus Idle */ 2529 - case 7: /* Packet */ 2530 - case 8: /* DMA Queued */ 2531 - case 9: /* Device Diagnostic */ 2532 - case 11: /* UDMA Data-in */ 2533 - case 12: /* UDMA Data-Out */ 2534 - case 13: /* FPDMA */ 2519 + case 8: /* Device Diagnostic */ 2520 + case 9: /* Device Reset */ 2521 + case 7: /* DMA Queued */ 2522 + case 12: /* FPDMA */ 2523 + case 15: /* Return Response Info */ 2535 2524 default: /* Reserved */ 2536 2525 break; 2537 2526 } ··· 2559 2550 2560 2551 /* We may not issue DMA commands if no DMA mode is set */ 2561 2552 if (tf->protocol == ATA_PROT_DMA && dev->dma_mode == 0) 2562 - goto invalid_fld; 2563 - 2564 - if (cdb[1] & 0xe0) 2565 - /* PIO multi not supported yet */ 2566 2553 goto invalid_fld; 2567 2554 2568 2555 /* ··· 2605 2600 tf->device = cdb[8]; 2606 2601 tf->command = cdb[9]; 2607 2602 } 2608 - /* 2609 - * If slave is possible, enforce correct master/slave bit 2610 - */ 2611 - if (qc->ap->flags & ATA_FLAG_SLAVE_POSS) 2612 - tf->device = qc->dev->devno ? 2613 - tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1; 2603 + 2604 + /* enforce correct master/slave bit */ 2605 + tf->device = dev->devno ? 2606 + tf->device | ATA_DEV1 : tf->device & ~ATA_DEV1; 2607 + 2608 + /* sanity check for pio multi commands */ 2609 + if ((cdb[1] & 0xe0) && !is_multi_taskfile(tf)) 2610 + goto invalid_fld; 2611 + 2612 + if (is_multi_taskfile(tf)) { 2613 + unsigned int multi_count = 1 << (cdb[1] >> 5); 2614 + 2615 + /* compare the passed through multi_count 2616 + * with the cached multi_count of libata 2617 + */ 2618 + if (multi_count != dev->multi_count) 2619 + ata_dev_printk(dev, KERN_WARNING, 2620 + "invalid multi_count %u ignored\n", 2621 + multi_count); 2622 + } 2614 2623 2615 2624 /* READ/WRITE LONG use a non-standard sect_size */ 2616 2625 qc->sect_size = ATA_SECT_SIZE;
+29 -8
drivers/ata/libata-sff.c
··· 80 80 u8 ata_irq_ack(struct ata_port *ap, unsigned int chk_drq) 81 81 { 82 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 85 status = ata_busy_wait(ap, bits, 1000); 86 86 if (status & bits) 87 87 if (ata_msg_err(ap)) 88 88 printk(KERN_ERR "abnormal status 0x%X\n", status); 89 89 90 - /* get controller status; clear intr, err bits */ 91 - host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 92 - iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, 93 - ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 90 + if (ap->ioaddr.bmdma_addr) { 91 + /* get controller status; clear intr, err bits */ 92 + host_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 93 + iowrite8(host_stat | ATA_DMA_INTR | ATA_DMA_ERR, 94 + ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 94 95 95 - post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 96 - 96 + post_stat = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_STATUS); 97 + } 97 98 if (ata_msg_intr(ap)) 98 99 printk(KERN_INFO "%s: irq ack: host_stat 0x%X, new host_stat 0x%X, drv_stat 0x%X\n", 99 100 __FUNCTION__, 100 101 host_stat, post_stat, status); 101 - 102 102 return status; 103 103 } 104 104 ··· 514 514 { 515 515 if (qc->ap->ioaddr.bmdma_addr) 516 516 ata_bmdma_stop(qc); 517 + } 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 + 533 + int ata_sff_port_start(struct ata_port *ap) 534 + { 535 + if (ap->ioaddr.bmdma_addr) 536 + return ata_port_start(ap); 537 + return 0; 517 538 } 518 539 519 540 #ifdef CONFIG_PCI
-1
drivers/ata/pata_isapnp.c
··· 77 77 struct ata_host *host; 78 78 struct ata_port *ap; 79 79 void __iomem *cmd_addr, *ctl_addr; 80 - int rc; 81 80 82 81 if (pnp_port_valid(idev, 0) == 0) 83 82 return -ENODEV;
+2 -1
include/linux/ata.h
··· 151 151 ATA_CMD_WRITE_MULTI_EXT = 0x39, 152 152 ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE, 153 153 ATA_CMD_SET_FEATURES = 0xEF, 154 + ATA_CMD_SET_MULTI = 0xC6, 154 155 ATA_CMD_PACKET = 0xA0, 155 156 ATA_CMD_VERIFY = 0x40, 156 157 ATA_CMD_VERIFY_EXT = 0x42, ··· 250 249 /* ATA taskfile protocols */ 251 250 ATA_PROT_UNKNOWN, /* unknown/invalid */ 252 251 ATA_PROT_NODATA, /* no data */ 253 - ATA_PROT_PIO, /* PIO single sector */ 252 + ATA_PROT_PIO, /* PIO data xfer */ 254 253 ATA_PROT_DMA, /* DMA */ 255 254 ATA_PROT_NCQ, /* NCQ */ 256 255 ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
+1
include/linux/libata.h
··· 753 753 extern u8 ata_altstatus(struct ata_port *ap); 754 754 extern void ata_exec_command(struct ata_port *ap, const struct ata_taskfile *tf); 755 755 extern int ata_port_start (struct ata_port *ap); 756 + extern int ata_sff_port_start (struct ata_port *ap); 756 757 extern irqreturn_t ata_interrupt (int irq, void *dev_instance); 757 758 extern void ata_data_xfer(struct ata_device *adev, unsigned char *buf, 758 759 unsigned int buflen, int write_data);