diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:52:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-29 11:52:05 -0400 |
commit | c135b6592bd63925397e60425e0301f33f06c7a6 (patch) | |
tree | ad935da857c1a680b2a821e8889993ca5a59a8ff /drivers | |
parent | 5f78e4d33945b291d12765cdd7e4304f437b9361 (diff) | |
parent | 65c0d4e54ae4b81d8c8bb685169e48306656bb5c (diff) |
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
Fix bug - Implement bfin ata interrupt handler to avoid "irq 68 nobody cared" (v2)
sata_mv: Improve naming of main_irq cause/mask identifiers
libata-scsi: improve rbuf handling for simulated commands
libata-scsi: clean up inquiry / mode sense related functions
[MIPS] ATA: Rename routerboard 500 to 532
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ata/Kconfig | 8 | ||||
-rw-r--r-- | drivers/ata/Makefile | 2 | ||||
-rw-r--r-- | drivers/ata/libata-scsi.c | 507 | ||||
-rw-r--r-- | drivers/ata/libata.h | 28 | ||||
-rw-r--r-- | drivers/ata/pata_bf54x.c | 124 | ||||
-rw-r--r-- | drivers/ata/pata_rb532_cf.c (renamed from drivers/ata/pata_rb500_cf.c) | 78 | ||||
-rw-r--r-- | drivers/ata/sata_mv.c | 77 |
7 files changed, 365 insertions, 459 deletions
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 292aa9a0f02f..1c11df9a5f32 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig | |||
@@ -566,11 +566,11 @@ config PATA_RADISYS | |||
566 | 566 | ||
567 | If unsure, say N. | 567 | If unsure, say N. |
568 | 568 | ||
569 | config PATA_RB500 | 569 | config PATA_RB532 |
570 | tristate "RouterBoard 500 PATA CompactFlash support" | 570 | tristate "RouterBoard 532 PATA CompactFlash support" |
571 | depends on MIKROTIK_RB500 | 571 | depends on MIKROTIK_RB532 |
572 | help | 572 | help |
573 | This option enables support for the RouterBoard 500 | 573 | This option enables support for the RouterBoard 532 |
574 | PATA CompactFlash controller. | 574 | PATA CompactFlash controller. |
575 | 575 | ||
576 | If unsure, say N. | 576 | If unsure, say N. |
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index 1fbc2aa648b7..b693d829383a 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile | |||
@@ -55,7 +55,7 @@ obj-$(CONFIG_PATA_PDC2027X) += pata_pdc2027x.o | |||
55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o | 55 | obj-$(CONFIG_PATA_PDC_OLD) += pata_pdc202xx_old.o |
56 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o | 56 | obj-$(CONFIG_PATA_QDI) += pata_qdi.o |
57 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o | 57 | obj-$(CONFIG_PATA_RADISYS) += pata_radisys.o |
58 | obj-$(CONFIG_PATA_RB500) += pata_rb500_cf.o | 58 | obj-$(CONFIG_PATA_RB532) += pata_rb532_cf.o |
59 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o | 59 | obj-$(CONFIG_PATA_RZ1000) += pata_rz1000.o |
60 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o | 60 | obj-$(CONFIG_PATA_SC1200) += pata_sc1200.o |
61 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o | 61 | obj-$(CONFIG_PATA_SERVERWORKS) += pata_serverworks.o |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index a34f32442edf..3ce43920e459 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -49,7 +49,11 @@ | |||
49 | 49 | ||
50 | #include "libata.h" | 50 | #include "libata.h" |
51 | 51 | ||
52 | #define SECTOR_SIZE 512 | 52 | #define SECTOR_SIZE 512 |
53 | #define ATA_SCSI_RBUF_SIZE 4096 | ||
54 | |||
55 | static DEFINE_SPINLOCK(ata_scsi_rbuf_lock); | ||
56 | static u8 ata_scsi_rbuf[ATA_SCSI_RBUF_SIZE]; | ||
53 | 57 | ||
54 | typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc); | 58 | typedef unsigned int (*ata_xlat_func_t)(struct ata_queued_cmd *qc); |
55 | 59 | ||
@@ -179,6 +183,13 @@ DEVICE_ATTR(link_power_management_policy, S_IRUGO | S_IWUSR, | |||
179 | ata_scsi_lpm_show, ata_scsi_lpm_put); | 183 | ata_scsi_lpm_show, ata_scsi_lpm_put); |
180 | EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); | 184 | EXPORT_SYMBOL_GPL(dev_attr_link_power_management_policy); |
181 | 185 | ||
186 | static void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) | ||
187 | { | ||
188 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; | ||
189 | |||
190 | scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); | ||
191 | } | ||
192 | |||
182 | static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, | 193 | static void ata_scsi_invalid_field(struct scsi_cmnd *cmd, |
183 | void (*done)(struct scsi_cmnd *)) | 194 | void (*done)(struct scsi_cmnd *)) |
184 | { | 195 | { |
@@ -1632,53 +1643,48 @@ defer: | |||
1632 | 1643 | ||
1633 | /** | 1644 | /** |
1634 | * ata_scsi_rbuf_get - Map response buffer. | 1645 | * ata_scsi_rbuf_get - Map response buffer. |
1635 | * @cmd: SCSI command containing buffer to be mapped. | 1646 | * @flags: unsigned long variable to store irq enable status |
1636 | * @buf_out: Pointer to mapped area. | 1647 | * @copy_in: copy in from user buffer |
1637 | * | 1648 | * |
1638 | * Maps buffer contained within SCSI command @cmd. | 1649 | * Prepare buffer for simulated SCSI commands. |
1639 | * | 1650 | * |
1640 | * LOCKING: | 1651 | * LOCKING: |
1641 | * spin_lock_irqsave(host lock) | 1652 | * spin_lock_irqsave(ata_scsi_rbuf_lock) on success |
1642 | * | 1653 | * |
1643 | * RETURNS: | 1654 | * RETURNS: |
1644 | * Length of response buffer. | 1655 | * Pointer to response buffer. |
1645 | */ | 1656 | */ |
1646 | 1657 | static void *ata_scsi_rbuf_get(struct scsi_cmnd *cmd, bool copy_in, | |
1647 | static unsigned int ata_scsi_rbuf_get(struct scsi_cmnd *cmd, u8 **buf_out) | 1658 | unsigned long *flags) |
1648 | { | 1659 | { |
1649 | u8 *buf; | 1660 | spin_lock_irqsave(&ata_scsi_rbuf_lock, *flags); |
1650 | unsigned int buflen; | ||
1651 | |||
1652 | struct scatterlist *sg = scsi_sglist(cmd); | ||
1653 | 1661 | ||
1654 | if (sg) { | 1662 | memset(ata_scsi_rbuf, 0, ATA_SCSI_RBUF_SIZE); |
1655 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; | 1663 | if (copy_in) |
1656 | buflen = sg->length; | 1664 | sg_copy_to_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), |
1657 | } else { | 1665 | ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE); |
1658 | buf = NULL; | 1666 | return ata_scsi_rbuf; |
1659 | buflen = 0; | ||
1660 | } | ||
1661 | |||
1662 | *buf_out = buf; | ||
1663 | return buflen; | ||
1664 | } | 1667 | } |
1665 | 1668 | ||
1666 | /** | 1669 | /** |
1667 | * ata_scsi_rbuf_put - Unmap response buffer. | 1670 | * ata_scsi_rbuf_put - Unmap response buffer. |
1668 | * @cmd: SCSI command containing buffer to be unmapped. | 1671 | * @cmd: SCSI command containing buffer to be unmapped. |
1669 | * @buf: buffer to unmap | 1672 | * @copy_out: copy out result |
1673 | * @flags: @flags passed to ata_scsi_rbuf_get() | ||
1670 | * | 1674 | * |
1671 | * Unmaps response buffer contained within @cmd. | 1675 | * Returns rbuf buffer. The result is copied to @cmd's buffer if |
1676 | * @copy_back is true. | ||
1672 | * | 1677 | * |
1673 | * LOCKING: | 1678 | * LOCKING: |
1674 | * spin_lock_irqsave(host lock) | 1679 | * Unlocks ata_scsi_rbuf_lock. |
1675 | */ | 1680 | */ |
1676 | 1681 | static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, bool copy_out, | |
1677 | static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf) | 1682 | unsigned long *flags) |
1678 | { | 1683 | { |
1679 | struct scatterlist *sg = scsi_sglist(cmd); | 1684 | if (copy_out) |
1680 | if (sg) | 1685 | sg_copy_from_buffer(scsi_sglist(cmd), scsi_sg_count(cmd), |
1681 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 1686 | ata_scsi_rbuf, ATA_SCSI_RBUF_SIZE); |
1687 | spin_unlock_irqrestore(&ata_scsi_rbuf_lock, *flags); | ||
1682 | } | 1688 | } |
1683 | 1689 | ||
1684 | /** | 1690 | /** |
@@ -1696,24 +1702,17 @@ static inline void ata_scsi_rbuf_put(struct scsi_cmnd *cmd, u8 *buf) | |||
1696 | * LOCKING: | 1702 | * LOCKING: |
1697 | * spin_lock_irqsave(host lock) | 1703 | * spin_lock_irqsave(host lock) |
1698 | */ | 1704 | */ |
1699 | 1705 | static void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |
1700 | void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | 1706 | unsigned int (*actor)(struct ata_scsi_args *args, u8 *rbuf)) |
1701 | unsigned int (*actor) (struct ata_scsi_args *args, | ||
1702 | u8 *rbuf, unsigned int buflen)) | ||
1703 | { | 1707 | { |
1704 | u8 *rbuf; | 1708 | u8 *rbuf; |
1705 | unsigned int buflen, rc; | 1709 | unsigned int rc; |
1706 | struct scsi_cmnd *cmd = args->cmd; | 1710 | struct scsi_cmnd *cmd = args->cmd; |
1707 | unsigned long flags; | 1711 | unsigned long flags; |
1708 | 1712 | ||
1709 | local_irq_save(flags); | 1713 | rbuf = ata_scsi_rbuf_get(cmd, false, &flags); |
1710 | 1714 | rc = actor(args, rbuf); | |
1711 | buflen = ata_scsi_rbuf_get(cmd, &rbuf); | 1715 | ata_scsi_rbuf_put(cmd, rc == 0, &flags); |
1712 | memset(rbuf, 0, buflen); | ||
1713 | rc = actor(args, rbuf, buflen); | ||
1714 | ata_scsi_rbuf_put(cmd, rbuf); | ||
1715 | |||
1716 | local_irq_restore(flags); | ||
1717 | 1716 | ||
1718 | if (rc == 0) | 1717 | if (rc == 0) |
1719 | cmd->result = SAM_STAT_GOOD; | 1718 | cmd->result = SAM_STAT_GOOD; |
@@ -1721,26 +1720,9 @@ void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |||
1721 | } | 1720 | } |
1722 | 1721 | ||
1723 | /** | 1722 | /** |
1724 | * ATA_SCSI_RBUF_SET - helper to set values in SCSI response buffer | ||
1725 | * @idx: byte index into SCSI response buffer | ||
1726 | * @val: value to set | ||
1727 | * | ||
1728 | * To be used by SCSI command simulator functions. This macros | ||
1729 | * expects two local variables, u8 *rbuf and unsigned int buflen, | ||
1730 | * are in scope. | ||
1731 | * | ||
1732 | * LOCKING: | ||
1733 | * None. | ||
1734 | */ | ||
1735 | #define ATA_SCSI_RBUF_SET(idx, val) do { \ | ||
1736 | if ((idx) < buflen) rbuf[(idx)] = (u8)(val); \ | ||
1737 | } while (0) | ||
1738 | |||
1739 | /** | ||
1740 | * ata_scsiop_inq_std - Simulate INQUIRY command | 1723 | * ata_scsiop_inq_std - Simulate INQUIRY command |
1741 | * @args: device IDENTIFY data / SCSI command of interest. | 1724 | * @args: device IDENTIFY data / SCSI command of interest. |
1742 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1725 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1743 | * @buflen: Response buffer length. | ||
1744 | * | 1726 | * |
1745 | * Returns standard device identification data associated | 1727 | * Returns standard device identification data associated |
1746 | * with non-VPD INQUIRY command output. | 1728 | * with non-VPD INQUIRY command output. |
@@ -1748,10 +1730,17 @@ void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | |||
1748 | * LOCKING: | 1730 | * LOCKING: |
1749 | * spin_lock_irqsave(host lock) | 1731 | * spin_lock_irqsave(host lock) |
1750 | */ | 1732 | */ |
1751 | 1733 | static unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf) | |
1752 | unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, | ||
1753 | unsigned int buflen) | ||
1754 | { | 1734 | { |
1735 | const u8 versions[] = { | ||
1736 | 0x60, /* SAM-3 (no version claimed) */ | ||
1737 | |||
1738 | 0x03, | ||
1739 | 0x20, /* SBC-2 (no version claimed) */ | ||
1740 | |||
1741 | 0x02, | ||
1742 | 0x60 /* SPC-3 (no version claimed) */ | ||
1743 | }; | ||
1755 | u8 hdr[] = { | 1744 | u8 hdr[] = { |
1756 | TYPE_DISK, | 1745 | TYPE_DISK, |
1757 | 0, | 1746 | 0, |
@@ -1760,35 +1749,21 @@ unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, | |||
1760 | 95 - 4 | 1749 | 95 - 4 |
1761 | }; | 1750 | }; |
1762 | 1751 | ||
1752 | VPRINTK("ENTER\n"); | ||
1753 | |||
1763 | /* set scsi removeable (RMB) bit per ata bit */ | 1754 | /* set scsi removeable (RMB) bit per ata bit */ |
1764 | if (ata_id_removeable(args->id)) | 1755 | if (ata_id_removeable(args->id)) |
1765 | hdr[1] |= (1 << 7); | 1756 | hdr[1] |= (1 << 7); |
1766 | 1757 | ||
1767 | VPRINTK("ENTER\n"); | ||
1768 | |||
1769 | memcpy(rbuf, hdr, sizeof(hdr)); | 1758 | memcpy(rbuf, hdr, sizeof(hdr)); |
1759 | memcpy(&rbuf[8], "ATA ", 8); | ||
1760 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); | ||
1761 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); | ||
1770 | 1762 | ||
1771 | if (buflen > 35) { | 1763 | if (rbuf[32] == 0 || rbuf[32] == ' ') |
1772 | memcpy(&rbuf[8], "ATA ", 8); | 1764 | memcpy(&rbuf[32], "n/a ", 4); |
1773 | ata_id_string(args->id, &rbuf[16], ATA_ID_PROD, 16); | ||
1774 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); | ||
1775 | if (rbuf[32] == 0 || rbuf[32] == ' ') | ||
1776 | memcpy(&rbuf[32], "n/a ", 4); | ||
1777 | } | ||
1778 | |||
1779 | if (buflen > 63) { | ||
1780 | const u8 versions[] = { | ||
1781 | 0x60, /* SAM-3 (no version claimed) */ | ||
1782 | |||
1783 | 0x03, | ||
1784 | 0x20, /* SBC-2 (no version claimed) */ | ||
1785 | 1765 | ||
1786 | 0x02, | 1766 | memcpy(rbuf + 59, versions, sizeof(versions)); |
1787 | 0x60 /* SPC-3 (no version claimed) */ | ||
1788 | }; | ||
1789 | |||
1790 | memcpy(rbuf + 59, versions, sizeof(versions)); | ||
1791 | } | ||
1792 | 1767 | ||
1793 | return 0; | 1768 | return 0; |
1794 | } | 1769 | } |
@@ -1797,27 +1772,22 @@ unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, | |||
1797 | * ata_scsiop_inq_00 - Simulate INQUIRY VPD page 0, list of pages | 1772 | * ata_scsiop_inq_00 - Simulate INQUIRY VPD page 0, list of pages |
1798 | * @args: device IDENTIFY data / SCSI command of interest. | 1773 | * @args: device IDENTIFY data / SCSI command of interest. |
1799 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1774 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1800 | * @buflen: Response buffer length. | ||
1801 | * | 1775 | * |
1802 | * Returns list of inquiry VPD pages available. | 1776 | * Returns list of inquiry VPD pages available. |
1803 | * | 1777 | * |
1804 | * LOCKING: | 1778 | * LOCKING: |
1805 | * spin_lock_irqsave(host lock) | 1779 | * spin_lock_irqsave(host lock) |
1806 | */ | 1780 | */ |
1807 | 1781 | static unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf) | |
1808 | unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, | ||
1809 | unsigned int buflen) | ||
1810 | { | 1782 | { |
1811 | const u8 pages[] = { | 1783 | const u8 pages[] = { |
1812 | 0x00, /* page 0x00, this page */ | 1784 | 0x00, /* page 0x00, this page */ |
1813 | 0x80, /* page 0x80, unit serial no page */ | 1785 | 0x80, /* page 0x80, unit serial no page */ |
1814 | 0x83 /* page 0x83, device ident page */ | 1786 | 0x83 /* page 0x83, device ident page */ |
1815 | }; | 1787 | }; |
1816 | rbuf[3] = sizeof(pages); /* number of supported VPD pages */ | ||
1817 | |||
1818 | if (buflen > 6) | ||
1819 | memcpy(rbuf + 4, pages, sizeof(pages)); | ||
1820 | 1788 | ||
1789 | rbuf[3] = sizeof(pages); /* number of supported VPD pages */ | ||
1790 | memcpy(rbuf + 4, pages, sizeof(pages)); | ||
1821 | return 0; | 1791 | return 0; |
1822 | } | 1792 | } |
1823 | 1793 | ||
@@ -1825,16 +1795,13 @@ unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, | |||
1825 | * ata_scsiop_inq_80 - Simulate INQUIRY VPD page 80, device serial number | 1795 | * ata_scsiop_inq_80 - Simulate INQUIRY VPD page 80, device serial number |
1826 | * @args: device IDENTIFY data / SCSI command of interest. | 1796 | * @args: device IDENTIFY data / SCSI command of interest. |
1827 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1797 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1828 | * @buflen: Response buffer length. | ||
1829 | * | 1798 | * |
1830 | * Returns ATA device serial number. | 1799 | * Returns ATA device serial number. |
1831 | * | 1800 | * |
1832 | * LOCKING: | 1801 | * LOCKING: |
1833 | * spin_lock_irqsave(host lock) | 1802 | * spin_lock_irqsave(host lock) |
1834 | */ | 1803 | */ |
1835 | 1804 | static unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf) | |
1836 | unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | ||
1837 | unsigned int buflen) | ||
1838 | { | 1805 | { |
1839 | const u8 hdr[] = { | 1806 | const u8 hdr[] = { |
1840 | 0, | 1807 | 0, |
@@ -1842,12 +1809,10 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | |||
1842 | 0, | 1809 | 0, |
1843 | ATA_ID_SERNO_LEN, /* page len */ | 1810 | ATA_ID_SERNO_LEN, /* page len */ |
1844 | }; | 1811 | }; |
1845 | memcpy(rbuf, hdr, sizeof(hdr)); | ||
1846 | |||
1847 | if (buflen > (ATA_ID_SERNO_LEN + 4 - 1)) | ||
1848 | ata_id_string(args->id, (unsigned char *) &rbuf[4], | ||
1849 | ATA_ID_SERNO, ATA_ID_SERNO_LEN); | ||
1850 | 1812 | ||
1813 | memcpy(rbuf, hdr, sizeof(hdr)); | ||
1814 | ata_id_string(args->id, (unsigned char *) &rbuf[4], | ||
1815 | ATA_ID_SERNO, ATA_ID_SERNO_LEN); | ||
1851 | return 0; | 1816 | return 0; |
1852 | } | 1817 | } |
1853 | 1818 | ||
@@ -1855,7 +1820,6 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | |||
1855 | * ata_scsiop_inq_83 - Simulate INQUIRY VPD page 83, device identity | 1820 | * ata_scsiop_inq_83 - Simulate INQUIRY VPD page 83, device identity |
1856 | * @args: device IDENTIFY data / SCSI command of interest. | 1821 | * @args: device IDENTIFY data / SCSI command of interest. |
1857 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1822 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1858 | * @buflen: Response buffer length. | ||
1859 | * | 1823 | * |
1860 | * Yields two logical unit device identification designators: | 1824 | * Yields two logical unit device identification designators: |
1861 | * - vendor specific ASCII containing the ATA serial number | 1825 | * - vendor specific ASCII containing the ATA serial number |
@@ -1865,41 +1829,37 @@ unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | |||
1865 | * LOCKING: | 1829 | * LOCKING: |
1866 | * spin_lock_irqsave(host lock) | 1830 | * spin_lock_irqsave(host lock) |
1867 | */ | 1831 | */ |
1868 | 1832 | static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf) | |
1869 | unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, | ||
1870 | unsigned int buflen) | ||
1871 | { | 1833 | { |
1872 | int num; | ||
1873 | const int sat_model_serial_desc_len = 68; | 1834 | const int sat_model_serial_desc_len = 68; |
1835 | int num; | ||
1874 | 1836 | ||
1875 | rbuf[1] = 0x83; /* this page code */ | 1837 | rbuf[1] = 0x83; /* this page code */ |
1876 | num = 4; | 1838 | num = 4; |
1877 | 1839 | ||
1878 | if (buflen > (ATA_ID_SERNO_LEN + num + 3)) { | 1840 | /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */ |
1879 | /* piv=0, assoc=lu, code_set=ACSII, designator=vendor */ | 1841 | rbuf[num + 0] = 2; |
1880 | rbuf[num + 0] = 2; | 1842 | rbuf[num + 3] = ATA_ID_SERNO_LEN; |
1881 | rbuf[num + 3] = ATA_ID_SERNO_LEN; | 1843 | num += 4; |
1882 | num += 4; | 1844 | ata_id_string(args->id, (unsigned char *) rbuf + num, |
1883 | ata_id_string(args->id, (unsigned char *) rbuf + num, | 1845 | ATA_ID_SERNO, ATA_ID_SERNO_LEN); |
1884 | ATA_ID_SERNO, ATA_ID_SERNO_LEN); | 1846 | num += ATA_ID_SERNO_LEN; |
1885 | num += ATA_ID_SERNO_LEN; | 1847 | |
1886 | } | 1848 | /* SAT defined lu model and serial numbers descriptor */ |
1887 | if (buflen > (sat_model_serial_desc_len + num + 3)) { | 1849 | /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */ |
1888 | /* SAT defined lu model and serial numbers descriptor */ | 1850 | rbuf[num + 0] = 2; |
1889 | /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */ | 1851 | rbuf[num + 1] = 1; |
1890 | rbuf[num + 0] = 2; | 1852 | rbuf[num + 3] = sat_model_serial_desc_len; |
1891 | rbuf[num + 1] = 1; | 1853 | num += 4; |
1892 | rbuf[num + 3] = sat_model_serial_desc_len; | 1854 | memcpy(rbuf + num, "ATA ", 8); |
1893 | num += 4; | 1855 | num += 8; |
1894 | memcpy(rbuf + num, "ATA ", 8); | 1856 | ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD, |
1895 | num += 8; | 1857 | ATA_ID_PROD_LEN); |
1896 | ata_id_string(args->id, (unsigned char *) rbuf + num, | 1858 | num += ATA_ID_PROD_LEN; |
1897 | ATA_ID_PROD, ATA_ID_PROD_LEN); | 1859 | ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO, |
1898 | num += ATA_ID_PROD_LEN; | 1860 | ATA_ID_SERNO_LEN); |
1899 | ata_id_string(args->id, (unsigned char *) rbuf + num, | 1861 | num += ATA_ID_SERNO_LEN; |
1900 | ATA_ID_SERNO, ATA_ID_SERNO_LEN); | 1862 | |
1901 | num += ATA_ID_SERNO_LEN; | ||
1902 | } | ||
1903 | rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ | 1863 | rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ |
1904 | return 0; | 1864 | return 0; |
1905 | } | 1865 | } |
@@ -1908,35 +1868,26 @@ unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, | |||
1908 | * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info | 1868 | * ata_scsiop_inq_89 - Simulate INQUIRY VPD page 89, ATA info |
1909 | * @args: device IDENTIFY data / SCSI command of interest. | 1869 | * @args: device IDENTIFY data / SCSI command of interest. |
1910 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1870 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1911 | * @buflen: Response buffer length. | ||
1912 | * | 1871 | * |
1913 | * Yields SAT-specified ATA VPD page. | 1872 | * Yields SAT-specified ATA VPD page. |
1914 | * | 1873 | * |
1915 | * LOCKING: | 1874 | * LOCKING: |
1916 | * spin_lock_irqsave(host lock) | 1875 | * spin_lock_irqsave(host lock) |
1917 | */ | 1876 | */ |
1918 | 1877 | static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf) | |
1919 | static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, | ||
1920 | unsigned int buflen) | ||
1921 | { | 1878 | { |
1922 | u8 pbuf[60]; | ||
1923 | struct ata_taskfile tf; | 1879 | struct ata_taskfile tf; |
1924 | unsigned int i; | ||
1925 | 1880 | ||
1926 | if (!buflen) | ||
1927 | return 0; | ||
1928 | |||
1929 | memset(&pbuf, 0, sizeof(pbuf)); | ||
1930 | memset(&tf, 0, sizeof(tf)); | 1881 | memset(&tf, 0, sizeof(tf)); |
1931 | 1882 | ||
1932 | pbuf[1] = 0x89; /* our page code */ | 1883 | rbuf[1] = 0x89; /* our page code */ |
1933 | pbuf[2] = (0x238 >> 8); /* page size fixed at 238h */ | 1884 | rbuf[2] = (0x238 >> 8); /* page size fixed at 238h */ |
1934 | pbuf[3] = (0x238 & 0xff); | 1885 | rbuf[3] = (0x238 & 0xff); |
1935 | 1886 | ||
1936 | memcpy(&pbuf[8], "linux ", 8); | 1887 | memcpy(&rbuf[8], "linux ", 8); |
1937 | memcpy(&pbuf[16], "libata ", 16); | 1888 | memcpy(&rbuf[16], "libata ", 16); |
1938 | memcpy(&pbuf[32], DRV_VERSION, 4); | 1889 | memcpy(&rbuf[32], DRV_VERSION, 4); |
1939 | ata_id_string(args->id, &pbuf[32], ATA_ID_FW_REV, 4); | 1890 | ata_id_string(args->id, &rbuf[32], ATA_ID_FW_REV, 4); |
1940 | 1891 | ||
1941 | /* we don't store the ATA device signature, so we fake it */ | 1892 | /* we don't store the ATA device signature, so we fake it */ |
1942 | 1893 | ||
@@ -1944,19 +1895,12 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, | |||
1944 | tf.lbal = 0x1; | 1895 | tf.lbal = 0x1; |
1945 | tf.nsect = 0x1; | 1896 | tf.nsect = 0x1; |
1946 | 1897 | ||
1947 | ata_tf_to_fis(&tf, 0, 1, &pbuf[36]); /* TODO: PMP? */ | 1898 | ata_tf_to_fis(&tf, 0, 1, &rbuf[36]); /* TODO: PMP? */ |
1948 | pbuf[36] = 0x34; /* force D2H Reg FIS (34h) */ | 1899 | rbuf[36] = 0x34; /* force D2H Reg FIS (34h) */ |
1949 | 1900 | ||
1950 | pbuf[56] = ATA_CMD_ID_ATA; | 1901 | rbuf[56] = ATA_CMD_ID_ATA; |
1951 | 1902 | ||
1952 | i = min(buflen, 60U); | 1903 | memcpy(&rbuf[60], &args->id[0], 512); |
1953 | memcpy(rbuf, &pbuf[0], i); | ||
1954 | buflen -= i; | ||
1955 | |||
1956 | if (!buflen) | ||
1957 | return 0; | ||
1958 | |||
1959 | memcpy(&rbuf[60], &args->id[0], min(buflen, 512U)); | ||
1960 | return 0; | 1904 | return 0; |
1961 | } | 1905 | } |
1962 | 1906 | ||
@@ -1964,7 +1908,6 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, | |||
1964 | * ata_scsiop_noop - Command handler that simply returns success. | 1908 | * ata_scsiop_noop - Command handler that simply returns success. |
1965 | * @args: device IDENTIFY data / SCSI command of interest. | 1909 | * @args: device IDENTIFY data / SCSI command of interest. |
1966 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 1910 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
1967 | * @buflen: Response buffer length. | ||
1968 | * | 1911 | * |
1969 | * No operation. Simply returns success to caller, to indicate | 1912 | * No operation. Simply returns success to caller, to indicate |
1970 | * that the caller should successfully complete this SCSI command. | 1913 | * that the caller should successfully complete this SCSI command. |
@@ -1972,47 +1915,16 @@ static unsigned int ata_scsiop_inq_89(struct ata_scsi_args *args, u8 *rbuf, | |||
1972 | * LOCKING: | 1915 | * LOCKING: |
1973 | * spin_lock_irqsave(host lock) | 1916 | * spin_lock_irqsave(host lock) |
1974 | */ | 1917 | */ |
1975 | 1918 | static unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf) | |
1976 | unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, | ||
1977 | unsigned int buflen) | ||
1978 | { | 1919 | { |
1979 | VPRINTK("ENTER\n"); | 1920 | VPRINTK("ENTER\n"); |
1980 | return 0; | 1921 | return 0; |
1981 | } | 1922 | } |
1982 | 1923 | ||
1983 | /** | 1924 | /** |
1984 | * ata_msense_push - Push data onto MODE SENSE data output buffer | ||
1985 | * @ptr_io: (input/output) Location to store more output data | ||
1986 | * @last: End of output data buffer | ||
1987 | * @buf: Pointer to BLOB being added to output buffer | ||
1988 | * @buflen: Length of BLOB | ||
1989 | * | ||
1990 | * Store MODE SENSE data on an output buffer. | ||
1991 | * | ||
1992 | * LOCKING: | ||
1993 | * None. | ||
1994 | */ | ||
1995 | |||
1996 | static void ata_msense_push(u8 **ptr_io, const u8 *last, | ||
1997 | const u8 *buf, unsigned int buflen) | ||
1998 | { | ||
1999 | u8 *ptr = *ptr_io; | ||
2000 | |||
2001 | if ((ptr + buflen - 1) > last) | ||
2002 | return; | ||
2003 | |||
2004 | memcpy(ptr, buf, buflen); | ||
2005 | |||
2006 | ptr += buflen; | ||
2007 | |||
2008 | *ptr_io = ptr; | ||
2009 | } | ||
2010 | |||
2011 | /** | ||
2012 | * ata_msense_caching - Simulate MODE SENSE caching info page | 1925 | * ata_msense_caching - Simulate MODE SENSE caching info page |
2013 | * @id: device IDENTIFY data | 1926 | * @id: device IDENTIFY data |
2014 | * @ptr_io: (input/output) Location to store more output data | 1927 | * @buf: output buffer |
2015 | * @last: End of output data buffer | ||
2016 | * | 1928 | * |
2017 | * Generate a caching info page, which conditionally indicates | 1929 | * Generate a caching info page, which conditionally indicates |
2018 | * write caching to the SCSI layer, depending on device | 1930 | * write caching to the SCSI layer, depending on device |
@@ -2021,58 +1933,43 @@ static void ata_msense_push(u8 **ptr_io, const u8 *last, | |||
2021 | * LOCKING: | 1933 | * LOCKING: |
2022 | * None. | 1934 | * None. |
2023 | */ | 1935 | */ |
2024 | 1936 | static unsigned int ata_msense_caching(u16 *id, u8 *buf) | |
2025 | static unsigned int ata_msense_caching(u16 *id, u8 **ptr_io, | ||
2026 | const u8 *last) | ||
2027 | { | 1937 | { |
2028 | u8 page[CACHE_MPAGE_LEN]; | 1938 | memcpy(buf, def_cache_mpage, sizeof(def_cache_mpage)); |
2029 | |||
2030 | memcpy(page, def_cache_mpage, sizeof(page)); | ||
2031 | if (ata_id_wcache_enabled(id)) | 1939 | if (ata_id_wcache_enabled(id)) |
2032 | page[2] |= (1 << 2); /* write cache enable */ | 1940 | buf[2] |= (1 << 2); /* write cache enable */ |
2033 | if (!ata_id_rahead_enabled(id)) | 1941 | if (!ata_id_rahead_enabled(id)) |
2034 | page[12] |= (1 << 5); /* disable read ahead */ | 1942 | buf[12] |= (1 << 5); /* disable read ahead */ |
2035 | 1943 | return sizeof(def_cache_mpage); | |
2036 | ata_msense_push(ptr_io, last, page, sizeof(page)); | ||
2037 | return sizeof(page); | ||
2038 | } | 1944 | } |
2039 | 1945 | ||
2040 | /** | 1946 | /** |
2041 | * ata_msense_ctl_mode - Simulate MODE SENSE control mode page | 1947 | * ata_msense_ctl_mode - Simulate MODE SENSE control mode page |
2042 | * @dev: Device associated with this MODE SENSE command | 1948 | * @buf: output buffer |
2043 | * @ptr_io: (input/output) Location to store more output data | ||
2044 | * @last: End of output data buffer | ||
2045 | * | 1949 | * |
2046 | * Generate a generic MODE SENSE control mode page. | 1950 | * Generate a generic MODE SENSE control mode page. |
2047 | * | 1951 | * |
2048 | * LOCKING: | 1952 | * LOCKING: |
2049 | * None. | 1953 | * None. |
2050 | */ | 1954 | */ |
2051 | 1955 | static unsigned int ata_msense_ctl_mode(u8 *buf) | |
2052 | static unsigned int ata_msense_ctl_mode(u8 **ptr_io, const u8 *last) | ||
2053 | { | 1956 | { |
2054 | ata_msense_push(ptr_io, last, def_control_mpage, | 1957 | memcpy(buf, def_control_mpage, sizeof(def_control_mpage)); |
2055 | sizeof(def_control_mpage)); | ||
2056 | return sizeof(def_control_mpage); | 1958 | return sizeof(def_control_mpage); |
2057 | } | 1959 | } |
2058 | 1960 | ||
2059 | /** | 1961 | /** |
2060 | * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page | 1962 | * ata_msense_rw_recovery - Simulate MODE SENSE r/w error recovery page |
2061 | * @dev: Device associated with this MODE SENSE command | 1963 | * @bufp: output buffer |
2062 | * @ptr_io: (input/output) Location to store more output data | ||
2063 | * @last: End of output data buffer | ||
2064 | * | 1964 | * |
2065 | * Generate a generic MODE SENSE r/w error recovery page. | 1965 | * Generate a generic MODE SENSE r/w error recovery page. |
2066 | * | 1966 | * |
2067 | * LOCKING: | 1967 | * LOCKING: |
2068 | * None. | 1968 | * None. |
2069 | */ | 1969 | */ |
2070 | 1970 | static unsigned int ata_msense_rw_recovery(u8 *buf) | |
2071 | static unsigned int ata_msense_rw_recovery(u8 **ptr_io, const u8 *last) | ||
2072 | { | 1971 | { |
2073 | 1972 | memcpy(buf, def_rw_recovery_mpage, sizeof(def_rw_recovery_mpage)); | |
2074 | ata_msense_push(ptr_io, last, def_rw_recovery_mpage, | ||
2075 | sizeof(def_rw_recovery_mpage)); | ||
2076 | return sizeof(def_rw_recovery_mpage); | 1973 | return sizeof(def_rw_recovery_mpage); |
2077 | } | 1974 | } |
2078 | 1975 | ||
@@ -2104,7 +2001,6 @@ static int ata_dev_supports_fua(u16 *id) | |||
2104 | * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands | 2001 | * ata_scsiop_mode_sense - Simulate MODE SENSE 6, 10 commands |
2105 | * @args: device IDENTIFY data / SCSI command of interest. | 2002 | * @args: device IDENTIFY data / SCSI command of interest. |
2106 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 2003 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
2107 | * @buflen: Response buffer length. | ||
2108 | * | 2004 | * |
2109 | * Simulate MODE SENSE commands. Assume this is invoked for direct | 2005 | * Simulate MODE SENSE commands. Assume this is invoked for direct |
2110 | * access devices (e.g. disks) only. There should be no block | 2006 | * access devices (e.g. disks) only. There should be no block |
@@ -2113,19 +2009,17 @@ static int ata_dev_supports_fua(u16 *id) | |||
2113 | * LOCKING: | 2009 | * LOCKING: |
2114 | * spin_lock_irqsave(host lock) | 2010 | * spin_lock_irqsave(host lock) |
2115 | */ | 2011 | */ |
2116 | 2012 | static unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf) | |
2117 | unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | ||
2118 | unsigned int buflen) | ||
2119 | { | 2013 | { |
2120 | struct ata_device *dev = args->dev; | 2014 | struct ata_device *dev = args->dev; |
2121 | u8 *scsicmd = args->cmd->cmnd, *p, *last; | 2015 | u8 *scsicmd = args->cmd->cmnd, *p = rbuf; |
2122 | const u8 sat_blk_desc[] = { | 2016 | const u8 sat_blk_desc[] = { |
2123 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ | 2017 | 0, 0, 0, 0, /* number of blocks: sat unspecified */ |
2124 | 0, | 2018 | 0, |
2125 | 0, 0x2, 0x0 /* block length: 512 bytes */ | 2019 | 0, 0x2, 0x0 /* block length: 512 bytes */ |
2126 | }; | 2020 | }; |
2127 | u8 pg, spg; | 2021 | u8 pg, spg; |
2128 | unsigned int ebd, page_control, six_byte, output_len, alloc_len, minlen; | 2022 | unsigned int ebd, page_control, six_byte; |
2129 | u8 dpofua; | 2023 | u8 dpofua; |
2130 | 2024 | ||
2131 | VPRINTK("ENTER\n"); | 2025 | VPRINTK("ENTER\n"); |
@@ -2148,17 +2042,10 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
2148 | goto invalid_fld; | 2042 | goto invalid_fld; |
2149 | } | 2043 | } |
2150 | 2044 | ||
2151 | if (six_byte) { | 2045 | if (six_byte) |
2152 | output_len = 4 + (ebd ? 8 : 0); | 2046 | p += 4 + (ebd ? 8 : 0); |
2153 | alloc_len = scsicmd[4]; | 2047 | else |
2154 | } else { | 2048 | p += 8 + (ebd ? 8 : 0); |
2155 | output_len = 8 + (ebd ? 8 : 0); | ||
2156 | alloc_len = (scsicmd[7] << 8) + scsicmd[8]; | ||
2157 | } | ||
2158 | minlen = (alloc_len < buflen) ? alloc_len : buflen; | ||
2159 | |||
2160 | p = rbuf + output_len; | ||
2161 | last = rbuf + minlen - 1; | ||
2162 | 2049 | ||
2163 | pg = scsicmd[2] & 0x3f; | 2050 | pg = scsicmd[2] & 0x3f; |
2164 | spg = scsicmd[3]; | 2051 | spg = scsicmd[3]; |
@@ -2171,61 +2058,48 @@ unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | |||
2171 | 2058 | ||
2172 | switch(pg) { | 2059 | switch(pg) { |
2173 | case RW_RECOVERY_MPAGE: | 2060 | case RW_RECOVERY_MPAGE: |
2174 | output_len += ata_msense_rw_recovery(&p, last); | 2061 | p += ata_msense_rw_recovery(p); |
2175 | break; | 2062 | break; |
2176 | 2063 | ||
2177 | case CACHE_MPAGE: | 2064 | case CACHE_MPAGE: |
2178 | output_len += ata_msense_caching(args->id, &p, last); | 2065 | p += ata_msense_caching(args->id, p); |
2179 | break; | 2066 | break; |
2180 | 2067 | ||
2181 | case CONTROL_MPAGE: { | 2068 | case CONTROL_MPAGE: |
2182 | output_len += ata_msense_ctl_mode(&p, last); | 2069 | p += ata_msense_ctl_mode(p); |
2183 | break; | 2070 | break; |
2184 | } | ||
2185 | 2071 | ||
2186 | case ALL_MPAGES: | 2072 | case ALL_MPAGES: |
2187 | output_len += ata_msense_rw_recovery(&p, last); | 2073 | p += ata_msense_rw_recovery(p); |
2188 | output_len += ata_msense_caching(args->id, &p, last); | 2074 | p += ata_msense_caching(args->id, p); |
2189 | output_len += ata_msense_ctl_mode(&p, last); | 2075 | p += ata_msense_ctl_mode(p); |
2190 | break; | 2076 | break; |
2191 | 2077 | ||
2192 | default: /* invalid page code */ | 2078 | default: /* invalid page code */ |
2193 | goto invalid_fld; | 2079 | goto invalid_fld; |
2194 | } | 2080 | } |
2195 | 2081 | ||
2196 | if (minlen < 1) | ||
2197 | return 0; | ||
2198 | |||
2199 | dpofua = 0; | 2082 | dpofua = 0; |
2200 | if (ata_dev_supports_fua(args->id) && (dev->flags & ATA_DFLAG_LBA48) && | 2083 | if (ata_dev_supports_fua(args->id) && (dev->flags & ATA_DFLAG_LBA48) && |
2201 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) | 2084 | (!(dev->flags & ATA_DFLAG_PIO) || dev->multi_count)) |
2202 | dpofua = 1 << 4; | 2085 | dpofua = 1 << 4; |
2203 | 2086 | ||
2204 | if (six_byte) { | 2087 | if (six_byte) { |
2205 | output_len--; | 2088 | rbuf[0] = p - rbuf - 1; |
2206 | rbuf[0] = output_len; | 2089 | rbuf[2] |= dpofua; |
2207 | if (minlen > 2) | ||
2208 | rbuf[2] |= dpofua; | ||
2209 | if (ebd) { | 2090 | if (ebd) { |
2210 | if (minlen > 3) | 2091 | rbuf[3] = sizeof(sat_blk_desc); |
2211 | rbuf[3] = sizeof(sat_blk_desc); | 2092 | memcpy(rbuf + 4, sat_blk_desc, sizeof(sat_blk_desc)); |
2212 | if (minlen > 11) | ||
2213 | memcpy(rbuf + 4, sat_blk_desc, | ||
2214 | sizeof(sat_blk_desc)); | ||
2215 | } | 2093 | } |
2216 | } else { | 2094 | } else { |
2217 | output_len -= 2; | 2095 | unsigned int output_len = p - rbuf - 2; |
2096 | |||
2218 | rbuf[0] = output_len >> 8; | 2097 | rbuf[0] = output_len >> 8; |
2219 | if (minlen > 1) | 2098 | rbuf[1] = output_len; |
2220 | rbuf[1] = output_len; | 2099 | rbuf[3] |= dpofua; |
2221 | if (minlen > 3) | ||
2222 | rbuf[3] |= dpofua; | ||
2223 | if (ebd) { | 2100 | if (ebd) { |
2224 | if (minlen > 7) | 2101 | rbuf[7] = sizeof(sat_blk_desc); |
2225 | rbuf[7] = sizeof(sat_blk_desc); | 2102 | memcpy(rbuf + 8, sat_blk_desc, sizeof(sat_blk_desc)); |
2226 | if (minlen > 15) | ||
2227 | memcpy(rbuf + 8, sat_blk_desc, | ||
2228 | sizeof(sat_blk_desc)); | ||
2229 | } | 2103 | } |
2230 | } | 2104 | } |
2231 | return 0; | 2105 | return 0; |
@@ -2245,15 +2119,13 @@ saving_not_supp: | |||
2245 | * ata_scsiop_read_cap - Simulate READ CAPACITY[ 16] commands | 2119 | * ata_scsiop_read_cap - Simulate READ CAPACITY[ 16] commands |
2246 | * @args: device IDENTIFY data / SCSI command of interest. | 2120 | * @args: device IDENTIFY data / SCSI command of interest. |
2247 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 2121 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
2248 | * @buflen: Response buffer length. | ||
2249 | * | 2122 | * |
2250 | * Simulate READ CAPACITY commands. | 2123 | * Simulate READ CAPACITY commands. |
2251 | * | 2124 | * |
2252 | * LOCKING: | 2125 | * LOCKING: |
2253 | * None. | 2126 | * None. |
2254 | */ | 2127 | */ |
2255 | unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | 2128 | static unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf) |
2256 | unsigned int buflen) | ||
2257 | { | 2129 | { |
2258 | u64 last_lba = args->dev->n_sectors - 1; /* LBA of the last block */ | 2130 | u64 last_lba = args->dev->n_sectors - 1; /* LBA of the last block */ |
2259 | 2131 | ||
@@ -2264,28 +2136,28 @@ unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | |||
2264 | last_lba = 0xffffffff; | 2136 | last_lba = 0xffffffff; |
2265 | 2137 | ||
2266 | /* sector count, 32-bit */ | 2138 | /* sector count, 32-bit */ |
2267 | ATA_SCSI_RBUF_SET(0, last_lba >> (8 * 3)); | 2139 | rbuf[0] = last_lba >> (8 * 3); |
2268 | ATA_SCSI_RBUF_SET(1, last_lba >> (8 * 2)); | 2140 | rbuf[1] = last_lba >> (8 * 2); |
2269 | ATA_SCSI_RBUF_SET(2, last_lba >> (8 * 1)); | 2141 | rbuf[2] = last_lba >> (8 * 1); |
2270 | ATA_SCSI_RBUF_SET(3, last_lba); | 2142 | rbuf[3] = last_lba; |
2271 | 2143 | ||
2272 | /* sector size */ | 2144 | /* sector size */ |
2273 | ATA_SCSI_RBUF_SET(6, ATA_SECT_SIZE >> 8); | 2145 | rbuf[6] = ATA_SECT_SIZE >> 8; |
2274 | ATA_SCSI_RBUF_SET(7, ATA_SECT_SIZE & 0xff); | 2146 | rbuf[7] = ATA_SECT_SIZE & 0xff; |
2275 | } else { | 2147 | } else { |
2276 | /* sector count, 64-bit */ | 2148 | /* sector count, 64-bit */ |
2277 | ATA_SCSI_RBUF_SET(0, last_lba >> (8 * 7)); | 2149 | rbuf[0] = last_lba >> (8 * 7); |
2278 | ATA_SCSI_RBUF_SET(1, last_lba >> (8 * 6)); | 2150 | rbuf[1] = last_lba >> (8 * 6); |
2279 | ATA_SCSI_RBUF_SET(2, last_lba >> (8 * 5)); | 2151 | rbuf[2] = last_lba >> (8 * 5); |
2280 | ATA_SCSI_RBUF_SET(3, last_lba >> (8 * 4)); | 2152 | rbuf[3] = last_lba >> (8 * 4); |
2281 | ATA_SCSI_RBUF_SET(4, last_lba >> (8 * 3)); | 2153 | rbuf[4] = last_lba >> (8 * 3); |
2282 | ATA_SCSI_RBUF_SET(5, last_lba >> (8 * 2)); | 2154 | rbuf[5] = last_lba >> (8 * 2); |
2283 | ATA_SCSI_RBUF_SET(6, last_lba >> (8 * 1)); | 2155 | rbuf[6] = last_lba >> (8 * 1); |
2284 | ATA_SCSI_RBUF_SET(7, last_lba); | 2156 | rbuf[7] = last_lba; |
2285 | 2157 | ||
2286 | /* sector size */ | 2158 | /* sector size */ |
2287 | ATA_SCSI_RBUF_SET(10, ATA_SECT_SIZE >> 8); | 2159 | rbuf[10] = ATA_SECT_SIZE >> 8; |
2288 | ATA_SCSI_RBUF_SET(11, ATA_SECT_SIZE & 0xff); | 2160 | rbuf[11] = ATA_SECT_SIZE & 0xff; |
2289 | } | 2161 | } |
2290 | 2162 | ||
2291 | return 0; | 2163 | return 0; |
@@ -2295,16 +2167,13 @@ unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | |||
2295 | * ata_scsiop_report_luns - Simulate REPORT LUNS command | 2167 | * ata_scsiop_report_luns - Simulate REPORT LUNS command |
2296 | * @args: device IDENTIFY data / SCSI command of interest. | 2168 | * @args: device IDENTIFY data / SCSI command of interest. |
2297 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. | 2169 | * @rbuf: Response buffer, to which simulated SCSI cmd output is sent. |
2298 | * @buflen: Response buffer length. | ||
2299 | * | 2170 | * |
2300 | * Simulate REPORT LUNS command. | 2171 | * Simulate REPORT LUNS command. |
2301 | * | 2172 | * |
2302 | * LOCKING: | 2173 | * LOCKING: |
2303 | * spin_lock_irqsave(host lock) | 2174 | * spin_lock_irqsave(host lock) |
2304 | */ | 2175 | */ |
2305 | 2176 | static unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf) | |
2306 | unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, | ||
2307 | unsigned int buflen) | ||
2308 | { | 2177 | { |
2309 | VPRINTK("ENTER\n"); | 2178 | VPRINTK("ENTER\n"); |
2310 | rbuf[3] = 8; /* just one lun, LUN 0, size 8 bytes */ | 2179 | rbuf[3] = 8; /* just one lun, LUN 0, size 8 bytes */ |
@@ -2312,53 +2181,6 @@ unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, | |||
2312 | return 0; | 2181 | return 0; |
2313 | } | 2182 | } |
2314 | 2183 | ||
2315 | /** | ||
2316 | * ata_scsi_set_sense - Set SCSI sense data and status | ||
2317 | * @cmd: SCSI request to be handled | ||
2318 | * @sk: SCSI-defined sense key | ||
2319 | * @asc: SCSI-defined additional sense code | ||
2320 | * @ascq: SCSI-defined additional sense code qualifier | ||
2321 | * | ||
2322 | * Helper function that builds a valid fixed format, current | ||
2323 | * response code and the given sense key (sk), additional sense | ||
2324 | * code (asc) and additional sense code qualifier (ascq) with | ||
2325 | * a SCSI command status of %SAM_STAT_CHECK_CONDITION and | ||
2326 | * DRIVER_SENSE set in the upper bits of scsi_cmnd::result . | ||
2327 | * | ||
2328 | * LOCKING: | ||
2329 | * Not required | ||
2330 | */ | ||
2331 | |||
2332 | void ata_scsi_set_sense(struct scsi_cmnd *cmd, u8 sk, u8 asc, u8 ascq) | ||
2333 | { | ||
2334 | cmd->result = (DRIVER_SENSE << 24) | SAM_STAT_CHECK_CONDITION; | ||
2335 | |||
2336 | scsi_build_sense_buffer(0, cmd->sense_buffer, sk, asc, ascq); | ||
2337 | } | ||
2338 | |||
2339 | /** | ||
2340 | * ata_scsi_badcmd - End a SCSI request with an error | ||
2341 | * @cmd: SCSI request to be handled | ||
2342 | * @done: SCSI command completion function | ||
2343 | * @asc: SCSI-defined additional sense code | ||
2344 | * @ascq: SCSI-defined additional sense code qualifier | ||
2345 | * | ||
2346 | * Helper function that completes a SCSI command with | ||
2347 | * %SAM_STAT_CHECK_CONDITION, with a sense key %ILLEGAL_REQUEST | ||
2348 | * and the specified additional sense codes. | ||
2349 | * | ||
2350 | * LOCKING: | ||
2351 | * spin_lock_irqsave(host lock) | ||
2352 | */ | ||
2353 | |||
2354 | void ata_scsi_badcmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *), u8 asc, u8 ascq) | ||
2355 | { | ||
2356 | DPRINTK("ENTER\n"); | ||
2357 | ata_scsi_set_sense(cmd, ILLEGAL_REQUEST, asc, ascq); | ||
2358 | |||
2359 | done(cmd); | ||
2360 | } | ||
2361 | |||
2362 | static void atapi_sense_complete(struct ata_queued_cmd *qc) | 2184 | static void atapi_sense_complete(struct ata_queued_cmd *qc) |
2363 | { | 2185 | { |
2364 | if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) { | 2186 | if (qc->err_mask && ((qc->err_mask & AC_ERR_DEV) == 0)) { |
@@ -2485,13 +2307,10 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2485 | u8 *scsicmd = cmd->cmnd; | 2307 | u8 *scsicmd = cmd->cmnd; |
2486 | 2308 | ||
2487 | if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { | 2309 | if ((scsicmd[0] == INQUIRY) && ((scsicmd[1] & 0x03) == 0)) { |
2488 | u8 *buf = NULL; | ||
2489 | unsigned int buflen; | ||
2490 | unsigned long flags; | 2310 | unsigned long flags; |
2311 | u8 *buf; | ||
2491 | 2312 | ||
2492 | local_irq_save(flags); | 2313 | buf = ata_scsi_rbuf_get(cmd, true, &flags); |
2493 | |||
2494 | buflen = ata_scsi_rbuf_get(cmd, &buf); | ||
2495 | 2314 | ||
2496 | /* ATAPI devices typically report zero for their SCSI version, | 2315 | /* ATAPI devices typically report zero for their SCSI version, |
2497 | * and sometimes deviate from the spec WRT response data | 2316 | * and sometimes deviate from the spec WRT response data |
@@ -2506,9 +2325,7 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2506 | buf[3] = 0x32; | 2325 | buf[3] = 0x32; |
2507 | } | 2326 | } |
2508 | 2327 | ||
2509 | ata_scsi_rbuf_put(cmd, buf); | 2328 | ata_scsi_rbuf_put(cmd, true, &flags); |
2510 | |||
2511 | local_irq_restore(flags); | ||
2512 | } | 2329 | } |
2513 | 2330 | ||
2514 | cmd->result = SAM_STAT_GOOD; | 2331 | cmd->result = SAM_STAT_GOOD; |
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h index ae2cfd95d43e..4514283937ea 100644 --- a/drivers/ata/libata.h +++ b/drivers/ata/libata.h | |||
@@ -146,34 +146,6 @@ extern void ata_scsi_scan_host(struct ata_port *ap, int sync); | |||
146 | extern int ata_scsi_offline_dev(struct ata_device *dev); | 146 | extern int ata_scsi_offline_dev(struct ata_device *dev); |
147 | extern void ata_scsi_media_change_notify(struct ata_device *dev); | 147 | extern void ata_scsi_media_change_notify(struct ata_device *dev); |
148 | extern void ata_scsi_hotplug(struct work_struct *work); | 148 | extern void ata_scsi_hotplug(struct work_struct *work); |
149 | extern unsigned int ata_scsiop_inq_std(struct ata_scsi_args *args, u8 *rbuf, | ||
150 | unsigned int buflen); | ||
151 | |||
152 | extern unsigned int ata_scsiop_inq_00(struct ata_scsi_args *args, u8 *rbuf, | ||
153 | unsigned int buflen); | ||
154 | |||
155 | extern unsigned int ata_scsiop_inq_80(struct ata_scsi_args *args, u8 *rbuf, | ||
156 | unsigned int buflen); | ||
157 | extern unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf, | ||
158 | unsigned int buflen); | ||
159 | extern unsigned int ata_scsiop_noop(struct ata_scsi_args *args, u8 *rbuf, | ||
160 | unsigned int buflen); | ||
161 | extern unsigned int ata_scsiop_sync_cache(struct ata_scsi_args *args, u8 *rbuf, | ||
162 | unsigned int buflen); | ||
163 | extern unsigned int ata_scsiop_mode_sense(struct ata_scsi_args *args, u8 *rbuf, | ||
164 | unsigned int buflen); | ||
165 | extern unsigned int ata_scsiop_read_cap(struct ata_scsi_args *args, u8 *rbuf, | ||
166 | unsigned int buflen); | ||
167 | extern unsigned int ata_scsiop_report_luns(struct ata_scsi_args *args, u8 *rbuf, | ||
168 | unsigned int buflen); | ||
169 | extern void ata_scsi_badcmd(struct scsi_cmnd *cmd, | ||
170 | void (*done)(struct scsi_cmnd *), | ||
171 | u8 asc, u8 ascq); | ||
172 | extern void ata_scsi_set_sense(struct scsi_cmnd *cmd, | ||
173 | u8 sk, u8 asc, u8 ascq); | ||
174 | extern void ata_scsi_rbuf_fill(struct ata_scsi_args *args, | ||
175 | unsigned int (*actor) (struct ata_scsi_args *args, | ||
176 | u8 *rbuf, unsigned int buflen)); | ||
177 | extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); | 149 | extern void ata_schedule_scsi_eh(struct Scsi_Host *shost); |
178 | extern void ata_scsi_dev_rescan(struct work_struct *work); | 150 | extern void ata_scsi_dev_rescan(struct work_struct *work); |
179 | extern int ata_bus_probe(struct ata_port *ap); | 151 | extern int ata_bus_probe(struct ata_port *ap); |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index a75de0684c15..9ab89732cf94 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1272,8 +1272,8 @@ static void bfin_freeze(struct ata_port *ap) | |||
1272 | 1272 | ||
1273 | void bfin_thaw(struct ata_port *ap) | 1273 | void bfin_thaw(struct ata_port *ap) |
1274 | { | 1274 | { |
1275 | dev_dbg(ap->dev, "in atapi dma thaw\n"); | ||
1275 | bfin_check_status(ap); | 1276 | bfin_check_status(ap); |
1276 | bfin_irq_clear(ap); | ||
1277 | bfin_irq_on(ap); | 1277 | bfin_irq_on(ap); |
1278 | } | 1278 | } |
1279 | 1279 | ||
@@ -1339,13 +1339,130 @@ static int bfin_port_start(struct ata_port *ap) | |||
1339 | return 0; | 1339 | return 0; |
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | static unsigned int bfin_ata_host_intr(struct ata_port *ap, | ||
1343 | struct ata_queued_cmd *qc) | ||
1344 | { | ||
1345 | struct ata_eh_info *ehi = &ap->link.eh_info; | ||
1346 | u8 status, host_stat = 0; | ||
1347 | |||
1348 | VPRINTK("ata%u: protocol %d task_state %d\n", | ||
1349 | ap->print_id, qc->tf.protocol, ap->hsm_task_state); | ||
1350 | |||
1351 | /* Check whether we are expecting interrupt in this state */ | ||
1352 | switch (ap->hsm_task_state) { | ||
1353 | case HSM_ST_FIRST: | ||
1354 | /* Some pre-ATAPI-4 devices assert INTRQ | ||
1355 | * at this state when ready to receive CDB. | ||
1356 | */ | ||
1357 | |||
1358 | /* Check the ATA_DFLAG_CDB_INTR flag is enough here. | ||
1359 | * The flag was turned on only for atapi devices. | ||
1360 | * No need to check is_atapi_taskfile(&qc->tf) again. | ||
1361 | */ | ||
1362 | if (!(qc->dev->flags & ATA_DFLAG_CDB_INTR)) | ||
1363 | goto idle_irq; | ||
1364 | break; | ||
1365 | case HSM_ST_LAST: | ||
1366 | if (qc->tf.protocol == ATA_PROT_DMA || | ||
1367 | qc->tf.protocol == ATAPI_PROT_DMA) { | ||
1368 | /* check status of DMA engine */ | ||
1369 | host_stat = ap->ops->bmdma_status(ap); | ||
1370 | VPRINTK("ata%u: host_stat 0x%X\n", | ||
1371 | ap->print_id, host_stat); | ||
1372 | |||
1373 | /* if it's not our irq... */ | ||
1374 | if (!(host_stat & ATA_DMA_INTR)) | ||
1375 | goto idle_irq; | ||
1376 | |||
1377 | /* before we do anything else, clear DMA-Start bit */ | ||
1378 | ap->ops->bmdma_stop(qc); | ||
1379 | |||
1380 | if (unlikely(host_stat & ATA_DMA_ERR)) { | ||
1381 | /* error when transfering data to/from memory */ | ||
1382 | qc->err_mask |= AC_ERR_HOST_BUS; | ||
1383 | ap->hsm_task_state = HSM_ST_ERR; | ||
1384 | } | ||
1385 | } | ||
1386 | break; | ||
1387 | case HSM_ST: | ||
1388 | break; | ||
1389 | default: | ||
1390 | goto idle_irq; | ||
1391 | } | ||
1392 | |||
1393 | /* check altstatus */ | ||
1394 | status = ap->ops->sff_check_altstatus(ap); | ||
1395 | if (status & ATA_BUSY) | ||
1396 | goto busy_ata; | ||
1397 | |||
1398 | /* check main status, clearing INTRQ */ | ||
1399 | status = ap->ops->sff_check_status(ap); | ||
1400 | if (unlikely(status & ATA_BUSY)) | ||
1401 | goto busy_ata; | ||
1402 | |||
1403 | /* ack bmdma irq events */ | ||
1404 | ap->ops->sff_irq_clear(ap); | ||
1405 | |||
1406 | ata_sff_hsm_move(ap, qc, status, 0); | ||
1407 | |||
1408 | if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA || | ||
1409 | qc->tf.protocol == ATAPI_PROT_DMA)) | ||
1410 | ata_ehi_push_desc(ehi, "BMDMA stat 0x%x", host_stat); | ||
1411 | |||
1412 | busy_ata: | ||
1413 | return 1; /* irq handled */ | ||
1414 | |||
1415 | idle_irq: | ||
1416 | ap->stats.idle_irq++; | ||
1417 | |||
1418 | #ifdef ATA_IRQ_TRAP | ||
1419 | if ((ap->stats.idle_irq % 1000) == 0) { | ||
1420 | ap->ops->irq_ack(ap, 0); /* debug trap */ | ||
1421 | ata_port_printk(ap, KERN_WARNING, "irq trap\n"); | ||
1422 | return 1; | ||
1423 | } | ||
1424 | #endif | ||
1425 | return 0; /* irq not handled */ | ||
1426 | } | ||
1427 | |||
1428 | static irqreturn_t bfin_ata_interrupt(int irq, void *dev_instance) | ||
1429 | { | ||
1430 | struct ata_host *host = dev_instance; | ||
1431 | unsigned int i; | ||
1432 | unsigned int handled = 0; | ||
1433 | unsigned long flags; | ||
1434 | |||
1435 | /* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */ | ||
1436 | spin_lock_irqsave(&host->lock, flags); | ||
1437 | |||
1438 | for (i = 0; i < host->n_ports; i++) { | ||
1439 | struct ata_port *ap; | ||
1440 | |||
1441 | ap = host->ports[i]; | ||
1442 | if (ap && | ||
1443 | !(ap->flags & ATA_FLAG_DISABLED)) { | ||
1444 | struct ata_queued_cmd *qc; | ||
1445 | |||
1446 | qc = ata_qc_from_tag(ap, ap->link.active_tag); | ||
1447 | if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) && | ||
1448 | (qc->flags & ATA_QCFLAG_ACTIVE)) | ||
1449 | handled |= bfin_ata_host_intr(ap, qc); | ||
1450 | } | ||
1451 | } | ||
1452 | |||
1453 | spin_unlock_irqrestore(&host->lock, flags); | ||
1454 | |||
1455 | return IRQ_RETVAL(handled); | ||
1456 | } | ||
1457 | |||
1458 | |||
1342 | static struct scsi_host_template bfin_sht = { | 1459 | static struct scsi_host_template bfin_sht = { |
1343 | ATA_BASE_SHT(DRV_NAME), | 1460 | ATA_BASE_SHT(DRV_NAME), |
1344 | .sg_tablesize = SG_NONE, | 1461 | .sg_tablesize = SG_NONE, |
1345 | .dma_boundary = ATA_DMA_BOUNDARY, | 1462 | .dma_boundary = ATA_DMA_BOUNDARY, |
1346 | }; | 1463 | }; |
1347 | 1464 | ||
1348 | static const struct ata_port_operations bfin_pata_ops = { | 1465 | static struct ata_port_operations bfin_pata_ops = { |
1349 | .inherits = &ata_sff_port_ops, | 1466 | .inherits = &ata_sff_port_ops, |
1350 | 1467 | ||
1351 | .set_piomode = bfin_set_piomode, | 1468 | .set_piomode = bfin_set_piomode, |
@@ -1370,7 +1487,6 @@ static const struct ata_port_operations bfin_pata_ops = { | |||
1370 | .thaw = bfin_thaw, | 1487 | .thaw = bfin_thaw, |
1371 | .softreset = bfin_softreset, | 1488 | .softreset = bfin_softreset, |
1372 | .postreset = bfin_postreset, | 1489 | .postreset = bfin_postreset, |
1373 | .post_internal_cmd = bfin_bmdma_stop, | ||
1374 | 1490 | ||
1375 | .sff_irq_clear = bfin_irq_clear, | 1491 | .sff_irq_clear = bfin_irq_clear, |
1376 | .sff_irq_on = bfin_irq_on, | 1492 | .sff_irq_on = bfin_irq_on, |
@@ -1507,7 +1623,7 @@ static int __devinit bfin_atapi_probe(struct platform_device *pdev) | |||
1507 | } | 1623 | } |
1508 | 1624 | ||
1509 | if (ata_host_activate(host, platform_get_irq(pdev, 0), | 1625 | if (ata_host_activate(host, platform_get_irq(pdev, 0), |
1510 | ata_sff_interrupt, IRQF_SHARED, &bfin_sht) != 0) { | 1626 | bfin_ata_interrupt, IRQF_SHARED, &bfin_sht) != 0) { |
1511 | peripheral_free_list(atapi_io_port); | 1627 | peripheral_free_list(atapi_io_port); |
1512 | dev_err(&pdev->dev, "Fail to attach ATAPI device\n"); | 1628 | dev_err(&pdev->dev, "Fail to attach ATAPI device\n"); |
1513 | return -ENODEV; | 1629 | return -ENODEV; |
diff --git a/drivers/ata/pata_rb500_cf.c b/drivers/ata/pata_rb532_cf.c index 4345174aaeec..a108d259f19d 100644 --- a/drivers/ata/pata_rb500_cf.c +++ b/drivers/ata/pata_rb532_cf.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | #include <asm/gpio.h> | 33 | #include <asm/gpio.h> |
34 | 34 | ||
35 | #define DRV_NAME "pata-rb500-cf" | 35 | #define DRV_NAME "pata-rb532-cf" |
36 | #define DRV_VERSION "0.1.0" | 36 | #define DRV_VERSION "0.1.0" |
37 | #define DRV_DESC "PATA driver for RouterBOARD 532 Compact Flash" | 37 | #define DRV_DESC "PATA driver for RouterBOARD 532 Compact Flash" |
38 | 38 | ||
@@ -43,7 +43,7 @@ | |||
43 | #define RB500_CF_REG_CTRL 0x080E | 43 | #define RB500_CF_REG_CTRL 0x080E |
44 | #define RB500_CF_REG_DATA 0x0C00 | 44 | #define RB500_CF_REG_DATA 0x0C00 |
45 | 45 | ||
46 | struct rb500_cf_info { | 46 | struct rb532_cf_info { |
47 | void __iomem *iobase; | 47 | void __iomem *iobase; |
48 | unsigned int gpio_line; | 48 | unsigned int gpio_line; |
49 | int frozen; | 49 | int frozen; |
@@ -52,10 +52,10 @@ struct rb500_cf_info { | |||
52 | 52 | ||
53 | /* ------------------------------------------------------------------------ */ | 53 | /* ------------------------------------------------------------------------ */ |
54 | 54 | ||
55 | static inline void rb500_pata_finish_io(struct ata_port *ap) | 55 | static inline void rb532_pata_finish_io(struct ata_port *ap) |
56 | { | 56 | { |
57 | struct ata_host *ah = ap->host; | 57 | struct ata_host *ah = ap->host; |
58 | struct rb500_cf_info *info = ah->private_data; | 58 | struct rb532_cf_info *info = ah->private_data; |
59 | 59 | ||
60 | ata_sff_altstatus(ap); | 60 | ata_sff_altstatus(ap); |
61 | ndelay(RB500_CF_IO_DELAY); | 61 | ndelay(RB500_CF_IO_DELAY); |
@@ -63,14 +63,14 @@ static inline void rb500_pata_finish_io(struct ata_port *ap) | |||
63 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); | 63 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_HIGH); |
64 | } | 64 | } |
65 | 65 | ||
66 | static void rb500_pata_exec_command(struct ata_port *ap, | 66 | static void rb532_pata_exec_command(struct ata_port *ap, |
67 | const struct ata_taskfile *tf) | 67 | const struct ata_taskfile *tf) |
68 | { | 68 | { |
69 | writeb(tf->command, ap->ioaddr.command_addr); | 69 | writeb(tf->command, ap->ioaddr.command_addr); |
70 | rb500_pata_finish_io(ap); | 70 | rb532_pata_finish_io(ap); |
71 | } | 71 | } |
72 | 72 | ||
73 | static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf, | 73 | static void rb532_pata_data_xfer(struct ata_device *adev, unsigned char *buf, |
74 | unsigned int buflen, int write_data) | 74 | unsigned int buflen, int write_data) |
75 | { | 75 | { |
76 | struct ata_port *ap = adev->link->ap; | 76 | struct ata_port *ap = adev->link->ap; |
@@ -84,27 +84,27 @@ static void rb500_pata_data_xfer(struct ata_device *adev, unsigned char *buf, | |||
84 | *buf = readb(ioaddr); | 84 | *buf = readb(ioaddr); |
85 | } | 85 | } |
86 | 86 | ||
87 | rb500_pata_finish_io(adev->link->ap); | 87 | rb532_pata_finish_io(adev->link->ap); |
88 | } | 88 | } |
89 | 89 | ||
90 | static void rb500_pata_freeze(struct ata_port *ap) | 90 | static void rb532_pata_freeze(struct ata_port *ap) |
91 | { | 91 | { |
92 | struct rb500_cf_info *info = ap->host->private_data; | 92 | struct rb532_cf_info *info = ap->host->private_data; |
93 | 93 | ||
94 | info->frozen = 1; | 94 | info->frozen = 1; |
95 | } | 95 | } |
96 | 96 | ||
97 | static void rb500_pata_thaw(struct ata_port *ap) | 97 | static void rb532_pata_thaw(struct ata_port *ap) |
98 | { | 98 | { |
99 | struct rb500_cf_info *info = ap->host->private_data; | 99 | struct rb532_cf_info *info = ap->host->private_data; |
100 | 100 | ||
101 | info->frozen = 0; | 101 | info->frozen = 0; |
102 | } | 102 | } |
103 | 103 | ||
104 | static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance) | 104 | static irqreturn_t rb532_pata_irq_handler(int irq, void *dev_instance) |
105 | { | 105 | { |
106 | struct ata_host *ah = dev_instance; | 106 | struct ata_host *ah = dev_instance; |
107 | struct rb500_cf_info *info = ah->private_data; | 107 | struct rb532_cf_info *info = ah->private_data; |
108 | 108 | ||
109 | if (gpio_get_value(info->gpio_line)) { | 109 | if (gpio_get_value(info->gpio_line)) { |
110 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); | 110 | set_irq_type(info->irq, IRQ_TYPE_LEVEL_LOW); |
@@ -117,30 +117,30 @@ static irqreturn_t rb500_pata_irq_handler(int irq, void *dev_instance) | |||
117 | return IRQ_HANDLED; | 117 | return IRQ_HANDLED; |
118 | } | 118 | } |
119 | 119 | ||
120 | static struct ata_port_operations rb500_pata_port_ops = { | 120 | static struct ata_port_operations rb532_pata_port_ops = { |
121 | .inherits = &ata_sff_port_ops, | 121 | .inherits = &ata_sff_port_ops, |
122 | .sff_exec_command = rb500_pata_exec_command, | 122 | .sff_exec_command = rb532_pata_exec_command, |
123 | .sff_data_xfer = rb500_pata_data_xfer, | 123 | .sff_data_xfer = rb532_pata_data_xfer, |
124 | .freeze = rb500_pata_freeze, | 124 | .freeze = rb532_pata_freeze, |
125 | .thaw = rb500_pata_thaw, | 125 | .thaw = rb532_pata_thaw, |
126 | }; | 126 | }; |
127 | 127 | ||
128 | /* ------------------------------------------------------------------------ */ | 128 | /* ------------------------------------------------------------------------ */ |
129 | 129 | ||
130 | static struct scsi_host_template rb500_pata_sht = { | 130 | static struct scsi_host_template rb532_pata_sht = { |
131 | ATA_PIO_SHT(DRV_NAME), | 131 | ATA_PIO_SHT(DRV_NAME), |
132 | }; | 132 | }; |
133 | 133 | ||
134 | /* ------------------------------------------------------------------------ */ | 134 | /* ------------------------------------------------------------------------ */ |
135 | 135 | ||
136 | static void rb500_pata_setup_ports(struct ata_host *ah) | 136 | static void rb532_pata_setup_ports(struct ata_host *ah) |
137 | { | 137 | { |
138 | struct rb500_cf_info *info = ah->private_data; | 138 | struct rb532_cf_info *info = ah->private_data; |
139 | struct ata_port *ap; | 139 | struct ata_port *ap; |
140 | 140 | ||
141 | ap = ah->ports[0]; | 141 | ap = ah->ports[0]; |
142 | 142 | ||
143 | ap->ops = &rb500_pata_port_ops; | 143 | ap->ops = &rb532_pata_port_ops; |
144 | ap->pio_mask = 0x1f; /* PIO4 */ | 144 | ap->pio_mask = 0x1f; /* PIO4 */ |
145 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; | 145 | ap->flags = ATA_FLAG_NO_LEGACY | ATA_FLAG_MMIO; |
146 | 146 | ||
@@ -153,13 +153,13 @@ static void rb500_pata_setup_ports(struct ata_host *ah) | |||
153 | ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA; | 153 | ap->ioaddr.data_addr = info->iobase + RB500_CF_REG_DATA; |
154 | } | 154 | } |
155 | 155 | ||
156 | static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) | 156 | static __devinit int rb532_pata_driver_probe(struct platform_device *pdev) |
157 | { | 157 | { |
158 | unsigned int irq; | 158 | unsigned int irq; |
159 | int gpio; | 159 | int gpio; |
160 | struct resource *res; | 160 | struct resource *res; |
161 | struct ata_host *ah; | 161 | struct ata_host *ah; |
162 | struct rb500_cf_info *info; | 162 | struct rb532_cf_info *info; |
163 | int ret; | 163 | int ret; |
164 | 164 | ||
165 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 165 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
@@ -213,10 +213,10 @@ static __devinit int rb500_pata_driver_probe(struct platform_device *pdev) | |||
213 | goto err_free_gpio; | 213 | goto err_free_gpio; |
214 | } | 214 | } |
215 | 215 | ||
216 | rb500_pata_setup_ports(ah); | 216 | rb532_pata_setup_ports(ah); |
217 | 217 | ||
218 | ret = ata_host_activate(ah, irq, rb500_pata_irq_handler, | 218 | ret = ata_host_activate(ah, irq, rb532_pata_irq_handler, |
219 | IRQF_TRIGGER_LOW, &rb500_pata_sht); | 219 | IRQF_TRIGGER_LOW, &rb532_pata_sht); |
220 | if (ret) | 220 | if (ret) |
221 | goto err_free_gpio; | 221 | goto err_free_gpio; |
222 | 222 | ||
@@ -228,10 +228,10 @@ err_free_gpio: | |||
228 | return ret; | 228 | return ret; |
229 | } | 229 | } |
230 | 230 | ||
231 | static __devexit int rb500_pata_driver_remove(struct platform_device *pdev) | 231 | static __devexit int rb532_pata_driver_remove(struct platform_device *pdev) |
232 | { | 232 | { |
233 | struct ata_host *ah = platform_get_drvdata(pdev); | 233 | struct ata_host *ah = platform_get_drvdata(pdev); |
234 | struct rb500_cf_info *info = ah->private_data; | 234 | struct rb532_cf_info *info = ah->private_data; |
235 | 235 | ||
236 | ata_host_detach(ah); | 236 | ata_host_detach(ah); |
237 | gpio_free(info->gpio_line); | 237 | gpio_free(info->gpio_line); |
@@ -242,9 +242,9 @@ static __devexit int rb500_pata_driver_remove(struct platform_device *pdev) | |||
242 | /* work with hotplug and coldplug */ | 242 | /* work with hotplug and coldplug */ |
243 | MODULE_ALIAS("platform:" DRV_NAME); | 243 | MODULE_ALIAS("platform:" DRV_NAME); |
244 | 244 | ||
245 | static struct platform_driver rb500_pata_platform_driver = { | 245 | static struct platform_driver rb532_pata_platform_driver = { |
246 | .probe = rb500_pata_driver_probe, | 246 | .probe = rb532_pata_driver_probe, |
247 | .remove = __devexit_p(rb500_pata_driver_remove), | 247 | .remove = __devexit_p(rb532_pata_driver_remove), |
248 | .driver = { | 248 | .driver = { |
249 | .name = DRV_NAME, | 249 | .name = DRV_NAME, |
250 | .owner = THIS_MODULE, | 250 | .owner = THIS_MODULE, |
@@ -255,16 +255,16 @@ static struct platform_driver rb500_pata_platform_driver = { | |||
255 | 255 | ||
256 | #define DRV_INFO DRV_DESC " version " DRV_VERSION | 256 | #define DRV_INFO DRV_DESC " version " DRV_VERSION |
257 | 257 | ||
258 | static int __init rb500_pata_module_init(void) | 258 | static int __init rb532_pata_module_init(void) |
259 | { | 259 | { |
260 | printk(KERN_INFO DRV_INFO "\n"); | 260 | printk(KERN_INFO DRV_INFO "\n"); |
261 | 261 | ||
262 | return platform_driver_register(&rb500_pata_platform_driver); | 262 | return platform_driver_register(&rb532_pata_platform_driver); |
263 | } | 263 | } |
264 | 264 | ||
265 | static void __exit rb500_pata_module_exit(void) | 265 | static void __exit rb532_pata_module_exit(void) |
266 | { | 266 | { |
267 | platform_driver_unregister(&rb500_pata_platform_driver); | 267 | platform_driver_unregister(&rb532_pata_platform_driver); |
268 | } | 268 | } |
269 | 269 | ||
270 | MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>"); | 270 | MODULE_AUTHOR("Gabor Juhos <juhosg at openwrt.org>"); |
@@ -273,5 +273,5 @@ MODULE_DESCRIPTION(DRV_DESC); | |||
273 | MODULE_VERSION(DRV_VERSION); | 273 | MODULE_VERSION(DRV_VERSION); |
274 | MODULE_LICENSE("GPL"); | 274 | MODULE_LICENSE("GPL"); |
275 | 275 | ||
276 | module_init(rb500_pata_module_init); | 276 | module_init(rb532_pata_module_init); |
277 | module_exit(rb500_pata_module_exit); | 277 | module_exit(rb532_pata_module_exit); |
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c index 26a6337195b3..842b1a15b78c 100644 --- a/drivers/ata/sata_mv.c +++ b/drivers/ata/sata_mv.c | |||
@@ -172,10 +172,11 @@ enum { | |||
172 | PCIE_IRQ_MASK_OFS = 0x1910, | 172 | PCIE_IRQ_MASK_OFS = 0x1910, |
173 | PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */ | 173 | PCIE_UNMASK_ALL_IRQS = 0x40a, /* assorted bits */ |
174 | 174 | ||
175 | HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, | 175 | /* Host Controller Main Interrupt Cause/Mask registers (1 per-chip) */ |
176 | HC_MAIN_IRQ_MASK_OFS = 0x1d64, | 176 | PCI_HC_MAIN_IRQ_CAUSE_OFS = 0x1d60, |
177 | HC_SOC_MAIN_IRQ_CAUSE_OFS = 0x20020, | 177 | PCI_HC_MAIN_IRQ_MASK_OFS = 0x1d64, |
178 | HC_SOC_MAIN_IRQ_MASK_OFS = 0x20024, | 178 | SOC_HC_MAIN_IRQ_CAUSE_OFS = 0x20020, |
179 | SOC_HC_MAIN_IRQ_MASK_OFS = 0x20024, | ||
179 | ERR_IRQ = (1 << 0), /* shift by port # */ | 180 | ERR_IRQ = (1 << 0), /* shift by port # */ |
180 | DONE_IRQ = (1 << 1), /* shift by port # */ | 181 | DONE_IRQ = (1 << 1), /* shift by port # */ |
181 | HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */ | 182 | HC0_IRQ_PEND = 0x1ff, /* bits 0-8 = HC0's ports */ |
@@ -445,8 +446,8 @@ struct mv_host_priv { | |||
445 | const struct mv_hw_ops *ops; | 446 | const struct mv_hw_ops *ops; |
446 | int n_ports; | 447 | int n_ports; |
447 | void __iomem *base; | 448 | void __iomem *base; |
448 | void __iomem *main_cause_reg_addr; | 449 | void __iomem *main_irq_cause_addr; |
449 | void __iomem *main_mask_reg_addr; | 450 | void __iomem *main_irq_mask_addr; |
450 | u32 irq_cause_ofs; | 451 | u32 irq_cause_ofs; |
451 | u32 irq_mask_ofs; | 452 | u32 irq_mask_ofs; |
452 | u32 unmask_all_irqs; | 453 | u32 unmask_all_irqs; |
@@ -727,8 +728,8 @@ static inline unsigned int mv_hardport_from_port(unsigned int port) | |||
727 | * Simple code, with two return values, so macro rather than inline. | 728 | * Simple code, with two return values, so macro rather than inline. |
728 | * | 729 | * |
729 | * port is the sole input, in range 0..7. | 730 | * port is the sole input, in range 0..7. |
730 | * shift is one output, for use with the main_cause and main_mask registers. | 731 | * shift is one output, for use with main_irq_cause / main_irq_mask registers. |
731 | * hardport is the other output, in range 0..3 | 732 | * hardport is the other output, in range 0..3. |
732 | * | 733 | * |
733 | * Note that port and hardport may be the same variable in some cases. | 734 | * Note that port and hardport may be the same variable in some cases. |
734 | */ | 735 | */ |
@@ -1679,12 +1680,12 @@ static void mv_process_crpb_entries(struct ata_port *ap, struct mv_port_priv *pp | |||
1679 | /** | 1680 | /** |
1680 | * mv_host_intr - Handle all interrupts on the given host controller | 1681 | * mv_host_intr - Handle all interrupts on the given host controller |
1681 | * @host: host specific structure | 1682 | * @host: host specific structure |
1682 | * @main_cause: Main interrupt cause register for the chip. | 1683 | * @main_irq_cause: Main interrupt cause register for the chip. |
1683 | * | 1684 | * |
1684 | * LOCKING: | 1685 | * LOCKING: |
1685 | * Inherited from caller. | 1686 | * Inherited from caller. |
1686 | */ | 1687 | */ |
1687 | static int mv_host_intr(struct ata_host *host, u32 main_cause) | 1688 | static int mv_host_intr(struct ata_host *host, u32 main_irq_cause) |
1688 | { | 1689 | { |
1689 | struct mv_host_priv *hpriv = host->private_data; | 1690 | struct mv_host_priv *hpriv = host->private_data; |
1690 | void __iomem *mmio = hpriv->base, *hc_mmio = NULL; | 1691 | void __iomem *mmio = hpriv->base, *hc_mmio = NULL; |
@@ -1705,7 +1706,7 @@ static int mv_host_intr(struct ata_host *host, u32 main_cause) | |||
1705 | * Do nothing if port is not interrupting or is disabled: | 1706 | * Do nothing if port is not interrupting or is disabled: |
1706 | */ | 1707 | */ |
1707 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 1708 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); |
1708 | port_cause = (main_cause >> shift) & (DONE_IRQ | ERR_IRQ); | 1709 | port_cause = (main_irq_cause >> shift) & (DONE_IRQ | ERR_IRQ); |
1709 | if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED)) | 1710 | if (!port_cause || !ap || (ap->flags & ATA_FLAG_DISABLED)) |
1710 | continue; | 1711 | continue; |
1711 | /* | 1712 | /* |
@@ -1811,20 +1812,20 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance) | |||
1811 | struct ata_host *host = dev_instance; | 1812 | struct ata_host *host = dev_instance; |
1812 | struct mv_host_priv *hpriv = host->private_data; | 1813 | struct mv_host_priv *hpriv = host->private_data; |
1813 | unsigned int handled = 0; | 1814 | unsigned int handled = 0; |
1814 | u32 main_cause, main_mask; | 1815 | u32 main_irq_cause, main_irq_mask; |
1815 | 1816 | ||
1816 | spin_lock(&host->lock); | 1817 | spin_lock(&host->lock); |
1817 | main_cause = readl(hpriv->main_cause_reg_addr); | 1818 | main_irq_cause = readl(hpriv->main_irq_cause_addr); |
1818 | main_mask = readl(hpriv->main_mask_reg_addr); | 1819 | main_irq_mask = readl(hpriv->main_irq_mask_addr); |
1819 | /* | 1820 | /* |
1820 | * Deal with cases where we either have nothing pending, or have read | 1821 | * Deal with cases where we either have nothing pending, or have read |
1821 | * a bogus register value which can indicate HW removal or PCI fault. | 1822 | * a bogus register value which can indicate HW removal or PCI fault. |
1822 | */ | 1823 | */ |
1823 | if ((main_cause & main_mask) && (main_cause != 0xffffffffU)) { | 1824 | if ((main_irq_cause & main_irq_mask) && (main_irq_cause != 0xffffffffU)) { |
1824 | if (unlikely((main_cause & PCI_ERR) && HAS_PCI(host))) | 1825 | if (unlikely((main_irq_cause & PCI_ERR) && HAS_PCI(host))) |
1825 | handled = mv_pci_error(host, hpriv->base); | 1826 | handled = mv_pci_error(host, hpriv->base); |
1826 | else | 1827 | else |
1827 | handled = mv_host_intr(host, main_cause); | 1828 | handled = mv_host_intr(host, main_irq_cause); |
1828 | } | 1829 | } |
1829 | spin_unlock(&host->lock); | 1830 | spin_unlock(&host->lock); |
1830 | return IRQ_RETVAL(handled); | 1831 | return IRQ_RETVAL(handled); |
@@ -2027,7 +2028,7 @@ static void mv_reset_pci_bus(struct ata_host *host, void __iomem *mmio) | |||
2027 | ZERO(MV_PCI_DISC_TIMER); | 2028 | ZERO(MV_PCI_DISC_TIMER); |
2028 | ZERO(MV_PCI_MSI_TRIGGER); | 2029 | ZERO(MV_PCI_MSI_TRIGGER); |
2029 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); | 2030 | writel(0x000100ff, mmio + MV_PCI_XBAR_TMOUT); |
2030 | ZERO(HC_MAIN_IRQ_MASK_OFS); | 2031 | ZERO(PCI_HC_MAIN_IRQ_MASK_OFS); |
2031 | ZERO(MV_PCI_SERR_MASK); | 2032 | ZERO(MV_PCI_SERR_MASK); |
2032 | ZERO(hpriv->irq_cause_ofs); | 2033 | ZERO(hpriv->irq_cause_ofs); |
2033 | ZERO(hpriv->irq_mask_ofs); | 2034 | ZERO(hpriv->irq_mask_ofs); |
@@ -2404,7 +2405,7 @@ static void mv_eh_freeze(struct ata_port *ap) | |||
2404 | { | 2405 | { |
2405 | struct mv_host_priv *hpriv = ap->host->private_data; | 2406 | struct mv_host_priv *hpriv = ap->host->private_data; |
2406 | unsigned int shift, hardport, port = ap->port_no; | 2407 | unsigned int shift, hardport, port = ap->port_no; |
2407 | u32 main_mask; | 2408 | u32 main_irq_mask; |
2408 | 2409 | ||
2409 | /* FIXME: handle coalescing completion events properly */ | 2410 | /* FIXME: handle coalescing completion events properly */ |
2410 | 2411 | ||
@@ -2412,9 +2413,9 @@ static void mv_eh_freeze(struct ata_port *ap) | |||
2412 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); | 2413 | MV_PORT_TO_SHIFT_AND_HARDPORT(port, shift, hardport); |
2413 | 2414 | ||
2414 | /* disable assertion of portN err, done events */ | 2415 | /* disable assertion of portN err, done events */ |
2415 | main_mask = readl(hpriv->main_mask_reg_addr); | 2416 | main_irq_mask = readl(hpriv->main_irq_mask_addr); |
2416 | main_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); | 2417 | main_irq_mask &= ~((DONE_IRQ | ERR_IRQ) << shift); |
2417 | writelfl(main_mask, hpriv->main_mask_reg_addr); | 2418 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); |
2418 | } | 2419 | } |
2419 | 2420 | ||
2420 | static void mv_eh_thaw(struct ata_port *ap) | 2421 | static void mv_eh_thaw(struct ata_port *ap) |
@@ -2423,7 +2424,7 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2423 | unsigned int shift, hardport, port = ap->port_no; | 2424 | unsigned int shift, hardport, port = ap->port_no; |
2424 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); | 2425 | void __iomem *hc_mmio = mv_hc_base_from_port(hpriv->base, port); |
2425 | void __iomem *port_mmio = mv_ap_base(ap); | 2426 | void __iomem *port_mmio = mv_ap_base(ap); |
2426 | u32 main_mask, hc_irq_cause; | 2427 | u32 main_irq_mask, hc_irq_cause; |
2427 | 2428 | ||
2428 | /* FIXME: handle coalescing completion events properly */ | 2429 | /* FIXME: handle coalescing completion events properly */ |
2429 | 2430 | ||
@@ -2438,9 +2439,9 @@ static void mv_eh_thaw(struct ata_port *ap) | |||
2438 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); | 2439 | writelfl(hc_irq_cause, hc_mmio + HC_IRQ_CAUSE_OFS); |
2439 | 2440 | ||
2440 | /* enable assertion of portN err, done events */ | 2441 | /* enable assertion of portN err, done events */ |
2441 | main_mask = readl(hpriv->main_mask_reg_addr); | 2442 | main_irq_mask = readl(hpriv->main_irq_mask_addr); |
2442 | main_mask |= ((DONE_IRQ | ERR_IRQ) << shift); | 2443 | main_irq_mask |= ((DONE_IRQ | ERR_IRQ) << shift); |
2443 | writelfl(main_mask, hpriv->main_mask_reg_addr); | 2444 | writelfl(main_irq_mask, hpriv->main_irq_mask_addr); |
2444 | } | 2445 | } |
2445 | 2446 | ||
2446 | /** | 2447 | /** |
@@ -2654,15 +2655,15 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
2654 | goto done; | 2655 | goto done; |
2655 | 2656 | ||
2656 | if (HAS_PCI(host)) { | 2657 | if (HAS_PCI(host)) { |
2657 | hpriv->main_cause_reg_addr = mmio + HC_MAIN_IRQ_CAUSE_OFS; | 2658 | hpriv->main_irq_cause_addr = mmio + PCI_HC_MAIN_IRQ_CAUSE_OFS; |
2658 | hpriv->main_mask_reg_addr = mmio + HC_MAIN_IRQ_MASK_OFS; | 2659 | hpriv->main_irq_mask_addr = mmio + PCI_HC_MAIN_IRQ_MASK_OFS; |
2659 | } else { | 2660 | } else { |
2660 | hpriv->main_cause_reg_addr = mmio + HC_SOC_MAIN_IRQ_CAUSE_OFS; | 2661 | hpriv->main_irq_cause_addr = mmio + SOC_HC_MAIN_IRQ_CAUSE_OFS; |
2661 | hpriv->main_mask_reg_addr = mmio + HC_SOC_MAIN_IRQ_MASK_OFS; | 2662 | hpriv->main_irq_mask_addr = mmio + SOC_HC_MAIN_IRQ_MASK_OFS; |
2662 | } | 2663 | } |
2663 | 2664 | ||
2664 | /* global interrupt mask: 0 == mask everything */ | 2665 | /* global interrupt mask: 0 == mask everything */ |
2665 | writel(0, hpriv->main_mask_reg_addr); | 2666 | writel(0, hpriv->main_irq_mask_addr); |
2666 | 2667 | ||
2667 | n_hc = mv_get_hc_count(host->ports[0]->flags); | 2668 | n_hc = mv_get_hc_count(host->ports[0]->flags); |
2668 | 2669 | ||
@@ -2712,23 +2713,23 @@ static int mv_init_host(struct ata_host *host, unsigned int board_idx) | |||
2712 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); | 2713 | writelfl(hpriv->unmask_all_irqs, mmio + hpriv->irq_mask_ofs); |
2713 | if (IS_GEN_I(hpriv)) | 2714 | if (IS_GEN_I(hpriv)) |
2714 | writelfl(~HC_MAIN_MASKED_IRQS_5, | 2715 | writelfl(~HC_MAIN_MASKED_IRQS_5, |
2715 | hpriv->main_mask_reg_addr); | 2716 | hpriv->main_irq_mask_addr); |
2716 | else | 2717 | else |
2717 | writelfl(~HC_MAIN_MASKED_IRQS, | 2718 | writelfl(~HC_MAIN_MASKED_IRQS, |
2718 | hpriv->main_mask_reg_addr); | 2719 | hpriv->main_irq_mask_addr); |
2719 | 2720 | ||
2720 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " | 2721 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x " |
2721 | "PCI int cause/mask=0x%08x/0x%08x\n", | 2722 | "PCI int cause/mask=0x%08x/0x%08x\n", |
2722 | readl(hpriv->main_cause_reg_addr), | 2723 | readl(hpriv->main_irq_cause_addr), |
2723 | readl(hpriv->main_mask_reg_addr), | 2724 | readl(hpriv->main_irq_mask_addr), |
2724 | readl(mmio + hpriv->irq_cause_ofs), | 2725 | readl(mmio + hpriv->irq_cause_ofs), |
2725 | readl(mmio + hpriv->irq_mask_ofs)); | 2726 | readl(mmio + hpriv->irq_mask_ofs)); |
2726 | } else { | 2727 | } else { |
2727 | writelfl(~HC_MAIN_MASKED_IRQS_SOC, | 2728 | writelfl(~HC_MAIN_MASKED_IRQS_SOC, |
2728 | hpriv->main_mask_reg_addr); | 2729 | hpriv->main_irq_mask_addr); |
2729 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", | 2730 | VPRINTK("HC MAIN IRQ cause/mask=0x%08x/0x%08x\n", |
2730 | readl(hpriv->main_cause_reg_addr), | 2731 | readl(hpriv->main_irq_cause_addr), |
2731 | readl(hpriv->main_mask_reg_addr)); | 2732 | readl(hpriv->main_irq_mask_addr)); |
2732 | } | 2733 | } |
2733 | done: | 2734 | done: |
2734 | return rc; | 2735 | return rc; |