diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/Kconfig | 4 | ||||
-rw-r--r-- | drivers/scsi/libata-bmdma.c | 37 | ||||
-rw-r--r-- | drivers/scsi/libata-core.c | 27 | ||||
-rw-r--r-- | drivers/scsi/libata-scsi.c | 140 | ||||
-rw-r--r-- | drivers/scsi/pdc_adma.c | 2 | ||||
-rw-r--r-- | drivers/scsi/sata_mv.c | 5 | ||||
-rw-r--r-- | drivers/scsi/sata_svw.c | 56 | ||||
-rw-r--r-- | drivers/scsi/sata_vsc.c | 124 |
8 files changed, 245 insertions, 150 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 5c94a5d4efc0..4035920ce3d8 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -595,10 +595,10 @@ config SCSI_SATA_VIA | |||
595 | If unsure, say N. | 595 | If unsure, say N. |
596 | 596 | ||
597 | config SCSI_SATA_VITESSE | 597 | config SCSI_SATA_VITESSE |
598 | tristate "VITESSE VSC-7174 SATA support" | 598 | tristate "VITESSE VSC-7174 / INTEL 31244 SATA support" |
599 | depends on SCSI_SATA && PCI | 599 | depends on SCSI_SATA && PCI |
600 | help | 600 | help |
601 | This option enables support for Vitesse VSC7174 Serial ATA. | 601 | This option enables support for Vitesse VSC7174 and Intel 31244 Serial ATA. |
602 | 602 | ||
603 | If unsure, say N. | 603 | If unsure, say N. |
604 | 604 | ||
diff --git a/drivers/scsi/libata-bmdma.c b/drivers/scsi/libata-bmdma.c index a93336adcd23..999725ca8d09 100644 --- a/drivers/scsi/libata-bmdma.c +++ b/drivers/scsi/libata-bmdma.c | |||
@@ -648,6 +648,7 @@ int ata_pci_init_one (struct pci_dev *pdev, struct ata_port_info **port_info, | |||
648 | goto err_out_regions; | 648 | goto err_out_regions; |
649 | } | 649 | } |
650 | 650 | ||
651 | /* FIXME: If we get no DMA mask we should fall back to PIO */ | ||
651 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); | 652 | rc = pci_set_dma_mask(pdev, ATA_DMA_MASK); |
652 | if (rc) | 653 | if (rc) |
653 | goto err_out_regions; | 654 | goto err_out_regions; |
@@ -699,5 +700,41 @@ err_out: | |||
699 | return rc; | 700 | return rc; |
700 | } | 701 | } |
701 | 702 | ||
703 | /** | ||
704 | * ata_pci_clear_simplex - attempt to kick device out of simplex | ||
705 | * @pdev: PCI device | ||
706 | * | ||
707 | * Some PCI ATA devices report simplex mode but in fact can be told to | ||
708 | * enter non simplex mode. This implements the neccessary logic to | ||
709 | * perform the task on such devices. Calling it on other devices will | ||
710 | * have -undefined- behaviour. | ||
711 | */ | ||
712 | |||
713 | int ata_pci_clear_simplex(struct pci_dev *pdev) | ||
714 | { | ||
715 | unsigned long bmdma = pci_resource_start(pdev, 4); | ||
716 | u8 simplex; | ||
717 | |||
718 | if (bmdma == 0) | ||
719 | return -ENOENT; | ||
720 | |||
721 | simplex = inb(bmdma + 0x02); | ||
722 | outb(simplex & 0x60, bmdma + 0x02); | ||
723 | simplex = inb(bmdma + 0x02); | ||
724 | if (simplex & 0x80) | ||
725 | return -EOPNOTSUPP; | ||
726 | return 0; | ||
727 | } | ||
728 | |||
729 | unsigned long ata_pci_default_filter(const struct ata_port *ap, struct ata_device *adev, unsigned long xfer_mask) | ||
730 | { | ||
731 | /* Filter out DMA modes if the device has been configured by | ||
732 | the BIOS as PIO only */ | ||
733 | |||
734 | if (ap->ioaddr.bmdma_addr == 0) | ||
735 | xfer_mask &= ~(ATA_MASK_MWDMA | ATA_MASK_UDMA); | ||
736 | return xfer_mask; | ||
737 | } | ||
738 | |||
702 | #endif /* CONFIG_PCI */ | 739 | #endif /* CONFIG_PCI */ |
703 | 740 | ||
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index 64dce00e9c46..5d00bb721e23 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c | |||
@@ -962,6 +962,8 @@ ata_exec_internal(struct ata_port *ap, struct ata_device *dev, | |||
962 | spin_unlock_irqrestore(&ap->host_set->lock, flags); | 962 | spin_unlock_irqrestore(&ap->host_set->lock, flags); |
963 | 963 | ||
964 | if (!wait_for_completion_timeout(&wait, ATA_TMOUT_INTERNAL)) { | 964 | if (!wait_for_completion_timeout(&wait, ATA_TMOUT_INTERNAL)) { |
965 | ata_port_flush_task(ap); | ||
966 | |||
965 | spin_lock_irqsave(&ap->host_set->lock, flags); | 967 | spin_lock_irqsave(&ap->host_set->lock, flags); |
966 | 968 | ||
967 | /* We're racing with irq here. If we lose, the | 969 | /* We're racing with irq here. If we lose, the |
@@ -1737,7 +1739,7 @@ static int ata_host_set_pio(struct ata_port *ap) | |||
1737 | continue; | 1739 | continue; |
1738 | 1740 | ||
1739 | if (!dev->pio_mode) { | 1741 | if (!dev->pio_mode) { |
1740 | printk(KERN_WARNING "ata%u: no PIO support\n", ap->id); | 1742 | printk(KERN_WARNING "ata%u: no PIO support for device %d.\n", ap->id, i); |
1741 | return -1; | 1743 | return -1; |
1742 | } | 1744 | } |
1743 | 1745 | ||
@@ -2863,6 +2865,8 @@ void ata_qc_prep(struct ata_queued_cmd *qc) | |||
2863 | ata_fill_sg(qc); | 2865 | ata_fill_sg(qc); |
2864 | } | 2866 | } |
2865 | 2867 | ||
2868 | void ata_noop_qc_prep(struct ata_queued_cmd *qc) { } | ||
2869 | |||
2866 | /** | 2870 | /** |
2867 | * ata_sg_init_one - Associate command with memory buffer | 2871 | * ata_sg_init_one - Associate command with memory buffer |
2868 | * @qc: Command to be associated | 2872 | * @qc: Command to be associated |
@@ -3907,7 +3911,6 @@ static inline int ata_should_dma_map(struct ata_queued_cmd *qc) | |||
3907 | 3911 | ||
3908 | case ATA_PROT_ATAPI: | 3912 | case ATA_PROT_ATAPI: |
3909 | case ATA_PROT_PIO: | 3913 | case ATA_PROT_PIO: |
3910 | case ATA_PROT_PIO_MULT: | ||
3911 | if (ap->flags & ATA_FLAG_PIO_DMA) | 3914 | if (ap->flags & ATA_FLAG_PIO_DMA) |
3912 | return 1; | 3915 | return 1; |
3913 | 3916 | ||
@@ -4199,14 +4202,17 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc) | |||
4199 | 4202 | ||
4200 | void ata_bmdma_irq_clear(struct ata_port *ap) | 4203 | void ata_bmdma_irq_clear(struct ata_port *ap) |
4201 | { | 4204 | { |
4202 | if (ap->flags & ATA_FLAG_MMIO) { | 4205 | if (!ap->ioaddr.bmdma_addr) |
4203 | void __iomem *mmio = ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; | 4206 | return; |
4204 | writeb(readb(mmio), mmio); | ||
4205 | } else { | ||
4206 | unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; | ||
4207 | outb(inb(addr), addr); | ||
4208 | } | ||
4209 | 4207 | ||
4208 | if (ap->flags & ATA_FLAG_MMIO) { | ||
4209 | void __iomem *mmio = | ||
4210 | ((void __iomem *) ap->ioaddr.bmdma_addr) + ATA_DMA_STATUS; | ||
4211 | writeb(readb(mmio), mmio); | ||
4212 | } else { | ||
4213 | unsigned long addr = ap->ioaddr.bmdma_addr + ATA_DMA_STATUS; | ||
4214 | outb(inb(addr), addr); | ||
4215 | } | ||
4210 | } | 4216 | } |
4211 | 4217 | ||
4212 | 4218 | ||
@@ -4337,9 +4343,9 @@ idle_irq: | |||
4337 | 4343 | ||
4338 | #ifdef ATA_IRQ_TRAP | 4344 | #ifdef ATA_IRQ_TRAP |
4339 | if ((ap->stats.idle_irq % 1000) == 0) { | 4345 | if ((ap->stats.idle_irq % 1000) == 0) { |
4340 | handled = 1; | ||
4341 | ata_irq_ack(ap, 0); /* debug trap */ | 4346 | ata_irq_ack(ap, 0); /* debug trap */ |
4342 | printk(KERN_WARNING "ata%d: irq trap\n", ap->id); | 4347 | printk(KERN_WARNING "ata%d: irq trap\n", ap->id); |
4348 | return 1; | ||
4343 | } | 4349 | } |
4344 | #endif | 4350 | #endif |
4345 | return 0; /* irq not handled */ | 4351 | return 0; /* irq not handled */ |
@@ -5064,6 +5070,7 @@ EXPORT_SYMBOL_GPL(ata_port_stop); | |||
5064 | EXPORT_SYMBOL_GPL(ata_host_stop); | 5070 | EXPORT_SYMBOL_GPL(ata_host_stop); |
5065 | EXPORT_SYMBOL_GPL(ata_interrupt); | 5071 | EXPORT_SYMBOL_GPL(ata_interrupt); |
5066 | EXPORT_SYMBOL_GPL(ata_qc_prep); | 5072 | EXPORT_SYMBOL_GPL(ata_qc_prep); |
5073 | EXPORT_SYMBOL_GPL(ata_noop_qc_prep); | ||
5067 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); | 5074 | EXPORT_SYMBOL_GPL(ata_bmdma_setup); |
5068 | EXPORT_SYMBOL_GPL(ata_bmdma_start); | 5075 | EXPORT_SYMBOL_GPL(ata_bmdma_start); |
5069 | EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear); | 5076 | EXPORT_SYMBOL_GPL(ata_bmdma_irq_clear); |
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index bd9f2176f79a..a1259b242b8e 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -521,13 +521,11 @@ void ata_to_sense_error(unsigned id, u8 drv_stat, u8 drv_err, u8 *sk, u8 *asc, | |||
521 | printk(KERN_WARNING "ata%u: no sense translation for status: 0x%02x\n", | 521 | printk(KERN_WARNING "ata%u: no sense translation for status: 0x%02x\n", |
522 | id, drv_stat); | 522 | id, drv_stat); |
523 | 523 | ||
524 | /* For our last chance pick, use medium read error because | 524 | /* We need a sensible error return here, which is tricky, and one |
525 | * it's much more common than an ATA drive telling you a write | 525 | that won't cause people to do things like return a disk wrongly */ |
526 | * has failed. | 526 | *sk = ABORTED_COMMAND; |
527 | */ | 527 | *asc = 0x00; |
528 | *sk = MEDIUM_ERROR; | 528 | *ascq = 0x00; |
529 | *asc = 0x11; /* "unrecovered read error" */ | ||
530 | *ascq = 0x04; /* "auto-reallocation failed" */ | ||
531 | 529 | ||
532 | translate_done: | 530 | translate_done: |
533 | printk(KERN_ERR "ata%u: translated ATA stat/err 0x%02x/%02x to " | 531 | printk(KERN_ERR "ata%u: translated ATA stat/err 0x%02x/%02x to " |
@@ -672,6 +670,41 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
672 | } | 670 | } |
673 | } | 671 | } |
674 | 672 | ||
673 | static void ata_scsi_sdev_config(struct scsi_device *sdev) | ||
674 | { | ||
675 | sdev->use_10_for_rw = 1; | ||
676 | sdev->use_10_for_ms = 1; | ||
677 | } | ||
678 | |||
679 | static void ata_scsi_dev_config(struct scsi_device *sdev, | ||
680 | struct ata_device *dev) | ||
681 | { | ||
682 | unsigned int max_sectors; | ||
683 | |||
684 | /* TODO: 2048 is an arbitrary number, not the | ||
685 | * hardware maximum. This should be increased to | ||
686 | * 65534 when Jens Axboe's patch for dynamically | ||
687 | * determining max_sectors is merged. | ||
688 | */ | ||
689 | max_sectors = ATA_MAX_SECTORS; | ||
690 | if (dev->flags & ATA_DFLAG_LBA48) | ||
691 | max_sectors = 2048; | ||
692 | if (dev->max_sectors) | ||
693 | max_sectors = dev->max_sectors; | ||
694 | |||
695 | blk_queue_max_sectors(sdev->request_queue, max_sectors); | ||
696 | |||
697 | /* | ||
698 | * SATA DMA transfers must be multiples of 4 byte, so | ||
699 | * we need to pad ATAPI transfers using an extra sg. | ||
700 | * Decrement max hw segments accordingly. | ||
701 | */ | ||
702 | if (dev->class == ATA_DEV_ATAPI) { | ||
703 | request_queue_t *q = sdev->request_queue; | ||
704 | blk_queue_max_hw_segments(q, q->max_hw_segments - 1); | ||
705 | } | ||
706 | } | ||
707 | |||
675 | /** | 708 | /** |
676 | * ata_scsi_slave_config - Set SCSI device attributes | 709 | * ata_scsi_slave_config - Set SCSI device attributes |
677 | * @sdev: SCSI device to examine | 710 | * @sdev: SCSI device to examine |
@@ -686,41 +719,18 @@ void ata_gen_fixed_sense(struct ata_queued_cmd *qc) | |||
686 | 719 | ||
687 | int ata_scsi_slave_config(struct scsi_device *sdev) | 720 | int ata_scsi_slave_config(struct scsi_device *sdev) |
688 | { | 721 | { |
689 | sdev->use_10_for_rw = 1; | 722 | ata_scsi_sdev_config(sdev); |
690 | sdev->use_10_for_ms = 1; | ||
691 | 723 | ||
692 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); | 724 | blk_queue_max_phys_segments(sdev->request_queue, LIBATA_MAX_PRD); |
693 | 725 | ||
694 | if (sdev->id < ATA_MAX_DEVICES) { | 726 | if (sdev->id < ATA_MAX_DEVICES) { |
695 | struct ata_port *ap; | 727 | struct ata_port *ap; |
696 | struct ata_device *dev; | 728 | struct ata_device *dev; |
697 | unsigned int max_sectors; | ||
698 | 729 | ||
699 | ap = (struct ata_port *) &sdev->host->hostdata[0]; | 730 | ap = (struct ata_port *) &sdev->host->hostdata[0]; |
700 | dev = &ap->device[sdev->id]; | 731 | dev = &ap->device[sdev->id]; |
701 | 732 | ||
702 | /* TODO: 2048 is an arbitrary number, not the | 733 | ata_scsi_dev_config(sdev, dev); |
703 | * hardware maximum. This should be increased to | ||
704 | * 65534 when Jens Axboe's patch for dynamically | ||
705 | * determining max_sectors is merged. | ||
706 | */ | ||
707 | max_sectors = ATA_MAX_SECTORS; | ||
708 | if (dev->flags & ATA_DFLAG_LBA48) | ||
709 | max_sectors = 2048; | ||
710 | if (dev->max_sectors) | ||
711 | max_sectors = dev->max_sectors; | ||
712 | |||
713 | blk_queue_max_sectors(sdev->request_queue, max_sectors); | ||
714 | |||
715 | /* | ||
716 | * SATA DMA transfers must be multiples of 4 byte, so | ||
717 | * we need to pad ATAPI transfers using an extra sg. | ||
718 | * Decrement max hw segments accordingly. | ||
719 | */ | ||
720 | if (dev->class == ATA_DEV_ATAPI) { | ||
721 | request_queue_t *q = sdev->request_queue; | ||
722 | blk_queue_max_hw_segments(q, q->max_hw_segments - 1); | ||
723 | } | ||
724 | } | 734 | } |
725 | 735 | ||
726 | return 0; /* scsi layer doesn't check return value, sigh */ | 736 | return 0; /* scsi layer doesn't check return value, sigh */ |
@@ -1552,7 +1562,7 @@ void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |||
1552 | * @buflen: Response buffer length. | 1562 | * @buflen: Response buffer length. |
1553 | * | 1563 | * |
1554 | * Returns standard device identification data associated | 1564 | * Returns standard device identification data associated |
1555 | * with non-EVPD INQUIRY command output. | 1565 | * with non-VPD INQUIRY command output. |
1556 | * | 1566 | * |
1557 | * LOCKING: | 1567 | * LOCKING: |
1558 | * spin_lock_irqsave(host_set lock) | 1568 | * spin_lock_irqsave(host_set lock) |
@@ -1603,12 +1613,12 @@ unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, | |||
1603 | } | 1613 | } |
1604 | 1614 | ||
1605 | /** | 1615 | /** |
1606 | * ata_scsiop_inq_00 - Simulate INQUIRY EVPD page 0, list of pages | 1616 | * ata_scsiop_inq_00 - Simulate INQUIRY VPD page 0, list of pages |
1607 | * @args: device IDENTIFY data / SCSI command of interest. | 1617 | * @args: device IDENTIFY data / SCSI command of interest. |
1608 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1618 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1609 | * @buflen: Response buffer length. | 1619 | * @buflen: Response buffer length. |
1610 | * | 1620 | * |
1611 | * Returns list of inquiry EVPD pages available. | 1621 | * Returns list of inquiry VPD pages available. |
1612 | * | 1622 | * |
1613 | * LOCKING: | 1623 | * LOCKING: |
1614 | * spin_lock_irqsave(host_set lock) | 1624 | * spin_lock_irqsave(host_set lock) |
@@ -1622,7 +1632,7 @@ unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, | |||
1622 | 0x80, /* page 0x80, unit serial no page */ | 1632 | 0x80, /* page 0x80, unit serial no page */ |
1623 | 0x83 /* page 0x83, device ident page */ | 1633 | 0x83 /* page 0x83, device ident page */ |
1624 | }; | 1634 | }; |
1625 | rbuf[3] = sizeof(pages); /* number of supported EVPD pages */ | 1635 | rbuf[3] = sizeof(pages); /* number of supported VPD pages */ |
1626 | 1636 | ||
1627 | if (buflen > 6) | 1637 | if (buflen > 6) |
1628 | memcpy(rbuf + 4, pages, sizeof(pages)); | 1638 | memcpy(rbuf + 4, pages, sizeof(pages)); |
@@ -1631,7 +1641,7 @@ unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, | |||
1631 | } | 1641 | } |
1632 | 1642 | ||
1633 | /** | 1643 | /** |
1634 | * ata_scsiop_inq_80 - Simulate INQUIRY EVPD page 80, device serial number | 1644 | * ata_scsiop_inq_80 - Simulate INQUIRY VPD page 80, device serial number |
1635 | * @args: device IDENTIFY data / SCSI command of interest. | 1645 | * @args: device IDENTIFY data / SCSI command of interest. |
1636 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1646 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1637 | * @buflen: Response buffer length. | 1647 | * @buflen: Response buffer length. |
@@ -1660,16 +1670,16 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | |||
1660 | return 0; | 1670 | return 0; |
1661 | } | 1671 | } |
1662 | 1672 | ||
1663 | static const char * const inq_83_str = "Linux ATA-SCSI simulator"; | ||
1664 | |||
1665 | /** | 1673 | /** |
1666 | * ata_scsiop_inq_83 - Simulate INQUIRY EVPD page 83, device identity | 1674 | * ata_scsiop_inq_83 - Simulate INQUIRY VPD page 83, device identity |
1667 | * @args: device IDENTIFY data / SCSI command of interest. | 1675 | * @args: device IDENTIFY data / SCSI command of interest. |
1668 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1676 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1669 | * @buflen: Response buffer length. | 1677 | * @buflen: Response buffer length. |
1670 | * | 1678 | * |
1671 | * Returns device identification. Currently hardcoded to | 1679 | * Yields two logical unit device identification designators: |
1672 | * return "Linux ATA-SCSI simulator". | 1680 | * - vendor specific ASCII containing the ATA serial number |
1681 | * - SAT defined "t10 vendor id based" containing ASCII vendor | ||
1682 | * name ("ATA "), model and serial numbers. | ||
1673 | * | 1683 | * |
1674 | * LOCKING: | 1684 | * LOCKING: |
1675 | * spin_lock_irqsave(host_set lock) | 1685 | * spin_lock_irqsave(host_set lock) |
@@ -1678,16 +1688,39 @@ static const char * const inq_83_str = "Linux ATA-SCSI simulator"; | |||
1678 | unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, | 1688 | unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, |
1679 | unsigned int buflen) | 1689 | unsigned int buflen) |
1680 | { | 1690 | { |
1681 | rbuf[1] = 0x83; /* this page code */ | 1691 | int num; |
1682 | rbuf[3] = 4 + strlen(inq_83_str); /* page len */ | 1692 | const int sat_model_serial_desc_len = 68; |
1693 | const int ata_model_byte_len = 40; | ||
1683 | 1694 | ||
1684 | /* our one and only identification descriptor (vendor-specific) */ | 1695 | rbuf[1] = 0x83; /* this page code */ |
1685 | if (buflen > (strlen(inq_83_str) + 4 + 4 - 1)) { | 1696 | num = 4; |
1686 | rbuf[4 + 0] = 2; /* code set: ASCII */ | 1697 | |
1687 | rbuf[4 + 3] = strlen(inq_83_str); | 1698 | if (buflen > (ATA_SERNO_LEN + num + 3)) { |
1688 | memcpy(rbuf + 4 + 4, inq_83_str, strlen(inq_83_str)); | 1699 | /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */ |
1700 | rbuf[num + 0] = 2; | ||
1701 | rbuf[num + 3] = ATA_SERNO_LEN; | ||
1702 | num += 4; | ||
1703 | ata_id_string(args->id, (unsigned char *) rbuf + num, | ||
1704 | ATA_ID_SERNO_OFS, ATA_SERNO_LEN); | ||
1705 | num += ATA_SERNO_LEN; | ||
1689 | } | 1706 | } |
1690 | 1707 | if (buflen > (sat_model_serial_desc_len + num + 3)) { | |
1708 | /* SAT defined lu model and serial numbers descriptor */ | ||
1709 | /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */ | ||
1710 | rbuf[num + 0] = 2; | ||
1711 | rbuf[num + 1] = 1; | ||
1712 | rbuf[num + 3] = sat_model_serial_desc_len; | ||
1713 | num += 4; | ||
1714 | memcpy(rbuf + num, "ATA ", 8); | ||
1715 | num += 8; | ||
1716 | ata_id_string(args->id, (unsigned char *) rbuf + num, | ||
1717 | ATA_ID_PROD_OFS, ata_model_byte_len); | ||
1718 | num += ata_model_byte_len; | ||
1719 | ata_id_string(args->id, (unsigned char *) rbuf + num, | ||
1720 | ATA_ID_SERNO_OFS, ATA_SERNO_LEN); | ||
1721 | num += ATA_SERNO_LEN; | ||
1722 | } | ||
1723 | rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ | ||
1691 | return 0; | 1724 | return 0; |
1692 | } | 1725 | } |
1693 | 1726 | ||
@@ -2366,9 +2399,6 @@ ata_scsi_map_proto(u8 byte1) | |||
2366 | 2399 | ||
2367 | case 4: /* PIO Data-in */ | 2400 | case 4: /* PIO Data-in */ |
2368 | case 5: /* PIO Data-out */ | 2401 | case 5: /* PIO Data-out */ |
2369 | if (byte1 & 0xe0) { | ||
2370 | return ATA_PROT_PIO_MULT; | ||
2371 | } | ||
2372 | return ATA_PROT_PIO; | 2402 | return ATA_PROT_PIO; |
2373 | 2403 | ||
2374 | case 10: /* Device Reset */ | 2404 | case 10: /* Device Reset */ |
@@ -2407,6 +2437,10 @@ ata_scsi_pass_thru(struct ata_queued_cmd *qc, const u8 *scsicmd) | |||
2407 | if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN) | 2437 | if ((tf->protocol = ata_scsi_map_proto(scsicmd[1])) == ATA_PROT_UNKNOWN) |
2408 | goto invalid_fld; | 2438 | goto invalid_fld; |
2409 | 2439 | ||
2440 | if (scsicmd[1] & 0xe0) | ||
2441 | /* PIO multi not supported yet */ | ||
2442 | goto invalid_fld; | ||
2443 | |||
2410 | /* | 2444 | /* |
2411 | * 12 and 16 byte CDBs use different offsets to | 2445 | * 12 and 16 byte CDBs use different offsets to |
2412 | * provide the various register values. | 2446 | * provide the various register values. |
diff --git a/drivers/scsi/pdc_adma.c b/drivers/scsi/pdc_adma.c index b3dc5f85ae0b..3c85c4b66e19 100644 --- a/drivers/scsi/pdc_adma.c +++ b/drivers/scsi/pdc_adma.c | |||
@@ -321,7 +321,7 @@ static int adma_fill_sg(struct ata_queued_cmd *qc) | |||
321 | = (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); | 321 | = (pFLAGS & pEND) ? 0 : cpu_to_le32(pp->pkt_dma + i + 4); |
322 | i += 4; | 322 | i += 4; |
323 | 323 | ||
324 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", nelem, | 324 | VPRINTK("PRD[%u] = (0x%lX, 0x%X)\n", i/4, |
325 | (unsigned long)addr, len); | 325 | (unsigned long)addr, len); |
326 | } | 326 | } |
327 | return i; | 327 | return i; |
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c index 874c5be0843c..275ed9bd898c 100644 --- a/drivers/scsi/sata_mv.c +++ b/drivers/scsi/sata_mv.c | |||
@@ -1262,6 +1262,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1262 | void __iomem *port_mmio = mv_ap_base(ap); | 1262 | void __iomem *port_mmio = mv_ap_base(ap); |
1263 | struct mv_port_priv *pp = ap->private_data; | 1263 | struct mv_port_priv *pp = ap->private_data; |
1264 | u32 out_ptr; | 1264 | u32 out_ptr; |
1265 | u8 ata_status; | ||
1265 | 1266 | ||
1266 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1267 | out_ptr = readl(port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1267 | 1268 | ||
@@ -1269,6 +1270,8 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1269 | WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != | 1270 | WARN_ON(((out_ptr >> EDMA_RSP_Q_PTR_SHIFT) & MV_MAX_Q_DEPTH_MASK) != |
1270 | pp->rsp_consumer); | 1271 | pp->rsp_consumer); |
1271 | 1272 | ||
1273 | ata_status = pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT; | ||
1274 | |||
1272 | /* increment our consumer index... */ | 1275 | /* increment our consumer index... */ |
1273 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); | 1276 | pp->rsp_consumer = mv_inc_q_index(&pp->rsp_consumer); |
1274 | 1277 | ||
@@ -1283,7 +1286,7 @@ static u8 mv_get_crpb_status(struct ata_port *ap) | |||
1283 | writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); | 1286 | writelfl(out_ptr, port_mmio + EDMA_RSP_Q_OUT_PTR_OFS); |
1284 | 1287 | ||
1285 | /* Return ATA status register for completed CRPB */ | 1288 | /* Return ATA status register for completed CRPB */ |
1286 | return (pp->crpb[pp->rsp_consumer].flags >> CRPB_FLAG_STATUS_SHIFT); | 1289 | return ata_status; |
1287 | } | 1290 | } |
1288 | 1291 | ||
1289 | /** | 1292 | /** |
diff --git a/drivers/scsi/sata_svw.c b/drivers/scsi/sata_svw.c index 051e47d975ca..724f0ed6a52d 100644 --- a/drivers/scsi/sata_svw.c +++ b/drivers/scsi/sata_svw.c | |||
@@ -56,33 +56,35 @@ | |||
56 | #define DRV_NAME "sata_svw" | 56 | #define DRV_NAME "sata_svw" |
57 | #define DRV_VERSION "1.07" | 57 | #define DRV_VERSION "1.07" |
58 | 58 | ||
59 | /* Taskfile registers offsets */ | 59 | enum { |
60 | #define K2_SATA_TF_CMD_OFFSET 0x00 | 60 | /* Taskfile registers offsets */ |
61 | #define K2_SATA_TF_DATA_OFFSET 0x00 | 61 | K2_SATA_TF_CMD_OFFSET = 0x00, |
62 | #define K2_SATA_TF_ERROR_OFFSET 0x04 | 62 | K2_SATA_TF_DATA_OFFSET = 0x00, |
63 | #define K2_SATA_TF_NSECT_OFFSET 0x08 | 63 | K2_SATA_TF_ERROR_OFFSET = 0x04, |
64 | #define K2_SATA_TF_LBAL_OFFSET 0x0c | 64 | K2_SATA_TF_NSECT_OFFSET = 0x08, |
65 | #define K2_SATA_TF_LBAM_OFFSET 0x10 | 65 | K2_SATA_TF_LBAL_OFFSET = 0x0c, |
66 | #define K2_SATA_TF_LBAH_OFFSET 0x14 | 66 | K2_SATA_TF_LBAM_OFFSET = 0x10, |
67 | #define K2_SATA_TF_DEVICE_OFFSET 0x18 | 67 | K2_SATA_TF_LBAH_OFFSET = 0x14, |
68 | #define K2_SATA_TF_CMDSTAT_OFFSET 0x1c | 68 | K2_SATA_TF_DEVICE_OFFSET = 0x18, |
69 | #define K2_SATA_TF_CTL_OFFSET 0x20 | 69 | K2_SATA_TF_CMDSTAT_OFFSET = 0x1c, |
70 | 70 | K2_SATA_TF_CTL_OFFSET = 0x20, | |
71 | /* DMA base */ | 71 | |
72 | #define K2_SATA_DMA_CMD_OFFSET 0x30 | 72 | /* DMA base */ |
73 | 73 | K2_SATA_DMA_CMD_OFFSET = 0x30, | |
74 | /* SCRs base */ | 74 | |
75 | #define K2_SATA_SCR_STATUS_OFFSET 0x40 | 75 | /* SCRs base */ |
76 | #define K2_SATA_SCR_ERROR_OFFSET 0x44 | 76 | K2_SATA_SCR_STATUS_OFFSET = 0x40, |
77 | #define K2_SATA_SCR_CONTROL_OFFSET 0x48 | 77 | K2_SATA_SCR_ERROR_OFFSET = 0x44, |
78 | 78 | K2_SATA_SCR_CONTROL_OFFSET = 0x48, | |
79 | /* Others */ | 79 | |
80 | #define K2_SATA_SICR1_OFFSET 0x80 | 80 | /* Others */ |
81 | #define K2_SATA_SICR2_OFFSET 0x84 | 81 | K2_SATA_SICR1_OFFSET = 0x80, |
82 | #define K2_SATA_SIM_OFFSET 0x88 | 82 | K2_SATA_SICR2_OFFSET = 0x84, |
83 | 83 | K2_SATA_SIM_OFFSET = 0x88, | |
84 | /* Port stride */ | 84 | |
85 | #define K2_SATA_PORT_OFFSET 0x100 | 85 | /* Port stride */ |
86 | K2_SATA_PORT_OFFSET = 0x100, | ||
87 | }; | ||
86 | 88 | ||
87 | static u8 k2_stat_check_status(struct ata_port *ap); | 89 | static u8 k2_stat_check_status(struct ata_port *ap); |
88 | 90 | ||
diff --git a/drivers/scsi/sata_vsc.c b/drivers/scsi/sata_vsc.c index ee75b9b38ae8..9701a806539d 100644 --- a/drivers/scsi/sata_vsc.c +++ b/drivers/scsi/sata_vsc.c | |||
@@ -47,52 +47,58 @@ | |||
47 | #include <linux/libata.h> | 47 | #include <linux/libata.h> |
48 | 48 | ||
49 | #define DRV_NAME "sata_vsc" | 49 | #define DRV_NAME "sata_vsc" |
50 | #define DRV_VERSION "1.1" | 50 | #define DRV_VERSION "1.2" |
51 | 51 | ||
52 | /* Interrupt register offsets (from chip base address) */ | 52 | enum { |
53 | #define VSC_SATA_INT_STAT_OFFSET 0x00 | 53 | /* Interrupt register offsets (from chip base address) */ |
54 | #define VSC_SATA_INT_MASK_OFFSET 0x04 | 54 | VSC_SATA_INT_STAT_OFFSET = 0x00, |
55 | 55 | VSC_SATA_INT_MASK_OFFSET = 0x04, | |
56 | /* Taskfile registers offsets */ | 56 | |
57 | #define VSC_SATA_TF_CMD_OFFSET 0x00 | 57 | /* Taskfile registers offsets */ |
58 | #define VSC_SATA_TF_DATA_OFFSET 0x00 | 58 | VSC_SATA_TF_CMD_OFFSET = 0x00, |
59 | #define VSC_SATA_TF_ERROR_OFFSET 0x04 | 59 | VSC_SATA_TF_DATA_OFFSET = 0x00, |
60 | #define VSC_SATA_TF_FEATURE_OFFSET 0x06 | 60 | VSC_SATA_TF_ERROR_OFFSET = 0x04, |
61 | #define VSC_SATA_TF_NSECT_OFFSET 0x08 | 61 | VSC_SATA_TF_FEATURE_OFFSET = 0x06, |
62 | #define VSC_SATA_TF_LBAL_OFFSET 0x0c | 62 | VSC_SATA_TF_NSECT_OFFSET = 0x08, |
63 | #define VSC_SATA_TF_LBAM_OFFSET 0x10 | 63 | VSC_SATA_TF_LBAL_OFFSET = 0x0c, |
64 | #define VSC_SATA_TF_LBAH_OFFSET 0x14 | 64 | VSC_SATA_TF_LBAM_OFFSET = 0x10, |
65 | #define VSC_SATA_TF_DEVICE_OFFSET 0x18 | 65 | VSC_SATA_TF_LBAH_OFFSET = 0x14, |
66 | #define VSC_SATA_TF_STATUS_OFFSET 0x1c | 66 | VSC_SATA_TF_DEVICE_OFFSET = 0x18, |
67 | #define VSC_SATA_TF_COMMAND_OFFSET 0x1d | 67 | VSC_SATA_TF_STATUS_OFFSET = 0x1c, |
68 | #define VSC_SATA_TF_ALTSTATUS_OFFSET 0x28 | 68 | VSC_SATA_TF_COMMAND_OFFSET = 0x1d, |
69 | #define VSC_SATA_TF_CTL_OFFSET 0x29 | 69 | VSC_SATA_TF_ALTSTATUS_OFFSET = 0x28, |
70 | 70 | VSC_SATA_TF_CTL_OFFSET = 0x29, | |
71 | /* DMA base */ | 71 | |
72 | #define VSC_SATA_UP_DESCRIPTOR_OFFSET 0x64 | 72 | /* DMA base */ |
73 | #define VSC_SATA_UP_DATA_BUFFER_OFFSET 0x6C | 73 | VSC_SATA_UP_DESCRIPTOR_OFFSET = 0x64, |
74 | #define VSC_SATA_DMA_CMD_OFFSET 0x70 | 74 | VSC_SATA_UP_DATA_BUFFER_OFFSET = 0x6C, |
75 | 75 | VSC_SATA_DMA_CMD_OFFSET = 0x70, | |
76 | /* SCRs base */ | 76 | |
77 | #define VSC_SATA_SCR_STATUS_OFFSET 0x100 | 77 | /* SCRs base */ |
78 | #define VSC_SATA_SCR_ERROR_OFFSET 0x104 | 78 | VSC_SATA_SCR_STATUS_OFFSET = 0x100, |
79 | #define VSC_SATA_SCR_CONTROL_OFFSET 0x108 | 79 | VSC_SATA_SCR_ERROR_OFFSET = 0x104, |
80 | 80 | VSC_SATA_SCR_CONTROL_OFFSET = 0x108, | |
81 | /* Port stride */ | 81 | |
82 | #define VSC_SATA_PORT_OFFSET 0x200 | 82 | /* Port stride */ |
83 | 83 | VSC_SATA_PORT_OFFSET = 0x200, | |
84 | /* Error interrupt status bit offsets */ | 84 | |
85 | #define VSC_SATA_INT_ERROR_E_OFFSET 2 | 85 | /* Error interrupt status bit offsets */ |
86 | #define VSC_SATA_INT_ERROR_P_OFFSET 4 | 86 | VSC_SATA_INT_ERROR_CRC = 0x40, |
87 | #define VSC_SATA_INT_ERROR_T_OFFSET 5 | 87 | VSC_SATA_INT_ERROR_T = 0x20, |
88 | #define VSC_SATA_INT_ERROR_M_OFFSET 1 | 88 | VSC_SATA_INT_ERROR_P = 0x10, |
89 | VSC_SATA_INT_ERROR_R = 0x8, | ||
90 | VSC_SATA_INT_ERROR_E = 0x4, | ||
91 | VSC_SATA_INT_ERROR_M = 0x2, | ||
92 | VSC_SATA_INT_PHY_CHANGE = 0x1, | ||
93 | VSC_SATA_INT_ERROR = (VSC_SATA_INT_ERROR_CRC | VSC_SATA_INT_ERROR_T | \ | ||
94 | VSC_SATA_INT_ERROR_P | VSC_SATA_INT_ERROR_R | \ | ||
95 | VSC_SATA_INT_ERROR_E | VSC_SATA_INT_ERROR_M | \ | ||
96 | VSC_SATA_INT_PHY_CHANGE), | ||
97 | }; | ||
98 | |||
99 | |||
89 | #define is_vsc_sata_int_err(port_idx, int_status) \ | 100 | #define is_vsc_sata_int_err(port_idx, int_status) \ |
90 | (int_status & ((1 << (VSC_SATA_INT_ERROR_E_OFFSET + (8 * port_idx))) | \ | 101 | (int_status & (VSC_SATA_INT_ERROR << (8 * port_idx))) |
91 | (1 << (VSC_SATA_INT_ERROR_P_OFFSET + (8 * port_idx))) | \ | ||
92 | (1 << (VSC_SATA_INT_ERROR_T_OFFSET + (8 * port_idx))) | \ | ||
93 | (1 << (VSC_SATA_INT_ERROR_M_OFFSET + (8 * port_idx))) \ | ||
94 | )\ | ||
95 | ) | ||
96 | 102 | ||
97 | 103 | ||
98 | static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) | 104 | static u32 vsc_sata_scr_read (struct ata_port *ap, unsigned int sc_reg) |
@@ -215,14 +221,6 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, | |||
215 | 221 | ||
216 | ap = host_set->ports[i]; | 222 | ap = host_set->ports[i]; |
217 | 223 | ||
218 | if (is_vsc_sata_int_err(i, int_status)) { | ||
219 | u32 err_status; | ||
220 | printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__); | ||
221 | err_status = ap ? vsc_sata_scr_read(ap, SCR_ERROR) : 0; | ||
222 | vsc_sata_scr_write(ap, SCR_ERROR, err_status); | ||
223 | handled++; | ||
224 | } | ||
225 | |||
226 | if (ap && !(ap->flags & | 224 | if (ap && !(ap->flags & |
227 | (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { | 225 | (ATA_FLAG_PORT_DISABLED|ATA_FLAG_NOINTR))) { |
228 | struct ata_queued_cmd *qc; | 226 | struct ata_queued_cmd *qc; |
@@ -230,12 +228,26 @@ static irqreturn_t vsc_sata_interrupt (int irq, void *dev_instance, | |||
230 | qc = ata_qc_from_tag(ap, ap->active_tag); | 228 | qc = ata_qc_from_tag(ap, ap->active_tag); |
231 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { | 229 | if (qc && (!(qc->tf.ctl & ATA_NIEN))) { |
232 | handled += ata_host_intr(ap, qc); | 230 | handled += ata_host_intr(ap, qc); |
233 | } else { | 231 | } else if (is_vsc_sata_int_err(i, int_status)) { |
234 | printk(KERN_DEBUG "%s: ignoring interrupt(s)\n", __FUNCTION__); | 232 | /* |
233 | * On some chips (i.e. Intel 31244), an error | ||
234 | * interrupt will sneak in at initialization | ||
235 | * time (phy state changes). Clearing the SCR | ||
236 | * error register is not required, but it prevents | ||
237 | * the phy state change interrupts from recurring | ||
238 | * later. | ||
239 | */ | ||
240 | u32 err_status; | ||
241 | err_status = vsc_sata_scr_read(ap, SCR_ERROR); | ||
242 | printk(KERN_DEBUG "%s: clearing interrupt, " | ||
243 | "status %x; sata err status %x\n", | ||
244 | __FUNCTION__, | ||
245 | int_status, err_status); | ||
246 | vsc_sata_scr_write(ap, SCR_ERROR, err_status); | ||
247 | /* Clear interrupt status */ | ||
235 | ata_chk_status(ap); | 248 | ata_chk_status(ap); |
236 | handled++; | 249 | handled++; |
237 | } | 250 | } |
238 | |||
239 | } | 251 | } |
240 | } | 252 | } |
241 | } | 253 | } |