if_wl.c (41591) | if_wl.c (41616) |
---|---|
1/* $Id: if_wl.c,v 1.17 1998/11/15 19:30:48 eivind Exp $ */ | 1/* $Id: if_wl.c,v 1.18 1998/12/07 21:58:21 archie Exp $ */ |
2/* 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions 5 * are met: 6 * 1. Redistributions of source code must retain all copyright 7 * notices, this list of conditions and the following disclaimer. 8 * 2. The names of the authors may not be used to endorse or promote products 9 * derived from this software withough specific prior written permission --- 479 unchanged lines hidden (view full) --- 489 ifp->if_unit = id->id_unit; 490 ifp->if_mtu = WAVELAN_MTU; 491 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; 492#ifdef WLDEBUG 493 ifp->if_flags |= IFF_DEBUG; 494#endif 495#if MULTICAST 496 ifp->if_flags |= IFF_MULTICAST; | 2/* 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions 5 * are met: 6 * 1. Redistributions of source code must retain all copyright 7 * notices, this list of conditions and the following disclaimer. 8 * 2. The names of the authors may not be used to endorse or promote products 9 * derived from this software withough specific prior written permission --- 479 unchanged lines hidden (view full) --- 489 ifp->if_unit = id->id_unit; 490 ifp->if_mtu = WAVELAN_MTU; 491 ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX; 492#ifdef WLDEBUG 493 ifp->if_flags |= IFF_DEBUG; 494#endif 495#if MULTICAST 496 ifp->if_flags |= IFF_MULTICAST; |
497#endif MULTICAST | 497#endif /* MULTICAST */ |
498 ifp->if_name = "wl"; 499 ifp->if_unit = unit; 500 ifp->if_init = wlinit; 501 ifp->if_output = ether_output; 502 ifp->if_start = wlstart; 503 ifp->if_ioctl = wlioctl; 504 ifp->if_timer = 0; /* paranoia */ 505 /* no entries --- 225 unchanged lines hidden (view full) --- 731 732 /* clear reset command and set PIO#1 in autoincrement mode */ 733 sc->hacr = HACR_DEFAULT; 734 CMD(unit); 735 736#ifdef WLDEBUG 737 if (sc->wl_if.if_flags & IFF_DEBUG) 738 wlmmcstat(unit); /* Display MMC registers */ | 498 ifp->if_name = "wl"; 499 ifp->if_unit = unit; 500 ifp->if_init = wlinit; 501 ifp->if_output = ether_output; 502 ifp->if_start = wlstart; 503 ifp->if_ioctl = wlioctl; 504 ifp->if_timer = 0; /* paranoia */ 505 /* no entries --- 225 unchanged lines hidden (view full) --- 731 732 /* clear reset command and set PIO#1 in autoincrement mode */ 733 sc->hacr = HACR_DEFAULT; 734 CMD(unit); 735 736#ifdef WLDEBUG 737 if (sc->wl_if.if_flags & IFF_DEBUG) 738 wlmmcstat(unit); /* Display MMC registers */ |
739#endif WLDEBUG | 739#endif /* WLDEBUG */ |
740 wlbldcu(unit); /* set up command unit structures */ 741 742 if (wldiag(unit) == 0) 743 return(0); 744 745 if (wlconfig(unit) == 0) 746 return(0); 747 /* --- 531 unchanged lines hidden (view full) --- 1279 if(sc->flags & DSF_RUNNING) { 1280 sc->flags &= ~DSF_RUNNING; 1281 wlinit(sc); 1282 } 1283 error = 0; 1284 } 1285#endif 1286 break; | 740 wlbldcu(unit); /* set up command unit structures */ 741 742 if (wldiag(unit) == 0) 743 return(0); 744 745 if (wlconfig(unit) == 0) 746 return(0); 747 /* --- 531 unchanged lines hidden (view full) --- 1279 if(sc->flags & DSF_RUNNING) { 1280 sc->flags &= ~DSF_RUNNING; 1281 wlinit(sc); 1282 } 1283 error = 0; 1284 } 1285#endif 1286 break; |
1287#endif MULTICAST | 1287#endif /* MULTICAST */ |
1288 1289 /* DEVICE SPECIFIC */ 1290 1291 1292 /* copy the PSA out to the caller */ 1293 case SIOCGWLPSA: 1294 /* pointer to buffer in user space */ 1295 up = (void *)ifr->ifr_data; --- 262 unchanged lines hidden (view full) --- 1558 } 1559 if (ac_status & AC_SW_A) { 1560 printf("wl%d: xmt aborted\n",unit); 1561 } 1562#ifdef notdef 1563 if (ac_status & TC_CARRIER) { 1564 printf("wl%d: no carrier\n", unit); 1565 } | 1288 1289 /* DEVICE SPECIFIC */ 1290 1291 1292 /* copy the PSA out to the caller */ 1293 case SIOCGWLPSA: 1294 /* pointer to buffer in user space */ 1295 up = (void *)ifr->ifr_data; --- 262 unchanged lines hidden (view full) --- 1558 } 1559 if (ac_status & AC_SW_A) { 1560 printf("wl%d: xmt aborted\n",unit); 1561 } 1562#ifdef notdef 1563 if (ac_status & TC_CARRIER) { 1564 printf("wl%d: no carrier\n", unit); 1565 } |
1566#endif notdef | 1566#endif /* notdef */ |
1567 if (ac_status & TC_CLS) { 1568 printf("wl%d: no CTS\n", unit); 1569 } 1570 if (ac_status & TC_DMA) { 1571 printf("wl%d: DMA underrun\n", unit); 1572 } 1573 if (ac_status & TC_DEFER) { 1574 printf("wl%d: xmt deferred\n",unit); --- 145 unchanged lines hidden (view full) --- 1720 outw(PIOP1(base), fd_p); /* end_fd->link_offset = fd_p */ 1721 sc->end_fd = fd_p; 1722 1723 return 1; 1724} 1725 1726#ifdef WLDEBUG 1727static int xmt_debug = 0; | 1567 if (ac_status & TC_CLS) { 1568 printf("wl%d: no CTS\n", unit); 1569 } 1570 if (ac_status & TC_DMA) { 1571 printf("wl%d: DMA underrun\n", unit); 1572 } 1573 if (ac_status & TC_DEFER) { 1574 printf("wl%d: xmt deferred\n",unit); --- 145 unchanged lines hidden (view full) --- 1720 outw(PIOP1(base), fd_p); /* end_fd->link_offset = fd_p */ 1721 sc->end_fd = fd_p; 1722 1723 return 1; 1724} 1725 1726#ifdef WLDEBUG 1727static int xmt_debug = 0; |
1728#endif WLDEBUG | 1728#endif /* WLDEBUG */ |
1729 1730/* 1731 * wlxmt: 1732 * 1733 * This routine fills in the appropriate registers and memory 1734 * locations on the WaveLAN board and starts the board off on 1735 * the transmit. 1736 * --- 33 unchanged lines hidden (view full) --- 1770 1771#ifdef WLDEBUG 1772 if (sc->wl_if.if_flags & IFF_DEBUG) { 1773 if (xmt_debug) { 1774 printf("XMT mbuf: L%d @%p ", count, (void *)mb_p); 1775 printf("ether type %x\n", eh_p->ether_type); 1776 } 1777 } | 1729 1730/* 1731 * wlxmt: 1732 * 1733 * This routine fills in the appropriate registers and memory 1734 * locations on the WaveLAN board and starts the board off on 1735 * the transmit. 1736 * --- 33 unchanged lines hidden (view full) --- 1770 1771#ifdef WLDEBUG 1772 if (sc->wl_if.if_flags & IFF_DEBUG) { 1773 if (xmt_debug) { 1774 printf("XMT mbuf: L%d @%p ", count, (void *)mb_p); 1775 printf("ether type %x\n", eh_p->ether_type); 1776 } 1777 } |
1778#endif WLDEBUG | 1778#endif /* WLDEBUG */ |
1779 outw(PIOR0(base), OFFSET_TBD); 1780 outw(PIOP0(base), 0); /* act_count */ 1781 outw(PIOR1(base), OFFSET_TBD + 4); 1782 outw(PIOP1(base), xmtdata_p); /* buffer_addr */ 1783 outw(PIOP1(base), 0); /* buffer_base */ 1784 for (;;) { 1785 if (count) { 1786 if (clen + count > WAVELAN_MTU) --- 38 unchanged lines hidden (view full) --- 1825 } else if ((tm_p = tm_p->m_next) == (struct mbuf *)0) 1826 break; 1827 count = tm_p->m_len; 1828 mb_p = mtod(tm_p, u_char *); 1829#ifdef WLDEBUG 1830 if (sc->wl_if.if_flags & IFF_DEBUG) 1831 if (xmt_debug) 1832 printf("mbuf+ L%d @%p ", count, (void *)mb_p); | 1779 outw(PIOR0(base), OFFSET_TBD); 1780 outw(PIOP0(base), 0); /* act_count */ 1781 outw(PIOR1(base), OFFSET_TBD + 4); 1782 outw(PIOP1(base), xmtdata_p); /* buffer_addr */ 1783 outw(PIOP1(base), 0); /* buffer_base */ 1784 for (;;) { 1785 if (count) { 1786 if (clen + count > WAVELAN_MTU) --- 38 unchanged lines hidden (view full) --- 1825 } else if ((tm_p = tm_p->m_next) == (struct mbuf *)0) 1826 break; 1827 count = tm_p->m_len; 1828 mb_p = mtod(tm_p, u_char *); 1829#ifdef WLDEBUG 1830 if (sc->wl_if.if_flags & IFF_DEBUG) 1831 if (xmt_debug) 1832 printf("mbuf+ L%d @%p ", count, (void *)mb_p); |
1833#endif WLDEBUG | 1833#endif /* WLDEBUG */ |
1834 } 1835#ifdef WLDEBUG 1836 if (sc->wl_if.if_flags & IFF_DEBUG) 1837 if (xmt_debug) 1838 printf("CLEN = %d\n", clen); | 1834 } 1835#ifdef WLDEBUG 1836 if (sc->wl_if.if_flags & IFF_DEBUG) 1837 if (xmt_debug) 1838 printf("CLEN = %d\n", clen); |
1839#endif WLDEBUG | 1839#endif /* WLDEBUG */ |
1840 outw(PIOR0(base), tbd_p); 1841 if (clen < ETHERMIN) { 1842 outw(PIOP0(base), inw(PIOP0(base)) + ETHERMIN - clen); 1843 outw(PIOR1(base), xmtdata_p); 1844 for (xmtshort_p = xmtdata_p; clen < ETHERMIN; clen += 2) 1845 outw(PIOP1(base), 0); 1846 } 1847 outw(PIOP0(base), inw(PIOP0(base)) | TBD_SW_EOF); 1848 outw(PIOR0(base), tbd_p + 2); 1849 outw(PIOP0(base), I82586NULL); 1850#ifdef WLDEBUG 1851 if (sc->wl_if.if_flags & IFF_DEBUG) { 1852 if (xmt_debug) { 1853 wltbd(unit); 1854 printf("\n"); 1855 } 1856 } | 1840 outw(PIOR0(base), tbd_p); 1841 if (clen < ETHERMIN) { 1842 outw(PIOP0(base), inw(PIOP0(base)) + ETHERMIN - clen); 1843 outw(PIOR1(base), xmtdata_p); 1844 for (xmtshort_p = xmtdata_p; clen < ETHERMIN; clen += 2) 1845 outw(PIOP1(base), 0); 1846 } 1847 outw(PIOP0(base), inw(PIOP0(base)) | TBD_SW_EOF); 1848 outw(PIOR0(base), tbd_p + 2); 1849 outw(PIOP0(base), I82586NULL); 1850#ifdef WLDEBUG 1851 if (sc->wl_if.if_flags & IFF_DEBUG) { 1852 if (xmt_debug) { 1853 wltbd(unit); 1854 printf("\n"); 1855 } 1856 } |
1857#endif WLDEBUG | 1857#endif /* WLDEBUG */ |
1858 1859 outw(PIOR0(base), OFFSET_SCB + 2); /* address of scb_command */ 1860 /* 1861 * wait for 586 to clear previous command, complain if it takes 1862 * too long 1863 */ 1864 for (spin = 1;;spin = (spin + 1) % 10000) { 1865 if (inw(PIOP0(base)) == 0) { /* it's done, we can go */ --- 168 unchanged lines hidden (view full) --- 2034#if defined(__FreeBSD__) && __FreeBSD_version >= 300000 2035 struct ifmultiaddr *ifma; 2036 u_char *addrp; 2037#else 2038 struct ether_multi *enm; 2039 struct ether_multistep step; 2040#endif 2041 int cnt = 0; | 1858 1859 outw(PIOR0(base), OFFSET_SCB + 2); /* address of scb_command */ 1860 /* 1861 * wait for 586 to clear previous command, complain if it takes 1862 * too long 1863 */ 1864 for (spin = 1;;spin = (spin + 1) % 10000) { 1865 if (inw(PIOP0(base)) == 0) { /* it's done, we can go */ --- 168 unchanged lines hidden (view full) --- 2034#if defined(__FreeBSD__) && __FreeBSD_version >= 300000 2035 struct ifmultiaddr *ifma; 2036 u_char *addrp; 2037#else 2038 struct ether_multi *enm; 2039 struct ether_multistep step; 2040#endif 2041 int cnt = 0; |
2042#endif MULTICAST | 2042#endif /* MULTICAST */ |
2043 2044#ifdef WLDEBUG 2045 if (sc->wl_if.if_flags & IFF_DEBUG) 2046 printf("wl%d: entered wlconfig()\n",unit); 2047#endif 2048 outw(PIOR0(base), OFFSET_SCB); 2049 if (inw(PIOP0(base)) & SCB_SW_INT) { 2050 /* --- 95 unchanged lines hidden (view full) --- 2146 } 2147 ETHER_NEXT_MULTI(step, enm); 2148 } 2149#endif 2150 outw(PIOR1(base), OFFSET_CU + 6); /* mc-cnt */ 2151 outw(PIOP1(base), cnt * WAVELAN_ADDR_SIZE); 2152 if(wlcmd(unit, "config()-mcaddress") == 0) 2153 return 0; | 2043 2044#ifdef WLDEBUG 2045 if (sc->wl_if.if_flags & IFF_DEBUG) 2046 printf("wl%d: entered wlconfig()\n",unit); 2047#endif 2048 outw(PIOR0(base), OFFSET_SCB); 2049 if (inw(PIOP0(base)) & SCB_SW_INT) { 2050 /* --- 95 unchanged lines hidden (view full) --- 2146 } 2147 ETHER_NEXT_MULTI(step, enm); 2148 } 2149#endif 2150 outw(PIOR1(base), OFFSET_CU + 6); /* mc-cnt */ 2151 outw(PIOP1(base), cnt * WAVELAN_ADDR_SIZE); 2152 if(wlcmd(unit, "config()-mcaddress") == 0) 2153 return 0; |
2154#endif MULTICAST | 2154#endif /* MULTICAST */ |
2155 2156 outw(PIOR1(base), OFFSET_CU); 2157 outw(PIOP1(base), 0); /* ac_status */ 2158 outw(PIOP1(base), AC_IASETUP|AC_CW_EL); /* ac_command */ 2159 outw(PIOR1(base), OFFSET_CU + 6); 2160 outsw(PIOP1(base), sc->wl_addr, WAVELAN_ADDR_SIZE/2); 2161 2162 if(wlcmd(unit, "config()-address") == 0) --- 540 unchanged lines hidden --- | 2155 2156 outw(PIOR1(base), OFFSET_CU); 2157 outw(PIOP1(base), 0); /* ac_status */ 2158 outw(PIOP1(base), AC_IASETUP|AC_CW_EL); /* ac_command */ 2159 outw(PIOR1(base), OFFSET_CU + 6); 2160 outsw(PIOP1(base), sc->wl_addr, WAVELAN_ADDR_SIZE/2); 2161 2162 if(wlcmd(unit, "config()-address") == 0) --- 540 unchanged lines hidden --- |