Home | History | Annotate | Line # | Download | only in sbus
if_le_ledma.c revision 1.20
      1  1.20  thorpej /*	$NetBSD: if_le_ledma.c,v 1.20 2002/09/30 23:07:08 thorpej Exp $	*/
      2   1.1       pk 
      3   1.1       pk /*-
      4   1.1       pk  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
      5   1.1       pk  * All rights reserved.
      6   1.1       pk  *
      7   1.1       pk  * This code is derived from software contributed to The NetBSD Foundation
      8   1.1       pk  * by Charles M. Hannum; Jason R. Thorpe of the Numerical Aerospace
      9   1.1       pk  * Simulation Facility, NASA Ames Research Center; Paul Kranenburg.
     10   1.1       pk  *
     11   1.1       pk  * Redistribution and use in source and binary forms, with or without
     12   1.1       pk  * modification, are permitted provided that the following conditions
     13   1.1       pk  * are met:
     14   1.1       pk  * 1. Redistributions of source code must retain the above copyright
     15   1.1       pk  *    notice, this list of conditions and the following disclaimer.
     16   1.1       pk  * 2. Redistributions in binary form must reproduce the above copyright
     17   1.1       pk  *    notice, this list of conditions and the following disclaimer in the
     18   1.1       pk  *    documentation and/or other materials provided with the distribution.
     19   1.1       pk  * 3. All advertising materials mentioning features or use of this software
     20   1.1       pk  *    must display the following acknowledgement:
     21   1.1       pk  *	This product includes software developed by the NetBSD
     22   1.1       pk  *	Foundation, Inc. and its contributors.
     23   1.1       pk  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24   1.1       pk  *    contributors may be used to endorse or promote products derived
     25   1.1       pk  *    from this software without specific prior written permission.
     26   1.1       pk  *
     27   1.1       pk  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28   1.1       pk  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29   1.1       pk  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30   1.1       pk  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31   1.1       pk  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32   1.1       pk  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33   1.1       pk  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34   1.1       pk  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35   1.1       pk  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36   1.1       pk  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37   1.1       pk  * POSSIBILITY OF SUCH DAMAGE.
     38   1.1       pk  */
     39  1.15    lukem 
     40  1.15    lukem #include <sys/cdefs.h>
     41  1.20  thorpej __KERNEL_RCSID(0, "$NetBSD: if_le_ledma.c,v 1.20 2002/09/30 23:07:08 thorpej Exp $");
     42   1.1       pk 
     43   1.1       pk #include "opt_inet.h"
     44   1.1       pk #include "bpfilter.h"
     45   1.1       pk 
     46   1.1       pk #include <sys/param.h>
     47   1.1       pk #include <sys/systm.h>
     48   1.1       pk #include <sys/mbuf.h>
     49   1.1       pk #include <sys/syslog.h>
     50   1.1       pk #include <sys/socket.h>
     51   1.1       pk #include <sys/device.h>
     52   1.1       pk #include <sys/malloc.h>
     53   1.1       pk 
     54   1.1       pk #include <net/if.h>
     55   1.1       pk #include <net/if_ether.h>
     56   1.1       pk #include <net/if_media.h>
     57   1.1       pk 
     58   1.1       pk #ifdef INET
     59   1.1       pk #include <netinet/in.h>
     60   1.1       pk #include <netinet/if_inarp.h>
     61   1.1       pk #endif
     62   1.1       pk 
     63  1.11       pk #include <machine/bus.h>
     64  1.11       pk #include <machine/intr.h>
     65   1.1       pk 
     66   1.1       pk #include <dev/sbus/sbusvar.h>
     67   1.1       pk 
     68   1.1       pk #include <dev/ic/lsi64854reg.h>
     69   1.1       pk #include <dev/ic/lsi64854var.h>
     70   1.1       pk 
     71   1.1       pk #include <dev/ic/lancereg.h>
     72   1.1       pk #include <dev/ic/lancevar.h>
     73   1.1       pk #include <dev/ic/am7990reg.h>
     74   1.1       pk #include <dev/ic/am7990var.h>
     75   1.1       pk 
     76   1.1       pk /*
     77   1.1       pk  * LANCE registers.
     78   1.1       pk  */
     79   1.1       pk #define LEREG1_RDP	0	/* Register Data port */
     80   1.1       pk #define LEREG1_RAP	2	/* Register Address port */
     81   1.1       pk 
     82   1.1       pk struct	le_softc {
     83   1.1       pk 	struct	am7990_softc	sc_am7990;	/* glue to MI code */
     84   1.1       pk 	struct	sbusdev		sc_sd;		/* sbus device */
     85   1.1       pk 	bus_space_tag_t		sc_bustag;
     86   1.8       pk 	bus_dmamap_t		sc_dmamap;
     87   1.1       pk 	bus_space_handle_t	sc_reg;		/* LANCE registers */
     88   1.1       pk 	struct	lsi64854_softc	*sc_dma;	/* pointer to my dma */
     89   1.4      eeh 	u_int			sc_laddr;	/* LANCE DMA address */
     90   1.1       pk };
     91   1.1       pk 
     92   1.1       pk #define MEMSIZE		(16*1024)	/* LANCE memory size */
     93   1.1       pk #define LEDMA_BOUNDARY	(16*1024*1024)	/* must not cross 16MB boundary */
     94   1.1       pk 
     95   1.1       pk int	lematch_ledma __P((struct device *, struct cfdata *, void *));
     96   1.1       pk void	leattach_ledma __P((struct device *, struct device *, void *));
     97   1.1       pk 
     98   1.1       pk /*
     99   1.1       pk  * Media types supported by the Sun4m.
    100   1.1       pk  */
    101   1.1       pk static int lemedia[] = {
    102   1.1       pk 	IFM_ETHER|IFM_10_T,
    103   1.1       pk 	IFM_ETHER|IFM_10_5,
    104   1.1       pk 	IFM_ETHER|IFM_AUTO,
    105   1.1       pk };
    106   1.1       pk #define NLEMEDIA	(sizeof(lemedia) / sizeof(lemedia[0]))
    107   1.1       pk 
    108   1.1       pk void	lesetutp __P((struct lance_softc *));
    109   1.1       pk void	lesetaui __P((struct lance_softc *));
    110   1.1       pk 
    111   1.1       pk int	lemediachange __P((struct lance_softc *));
    112   1.1       pk void	lemediastatus __P((struct lance_softc *, struct ifmediareq *));
    113   1.1       pk 
    114  1.20  thorpej CFATTACH_DECL(le_ledma, sizeof(struct le_softc),
    115  1.20  thorpej     lematch_ledma, leattach_ledma, NULL, NULL)
    116   1.1       pk 
    117   1.1       pk extern struct cfdriver le_cd;
    118   1.1       pk 
    119  1.14      mrg #if defined(_KERNEL_OPT)
    120   1.1       pk #include "opt_ddb.h"
    121   1.1       pk #endif
    122   1.1       pk 
    123   1.1       pk #ifdef DDB
    124   1.1       pk #define	integrate
    125   1.1       pk #define hide
    126   1.1       pk #else
    127   1.1       pk #define	integrate	static __inline
    128   1.1       pk #define hide		static
    129   1.1       pk #endif
    130   1.1       pk 
    131   1.1       pk static void lewrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
    132   1.1       pk static u_int16_t lerdcsr __P((struct lance_softc *, u_int16_t));
    133   1.1       pk hide void lehwreset __P((struct lance_softc *));
    134   1.1       pk hide void lehwinit __P((struct lance_softc *));
    135   1.1       pk hide void lenocarrier __P((struct lance_softc *));
    136   1.1       pk 
    137   1.1       pk static void
    138   1.1       pk lewrcsr(sc, port, val)
    139   1.1       pk 	struct lance_softc *sc;
    140   1.1       pk 	u_int16_t port, val;
    141   1.1       pk {
    142   1.1       pk 	struct le_softc *lesc = (struct le_softc *)sc;
    143   1.1       pk 
    144   1.1       pk 	bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port);
    145   1.1       pk 	bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP, val);
    146   1.1       pk 
    147   1.1       pk #if defined(SUN4M)
    148   1.1       pk 	/*
    149   1.1       pk 	 * We need to flush the Sbus->Mbus write buffers. This can most
    150   1.1       pk 	 * easily be accomplished by reading back the register that we
    151   1.1       pk 	 * just wrote (thanks to Chris Torek for this solution).
    152   1.1       pk 	 */
    153   1.1       pk 	if (CPU_ISSUN4M) {
    154   1.1       pk 		volatile u_int16_t discard;
    155   1.1       pk 		discard = bus_space_read_2(lesc->sc_bustag, lesc->sc_reg,
    156   1.1       pk 					   LEREG1_RDP);
    157   1.1       pk 	}
    158   1.1       pk #endif
    159   1.1       pk }
    160   1.1       pk 
    161   1.1       pk static u_int16_t
    162   1.1       pk lerdcsr(sc, port)
    163   1.1       pk 	struct lance_softc *sc;
    164   1.1       pk 	u_int16_t port;
    165   1.1       pk {
    166   1.1       pk 	struct le_softc *lesc = (struct le_softc *)sc;
    167   1.1       pk 
    168   1.1       pk 	bus_space_write_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RAP, port);
    169   1.1       pk 	return (bus_space_read_2(lesc->sc_bustag, lesc->sc_reg, LEREG1_RDP));
    170   1.1       pk }
    171   1.1       pk 
    172   1.1       pk void
    173   1.1       pk lesetutp(sc)
    174   1.1       pk 	struct lance_softc *sc;
    175   1.1       pk {
    176   1.3       pk 	struct lsi64854_softc *dma = ((struct le_softc *)sc)->sc_dma;
    177   1.1       pk 	u_int32_t csr;
    178   1.1       pk 
    179   1.3       pk 	csr = L64854_GCSR(dma);
    180   1.1       pk 	csr |= E_TP_AUI;
    181   1.3       pk 	L64854_SCSR(dma, csr);
    182   1.1       pk 	delay(20000);	/* must not touch le for 20ms */
    183   1.1       pk }
    184   1.1       pk 
    185   1.1       pk void
    186   1.1       pk lesetaui(sc)
    187   1.1       pk 	struct lance_softc *sc;
    188   1.1       pk {
    189   1.3       pk 	struct lsi64854_softc *dma = ((struct le_softc *)sc)->sc_dma;
    190   1.1       pk 	u_int32_t csr;
    191   1.1       pk 
    192   1.3       pk 	csr = L64854_GCSR(dma);
    193   1.1       pk 	csr &= ~E_TP_AUI;
    194   1.3       pk 	L64854_SCSR(dma, csr);
    195   1.1       pk 	delay(20000);	/* must not touch le for 20ms */
    196   1.1       pk }
    197   1.1       pk 
    198   1.1       pk int
    199   1.1       pk lemediachange(sc)
    200   1.1       pk 	struct lance_softc *sc;
    201   1.1       pk {
    202   1.1       pk 	struct ifmedia *ifm = &sc->sc_media;
    203   1.1       pk 
    204   1.1       pk 	if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER)
    205   1.1       pk 		return (EINVAL);
    206   1.1       pk 
    207   1.1       pk 	/*
    208   1.1       pk 	 * Switch to the selected media.  If autoselect is
    209   1.1       pk 	 * set, we don't really have to do anything.  We'll
    210   1.1       pk 	 * switch to the other media when we detect loss of
    211   1.1       pk 	 * carrier.
    212   1.1       pk 	 */
    213   1.1       pk 	switch (IFM_SUBTYPE(ifm->ifm_media)) {
    214   1.1       pk 	case IFM_10_T:
    215   1.1       pk 		lesetutp(sc);
    216   1.1       pk 		break;
    217   1.1       pk 
    218   1.1       pk 	case IFM_10_5:
    219   1.1       pk 		lesetaui(sc);
    220   1.1       pk 		break;
    221   1.1       pk 
    222   1.1       pk 	case IFM_AUTO:
    223   1.1       pk 		break;
    224   1.1       pk 
    225   1.1       pk 	default:
    226   1.1       pk 		return (EINVAL);
    227   1.1       pk 	}
    228   1.1       pk 
    229   1.1       pk 	return (0);
    230   1.1       pk }
    231   1.1       pk 
    232   1.1       pk void
    233   1.1       pk lemediastatus(sc, ifmr)
    234   1.1       pk 	struct lance_softc *sc;
    235   1.1       pk 	struct ifmediareq *ifmr;
    236   1.1       pk {
    237   1.3       pk 	struct lsi64854_softc *dma = ((struct le_softc *)sc)->sc_dma;
    238   1.1       pk 
    239   1.1       pk 	/*
    240   1.1       pk 	 * Notify the world which media we're currently using.
    241   1.1       pk 	 */
    242   1.3       pk 	if (L64854_GCSR(dma) & E_TP_AUI)
    243   1.1       pk 		ifmr->ifm_active = IFM_ETHER|IFM_10_T;
    244   1.1       pk 	else
    245   1.1       pk 		ifmr->ifm_active = IFM_ETHER|IFM_10_5;
    246   1.1       pk }
    247   1.1       pk 
    248   1.1       pk hide void
    249   1.1       pk lehwreset(sc)
    250   1.1       pk 	struct lance_softc *sc;
    251   1.1       pk {
    252   1.1       pk 	struct le_softc *lesc = (struct le_softc *)sc;
    253   1.1       pk 	struct lsi64854_softc *dma = lesc->sc_dma;
    254   1.1       pk 	u_int32_t csr;
    255   1.4      eeh 	u_int aui_bit;
    256   1.1       pk 
    257   1.1       pk 	/*
    258   1.1       pk 	 * Reset DMA channel.
    259   1.1       pk 	 */
    260   1.1       pk 	csr = L64854_GCSR(dma);
    261   1.1       pk 	aui_bit = csr & E_TP_AUI;
    262   1.1       pk 	DMA_RESET(dma);
    263   1.1       pk 
    264   1.1       pk 	/* Write bits 24-31 of Lance address */
    265   1.1       pk 	bus_space_write_4(dma->sc_bustag, dma->sc_regs, L64854_REG_ENBAR,
    266   1.1       pk 			  lesc->sc_laddr & 0xff000000);
    267   1.1       pk 
    268   1.1       pk 	DMA_ENINTR(dma);
    269   1.1       pk 
    270   1.1       pk 	/*
    271   1.1       pk 	 * Disable E-cache invalidates on chip writes.
    272   1.1       pk 	 * Retain previous cable selection bit.
    273   1.1       pk 	 */
    274   1.1       pk 	csr = L64854_GCSR(dma);
    275   1.1       pk 	csr |= (E_DSBL_WR_INVAL | aui_bit);
    276   1.1       pk 	L64854_SCSR(dma, csr);
    277   1.5       pk 	delay(20000);	/* must not touch le for 20ms */
    278   1.1       pk }
    279   1.1       pk 
    280   1.1       pk hide void
    281   1.1       pk lehwinit(sc)
    282   1.1       pk 	struct lance_softc *sc;
    283   1.1       pk {
    284   1.1       pk 
    285   1.1       pk 	/*
    286   1.1       pk 	 * Make sure we're using the currently-enabled media type.
    287   1.1       pk 	 * XXX Actually, this is probably unnecessary, now.
    288   1.1       pk 	 */
    289   1.1       pk 	switch (IFM_SUBTYPE(sc->sc_media.ifm_cur->ifm_media)) {
    290   1.1       pk 	case IFM_10_T:
    291   1.1       pk 		lesetutp(sc);
    292   1.1       pk 		break;
    293   1.1       pk 
    294   1.1       pk 	case IFM_10_5:
    295   1.1       pk 		lesetaui(sc);
    296   1.1       pk 		break;
    297   1.1       pk 	}
    298   1.1       pk }
    299   1.1       pk 
    300   1.1       pk hide void
    301   1.1       pk lenocarrier(sc)
    302   1.1       pk 	struct lance_softc *sc;
    303   1.1       pk {
    304   1.1       pk 	struct le_softc *lesc = (struct le_softc *)sc;
    305   1.1       pk 
    306   1.1       pk 	/*
    307   1.1       pk 	 * Check if the user has requested a certain cable type, and
    308   1.1       pk 	 * if so, honor that request.
    309   1.1       pk 	 */
    310   1.1       pk 	printf("%s: lost carrier on ", sc->sc_dev.dv_xname);
    311   1.1       pk 
    312   1.1       pk 	if (L64854_GCSR(lesc->sc_dma) & E_TP_AUI) {
    313   1.1       pk 		printf("UTP port");
    314   1.1       pk 		switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) {
    315   1.1       pk 		case IFM_10_5:
    316   1.1       pk 		case IFM_AUTO:
    317   1.1       pk 			printf(", switching to AUI port");
    318   1.1       pk 			lesetaui(sc);
    319   1.1       pk 		}
    320   1.1       pk 	} else {
    321   1.1       pk 		printf("AUI port");
    322   1.1       pk 		switch (IFM_SUBTYPE(sc->sc_media.ifm_media)) {
    323   1.1       pk 		case IFM_10_T:
    324   1.1       pk 		case IFM_AUTO:
    325   1.1       pk 			printf(", switching to UTP port");
    326   1.1       pk 			lesetutp(sc);
    327   1.1       pk 		}
    328   1.1       pk 	}
    329   1.1       pk 	printf("\n");
    330   1.1       pk }
    331   1.1       pk 
    332   1.1       pk int
    333   1.1       pk lematch_ledma(parent, cf, aux)
    334   1.1       pk 	struct device *parent;
    335   1.1       pk 	struct cfdata *cf;
    336   1.1       pk 	void *aux;
    337   1.1       pk {
    338   1.1       pk 	struct sbus_attach_args *sa = aux;
    339   1.1       pk 
    340  1.18  thorpej 	return (strcmp(cf->cf_name, sa->sa_name) == 0);
    341   1.1       pk }
    342   1.1       pk 
    343   1.1       pk 
    344   1.1       pk void
    345   1.1       pk leattach_ledma(parent, self, aux)
    346   1.1       pk 	struct device *parent, *self;
    347   1.1       pk 	void *aux;
    348   1.1       pk {
    349   1.1       pk 	struct sbus_attach_args *sa = aux;
    350   1.1       pk 	struct le_softc *lesc = (struct le_softc *)self;
    351   1.1       pk 	struct lsi64854_softc *lsi = (struct lsi64854_softc *)parent;
    352   1.1       pk 	struct lance_softc *sc = &lesc->sc_am7990.lsc;
    353   1.8       pk 	bus_dma_tag_t dmatag = sa->sa_dmatag;
    354   1.1       pk 	bus_dma_segment_t seg;
    355   1.1       pk 	int rseg, error;
    356   1.1       pk 	/* XXX the following declarations should be elsewhere */
    357   1.1       pk 	extern void myetheraddr __P((u_char *));
    358   1.1       pk 
    359   1.1       pk 	lesc->sc_bustag = sa->sa_bustag;
    360   1.1       pk 
    361   1.1       pk 	/* Establish link to `ledma' device */
    362   1.1       pk 	lesc->sc_dma = lsi;
    363   1.2       pk 	lesc->sc_dma->sc_client = lesc;
    364   1.1       pk 
    365   1.1       pk 	/* Map device registers */
    366  1.16       pk 	if (sbus_bus_map(sa->sa_bustag,
    367  1.16       pk 			 sa->sa_slot,
    368  1.16       pk 			 sa->sa_offset,
    369  1.16       pk 			 sa->sa_size,
    370  1.17      eeh 			 0, &lesc->sc_reg) != 0) {
    371   1.1       pk 		printf("%s @ ledma: cannot map registers\n", self->dv_xname);
    372   1.1       pk 		return;
    373   1.1       pk 	}
    374   1.1       pk 
    375   1.1       pk 	/* Allocate buffer memory */
    376   1.1       pk 	sc->sc_memsize = MEMSIZE;
    377   1.8       pk 
    378   1.9       pk 	/* Get a DMA handle */
    379   1.8       pk 	if ((error = bus_dmamap_create(dmatag, MEMSIZE, 1, MEMSIZE,
    380   1.8       pk 					LEDMA_BOUNDARY, BUS_DMA_NOWAIT,
    381   1.8       pk 					&lesc->sc_dmamap)) != 0) {
    382   1.8       pk 		printf("%s: DMA map create error %d\n", self->dv_xname, error);
    383   1.8       pk 		return;
    384   1.8       pk 	}
    385   1.8       pk 
    386   1.9       pk 	/* Allocate DMA buffer */
    387  1.10       pk 	if ((error = bus_dmamem_alloc(dmatag, MEMSIZE, 0, LEDMA_BOUNDARY,
    388   1.8       pk 				 &seg, 1, &rseg, BUS_DMA_NOWAIT)) != 0) {
    389   1.1       pk 		printf("%s @ ledma: DMA buffer alloc error %d\n",
    390   1.1       pk 			self->dv_xname, error);
    391   1.1       pk 		return;
    392   1.1       pk 	}
    393   1.8       pk 
    394  1.12      mrg 	/* Map DMA buffer into kernel space */
    395  1.12      mrg 	if ((error = bus_dmamem_map(dmatag, &seg, rseg, MEMSIZE,
    396  1.12      mrg 			       (caddr_t *)&sc->sc_mem,
    397  1.12      mrg 			       BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
    398  1.12      mrg 		printf("%s @ ledma: DMA buffer map error %d\n",
    399   1.1       pk 			self->dv_xname, error);
    400   1.8       pk 		bus_dmamem_free(dmatag, &seg, rseg);
    401   1.8       pk 		return;
    402   1.8       pk 	}
    403   1.8       pk 
    404  1.12      mrg 	/* Load DMA buffer */
    405  1.12      mrg 	if ((error = bus_dmamap_load(dmatag, lesc->sc_dmamap, sc->sc_mem,
    406  1.13      mrg 			MEMSIZE, NULL, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
    407  1.12      mrg 		printf("%s: DMA buffer map load error %d\n",
    408   1.8       pk 			self->dv_xname, error);
    409   1.8       pk 		bus_dmamem_free(dmatag, &seg, rseg);
    410  1.12      mrg 		bus_dmamem_unmap(dmatag, sc->sc_mem, MEMSIZE);
    411   1.1       pk 		return;
    412   1.1       pk 	}
    413   1.1       pk 
    414   1.8       pk 	lesc->sc_laddr = lesc->sc_dmamap->dm_segs[0].ds_addr;
    415   1.8       pk 	sc->sc_addr = lesc->sc_laddr & 0xffffff;
    416   1.1       pk 	sc->sc_conf3 = LE_C3_BSWP | LE_C3_ACON | LE_C3_BCON;
    417   1.1       pk 
    418   1.1       pk 
    419   1.1       pk 	/* Assume SBus is grandparent */
    420   1.1       pk 	lesc->sc_sd.sd_reset = (void *)lance_reset;
    421   1.1       pk 	sbus_establish(&lesc->sc_sd, parent);
    422   1.1       pk 
    423   1.1       pk 	sc->sc_mediachange = lemediachange;
    424   1.1       pk 	sc->sc_mediastatus = lemediastatus;
    425   1.1       pk 	sc->sc_supmedia = lemedia;
    426   1.1       pk 	sc->sc_nsupmedia = NLEMEDIA;
    427   1.1       pk 	sc->sc_defaultmedia = IFM_ETHER|IFM_AUTO;
    428   1.1       pk 
    429   1.1       pk 	myetheraddr(sc->sc_enaddr);
    430   1.1       pk 
    431   1.1       pk 	sc->sc_copytodesc = lance_copytobuf_contig;
    432   1.1       pk 	sc->sc_copyfromdesc = lance_copyfrombuf_contig;
    433   1.1       pk 	sc->sc_copytobuf = lance_copytobuf_contig;
    434   1.1       pk 	sc->sc_copyfrombuf = lance_copyfrombuf_contig;
    435   1.1       pk 	sc->sc_zerobuf = lance_zerobuf_contig;
    436   1.1       pk 
    437   1.1       pk 	sc->sc_rdcsr = lerdcsr;
    438   1.1       pk 	sc->sc_wrcsr = lewrcsr;
    439   1.1       pk 	sc->sc_hwinit = lehwinit;
    440   1.1       pk 	sc->sc_nocarrier = lenocarrier;
    441   1.1       pk 	sc->sc_hwreset = lehwreset;
    442   1.1       pk 
    443   1.6       pk 	/* Establish interrupt handler */
    444   1.6       pk 	if (sa->sa_nintr != 0)
    445  1.11       pk 		(void)bus_intr_establish(sa->sa_bustag, sa->sa_pri, IPL_NET, 0,
    446   1.6       pk 					 am7990_intr, sc);
    447   1.1       pk 
    448   1.1       pk 	am7990_config(&lesc->sc_am7990);
    449   1.1       pk 
    450   1.1       pk 	/* now initialize DMA */
    451   1.1       pk 	lehwreset(sc);
    452   1.1       pk }
    453