diff --git a/sys/arch/sun3/dev/if_le.c b/sys/arch/sun3/dev/if_le.c index 10d21fcc04e7..63d008828e7c 100644 --- a/sys/arch/sun3/dev/if_le.c +++ b/sys/arch/sun3/dev/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.28 1996/04/22 02:25:54 christos Exp $ */ +/* $NetBSD: if_le.c,v 1.29 1996/05/07 01:32:31 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -62,50 +62,39 @@ #include #include -#include -#include #include -#define LE_NEED_BUF_CONTIG #include -#define LE_SOFTC(unit) le_cd.cd_devs[unit] -#define LE_DELAY(x) DELAY(x) +#include +#include static int le_match __P((struct device *, void *, void *)); static void le_attach __P((struct device *, struct device *, void *)); -int leintr __P((void *)); struct cfattach le_ca = { sizeof(struct le_softc), le_match, le_attach }; -struct cfdriver le_cd = { - NULL, "le", DV_IFNET -}; +hide void lewrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t)); +hide u_int16_t lerdcsr __P((struct am7990_softc *, u_int16_t)); -integrate void -lehwinit(sc) - struct le_softc *sc; -{ -} - -integrate void +hide void lewrcsr(sc, port, val) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port, val; { - register struct lereg1 *ler1 = sc->sc_r1; + register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; ler1->ler1_rap = port; ler1->ler1_rdp = val; } -integrate u_int16_t +hide u_int16_t lerdcsr(sc, port) - struct le_softc *sc; + struct am7990_softc *sc; u_int16_t port; { - register struct lereg1 *ler1 = sc->sc_r1; + register struct lereg1 *ler1 = ((struct le_softc *)sc)->sc_r1; u_int16_t val; ler1->ler1_rap = port; @@ -143,7 +132,8 @@ le_attach(parent, self, aux) struct device *parent, *self; void *aux; { - struct le_softc *sc = (void *)self; + struct le_softc *lesc = (struct le_softc *)self; + struct am7990_softc *sc = &lesc->sc_am7990; struct cfdata *cf = self->dv_cfdata; struct confargs *ca = aux; int intpri; @@ -153,7 +143,7 @@ le_attach(parent, self, aux) intpri = 3; printf(" level %d", intpri); - sc->sc_r1 = (struct lereg1 *) + lesc->sc_r1 = (struct lereg1 *) obio_alloc(ca->ca_paddr, OBIO_AMD_ETHER_SIZE); sc->sc_memsize = 0x4000; /* 16K */ @@ -169,36 +159,12 @@ le_attach(parent, self, aux) sc->sc_copyfrombuf = am7990_copyfrombuf_contig; sc->sc_zerobuf = am7990_zerobuf_contig; - sc->sc_arpcom.ac_if.if_name = le_cd.cd_name; - leconfig(sc); + sc->sc_rdcsr = lerdcsr; + sc->sc_wrcsr = lewrcsr; + sc->sc_hwinit = NULL; + + am7990_config(sc); /* Install interrupt handler. */ - isr_add_autovect(leintr, (void *)sc, intpri); + isr_add_autovect(am7990_intr, (void *)sc, intpri); } - -/* - * Compare two Ether/802 addresses for equality, inlined and - * unrolled for speed. I'd love to have an inline assembler - * version of this... XXX: Who wanted that? mycroft? - * I wrote one, but the following is just as efficient. - * This expands to 10 short m68k instructions! -gwr - * Note: use this like bcmp() - */ -static inline u_short -ether_cmp(one, two) - u_char *one, *two; -{ - register u_short *a = (u_short *) one; - register u_short *b = (u_short *) two; - register u_short diff; - - diff = *a++ - *b++; - diff |= *a++ - *b++; - diff |= *a++ - *b++; - - return (diff); -} - -#define ETHER_CMP ether_cmp - -#include diff --git a/sys/arch/sun3/dev/if_levar.h b/sys/arch/sun3/dev/if_levar.h index 17fea04312ea..1d753e6d10d7 100644 --- a/sys/arch/sun3/dev/if_levar.h +++ b/sys/arch/sun3/dev/if_levar.h @@ -1,4 +1,4 @@ -/* $NetBSD: if_levar.h,v 1.1 1995/12/10 08:46:08 mycroft Exp $ */ +/* $NetBSD: if_levar.h,v 1.2 1996/05/07 01:32:37 thorpej Exp $ */ /*- * Copyright (c) 1995 Charles M. Hannum. All rights reserved. @@ -47,36 +47,7 @@ * This structure contains the output queue for the interface, its address, ... */ struct le_softc { - struct device sc_dev; /* base structure */ - struct arpcom sc_arpcom; /* Ethernet common part */ - - void (*sc_copytodesc)(); /* Copy to descriptor */ - void (*sc_copyfromdesc)(); /* Copy from descriptor */ - - void (*sc_copytobuf)(); /* Copy to buffer */ - void (*sc_copyfrombuf)(); /* Copy from buffer */ - void (*sc_zerobuf)(); /* and Zero bytes in buffer */ - - u_int16_t sc_conf3; /* CSR3 value */ - - void *sc_mem; /* base address of RAM -- CPU's view */ - u_long sc_addr; /* base address of RAM -- LANCE's view */ - u_long sc_memsize; /* size of RAM */ - - int sc_nrbuf; /* number of receive buffers */ - int sc_ntbuf; /* number of transmit buffers */ - int sc_last_rd; - int sc_first_td, sc_last_td, sc_no_td; - - int sc_initaddr; - int sc_rmdaddr; - int sc_tmdaddr; - int sc_rbufaddr; - int sc_tbufaddr; - -#ifdef LEDEBUG - int sc_debug; -#endif + struct am7990_softc sc_am7990; /* glue to MI code */ struct lereg1 *sc_r1; /* LANCE registers */ };