sc->sc_addr = kvtop((vaddr_t)sc->sc_mem); if (sc->sc_addr == 0L) { printf("\n%s: kvtop() failed!\n", sc->sc_dev.dv_xname); return; }
sc->sc_addr = (paddr_t)addr & 0x00ffffff;
leattach(parent, self, aux)	struct device *parent;	struct device *self;	void *aux;{	register struct le_softc *lesc = (struct le_softc *)self;	struct am7990_softc *sc = &lesc->sc_am7990;	struct confargs *ca = aux;	int pri = ca->ca_ipl;	extern void *etherbuf;	caddr_t addr;	int card;	/* XXX the following declarations should be elsewhere */	extern void myetheraddr(u_char *);	lebustype = ca->ca_bustype;	/* Are we the boot device? */	if (ca->ca_paddr == bootaddr)		bootdv = self;	switch (lebustype) {	case BUS_VMES:		/* 		 * get the first available etherbuf.  MVME376 uses its own		 * dual-ported RAM for etherbuf.  It is set by dip switches		 * on board.  We support the six Motorola address locations,		 * however, the board can be set up at any other address.		 * XXX These physical addresses should be mapped in extio!!!		 */		switch ((int)ca->ca_paddr) {		case 0xffff1200:			card = 0;			break;		case 0xffff1400:			card = 1;			break;		case 0xffff1600:			card = 2;			break;		case 0xffff5400:			card = 3;			break;		case 0xffff5600:			card = 4;			break;		case 0xffffa400:			card = 5;			break;		default:			printf(": unsupported address\n");			return;		}		addr = (caddr_t)(VLEMEMBASE - (card * VLEMEMSIZE));		sc->sc_mem = (void *)mapiodev(addr, VLEMEMSIZE);		if (sc->sc_mem == NULL) {			printf("\n%s: no more memory in external I/O map\n",			    sc->sc_dev.dv_xname);			return;		}		sc->sc_addr = kvtop((vaddr_t)sc->sc_mem);		if (sc->sc_addr == 0L) {			printf("\n%s: kvtop() failed!\n", sc->sc_dev.dv_xname);			return;		}		lesc->sc_r1 = (void *)ca->ca_vaddr;		lesc->sc_ipl = ca->ca_ipl;		lesc->sc_vec = ca->ca_vec;		sc->sc_memsize = VLEMEMSIZE;		sc->sc_conf3 = LE_C3_BSWP;		sc->sc_hwreset = vlereset;		sc->sc_rdcsr = vlerdcsr;		sc->sc_wrcsr = vlewrcsr;		sc->sc_hwinit = vleinit;		sc->sc_copytodesc = vle_copytobuf_contig;		sc->sc_copyfromdesc = am7990_copyfrombuf_contig;		sc->sc_copytobuf = vle_copytobuf_contig;		sc->sc_copyfrombuf = am7990_copyfrombuf_contig;		sc->sc_zerobuf = am7990_zerobuf_contig;		/* get ether address */		vleetheraddr(sc);		break;      	case BUS_PCC:		sc->sc_mem = etherbuf;		lesc->sc_r1 = (void *)ca->ca_vaddr;		sc->sc_conf3 = LE_C3_BSWP /*| LE_C3_ACON | LE_C3_BCON*/;		sc->sc_addr = kvtop((vaddr_t)sc->sc_mem);		sc->sc_memsize = LEMEMSIZE;		sc->sc_rdcsr = lerdcsr;		sc->sc_wrcsr = lewrcsr;		sc->sc_hwreset = NULL;		sc->sc_hwinit = NULL;		sc->sc_copytodesc = am7990_copytobuf_contig;		sc->sc_copyfromdesc = am7990_copyfrombuf_contig;		sc->sc_copytobuf = am7990_copytobuf_contig;		sc->sc_copyfrombuf = am7990_copyfrombuf_contig;		sc->sc_zerobuf = am7990_zerobuf_contig;		/* get ether address */		myetheraddr(sc->sc_arpcom.ac_enaddr);		break;	default:		printf(": unknown bus type\n");		return;	}	evcnt_attach(&sc->sc_dev, "intr", &lesc->sc_intrcnt);	evcnt_attach(&sc->sc_dev, "errs", &lesc->sc_errcnt);	/*	if (lebustype == BUS_VMES) 		vleinit(sc);	*/	am7990_config(sc);	/* connect the interrupt */	switch (lebustype) {	case BUS_VMES:		lesc->sc_ih.ih_fn = vle_intr;		lesc->sc_ih.ih_arg = sc;		lesc->sc_ih.ih_ipl = pri;		vmeintr_establish(ca->ca_vec + 0, &lesc->sc_ih);		break;#if NPCC > 0	case BUS_PCC:		lesc->sc_ih.ih_fn = am7990_intr;		lesc->sc_ih.ih_arg = sc;		lesc->sc_ih.ih_ipl = pri;		pccintr_establish(PCCV_LE, &lesc->sc_ih);		((struct pccreg *)ca->ca_master)->pcc_leirq = pri | PCC_IRQ_IEN;		break;#endif	}}