1998-07-21 21:36:01 +04:00
|
|
|
/* $NetBSD: if_le_isa.c,v 1.22 1998/07/21 17:36:06 drochner Exp $ */
|
1997-06-07 03:43:45 +04:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
|
|
|
|
* NASA Ames Research Center.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
1994-10-27 07:14:23 +03:00
|
|
|
|
1995-07-24 22:04:21 +04:00
|
|
|
/*-
|
|
|
|
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
|
|
|
|
* Copyright (c) 1992, 1993
|
|
|
|
* The Regents of the University of California. All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to Berkeley by
|
|
|
|
* Ralph Campbell and Rick Macklem.
|
1994-07-02 00:25:25 +04:00
|
|
|
*
|
1995-07-24 22:04:21 +04:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the University of
|
|
|
|
* California, Berkeley and its contributors.
|
|
|
|
* 4. Neither the name of the University nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
1994-07-02 00:25:25 +04:00
|
|
|
*
|
1995-07-24 22:04:21 +04:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
|
|
|
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* @(#)if_le.c 8.2 (Berkeley) 11/16/93
|
1994-07-02 00:25:25 +04:00
|
|
|
*/
|
|
|
|
|
1998-07-05 04:51:04 +04:00
|
|
|
#include "opt_inet.h"
|
1994-07-02 00:25:25 +04:00
|
|
|
#include "bpfilter.h"
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/mbuf.h>
|
|
|
|
#include <sys/syslog.h>
|
1995-07-24 22:04:21 +04:00
|
|
|
#include <sys/socket.h>
|
1994-07-02 00:25:25 +04:00
|
|
|
#include <sys/device.h>
|
|
|
|
|
|
|
|
#include <net/if.h>
|
1997-03-15 21:09:08 +03:00
|
|
|
#include <net/if_ether.h>
|
1997-03-17 06:17:34 +03:00
|
|
|
#include <net/if_media.h>
|
1994-07-02 00:25:25 +04:00
|
|
|
|
|
|
|
#ifdef INET
|
|
|
|
#include <netinet/in.h>
|
1997-03-15 21:09:08 +03:00
|
|
|
#include <netinet/if_inarp.h>
|
1994-07-02 00:25:25 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <vm/vm.h>
|
|
|
|
|
|
|
|
#include <machine/cpu.h>
|
1996-05-13 03:51:23 +04:00
|
|
|
#include <machine/intr.h>
|
1996-12-02 08:44:17 +03:00
|
|
|
#include <machine/bus.h>
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1995-04-17 16:06:30 +04:00
|
|
|
#include <dev/isa/isareg.h>
|
|
|
|
#include <dev/isa/isavar.h>
|
|
|
|
#include <dev/isa/isadmavar.h>
|
1995-07-27 08:39:05 +04:00
|
|
|
|
1998-07-21 21:36:01 +04:00
|
|
|
#include <dev/ic/lancereg.h>
|
|
|
|
#include <dev/ic/lancevar.h>
|
1995-07-24 22:04:21 +04:00
|
|
|
#include <dev/ic/am7990reg.h>
|
|
|
|
#include <dev/ic/am7990var.h>
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
#include <dev/isa/if_levar.h>
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
int ne2100_isa_probe __P((struct device *, struct cfdata *, void *));
|
|
|
|
int bicc_isa_probe __P((struct device *, struct cfdata *, void *));
|
|
|
|
void le_dummyattach __P((struct device *, struct device *, void *));
|
|
|
|
int le_dummyprobe __P((struct device *, struct cfdata *, void *));
|
|
|
|
void le_ne2100_attach __P((struct device *, struct device *, void *));
|
|
|
|
void le_bicc_attach __P((struct device *, struct device *, void *));
|
|
|
|
|
|
|
|
struct cfattach nele_ca = {
|
|
|
|
sizeof(struct device), ne2100_isa_probe, le_dummyattach
|
|
|
|
}, le_nele_ca = {
|
|
|
|
sizeof(struct le_softc), le_dummyprobe, le_ne2100_attach
|
|
|
|
}, bicc_ca = {
|
|
|
|
sizeof(struct device), bicc_isa_probe, le_dummyattach
|
|
|
|
}, le_bicc_ca = {
|
|
|
|
sizeof(struct le_softc), le_dummyprobe, le_bicc_attach
|
|
|
|
};
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
struct le_isa_params {
|
|
|
|
char *name;
|
|
|
|
int iosize, rap, rdp;
|
|
|
|
int macstart, macstride;
|
|
|
|
} ne2100_params = {
|
|
|
|
"NE2100",
|
|
|
|
24, NE2100_RAP, NE2100_RDP,
|
|
|
|
0, 1
|
|
|
|
}, bicc_params = {
|
|
|
|
"BICC Isolan",
|
|
|
|
16, BICC_RAP, BICC_RDP,
|
|
|
|
0, 2
|
1996-03-17 03:43:52 +03:00
|
|
|
};
|
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
int lance_isa_probe __P((struct isa_attach_args *, struct le_isa_params *));
|
|
|
|
void le_isa_attach __P((struct device *, struct le_softc *,
|
|
|
|
struct isa_attach_args *, struct le_isa_params *));
|
1996-03-17 03:43:52 +03:00
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
int le_isa_intredge __P((void *));
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-07-21 21:36:01 +04:00
|
|
|
#if defined(_KERNEL) && !defined(_LKM)
|
|
|
|
#include "opt_ddb.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DDB
|
|
|
|
#define integrate
|
|
|
|
#define hide
|
|
|
|
#else
|
|
|
|
#define integrate static __inline
|
|
|
|
#define hide static
|
|
|
|
#endif
|
|
|
|
|
|
|
|
hide void le_isa_wrcsr __P((struct lance_softc *, u_int16_t, u_int16_t));
|
|
|
|
hide u_int16_t le_isa_rdcsr __P((struct lance_softc *, u_int16_t));
|
1996-04-22 06:53:28 +04:00
|
|
|
|
1997-06-07 03:43:45 +04:00
|
|
|
#define LE_ISA_MEMSIZE 16384
|
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
hide void
|
|
|
|
le_isa_wrcsr(sc, port, val)
|
1998-07-21 21:36:01 +04:00
|
|
|
struct lance_softc *sc;
|
1995-07-24 22:04:21 +04:00
|
|
|
u_int16_t port, val;
|
1994-07-02 00:25:25 +04:00
|
|
|
{
|
1996-12-02 08:44:17 +03:00
|
|
|
struct le_softc *lesc = (struct le_softc *)sc;
|
|
|
|
bus_space_tag_t iot = lesc->sc_iot;
|
|
|
|
bus_space_handle_t ioh = lesc->sc_ioh;
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1996-12-02 08:44:17 +03:00
|
|
|
bus_space_write_2(iot, ioh, lesc->sc_rap, port);
|
|
|
|
bus_space_write_2(iot, ioh, lesc->sc_rdp, val);
|
1994-07-02 00:25:25 +04:00
|
|
|
}
|
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
hide u_int16_t
|
|
|
|
le_isa_rdcsr(sc, port)
|
1998-07-21 21:36:01 +04:00
|
|
|
struct lance_softc *sc;
|
1995-07-24 22:04:21 +04:00
|
|
|
u_int16_t port;
|
1994-07-02 00:25:25 +04:00
|
|
|
{
|
1996-12-02 08:44:17 +03:00
|
|
|
struct le_softc *lesc = (struct le_softc *)sc;
|
|
|
|
bus_space_tag_t iot = lesc->sc_iot;
|
|
|
|
bus_space_handle_t ioh = lesc->sc_ioh;
|
1995-07-24 22:04:21 +04:00
|
|
|
u_int16_t val;
|
|
|
|
|
1996-12-02 08:44:17 +03:00
|
|
|
bus_space_write_2(iot, ioh, lesc->sc_rap, port);
|
|
|
|
val = bus_space_read_2(iot, ioh, lesc->sc_rdp);
|
1995-07-24 22:04:21 +04:00
|
|
|
return (val);
|
|
|
|
}
|
1994-07-02 00:25:25 +04:00
|
|
|
|
|
|
|
int
|
1998-04-16 21:51:46 +04:00
|
|
|
ne2100_isa_probe(parent, match, aux)
|
1994-11-04 02:08:27 +03:00
|
|
|
struct device *parent;
|
1998-04-16 21:51:46 +04:00
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
1994-07-02 00:25:25 +04:00
|
|
|
{
|
1998-04-16 21:51:46 +04:00
|
|
|
return (lance_isa_probe(aux, &ne2100_params));
|
|
|
|
}
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
int
|
|
|
|
bicc_isa_probe(parent, match, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
return (lance_isa_probe(aux, &bicc_params));
|
1994-07-02 00:25:25 +04:00
|
|
|
}
|
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
/*
|
|
|
|
* Determine which chip is present on the card.
|
|
|
|
*/
|
1994-07-02 00:25:25 +04:00
|
|
|
int
|
1998-04-16 21:51:46 +04:00
|
|
|
lance_isa_probe(ia, p)
|
1994-07-02 00:25:25 +04:00
|
|
|
struct isa_attach_args *ia;
|
1998-04-16 21:51:46 +04:00
|
|
|
struct le_isa_params *p;
|
1994-07-02 00:25:25 +04:00
|
|
|
{
|
1996-12-02 08:44:17 +03:00
|
|
|
bus_space_tag_t iot = ia->ia_iot;
|
|
|
|
bus_space_handle_t ioh;
|
1998-04-16 21:51:46 +04:00
|
|
|
int rap, rdp;
|
|
|
|
int rv = 0;
|
|
|
|
|
|
|
|
/* Disallow wildcarded i/o address. */
|
|
|
|
if (ia->ia_iobase == ISACF_PORT_DEFAULT)
|
|
|
|
return (0);
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1996-12-02 08:44:17 +03:00
|
|
|
/* Map i/o space. */
|
1998-04-16 21:51:46 +04:00
|
|
|
if (bus_space_map(iot, ia->ia_iobase, p->iosize, 0, &ioh))
|
|
|
|
return (0);
|
1996-12-02 08:44:17 +03:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
rap = p->rap;
|
|
|
|
rdp = p->rdp;
|
1996-12-02 08:44:17 +03:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
/* Stop the LANCE chip and put it in a known state. */
|
|
|
|
bus_space_write_2(iot, ioh, rap, LE_CSR0);
|
|
|
|
bus_space_write_2(iot, ioh, rdp, LE_C0_STOP);
|
|
|
|
delay(100);
|
1997-09-10 07:05:39 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
bus_space_write_2(iot, ioh, rap, LE_CSR0);
|
|
|
|
if (bus_space_read_2(iot, ioh, rdp) != LE_C0_STOP)
|
1996-12-02 08:44:17 +03:00
|
|
|
goto bad;
|
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
bus_space_write_2(iot, ioh, rap, LE_CSR3);
|
|
|
|
bus_space_write_2(iot, ioh, rdp, 0);
|
1996-12-02 08:44:17 +03:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
ia->ia_iosize = p->iosize;
|
|
|
|
rv = 1;
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
bad:
|
|
|
|
bus_space_unmap(iot, ioh, p->iosize);
|
|
|
|
return (rv);
|
|
|
|
}
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
void
|
|
|
|
le_dummyattach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
printf("\n");
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
config_found(self, aux, 0);
|
|
|
|
}
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
int
|
|
|
|
le_dummyprobe(parent, match, aux)
|
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
return (1);
|
|
|
|
}
|
1997-09-10 07:05:39 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
void
|
|
|
|
le_ne2100_attach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
le_isa_attach(parent, (void *)self, aux, &ne2100_params);
|
|
|
|
}
|
1996-12-02 08:44:17 +03:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
void
|
|
|
|
le_bicc_attach(parent, self, aux)
|
|
|
|
struct device *parent, *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
|
|
|
le_isa_attach(parent, (void *)self, aux, &bicc_params);
|
1994-07-02 00:25:25 +04:00
|
|
|
}
|
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
void
|
|
|
|
le_isa_attach(parent, lesc, ia, p)
|
|
|
|
struct device *parent;
|
1996-05-07 05:50:04 +04:00
|
|
|
struct le_softc *lesc;
|
1994-07-02 00:25:25 +04:00
|
|
|
struct isa_attach_args *ia;
|
1998-04-16 21:51:46 +04:00
|
|
|
struct le_isa_params *p;
|
1994-07-02 00:25:25 +04:00
|
|
|
{
|
1998-07-21 21:36:01 +04:00
|
|
|
struct lance_softc *sc = &lesc->sc_am7990.lsc;
|
1996-12-02 08:44:17 +03:00
|
|
|
bus_space_tag_t iot = ia->ia_iot;
|
|
|
|
bus_space_handle_t ioh;
|
1998-04-18 14:26:56 +04:00
|
|
|
bus_dma_tag_t dmat = ia->ia_dmat;
|
1998-04-16 21:51:46 +04:00
|
|
|
bus_dma_segment_t seg;
|
1998-06-25 23:18:05 +04:00
|
|
|
int i, rseg, error;
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
printf(": %s Ethernet\n", p->name);
|
1996-12-02 08:44:17 +03:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
if (bus_space_map(iot, ia->ia_iobase, p->iosize, 0, &ioh))
|
|
|
|
panic("%s: can't map io", sc->sc_dev.dv_xname);
|
1994-07-02 00:25:25 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Extract the physical MAC address from the ROM.
|
|
|
|
*/
|
1997-03-15 21:09:08 +03:00
|
|
|
for (i = 0; i < sizeof(sc->sc_enaddr); i++)
|
1998-04-16 21:51:46 +04:00
|
|
|
sc->sc_enaddr[i] =
|
|
|
|
bus_space_read_1(iot, ioh, p->macstart + i * p->macstride);
|
1996-12-02 08:44:17 +03:00
|
|
|
|
1996-12-05 05:39:37 +03:00
|
|
|
lesc->sc_iot = iot;
|
|
|
|
lesc->sc_ioh = ioh;
|
1998-04-18 14:26:56 +04:00
|
|
|
lesc->sc_dmat = dmat;
|
1998-04-16 21:51:46 +04:00
|
|
|
lesc->sc_rap = p->rap;
|
|
|
|
lesc->sc_rdp = p->rdp;
|
1994-07-02 00:25:25 +04:00
|
|
|
|
|
|
|
/*
|
1998-04-16 21:51:46 +04:00
|
|
|
* Allocate a DMA area for the card.
|
1994-07-02 00:25:25 +04:00
|
|
|
*/
|
1998-04-16 21:51:46 +04:00
|
|
|
if (bus_dmamem_alloc(dmat, LE_ISA_MEMSIZE, NBPG, 0, &seg, 1,
|
|
|
|
&rseg, BUS_DMA_NOWAIT)) {
|
|
|
|
printf("%s: couldn't allocate memory for card\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (bus_dmamem_map(dmat, &seg, rseg, LE_ISA_MEMSIZE,
|
|
|
|
(caddr_t *)&sc->sc_mem,
|
|
|
|
BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
|
|
|
|
printf("%s: couldn't map memory for card\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
return;
|
|
|
|
}
|
1996-12-02 08:44:17 +03:00
|
|
|
|
|
|
|
/*
|
1998-04-16 21:51:46 +04:00
|
|
|
* Create and load the DMA map for the DMA area.
|
1996-12-02 08:44:17 +03:00
|
|
|
*/
|
1998-04-16 21:51:46 +04:00
|
|
|
if (bus_dmamap_create(dmat, LE_ISA_MEMSIZE, 1,
|
|
|
|
LE_ISA_MEMSIZE, 0, BUS_DMA_NOWAIT, &lesc->sc_dmam)) {
|
|
|
|
printf("%s: couldn't create DMA map\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
bus_dmamem_free(dmat, &seg, rseg);
|
|
|
|
return;
|
1995-07-24 22:04:21 +04:00
|
|
|
}
|
1998-04-16 21:51:46 +04:00
|
|
|
if (bus_dmamap_load(dmat, lesc->sc_dmam,
|
|
|
|
sc->sc_mem, LE_ISA_MEMSIZE, NULL, BUS_DMA_NOWAIT)) {
|
|
|
|
printf("%s: coundn't load DMA map\n",
|
|
|
|
sc->sc_dev.dv_xname);
|
|
|
|
bus_dmamem_free(dmat, &seg, rseg);
|
|
|
|
return;
|
1996-12-02 08:44:17 +03:00
|
|
|
}
|
1995-07-27 08:39:05 +04:00
|
|
|
|
1998-04-16 21:51:46 +04:00
|
|
|
sc->sc_conf3 = 0;
|
|
|
|
sc->sc_addr = lesc->sc_dmam->dm_segs[0].ds_addr;
|
|
|
|
sc->sc_memsize = LE_ISA_MEMSIZE;
|
|
|
|
|
1998-07-21 21:36:01 +04:00
|
|
|
sc->sc_copytodesc = lance_copytobuf_contig;
|
|
|
|
sc->sc_copyfromdesc = lance_copyfrombuf_contig;
|
|
|
|
sc->sc_copytobuf = lance_copytobuf_contig;
|
|
|
|
sc->sc_copyfrombuf = lance_copyfrombuf_contig;
|
|
|
|
sc->sc_zerobuf = lance_zerobuf_contig;
|
1998-04-16 21:51:46 +04:00
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
sc->sc_rdcsr = le_isa_rdcsr;
|
|
|
|
sc->sc_wrcsr = le_isa_wrcsr;
|
|
|
|
sc->sc_hwinit = NULL;
|
1995-07-27 08:39:05 +04:00
|
|
|
|
1998-06-25 23:18:05 +04:00
|
|
|
if (ia->ia_drq != DRQUNK) {
|
|
|
|
if ((error = isa_dmacascade(ia->ia_ic, ia->ia_drq)) != 0) {
|
|
|
|
printf("%s: unable to cascade DRQ, error = %d\n",
|
|
|
|
sc->sc_dev.dv_xname, error);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
1994-07-02 00:25:25 +04:00
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
lesc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
|
|
|
|
IPL_NET, le_isa_intredge, sc);
|
1998-06-25 23:18:05 +04:00
|
|
|
|
|
|
|
printf("%s", sc->sc_dev.dv_xname);
|
1998-07-21 21:36:01 +04:00
|
|
|
am7990_config(&lesc->sc_am7990);
|
1995-10-07 12:19:13 +03:00
|
|
|
}
|
|
|
|
|
1994-07-02 00:25:25 +04:00
|
|
|
/*
|
|
|
|
* Controller interrupt.
|
|
|
|
*/
|
1996-08-30 05:40:35 +04:00
|
|
|
int
|
1996-05-07 05:50:04 +04:00
|
|
|
le_isa_intredge(arg)
|
1995-04-17 16:06:30 +04:00
|
|
|
void *arg;
|
1994-07-02 00:25:25 +04:00
|
|
|
{
|
|
|
|
|
1996-05-07 05:50:04 +04:00
|
|
|
if (am7990_intr(arg) == 0)
|
1995-07-24 22:04:21 +04:00
|
|
|
return (0);
|
|
|
|
for (;;)
|
1996-05-07 05:50:04 +04:00
|
|
|
if (am7990_intr(arg) == 0)
|
1995-07-24 22:04:21 +04:00
|
|
|
return (1);
|
1994-07-02 00:25:25 +04:00
|
|
|
}
|