aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/atp870u.c
diff options
context:
space:
mode:
authorOndrej Zary <linux@rainbow-software.org>2015-11-17 13:23:43 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2015-11-25 22:08:30 -0500
commit3b30acf6a8989dc1a98f959d3c7743790eab00df (patch)
tree9e3201a49077434816853fb52614f882624c7f61 /drivers/scsi/atp870u.c
parentea41ed600b261fec87820c1aa2455942dcfa1ce7 (diff)
atp870u: Untangle tmport #5
Untangle the tmport crap so it becomes obvious what ports are accessed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Hannes Reinicke <hare@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/atp870u.c')
-rw-r--r--drivers/scsi/atp870u.c470
1 files changed, 173 insertions, 297 deletions
diff --git a/drivers/scsi/atp870u.c b/drivers/scsi/atp870u.c
index 3e3a68b2738d..3bf01fcb4b49 100644
--- a/drivers/scsi/atp870u.c
+++ b/drivers/scsi/atp870u.c
@@ -1639,7 +1639,6 @@ set_syn_ok:
1639 1639
1640static void is880(struct atp_unit *dev, unsigned int wkport) 1640static void is880(struct atp_unit *dev, unsigned int wkport)
1641{ 1641{
1642 unsigned int tmport;
1643 unsigned char i, j, k, rmb, n, lvdmode; 1642 unsigned char i, j, k, rmb, n, lvdmode;
1644 unsigned short int m; 1643 unsigned short int m;
1645 static unsigned char mbuf[512]; 1644 static unsigned char mbuf[512];
@@ -1664,130 +1663,100 @@ static void is880(struct atp_unit *dev, unsigned int wkport)
1664 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[0]); 1663 printk(KERN_INFO " ID: %2d Host Adapter\n", dev->host_id[0]);
1665 continue; 1664 continue;
1666 } 1665 }
1667 tmport = wkport + 0x5b; 1666 outb(0x01, wkport + 0x5b);
1668 outb(0x01, tmport); 1667 outb(0x08, wkport + 0x41);
1669 tmport = wkport + 0x41; 1668 outb(0x7f, wkport + 0x42);
1670 outb(0x08, tmport++); 1669 outb(satn[0], wkport + 0x43);
1671 outb(0x7f, tmport++); 1670 outb(satn[1], wkport + 0x44);
1672 outb(satn[0], tmport++); 1671 outb(satn[2], wkport + 0x45);
1673 outb(satn[1], tmport++); 1672 outb(satn[3], wkport + 0x46);
1674 outb(satn[2], tmport++); 1673 outb(satn[4], wkport + 0x47);
1675 outb(satn[3], tmport++); 1674 outb(satn[5], wkport + 0x48);
1676 outb(satn[4], tmport++); 1675 outb(0, wkport + 0x4f);
1677 outb(satn[5], tmport++); 1676 outb(dev->id[0][i].devsp, wkport + 0x51);
1678 tmport += 0x06; 1677 outb(0, wkport + 0x52);
1679 outb(0, tmport); 1678 outb(satn[6], wkport + 0x53);
1680 tmport += 0x02; 1679 outb(satn[7], wkport + 0x54);
1681 outb(dev->id[0][i].devsp, tmport++);
1682 outb(0, tmport++);
1683 outb(satn[6], tmport++);
1684 outb(satn[7], tmport++);
1685 j = i; 1680 j = i;
1686 if ((j & 0x08) != 0) { 1681 if ((j & 0x08) != 0) {
1687 j = (j & 0x07) | 0x40; 1682 j = (j & 0x07) | 0x40;
1688 } 1683 }
1689 outb(j, tmport); 1684 outb(j, wkport + 0x55);
1690 tmport += 0x03; 1685 outb(satn[8], wkport + 0x58);
1691 outb(satn[8], tmport);
1692 tmport += 0x07;
1693 1686
1694 while ((inb(tmport) & 0x80) == 0x00) 1687 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1695 cpu_relax(); 1688 cpu_relax();
1696 1689
1697 tmport -= 0x08; 1690 if (inb(wkport + 0x57) != 0x11 && inb(wkport + 0x57) != 0x8e)
1698 if (inb(tmport) != 0x11 && inb(tmport) != 0x8e)
1699 continue; 1691 continue;
1700 1692
1701 while (inb(tmport) != 0x8e) 1693 while (inb(wkport + 0x57) != 0x8e)
1702 cpu_relax(); 1694 cpu_relax();
1703 1695
1704 dev->active_id[0] |= m; 1696 dev->active_id[0] |= m;
1705 1697
1706 tmport = wkport + 0x50; 1698 outb(0x30, wkport + 0x50);
1707 outb(0x30, tmport); 1699 outb(0x00, wkport + 0x54);
1708 tmport = wkport + 0x54;
1709 outb(0x00, tmport);
1710 1700
1711phase_cmd: 1701phase_cmd:
1712 tmport = wkport + 0x58; 1702 outb(0x08, wkport + 0x58);
1713 outb(0x08, tmport);
1714 tmport += 0x07;
1715 1703
1716 while ((inb(tmport) & 0x80) == 0x00) 1704 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1717 cpu_relax(); 1705 cpu_relax();
1718 1706
1719 tmport -= 0x08; 1707 j = inb(wkport + 0x57);
1720 j = inb(tmport);
1721 if (j != 0x16) { 1708 if (j != 0x16) {
1722 tmport = wkport + 0x50; 1709 outb(0x41, wkport + 0x50);
1723 outb(0x41, tmport);
1724 goto phase_cmd; 1710 goto phase_cmd;
1725 } 1711 }
1726sel_ok: 1712sel_ok:
1727 tmport = wkport + 0x43; 1713 outb(inqd[0], wkport + 0x43);
1728 outb(inqd[0], tmport++); 1714 outb(inqd[1], wkport + 0x44);
1729 outb(inqd[1], tmport++); 1715 outb(inqd[2], wkport + 0x45);
1730 outb(inqd[2], tmport++); 1716 outb(inqd[3], wkport + 0x46);
1731 outb(inqd[3], tmport++); 1717 outb(inqd[4], wkport + 0x47);
1732 outb(inqd[4], tmport++); 1718 outb(inqd[5], wkport + 0x48);
1733 outb(inqd[5], tmport); 1719 outb(0, wkport + 0x4f);
1734 tmport += 0x07; 1720 outb(dev->id[0][i].devsp, wkport + 0x51);
1735 outb(0, tmport); 1721 outb(0, wkport + 0x52);
1736 tmport += 0x02; 1722 outb(inqd[6], wkport + 0x53);
1737 outb(dev->id[0][i].devsp, tmport++); 1723 outb(inqd[7], wkport + 0x54);
1738 outb(0, tmport++); 1724 outb(inqd[8], wkport + 0x58);
1739 outb(inqd[6], tmport++);
1740 outb(inqd[7], tmport++);
1741 tmport += 0x03;
1742 outb(inqd[8], tmport);
1743 tmport += 0x07;
1744 1725
1745 while ((inb(tmport) & 0x80) == 0x00) 1726 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1746 cpu_relax(); 1727 cpu_relax();
1747 1728
1748 tmport -= 0x08; 1729 if (inb(wkport + 0x57) != 0x11 && inb(wkport + 0x57) != 0x8e)
1749 if (inb(tmport) != 0x11 && inb(tmport) != 0x8e)
1750 continue; 1730 continue;
1751 1731
1752 while (inb(tmport) != 0x8e) 1732 while (inb(wkport + 0x57) != 0x8e)
1753 cpu_relax(); 1733 cpu_relax();
1754 1734
1755 tmport = wkport + 0x5b; 1735 outb(0x00, wkport + 0x5b);
1756 outb(0x00, tmport); 1736 outb(0x08, wkport + 0x58);
1757 tmport = wkport + 0x58;
1758 outb(0x08, tmport);
1759 tmport += 0x07;
1760 j = 0; 1737 j = 0;
1761rd_inq_data: 1738rd_inq_data:
1762 k = inb(tmport); 1739 k = inb(wkport + 0x5f);
1763 if ((k & 0x01) != 0) { 1740 if ((k & 0x01) != 0) {
1764 tmport -= 0x06; 1741 mbuf[j++] = inb(wkport + 0x59);
1765 mbuf[j++] = inb(tmport);
1766 tmport += 0x06;
1767 goto rd_inq_data; 1742 goto rd_inq_data;
1768 } 1743 }
1769 if ((k & 0x80) == 0) { 1744 if ((k & 0x80) == 0) {
1770 goto rd_inq_data; 1745 goto rd_inq_data;
1771 } 1746 }
1772 tmport -= 0x08; 1747 j = inb(wkport + 0x57);
1773 j = inb(tmport);
1774 if (j == 0x16) { 1748 if (j == 0x16) {
1775 goto inq_ok; 1749 goto inq_ok;
1776 } 1750 }
1777 tmport = wkport + 0x50; 1751 outb(0x46, wkport + 0x50);
1778 outb(0x46, tmport); 1752 outb(0, wkport + 0x52);
1779 tmport += 0x02; 1753 outb(0, wkport + 0x53);
1780 outb(0, tmport++); 1754 outb(0, wkport + 0x54);
1781 outb(0, tmport++); 1755 outb(0x08, wkport + 0x58);
1782 outb(0, tmport++); 1756 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1783 tmport += 0x03;
1784 outb(0x08, tmport);
1785 tmport += 0x07;
1786 while ((inb(tmport) & 0x80) == 0x00)
1787 cpu_relax(); 1757 cpu_relax();
1788 1758
1789 tmport -= 0x08; 1759 if (inb(wkport + 0x57) != 0x16)
1790 if (inb(tmport) != 0x16)
1791 goto sel_ok; 1760 goto sel_ok;
1792 1761
1793inq_ok: 1762inq_ok:
@@ -1810,58 +1779,43 @@ inq_ok:
1810 goto chg_wide; 1779 goto chg_wide;
1811 } 1780 }
1812 1781
1813 tmport = wkport + 0x5b; 1782 outb(0x01, wkport + 0x5b);
1814 outb(0x01, tmport); 1783 outb(satn[0], wkport + 0x43);
1815 tmport = wkport + 0x43; 1784 outb(satn[1], wkport + 0x44);
1816 outb(satn[0], tmport++); 1785 outb(satn[2], wkport + 0x45);
1817 outb(satn[1], tmport++); 1786 outb(satn[3], wkport + 0x46);
1818 outb(satn[2], tmport++); 1787 outb(satn[4], wkport + 0x47);
1819 outb(satn[3], tmport++); 1788 outb(satn[5], wkport + 0x48);
1820 outb(satn[4], tmport++); 1789 outb(0, wkport + 0x4f);
1821 outb(satn[5], tmport++); 1790 outb(dev->id[0][i].devsp, wkport + 0x51);
1822 tmport += 0x06; 1791 outb(0, wkport + 0x52);
1823 outb(0, tmport); 1792 outb(satn[6], wkport + 0x53);
1824 tmport += 0x02; 1793 outb(satn[7], wkport + 0x54);
1825 outb(dev->id[0][i].devsp, tmport++); 1794 outb(satn[8], wkport + 0x58);
1826 outb(0, tmport++); 1795
1827 outb(satn[6], tmport++); 1796 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1828 outb(satn[7], tmport++);
1829 tmport += 0x03;
1830 outb(satn[8], tmport);
1831 tmport += 0x07;
1832
1833 while ((inb(tmport) & 0x80) == 0x00)
1834 cpu_relax(); 1797 cpu_relax();
1835 1798
1836 tmport -= 0x08; 1799 if (inb(wkport + 0x57) != 0x11 && inb(wkport + 0x57) != 0x8e)
1837
1838 if (inb(tmport) != 0x11 && inb(tmport) != 0x8e)
1839 continue; 1800 continue;
1840 1801
1841 while (inb(tmport) != 0x8e) 1802 while (inb(wkport + 0x57) != 0x8e)
1842 cpu_relax(); 1803 cpu_relax();
1843 1804
1844try_u3: 1805try_u3:
1845 j = 0; 1806 j = 0;
1846 tmport = wkport + 0x54; 1807 outb(0x09, wkport + 0x54);
1847 outb(0x09, tmport); 1808 outb(0x20, wkport + 0x58);
1848 tmport += 0x04;
1849 outb(0x20, tmport);
1850 tmport += 0x07;
1851 1809
1852 while ((inb(tmport) & 0x80) == 0) { 1810 while ((inb(wkport + 0x5f) & 0x80) == 0) {
1853 if ((inb(tmport) & 0x01) != 0) { 1811 if ((inb(wkport + 0x5f) & 0x01) != 0)
1854 tmport -= 0x06; 1812 outb(u3[j++], wkport + 0x59);
1855 outb(u3[j++], tmport);
1856 tmport += 0x06;
1857 }
1858 } 1813 }
1859 tmport -= 0x08;
1860 1814
1861 while ((inb(tmport) & 0x80) == 0x00) 1815 while ((inb(wkport + 0x57) & 0x80) == 0x00)
1862 cpu_relax(); 1816 cpu_relax();
1863 1817
1864 j = inb(tmport) & 0x0f; 1818 j = inb(wkport + 0x57) & 0x0f;
1865 if (j == 0x0f) { 1819 if (j == 0x0f) {
1866 goto u3p_in; 1820 goto u3p_in;
1867 } 1821 }
@@ -1873,18 +1827,12 @@ try_u3:
1873 } 1827 }
1874 continue; 1828 continue;
1875u3p_out: 1829u3p_out:
1876 tmport = wkport + 0x58; 1830 outb(0x20, wkport + 0x58);
1877 outb(0x20, tmport); 1831 while ((inb(wkport + 0x5f) & 0x80) == 0) {
1878 tmport += 0x07; 1832 if ((inb(wkport + 0x5f) & 0x01) != 0)
1879 while ((inb(tmport) & 0x80) == 0) { 1833 outb(0, wkport + 0x59);
1880 if ((inb(tmport) & 0x01) != 0) {
1881 tmport -= 0x06;
1882 outb(0, tmport);
1883 tmport += 0x06;
1884 }
1885 } 1834 }
1886 tmport -= 0x08; 1835 j = inb(wkport + 0x57) & 0x0f;
1887 j = inb(tmport) & 0x0f;
1888 if (j == 0x0f) { 1836 if (j == 0x0f) {
1889 goto u3p_in; 1837 goto u3p_in;
1890 } 1838 }
@@ -1896,25 +1844,19 @@ u3p_out:
1896 } 1844 }
1897 continue; 1845 continue;
1898u3p_in: 1846u3p_in:
1899 tmport = wkport + 0x54; 1847 outb(0x09, wkport + 0x54);
1900 outb(0x09, tmport); 1848 outb(0x20, wkport + 0x58);
1901 tmport += 0x04;
1902 outb(0x20, tmport);
1903 tmport += 0x07;
1904 k = 0; 1849 k = 0;
1905u3p_in1: 1850u3p_in1:
1906 j = inb(tmport); 1851 j = inb(wkport + 0x5f);
1907 if ((j & 0x01) != 0) { 1852 if ((j & 0x01) != 0) {
1908 tmport -= 0x06; 1853 mbuf[k++] = inb(wkport + 0x59);
1909 mbuf[k++] = inb(tmport);
1910 tmport += 0x06;
1911 goto u3p_in1; 1854 goto u3p_in1;
1912 } 1855 }
1913 if ((j & 0x80) == 0x00) { 1856 if ((j & 0x80) == 0x00) {
1914 goto u3p_in1; 1857 goto u3p_in1;
1915 } 1858 }
1916 tmport -= 0x08; 1859 j = inb(wkport + 0x57) & 0x0f;
1917 j = inb(tmport) & 0x0f;
1918 if (j == 0x0f) { 1860 if (j == 0x0f) {
1919 goto u3p_in; 1861 goto u3p_in;
1920 } 1862 }
@@ -1926,19 +1868,14 @@ u3p_in1:
1926 } 1868 }
1927 continue; 1869 continue;
1928u3p_cmd: 1870u3p_cmd:
1929 tmport = wkport + 0x50; 1871 outb(0x30, wkport + 0x50);
1930 outb(0x30, tmport); 1872 outb(0x00, wkport + 0x54);
1931 tmport = wkport + 0x54; 1873 outb(0x08, wkport + 0x58);
1932 outb(0x00, tmport);
1933 tmport += 0x04;
1934 outb(0x08, tmport);
1935 tmport += 0x07;
1936 1874
1937 while ((inb(tmport) & 0x80) == 0x00) 1875 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1938 cpu_relax(); 1876 cpu_relax();
1939 1877
1940 tmport -= 0x08; 1878 j = inb(wkport + 0x57);
1941 j = inb(tmport);
1942 if (j != 0x16) { 1879 if (j != 0x16) {
1943 if (j == 0x4e) { 1880 if (j == 0x4e) {
1944 goto u3p_out; 1881 goto u3p_out;
@@ -1962,56 +1899,42 @@ u3p_cmd:
1962 continue; 1899 continue;
1963 } 1900 }
1964chg_wide: 1901chg_wide:
1965 tmport = wkport + 0x5b; 1902 outb(0x01, wkport + 0x5b);
1966 outb(0x01, tmport); 1903 outb(satn[0], wkport + 0x43);
1967 tmport = wkport + 0x43; 1904 outb(satn[1], wkport + 0x44);
1968 outb(satn[0], tmport++); 1905 outb(satn[2], wkport + 0x45);
1969 outb(satn[1], tmport++); 1906 outb(satn[3], wkport + 0x46);
1970 outb(satn[2], tmport++); 1907 outb(satn[4], wkport + 0x47);
1971 outb(satn[3], tmport++); 1908 outb(satn[5], wkport + 0x48);
1972 outb(satn[4], tmport++); 1909 outb(0, wkport + 0x4f);
1973 outb(satn[5], tmport++); 1910 outb(dev->id[0][i].devsp, wkport + 0x51);
1974 tmport += 0x06; 1911 outb(0, wkport + 0x52);
1975 outb(0, tmport); 1912 outb(satn[6], wkport + 0x53);
1976 tmport += 0x02; 1913 outb(satn[7], wkport + 0x54);
1977 outb(dev->id[0][i].devsp, tmport++); 1914 outb(satn[8], wkport + 0x58);
1978 outb(0, tmport++); 1915
1979 outb(satn[6], tmport++); 1916 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
1980 outb(satn[7], tmport++);
1981 tmport += 0x03;
1982 outb(satn[8], tmport);
1983 tmport += 0x07;
1984
1985 while ((inb(tmport) & 0x80) == 0x00)
1986 cpu_relax(); 1917 cpu_relax();
1987 1918
1988 tmport -= 0x08; 1919 if (inb(wkport + 0x57) != 0x11 && inb(wkport + 0x57) != 0x8e)
1989 if (inb(tmport) != 0x11 && inb(tmport) != 0x8e)
1990 continue; 1920 continue;
1991 1921
1992 while (inb(tmport) != 0x8e) 1922 while (inb(wkport + 0x57) != 0x8e)
1993 cpu_relax(); 1923 cpu_relax();
1994 1924
1995try_wide: 1925try_wide:
1996 j = 0; 1926 j = 0;
1997 tmport = wkport + 0x54; 1927 outb(0x05, wkport + 0x54);
1998 outb(0x05, tmport); 1928 outb(0x20, wkport + 0x58);
1999 tmport += 0x04;
2000 outb(0x20, tmport);
2001 tmport += 0x07;
2002 1929
2003 while ((inb(tmport) & 0x80) == 0) { 1930 while ((inb(wkport + 0x5f) & 0x80) == 0) {
2004 if ((inb(tmport) & 0x01) != 0) { 1931 if ((inb(wkport + 0x5f) & 0x01) != 0)
2005 tmport -= 0x06; 1932 outb(wide[j++], wkport + 0x59);
2006 outb(wide[j++], tmport);
2007 tmport += 0x06;
2008 }
2009 } 1933 }
2010 tmport -= 0x08; 1934 while ((inb(wkport + 0x57) & 0x80) == 0x00)
2011 while ((inb(tmport) & 0x80) == 0x00)
2012 cpu_relax(); 1935 cpu_relax();
2013 1936
2014 j = inb(tmport) & 0x0f; 1937 j = inb(wkport + 0x57) & 0x0f;
2015 if (j == 0x0f) { 1938 if (j == 0x0f) {
2016 goto widep_in; 1939 goto widep_in;
2017 } 1940 }
@@ -2023,18 +1946,12 @@ try_wide:
2023 } 1946 }
2024 continue; 1947 continue;
2025widep_out: 1948widep_out:
2026 tmport = wkport + 0x58; 1949 outb(0x20, wkport + 0x58);
2027 outb(0x20, tmport); 1950 while ((inb(wkport + 0x5f) & 0x80) == 0) {
2028 tmport += 0x07; 1951 if ((inb(wkport + 0x5f) & 0x01) != 0)
2029 while ((inb(tmport) & 0x80) == 0) { 1952 outb(0, wkport + 0x59);
2030 if ((inb(tmport) & 0x01) != 0) {
2031 tmport -= 0x06;
2032 outb(0, tmport);
2033 tmport += 0x06;
2034 }
2035 } 1953 }
2036 tmport -= 0x08; 1954 j = inb(wkport + 0x57) & 0x0f;
2037 j = inb(tmport) & 0x0f;
2038 if (j == 0x0f) { 1955 if (j == 0x0f) {
2039 goto widep_in; 1956 goto widep_in;
2040 } 1957 }
@@ -2046,25 +1963,19 @@ widep_out:
2046 } 1963 }
2047 continue; 1964 continue;
2048widep_in: 1965widep_in:
2049 tmport = wkport + 0x54; 1966 outb(0xff, wkport + 0x54);
2050 outb(0xff, tmport); 1967 outb(0x20, wkport + 0x58);
2051 tmport += 0x04;
2052 outb(0x20, tmport);
2053 tmport += 0x07;
2054 k = 0; 1968 k = 0;
2055widep_in1: 1969widep_in1:
2056 j = inb(tmport); 1970 j = inb(wkport + 0x5f);
2057 if ((j & 0x01) != 0) { 1971 if ((j & 0x01) != 0) {
2058 tmport -= 0x06; 1972 mbuf[k++] = inb(wkport + 0x59);
2059 mbuf[k++] = inb(tmport);
2060 tmport += 0x06;
2061 goto widep_in1; 1973 goto widep_in1;
2062 } 1974 }
2063 if ((j & 0x80) == 0x00) { 1975 if ((j & 0x80) == 0x00) {
2064 goto widep_in1; 1976 goto widep_in1;
2065 } 1977 }
2066 tmport -= 0x08; 1978 j = inb(wkport + 0x57) & 0x0f;
2067 j = inb(tmport) & 0x0f;
2068 if (j == 0x0f) { 1979 if (j == 0x0f) {
2069 goto widep_in; 1980 goto widep_in;
2070 } 1981 }
@@ -2076,19 +1987,14 @@ widep_in1:
2076 } 1987 }
2077 continue; 1988 continue;
2078widep_cmd: 1989widep_cmd:
2079 tmport = wkport + 0x50; 1990 outb(0x30, wkport + 0x50);
2080 outb(0x30, tmport); 1991 outb(0x00, wkport + 0x54);
2081 tmport = wkport + 0x54; 1992 outb(0x08, wkport + 0x58);
2082 outb(0x00, tmport);
2083 tmport += 0x04;
2084 outb(0x08, tmport);
2085 tmport += 0x07;
2086 1993
2087 while ((inb(tmport) & 0x80) == 0x00) 1994 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
2088 cpu_relax(); 1995 cpu_relax();
2089 1996
2090 tmport -= 0x08; 1997 j = inb(wkport + 0x57);
2091 j = inb(tmport);
2092 if (j != 0x16) { 1998 if (j != 0x16) {
2093 if (j == 0x4e) { 1999 if (j == 0x4e) {
2094 goto widep_out; 2000 goto widep_out;
@@ -2129,73 +2035,60 @@ set_sync:
2129 synuw[4] = 0x0a; 2035 synuw[4] = 0x0a;
2130 } 2036 }
2131 } 2037 }
2132 tmport = wkport + 0x5b;
2133 j = 0; 2038 j = 0;
2134 if ((m & dev->wide_id[0]) != 0) { 2039 if ((m & dev->wide_id[0]) != 0) {
2135 j |= 0x01; 2040 j |= 0x01;
2136 } 2041 }
2137 outb(j, tmport); 2042 outb(j, wkport + 0x5b);
2138 tmport = wkport + 0x43; 2043 outb(satn[0], wkport + 0x43);
2139 outb(satn[0], tmport++); 2044 outb(satn[1], wkport + 0x44);
2140 outb(satn[1], tmport++); 2045 outb(satn[2], wkport + 0x45);
2141 outb(satn[2], tmport++); 2046 outb(satn[3], wkport + 0x46);
2142 outb(satn[3], tmport++); 2047 outb(satn[4], wkport + 0x47);
2143 outb(satn[4], tmport++); 2048 outb(satn[5], wkport + 0x48);
2144 outb(satn[5], tmport++); 2049 outb(0, wkport + 0x4f);
2145 tmport += 0x06; 2050 outb(dev->id[0][i].devsp, wkport + 0x51);
2146 outb(0, tmport); 2051 outb(0, wkport + 0x52);
2147 tmport += 0x02; 2052 outb(satn[6], wkport + 0x53);
2148 outb(dev->id[0][i].devsp, tmport++); 2053 outb(satn[7], wkport + 0x54);
2149 outb(0, tmport++); 2054 outb(satn[8], wkport + 0x58);
2150 outb(satn[6], tmport++); 2055
2151 outb(satn[7], tmport++); 2056 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
2152 tmport += 0x03;
2153 outb(satn[8], tmport);
2154 tmport += 0x07;
2155
2156 while ((inb(tmport) & 0x80) == 0x00)
2157 cpu_relax(); 2057 cpu_relax();
2158 2058
2159 tmport -= 0x08; 2059 if ((inb(wkport + 0x57) != 0x11) && (inb(wkport + 0x57) != 0x8e)) {
2160 if ((inb(tmport) != 0x11) && (inb(tmport) != 0x8e)) {
2161 continue; 2060 continue;
2162 } 2061 }
2163 while (inb(tmport) != 0x8e) 2062 while (inb(wkport + 0x57) != 0x8e)
2164 cpu_relax(); 2063 cpu_relax();
2165 2064
2166try_sync: 2065try_sync:
2167 j = 0; 2066 j = 0;
2168 tmport = wkport + 0x54; 2067 outb(0x06, wkport + 0x54);
2169 outb(0x06, tmport); 2068 outb(0x20, wkport + 0x58);
2170 tmport += 0x04;
2171 outb(0x20, tmport);
2172 tmport += 0x07;
2173 2069
2174 while ((inb(tmport) & 0x80) == 0) { 2070 while ((inb(wkport + 0x5f) & 0x80) == 0) {
2175 if ((inb(tmport) & 0x01) != 0) { 2071 if ((inb(wkport + 0x5f) & 0x01) != 0) {
2176 tmport -= 0x06;
2177 if ((m & dev->wide_id[0]) != 0) { 2072 if ((m & dev->wide_id[0]) != 0) {
2178 if ((m & dev->ultra_map[0]) != 0) { 2073 if ((m & dev->ultra_map[0]) != 0) {
2179 outb(synuw[j++], tmport); 2074 outb(synuw[j++], wkport + 0x59);
2180 } else { 2075 } else {
2181 outb(synw[j++], tmport); 2076 outb(synw[j++], wkport + 0x59);
2182 } 2077 }
2183 } else { 2078 } else {
2184 if ((m & dev->ultra_map[0]) != 0) { 2079 if ((m & dev->ultra_map[0]) != 0) {
2185 outb(synu[j++], tmport); 2080 outb(synu[j++], wkport + 0x59);
2186 } else { 2081 } else {
2187 outb(synn[j++], tmport); 2082 outb(synn[j++], wkport + 0x59);
2188 } 2083 }
2189 } 2084 }
2190 tmport += 0x06;
2191 } 2085 }
2192 } 2086 }
2193 tmport -= 0x08;
2194 2087
2195 while ((inb(tmport) & 0x80) == 0x00) 2088 while ((inb(wkport + 0x57) & 0x80) == 0x00)
2196 cpu_relax(); 2089 cpu_relax();
2197 2090
2198 j = inb(tmport) & 0x0f; 2091 j = inb(wkport + 0x57) & 0x0f;
2199 if (j == 0x0f) { 2092 if (j == 0x0f) {
2200 goto phase_ins; 2093 goto phase_ins;
2201 } 2094 }
@@ -2207,18 +2100,12 @@ try_sync:
2207 } 2100 }
2208 continue; 2101 continue;
2209phase_outs: 2102phase_outs:
2210 tmport = wkport + 0x58; 2103 outb(0x20, wkport + 0x58);
2211 outb(0x20, tmport); 2104 while ((inb(wkport + 0x5f) & 0x80) == 0x00) {
2212 tmport += 0x07; 2105 if ((inb(wkport + 0x5f) & 0x01) != 0x00)
2213 while ((inb(tmport) & 0x80) == 0x00) { 2106 outb(0x00, wkport + 0x59);
2214 if ((inb(tmport) & 0x01) != 0x00) {
2215 tmport -= 0x06;
2216 outb(0x00, tmport);
2217 tmport += 0x06;
2218 }
2219 } 2107 }
2220 tmport -= 0x08; 2108 j = inb(wkport + 0x57);
2221 j = inb(tmport);
2222 if (j == 0x85) { 2109 if (j == 0x85) {
2223 goto tar_dcons; 2110 goto tar_dcons;
2224 } 2111 }
@@ -2234,29 +2121,23 @@ phase_outs:
2234 } 2121 }
2235 continue; 2122 continue;
2236phase_ins: 2123phase_ins:
2237 tmport = wkport + 0x54; 2124 outb(0x06, wkport + 0x54);
2238 outb(0x06, tmport); 2125 outb(0x20, wkport + 0x58);
2239 tmport += 0x04;
2240 outb(0x20, tmport);
2241 tmport += 0x07;
2242 k = 0; 2126 k = 0;
2243phase_ins1: 2127phase_ins1:
2244 j = inb(tmport); 2128 j = inb(wkport + 0x5f);
2245 if ((j & 0x01) != 0x00) { 2129 if ((j & 0x01) != 0x00) {
2246 tmport -= 0x06; 2130 mbuf[k++] = inb(wkport + 0x59);
2247 mbuf[k++] = inb(tmport);
2248 tmport += 0x06;
2249 goto phase_ins1; 2131 goto phase_ins1;
2250 } 2132 }
2251 if ((j & 0x80) == 0x00) { 2133 if ((j & 0x80) == 0x00) {
2252 goto phase_ins1; 2134 goto phase_ins1;
2253 } 2135 }
2254 tmport -= 0x08;
2255 2136
2256 while ((inb(tmport) & 0x80) == 0x00) 2137 while ((inb(wkport + 0x57) & 0x80) == 0x00)
2257 cpu_relax(); 2138 cpu_relax();
2258 2139
2259 j = inb(tmport); 2140 j = inb(wkport + 0x57);
2260 if (j == 0x85) { 2141 if (j == 0x85) {
2261 goto tar_dcons; 2142 goto tar_dcons;
2262 } 2143 }
@@ -2272,20 +2153,15 @@ phase_ins1:
2272 } 2153 }
2273 continue; 2154 continue;
2274phase_cmds: 2155phase_cmds:
2275 tmport = wkport + 0x50; 2156 outb(0x30, wkport + 0x50);
2276 outb(0x30, tmport);
2277tar_dcons: 2157tar_dcons:
2278 tmport = wkport + 0x54; 2158 outb(0x00, wkport + 0x54);
2279 outb(0x00, tmport); 2159 outb(0x08, wkport + 0x58);
2280 tmport += 0x04;
2281 outb(0x08, tmport);
2282 tmport += 0x07;
2283 2160
2284 while ((inb(tmport) & 0x80) == 0x00) 2161 while ((inb(wkport + 0x5f) & 0x80) == 0x00)
2285 cpu_relax(); 2162 cpu_relax();
2286 2163
2287 tmport -= 0x08; 2164 j = inb(wkport + 0x57);
2288 j = inb(tmport);
2289 if (j != 0x16) { 2165 if (j != 0x16) {
2290 continue; 2166 continue;
2291 } 2167 }