printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr));
printf(" address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr));
epconfig(sc, chipset, enaddr)	struct ep_softc *sc;	u_short chipset;	u_int8_t *enaddr;{	struct ifnet *ifp = &sc->sc_arpcom.ac_if;	bus_space_tag_t iot = sc->sc_iot;	bus_space_handle_t ioh = sc->sc_ioh;	u_int16_t i;	sc->ep_chipset = chipset;	/*	 * We could have been groveling around in other register	 * windows in the front-end; make sure we're in window 0	 * to read the EEPROM.	 */	GO_WINDOW(0);	if (enaddr == NULL) {		/*		 * Read the station address from the eeprom		 */		for (i = 0; i < 3; i++) {			u_int16_t x;			if (epbusyeeprom(sc))				return;		/* XXX why is eeprom busy? */			bus_space_write_2(iot, ioh, EP_W0_EEPROM_COMMAND,			    READ_EEPROM | i);			if (epbusyeeprom(sc))				return;		/* XXX why is eeprom busy? */			x = bus_space_read_2(iot, ioh, EP_W0_EEPROM_DATA);			sc->sc_arpcom.ac_enaddr[(i << 1)] = x >> 8;			sc->sc_arpcom.ac_enaddr[(i << 1) + 1] = x;		}	} else {		bcopy(enaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);	}	printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr));	/*	 * Vortex-based (3c59x pci,eisa) and Boomerang (3c900,3c515?) cards	 * allow FDDI-sized (4500) byte packets.  Commands only take an	 * 11-bit parameter, and  11 bits isn't enough to hold a full-size	 * packet length.	 * Commands to these cards implicitly upshift a packet size	 * or threshold by 2 bits. 	 * To detect  cards with large-packet support, we probe by setting	 * the transmit threshold register, then change windows and	 * read back the threshold register directly, and see if the	 * threshold value was shifted or not.	 */	bus_space_write_2(iot, ioh, EP_COMMAND,			  SET_TX_AVAIL_THRESH | EP_LARGEWIN_PROBE ); 	GO_WINDOW(5);	i = bus_space_read_2(iot, ioh, EP_W5_TX_AVAIL_THRESH);	GO_WINDOW(1);	switch (i)  {	case EP_LARGEWIN_PROBE:	case (EP_LARGEWIN_PROBE & EP_LARGEWIN_MASK):		sc->txashift = 0;		break;	case (EP_LARGEWIN_PROBE << 2):		sc->txashift = 2;		/* XXX does the 3c515 support Vortex-style RESET_OPTIONS? */		break;	default:		printf("wrote %d to TX_AVAIL_THRESH, read back %d. "		    "Interface disabled\n", EP_THRESH_DISABLE, (int) i);		return;	}	/*	 * Ensure Tx-available interrupts are enabled for 	 * start the interface.	 * XXX should be in epinit()?	 */	bus_space_write_2(iot, ioh, EP_COMMAND,	    SET_TX_AVAIL_THRESH | (1600 >> sc->txashift));	bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ);	ifp->if_softc = sc;	ifp->if_start = epstart;	ifp->if_ioctl = epioctl;	ifp->if_watchdog = epwatchdog;	ifp->if_flags =	    IFF_BROADCAST | IFF_SIMPLEX | IFF_NOTRAILERS | IFF_MULTICAST;	if_attach(ifp);	ether_ifattach(ifp);	/*	 * Finish configuration: 	 * determine chipset if the front-end couldn't do so,	 * show board details, set media.	 */#ifdef __NetBSD__	/* print RAM size */	ep_internalconfig(sc);#endif	GO_WINDOW(0);#ifdef __NetBSD__	ifmedia_init(&sc->sc_media, 0, ep_media_change, ep_media_status);#endif	/*	 * If we've got an indirect (ISA, PCMCIA?) board, the chipset	 * is unknown.  If the board has large-packet support, it's a	 * Vortex/Boomerang, otherwise it's a 3c509.	 * XXX use eeprom capability word instead?	 */	if (sc->ep_chipset == EP_CHIPSET_UNKNOWN && sc->txashift)  {		printf("warning: unknown chipset, possibly 3c515?\n");#ifdef notyet		sc->sc_chipset = EP_CHIPSET_VORTEX;#endif	/* notyet */	}	/*	 * Ascertain which media types are present and inform ifmedia.	 */	switch (sc->ep_chipset) {	/* on a direct bus, the attach routine can tell, but check anyway. */	case EP_CHIPSET_VORTEX:	case EP_CHIPSET_BOOMERANG2:		ep_vortex_probemedia(sc);		break;	/* on ISA we can't yet tell 3c509 from 3c515. Assume the former. */	case EP_CHIPSET_3C509:	default:		ep_isa_probemedia(sc);		break;	}	GO_WINDOW(1);		/* Window 1 is operating window */#if NBPFILTER > 0	bpfattach(&sc->sc_arpcom.ac_if.if_bpf, ifp, DLT_EN10MB,	    sizeof (struct ether_header));#endif	sc->tx_start_thresh = 20;	/* probably a good starting point. */	/*  Establish callback to reset card when we reboot. */	shutdownhook_establish(epshutdown, sc);	ep_complete_cmd(sc, EP_COMMAND, RX_RESET);	ep_complete_cmd(sc, EP_COMMAND, TX_RESET);}