--- Net2/arch/i386/isa/if_ec.c 2018/04/24 18:12:08 1.1.1.2 +++ Net2/arch/i386/isa/if_ec.c 2018/04/24 18:20:10 1.1.1.3 @@ -33,7 +33,9 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * + * if_ec.c,v 1.10 1993/06/14 16:45:25 mycroft Exp */ + /* * A driver for the 3Com 3C503 (Etherlink II) ethernet adaptor. * @@ -51,16 +53,6 @@ * onboard xceiver or not. Since the Clarkson drivers do a very * good rendition of a 3c503, I also scavenged a lot of ideas from * there. - * - * Kludges: - * Since I couldn't really think of any non-creative way (other than - * using a #define) of configuring the board to use the onboard xceiver, - * I kludged the isa_device->unit to contain this information. Simply - * put, if bit-7 of isa_device->unit is set (>127) then the driver - * configures that unit to onboard-xceiver (BNC) and if <128 it assumes - * AUI. ec_attach informs the user of this on bootup. Also, ec_probe - * repairs this bit after obtaining it's information since I didn't know - * what else within the depths of the kernel would freak out if I left it. */ #include "param.h" #include "mbuf.h" @@ -106,7 +98,6 @@ struct ec_softc { u_short ec_vector; /* interrupt vector */ short ec_io_ctl_addr; /* i/o bus address, control */ short ec_io_nic_addr; /* i/o bus address, DS8390 */ - short thick_or_thin; /* thick=0;thin=2 */ caddr_t ec_vmem_addr; /* card RAM virtual memory base */ u_long ec_vmem_size; /* card RAM bytes */ @@ -153,15 +144,20 @@ struct isa_device *is; /* * Now we get the MAC address. Assume thin ethernet unless told otherwise later. */ - outb(sc->ec_io_ctl_addr + E33G_CNTRL, ECNTRL_RESET|2); /* Toggle reset bit on*/ + /* Toggle reset bit on*/ + outb(sc->ec_io_ctl_addr + E33G_CNTRL, ECNTRL_RESET|ECNTRL_ONBOARD); DELAY(100); - outb(sc->ec_io_ctl_addr + E33G_CNTRL, 2); /* Toggle reset bit off */ + /* Toggle reset bit off */ + outb(sc->ec_io_ctl_addr + E33G_CNTRL, ECNTRL_ONBOARD); DELAY(100); - outb(sc->ec_io_ctl_addr + E33G_CNTRL, ECNTRL_SAPROM|2); /* Map SA_PROM */ + /* Map SA_PROM */ + outb(sc->ec_io_ctl_addr + E33G_CNTRL, ECNTRL_SAPROM|ECNTRL_ONBOARD); for (i=0;iec_addr[i] = inb(sc->ec_io_nic_addr + i); - outb(sc->ec_io_ctl_addr + E33G_CNTRL, 2); /* Disable SA_PROM */ - outb(sc->ec_io_ctl_addr + E33G_GACFR, EGACFR_IRQOFF); /* tcm, rsel, mbs0, nim */ + /* Disable SA_PROM */ + outb(sc->ec_io_ctl_addr + E33G_CNTRL, ECNTRL_ONBOARD); + /* tcm, rsel, mbs0, nim */ + outb(sc->ec_io_ctl_addr + E33G_GACFR, EGACFR_IRQOFF); /* * Stop the chip just in case. */ @@ -190,7 +186,7 @@ struct isa_device *is; /* * All done. */ - return(1); + return(16); } ecattach(is) @@ -249,7 +245,8 @@ struct isa_device *is; /* * Weeee.. We get to tell people we exist... */ - printf(" address %s", ether_sprintf(sc->ec_addr)); + printf("ec%d: ethernet address %s\n", + is->id_unit, ether_sprintf(sc->ec_addr)); } ec_init(unit) @@ -261,7 +258,6 @@ int unit; u_short ax, cx; Bdry=0; -printf("ecinit"); /* * Address not known. */ @@ -269,13 +265,10 @@ printf("ecinit"); return; /* - * XXX (untested) * select thick (e.g. AUI connector) if LLC0 bit is set */ - if (ifp->if_flags & IFF_LLC0) - outb(sc->ec_io_ctl_addr + E33G_CNTRL, 0); - else - outb(sc->ec_io_ctl_addr + E33G_CNTRL, 2); + outb(sc->ec_io_ctl_addr + E33G_CNTRL, + (ifp->if_flags & IFF_LLC0) ? 0 : ECNTRL_ONBOARD); /* * Set up the 8390 chip. @@ -547,6 +540,7 @@ int len; struct mbuf *m, *ecget(); int off, resid; + ++sc->ec_if.if_ipackets; /* * Deal with trailer protocol: if type is trailer type * get true type from first 16-bit word past data.