Home | History | Annotate | Line # | Download | only in isa
if_le_isa.c revision 1.14
      1 /*	$NetBSD: if_le_isa.c,v 1.14 1997/10/19 18:57:06 thorpej Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 1997 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
      9  * NASA Ames Research Center.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. Redistributions in binary form must reproduce the above copyright
     17  *    notice, this list of conditions and the following disclaimer in the
     18  *    documentation and/or other materials provided with the distribution.
     19  * 3. All advertising materials mentioning features or use of this software
     20  *    must display the following acknowledgement:
     21  *	This product includes software developed by the NetBSD
     22  *	Foundation, Inc. and its contributors.
     23  * 4. Neither the name of The NetBSD Foundation nor the names of its
     24  *    contributors may be used to endorse or promote products derived
     25  *    from this software without specific prior written permission.
     26  *
     27  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     28  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     29  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     30  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     31  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     32  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     33  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     34  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     35  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     36  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     37  * POSSIBILITY OF SUCH DAMAGE.
     38  */
     39 
     40 /*-
     41  * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
     42  * Copyright (c) 1992, 1993
     43  *	The Regents of the University of California.  All rights reserved.
     44  *
     45  * This code is derived from software contributed to Berkeley by
     46  * Ralph Campbell and Rick Macklem.
     47  *
     48  * Redistribution and use in source and binary forms, with or without
     49  * modification, are permitted provided that the following conditions
     50  * are met:
     51  * 1. Redistributions of source code must retain the above copyright
     52  *    notice, this list of conditions and the following disclaimer.
     53  * 2. Redistributions in binary form must reproduce the above copyright
     54  *    notice, this list of conditions and the following disclaimer in the
     55  *    documentation and/or other materials provided with the distribution.
     56  * 3. All advertising materials mentioning features or use of this software
     57  *    must display the following acknowledgement:
     58  *	This product includes software developed by the University of
     59  *	California, Berkeley and its contributors.
     60  * 4. Neither the name of the University nor the names of its contributors
     61  *    may be used to endorse or promote products derived from this software
     62  *    without specific prior written permission.
     63  *
     64  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     65  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     66  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     67  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     68  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     69  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     70  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     71  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     72  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     73  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     74  * SUCH DAMAGE.
     75  *
     76  *	@(#)if_le.c	8.2 (Berkeley) 11/16/93
     77  */
     78 
     79 #include "bpfilter.h"
     80 
     81 #include <sys/param.h>
     82 #include <sys/systm.h>
     83 #include <sys/mbuf.h>
     84 #include <sys/syslog.h>
     85 #include <sys/socket.h>
     86 #include <sys/device.h>
     87 
     88 #include <net/if.h>
     89 #include <net/if_ether.h>
     90 #include <net/if_media.h>
     91 
     92 #ifdef INET
     93 #include <netinet/in.h>
     94 #include <netinet/if_inarp.h>
     95 #endif
     96 
     97 #include <vm/vm.h>
     98 
     99 #include <machine/cpu.h>
    100 #include <machine/intr.h>
    101 #include <machine/bus.h>
    102 
    103 #include <dev/isa/isareg.h>
    104 #include <dev/isa/isavar.h>
    105 #include <dev/isa/isadmavar.h>
    106 
    107 #include <dev/ic/am7990reg.h>
    108 #include <dev/ic/am7990var.h>
    109 
    110 #include <dev/isa/if_levar.h>
    111 
    112 static char *card_type[] =
    113     { "unknown", "BICC Isolan", "NE2100", "DEPCA", "PCnet-ISA" };
    114 
    115 int le_isa_probe __P((struct device *, void *, void *));
    116 void le_isa_attach __P((struct device *, struct device *, void *));
    117 
    118 struct cfattach le_isa_ca = {
    119 	sizeof(struct le_softc), le_isa_probe, le_isa_attach
    120 };
    121 
    122 int depca_isa_probe __P((struct le_softc *, struct isa_attach_args *));
    123 int ne2100_isa_probe __P((struct le_softc *, struct isa_attach_args *));
    124 int bicc_isa_probe __P((struct le_softc *, struct isa_attach_args *));
    125 int lance_isa_probe __P((struct am7990_softc *));
    126 
    127 int le_isa_intredge __P((void *));
    128 
    129 hide void le_isa_wrcsr __P((struct am7990_softc *, u_int16_t, u_int16_t));
    130 hide u_int16_t le_isa_rdcsr __P((struct am7990_softc *, u_int16_t));
    131 
    132 void	depca_copytobuf __P((struct am7990_softc *, void *, int, int));
    133 void	depca_copyfrombuf __P((struct am7990_softc *, void *, int, int));
    134 void	depca_zerobuf __P((struct am7990_softc *, int, int));
    135 
    136 #define	LE_ISA_MEMSIZE	16384
    137 
    138 hide void
    139 le_isa_wrcsr(sc, port, val)
    140 	struct am7990_softc *sc;
    141 	u_int16_t port, val;
    142 {
    143 	struct le_softc *lesc = (struct le_softc *)sc;
    144 	bus_space_tag_t iot = lesc->sc_iot;
    145 	bus_space_handle_t ioh = lesc->sc_ioh;
    146 
    147 	bus_space_write_2(iot, ioh, lesc->sc_rap, port);
    148 	bus_space_write_2(iot, ioh, lesc->sc_rdp, val);
    149 }
    150 
    151 hide u_int16_t
    152 le_isa_rdcsr(sc, port)
    153 	struct am7990_softc *sc;
    154 	u_int16_t port;
    155 {
    156 	struct le_softc *lesc = (struct le_softc *)sc;
    157 	bus_space_tag_t iot = lesc->sc_iot;
    158 	bus_space_handle_t ioh = lesc->sc_ioh;
    159 	u_int16_t val;
    160 
    161 	bus_space_write_2(iot, ioh, lesc->sc_rap, port);
    162 	val = bus_space_read_2(iot, ioh, lesc->sc_rdp);
    163 	return (val);
    164 }
    165 
    166 int
    167 le_isa_probe(parent, match, aux)
    168 	struct device *parent;
    169 	void *match, *aux;
    170 {
    171 	struct le_softc *lesc = match;
    172 	struct isa_attach_args *ia = aux;
    173 
    174 	/* Disallow wildcarded i/o address. */
    175 	if (ia->ia_iobase == ISACF_PORT_DEFAULT)
    176 		return (0);
    177 
    178 	if (bicc_isa_probe(lesc, ia))
    179 		return (1);
    180 	if (ne2100_isa_probe(lesc, ia))
    181 		return (1);
    182 	if (depca_isa_probe(lesc, ia))
    183 		return (1);
    184 
    185 	return (0);
    186 }
    187 
    188 int
    189 depca_isa_probe(lesc, ia)
    190 	struct le_softc *lesc;
    191 	struct isa_attach_args *ia;
    192 {
    193 	struct am7990_softc *sc = &lesc->sc_am7990;
    194 	int iobase = ia->ia_iobase, port;
    195 	bus_space_tag_t iot = ia->ia_iot;
    196 	bus_space_handle_t ioh;
    197 	bus_space_handle_t memh;
    198 	u_int8_t csr;
    199 #if 0
    200 	u_int32_t sum, rom_sum;
    201 	u_int8_t x;
    202 #endif
    203 	int i;
    204 
    205 	/* Map i/o space. */
    206 	if (bus_space_map(iot, iobase, 16, 0, &ioh))
    207 		return 0;
    208 
    209 	if (ia->ia_maddr == MADDRUNK || ia->ia_msize == -1)
    210 		goto bad;
    211 
    212 	switch (ia->ia_msize) {
    213 	case 65536:
    214 		csr = DEPCA_CSR_SHE;
    215 		break;
    216 	case 32768:
    217 		csr = DEPCA_CSR_SHE | DEPCA_CSR_LOW32K;
    218 		break;
    219 	default:
    220 		goto bad;
    221 	}
    222 
    223 	/* Map card RAM. */
    224 	if (bus_space_map(ia->ia_memt, ia->ia_maddr, ia->ia_msize, 0, &memh))
    225 		goto bad;
    226 
    227 	/* Just needed to check mapability; don't need it anymore. */
    228 	bus_space_unmap(ia->ia_memt, memh, ia->ia_msize);
    229 
    230 	lesc->sc_iot = iot;
    231 	lesc->sc_ioh = ioh;
    232 	lesc->sc_rap = DEPCA_RAP;
    233 	lesc->sc_rdp = DEPCA_RDP;
    234 	lesc->sc_card = DEPCA;
    235 
    236 	if (lance_isa_probe(sc) == 0)
    237 		goto bad;
    238 
    239 	bus_space_write_1(iot, ioh, DEPCA_CSR, DEPCA_CSR_DUM);
    240 
    241 	/*
    242 	 * Extract the physical MAC address from the ROM.
    243 	 *
    244 	 * The address PROM is 32 bytes wide, and we access it through
    245 	 * a single I/O port.  On each read, it rotates to the next
    246 	 * position.  We find the ethernet address by looking for a
    247 	 * particular sequence of bytes (0xff, 0x00, 0x55, 0xaa, 0xff,
    248 	 * 0x00, 0x55, 0xaa), and then reading the next 8 bytes (the
    249 	 * ethernet address and a checksum).
    250 	 *
    251 	 * It appears that the PROM can be at one of two locations, so
    252 	 * we just try both.
    253 	 */
    254 	port = DEPCA_ADP;
    255 	for (i = 0; i < 32; i++)
    256 		if (bus_space_read_1(iot, ioh, port) == 0xff &&
    257 		    bus_space_read_1(iot, ioh, port) == 0x00 &&
    258 		    bus_space_read_1(iot, ioh, port) == 0x55 &&
    259 		    bus_space_read_1(iot, ioh, port) == 0xaa &&
    260 		    bus_space_read_1(iot, ioh, port) == 0xff &&
    261 		    bus_space_read_1(iot, ioh, port) == 0x00 &&
    262 		    bus_space_read_1(iot, ioh, port) == 0x55 &&
    263 		    bus_space_read_1(iot, ioh, port) == 0xaa)
    264 			goto found;
    265 	port = DEPCA_ADP + 1;
    266 	for (i = 0; i < 32; i++)
    267 		if (bus_space_read_1(iot, ioh, port) == 0xff &&
    268 		    bus_space_read_1(iot, ioh, port) == 0x00 &&
    269 		    bus_space_read_1(iot, ioh, port) == 0x55 &&
    270 		    bus_space_read_1(iot, ioh, port) == 0xaa &&
    271 		    bus_space_read_1(iot, ioh, port) == 0xff &&
    272 		    bus_space_read_1(iot, ioh, port) == 0x00 &&
    273 		    bus_space_read_1(iot, ioh, port) == 0x55 &&
    274 		    bus_space_read_1(iot, ioh, port) == 0xaa)
    275 			goto found;
    276 	printf("%s: address not found\n", sc->sc_dev.dv_xname);
    277 	goto bad;
    278 
    279 found:
    280 	for (i = 0; i < sizeof(sc->sc_enaddr); i++)
    281 		sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, port);
    282 
    283 #if 0
    284 	sum =
    285 	    (sc->sc_enaddr[0] <<  2) +
    286 	    (sc->sc_enaddr[1] << 10) +
    287 	    (sc->sc_enaddr[2] <<  1) +
    288 	    (sc->sc_enaddr[3] <<  9) +
    289 	    (sc->sc_enaddr[4] <<  0) +
    290 	    (sc->sc_enaddr[5] <<  8);
    291 	sum = (sum & 0xffff) + (sum >> 16);
    292 	sum = (sum & 0xffff) + (sum >> 16);
    293 
    294 	rom_sum = bus_space_read_1(iot, ioh, port);
    295 	rom_sum |= bus_space_read_1(iot, ioh, port) << 8;
    296 
    297 	if (sum != rom_sum) {
    298 		printf("%s: checksum mismatch; calculated %04x != read %04x",
    299 		    sc->sc_dev.dv_xname, sum, rom_sum);
    300 		goto bad;
    301 	}
    302 #endif
    303 
    304 	/*
    305 	 * XXX INDIRECT BROKENNESS!
    306 	 * XXX Should always unmap, and re-map in if_le_isa_attach().
    307 	 */
    308 
    309 	bus_space_write_1(iot, ioh, DEPCA_CSR, DEPCA_CSR_DUM | DEPCA_CSR_IEN |
    310 	    csr);
    311 
    312 	ia->ia_iosize = 16;
    313 	ia->ia_drq = DRQUNK;
    314 	return 1;
    315 
    316  bad:
    317 	bus_space_unmap(iot, ioh, 16);
    318 	return 0;
    319 }
    320 
    321 int
    322 ne2100_isa_probe(lesc, ia)
    323 	struct le_softc *lesc;
    324 	struct isa_attach_args *ia;
    325 {
    326 	struct am7990_softc *sc = &lesc->sc_am7990;
    327 	int iobase = ia->ia_iobase;
    328 	bus_space_tag_t iot = ia->ia_iot;
    329 	bus_space_handle_t ioh;
    330 	int i;
    331 
    332 	/* Map i/o space. */
    333 	if (bus_space_map(iot, iobase, 24, 0, &ioh))
    334 		return 0;
    335 
    336 	lesc->sc_iot = iot;
    337 	lesc->sc_ioh = ioh;
    338 	lesc->sc_rap = NE2100_RAP;
    339 	lesc->sc_rdp = NE2100_RDP;
    340 	lesc->sc_card = NE2100;
    341 
    342 	if (lance_isa_probe(sc) == 0) {
    343 		bus_space_unmap(iot, ioh, 24);
    344 		return 0;
    345 	}
    346 
    347 	/*
    348 	 * Extract the physical MAC address from the ROM.
    349 	 */
    350 	for (i = 0; i < sizeof(sc->sc_enaddr); i++)
    351 		sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, i);
    352 
    353 	/*
    354 	 * XXX INDIRECT BROKENNESS!
    355 	 * XXX Should always unmap, and re-map in if_le_isa_attach().
    356 	 */
    357 
    358 	ia->ia_iosize = 24;
    359 	return 1;
    360 }
    361 
    362 int
    363 bicc_isa_probe(lesc, ia)
    364 	struct le_softc *lesc;
    365 	struct isa_attach_args *ia;
    366 {
    367 	struct am7990_softc *sc = &lesc->sc_am7990;
    368 	int iobase = ia->ia_iobase;
    369 	bus_space_tag_t iot = ia->ia_iot;
    370 	bus_space_handle_t ioh;
    371 	int i;
    372 
    373 	/* Map i/o space. */
    374 	if (bus_space_map(iot, iobase, 16, 0, &ioh))
    375 		return 0;
    376 
    377 	lesc->sc_iot = iot;
    378 	lesc->sc_ioh = ioh;
    379 	lesc->sc_rap = BICC_RAP;
    380 	lesc->sc_rdp = BICC_RDP;
    381 	lesc->sc_card = BICC;
    382 
    383 	if (lance_isa_probe(sc) == 0) {
    384 		bus_space_unmap(iot, ioh, 16);
    385 		return 0;
    386 	}
    387 
    388 	/*
    389 	 * Extract the physical MAC address from the ROM.
    390 	 */
    391 	for (i = 0; i < sizeof(sc->sc_enaddr); i++)
    392 		sc->sc_enaddr[i] = bus_space_read_1(iot, ioh, i * 2);
    393 
    394 	/*
    395 	 * XXX INDIRECT BROKENNESS!
    396 	 * XXX Should always unmap, and re-map in if_le_isa_attach().
    397 	 */
    398 
    399 	ia->ia_iosize = 16;
    400 	return 1;
    401 }
    402 
    403 /*
    404  * Determine which chip is present on the card.
    405  */
    406 int
    407 lance_isa_probe(sc)
    408 	struct am7990_softc *sc;
    409 {
    410 
    411 	/* Stop the LANCE chip and put it in a known state. */
    412 	le_isa_wrcsr(sc, LE_CSR0, LE_C0_STOP);
    413 	delay(100);
    414 
    415 	if (le_isa_rdcsr(sc, LE_CSR0) != LE_C0_STOP)
    416 		return 0;
    417 
    418 	le_isa_wrcsr(sc, LE_CSR3, sc->sc_conf3);
    419 	return 1;
    420 }
    421 
    422 void
    423 le_isa_attach(parent, self, aux)
    424 	struct device *parent, *self;
    425 	void *aux;
    426 {
    427 	struct le_softc *lesc = (void *)self;
    428 	struct am7990_softc *sc = &lesc->sc_am7990;
    429 	struct isa_attach_args *ia = aux;
    430 	bus_space_tag_t iot = ia->ia_iot;
    431 	bus_space_tag_t memt = ia->ia_memt;
    432 	bus_dma_tag_t dmat = ia->ia_dmat;
    433 	bus_space_handle_t memh;
    434 	bus_dma_segment_t seg;
    435 	int rseg;
    436 
    437 	printf(": %s Ethernet\n", card_type[lesc->sc_card]);
    438 
    439 	lesc->sc_iot = iot;
    440 	lesc->sc_memt = memt;
    441 	lesc->sc_dmat = dmat;
    442 
    443 	/* XXX SHOULD RE-MAP I/O SPACE HERE. */
    444 
    445 	if (lesc->sc_card == DEPCA) {
    446 		u_char val;
    447 		int i;
    448 
    449 		/* Map shared memory. */
    450 		if (bus_space_map(memt, ia->ia_maddr, ia->ia_msize,
    451 		    0, &memh))
    452 			panic("le_isa_attach: can't map shared memory");
    453 
    454 		lesc->sc_memh = memh;
    455 
    456 		val = 0xff;
    457 		for (;;) {
    458 			bus_space_set_region_1(memt, memh, 0, val,
    459 			    ia->ia_msize);
    460 			for (i = 0; i < ia->ia_msize; i++)
    461 				if (bus_space_read_1(memt, memh, 1) != val) {
    462 					printf("%s: failed to clear memory\n",
    463 					    sc->sc_dev.dv_xname);
    464 					return;
    465 				}
    466 			if (val == 0x00)
    467 				break;
    468 			val -= 0x55;
    469 		}
    470 
    471 		sc->sc_conf3 = LE_C3_ACON;
    472 		sc->sc_mem = 0;			/* Not used. */
    473 		sc->sc_addr = 0;
    474 		sc->sc_memsize = ia->ia_msize;
    475 	} else {
    476 		/*
    477 		 * Allocate a DMA area for the card.
    478 		 */
    479 		if (bus_dmamem_alloc(dmat, LE_ISA_MEMSIZE, NBPG, 0, &seg, 1,
    480 		    &rseg, BUS_DMA_NOWAIT)) {
    481 			printf("%s: couldn't allocate memory for card\n",
    482 			    sc->sc_dev.dv_xname);
    483 			return;
    484 		}
    485 		if (bus_dmamem_map(dmat, &seg, rseg, LE_ISA_MEMSIZE,
    486 		    (caddr_t *)&sc->sc_mem,
    487 		    BUS_DMA_NOWAIT|BUS_DMAMEM_NOSYNC)) {
    488 			printf("%s: couldn't map memory for card\n",
    489 			    sc->sc_dev.dv_xname);
    490 			return;
    491 		}
    492 
    493 		/*
    494 		 * Create and load the DMA map for the DMA area.
    495 		 */
    496 		if (bus_dmamap_create(dmat, LE_ISA_MEMSIZE, 1,
    497 		    LE_ISA_MEMSIZE, 0, BUS_DMA_NOWAIT, &lesc->sc_dmam)) {
    498 			printf("%s: couldn't create DMA map\n",
    499 			    sc->sc_dev.dv_xname);
    500 			bus_dmamem_free(dmat, &seg, rseg);
    501 			return;
    502 		}
    503 		if (bus_dmamap_load(dmat, lesc->sc_dmam,
    504 		    sc->sc_mem, LE_ISA_MEMSIZE, NULL, BUS_DMA_NOWAIT)) {
    505 			printf("%s: coundn't load DMA map\n",
    506 			    sc->sc_dev.dv_xname);
    507 			bus_dmamem_free(dmat, &seg, rseg);
    508 			return;
    509 		}
    510 
    511 		sc->sc_conf3 = 0;
    512 		sc->sc_addr = lesc->sc_dmam->dm_segs[0].ds_addr;
    513 		sc->sc_memsize = LE_ISA_MEMSIZE;
    514 	}
    515 
    516 	if (lesc->sc_card == DEPCA) {
    517 		sc->sc_copytodesc = depca_copytobuf;
    518 		sc->sc_copyfromdesc = depca_copyfrombuf;
    519 		sc->sc_copytobuf = depca_copytobuf;
    520 		sc->sc_copyfrombuf = depca_copyfrombuf;
    521 		sc->sc_zerobuf = depca_zerobuf;
    522 	} else {
    523 		sc->sc_copytodesc = am7990_copytobuf_contig;
    524 		sc->sc_copyfromdesc = am7990_copyfrombuf_contig;
    525 		sc->sc_copytobuf = am7990_copytobuf_contig;
    526 		sc->sc_copyfrombuf = am7990_copyfrombuf_contig;
    527 		sc->sc_zerobuf = am7990_zerobuf_contig;
    528 	}
    529 
    530 	sc->sc_rdcsr = le_isa_rdcsr;
    531 	sc->sc_wrcsr = le_isa_wrcsr;
    532 	sc->sc_hwinit = NULL;
    533 
    534 	printf("%s", sc->sc_dev.dv_xname);
    535 	am7990_config(sc);
    536 
    537 	if (ia->ia_drq != DRQUNK)
    538 		isa_dmacascade(parent, ia->ia_drq);
    539 
    540 	lesc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
    541 	    IPL_NET, le_isa_intredge, sc);
    542 }
    543 
    544 /*
    545  * Controller interrupt.
    546  */
    547 int
    548 le_isa_intredge(arg)
    549 	void *arg;
    550 {
    551 
    552 	if (am7990_intr(arg) == 0)
    553 		return (0);
    554 	for (;;)
    555 		if (am7990_intr(arg) == 0)
    556 			return (1);
    557 }
    558 
    559 /*
    560  * DEPCA shared memory access functions.
    561  */
    562 
    563 void
    564 depca_copytobuf(sc, from, boff, len)
    565 	struct am7990_softc *sc;
    566 	void *from;
    567 	int boff, len;
    568 {
    569 	struct le_softc *lesc = (struct le_softc *)sc;
    570 
    571 	bus_space_write_region_1(lesc->sc_memt, lesc->sc_memh, boff,
    572 	    from, len);
    573 }
    574 
    575 void
    576 depca_copyfrombuf(sc, to, boff, len)
    577 	struct am7990_softc *sc;
    578 	void *to;
    579 	int boff, len;
    580 {
    581 	struct le_softc *lesc = (struct le_softc *)sc;
    582 
    583 	bus_space_read_region_1(lesc->sc_memt, lesc->sc_memh, boff,
    584 	    to, len);
    585 }
    586 
    587 void
    588 depca_zerobuf(sc, boff, len)
    589 	struct am7990_softc *sc;
    590 	int boff, len;
    591 {
    592 	struct le_softc *lesc = (struct le_softc *)sc;
    593 
    594 #if 0	/* XXX !! */
    595 	bus_space_set_region_1(lesc->sc_memt, lesc->sc_memh, boff,
    596 	    0x00, len);
    597 #else
    598 	for (; len != 0; boff++, len--)
    599 		bus_space_write_1(lesc->sc_memt, lesc->sc_memh, boff, 0x00);
    600 #endif
    601 }
    602