- Use PMAD-BA name for device match logic. It's not a real TURBOchannel
device and the id string is not found in option ROM string, but ULTRIX/OSF1 call it so anyway. - Squash IOASIC DMA buffer allocation into device attach() sequence.
This commit is contained in:
parent
77e30d85bf
commit
4f051180a0
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ioasic.c,v 1.32 2000/06/05 21:47:30 thorpej Exp $ */
|
||||
/* $NetBSD: ioasic.c,v 1.33 2000/07/11 04:10:25 nisimura Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -68,7 +68,7 @@
|
|||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.32 2000/06/05 21:47:30 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.33 2000/07/11 04:10:25 nisimura Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -108,8 +108,7 @@ int ioasic_intrnull __P((void *));
|
|||
#define IOASIC_NCOOKIES 4
|
||||
|
||||
struct ioasic_dev ioasic_devs[] = {
|
||||
/* XXX lance name */
|
||||
{ "lance", IOASIC_SLOT_3_START, C(IOASIC_DEV_LANCE),
|
||||
{ "PMAD-BA ", IOASIC_SLOT_3_START, C(IOASIC_DEV_LANCE),
|
||||
IOASIC_INTR_LANCE, },
|
||||
{ "z8530 ", IOASIC_SLOT_4_START, C(IOASIC_DEV_SCC0),
|
||||
IOASIC_INTR_SCC_0, },
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ioasic.c,v 1.13 2000/06/04 19:14:55 cgd Exp $ */
|
||||
/* $NetBSD: ioasic.c,v 1.14 2000/07/11 04:10:25 nisimura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Carnegie-Mellon University.
|
||||
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.13 2000/06/04 19:14:55 cgd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.14 2000/07/11 04:10:25 nisimura Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -53,11 +53,11 @@ __KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.13 2000/06/04 19:14:55 cgd Exp $");
|
|||
|
||||
#if defined(DEC_3MIN)
|
||||
static struct ioasic_dev kmin_ioasic_devs[] = {
|
||||
{ "lance", 0x0C0000, C(SYS_DEV_LANCE), IOASIC_INTR_LANCE, },
|
||||
{ "scc", 0x100000, C(SYS_DEV_SCC0), IOASIC_INTR_SCC_0, },
|
||||
{ "scc", 0x180000, C(SYS_DEV_SCC1), IOASIC_INTR_SCC_1, },
|
||||
{ "mc146818", 0x200000, C(SYS_DEV_BOGUS), 0 },
|
||||
{ "asc", 0x300000, C(SYS_DEV_SCSI), IOASIC_INTR_SCSI, },
|
||||
{ "PMAD-BA ", 0x0C0000, C(SYS_DEV_LANCE), },
|
||||
{ "scc", 0x100000, C(SYS_DEV_SCC0), },
|
||||
{ "scc", 0x180000, C(SYS_DEV_SCC1), },
|
||||
{ "mc146818", 0x200000, C(SYS_DEV_BOGUS), },
|
||||
{ "asc", 0x300000, C(SYS_DEV_SCSI), },
|
||||
};
|
||||
static int kmin_builtin_ndevs = ARRAY_SIZEOF(kmin_ioasic_devs);
|
||||
static int kmin_ioasic_ndevs = ARRAY_SIZEOF(kmin_ioasic_devs);
|
||||
|
@ -65,16 +65,16 @@ static int kmin_ioasic_ndevs = ARRAY_SIZEOF(kmin_ioasic_devs);
|
|||
|
||||
#if defined(DEC_MAXINE)
|
||||
static struct ioasic_dev xine_ioasic_devs[] = {
|
||||
{ "lance", 0x0C0000, C(SYS_DEV_LANCE), IOASIC_INTR_LANCE },
|
||||
{ "scc", 0x100000, C(SYS_DEV_SCC0), IOASIC_INTR_SCC_0 },
|
||||
{ "mc146818", 0x200000, C(SYS_DEV_BOGUS), 0 },
|
||||
{ "isdn", 0x240000, C(SYS_DEV_ISDN), XINE_INTR_ISDN, },
|
||||
{ "dtop", 0x280000, C(SYS_DEV_DTOP), XINE_INTR_DTOP, },
|
||||
{ "fdc", 0x2C0000, C(SYS_DEV_FDC), 0 },
|
||||
{ "asc", 0x300000, C(SYS_DEV_SCSI), IOASIC_INTR_SCSI, },
|
||||
{ "(TC0)", 0x0, C(SYS_DEV_OPT0), XINE_INTR_TC_0, },
|
||||
{ "(TC1)", 0x0, C(SYS_DEV_OPT1), XINE_INTR_TC_1, },
|
||||
{ "(TC2)", 0x0, C(SYS_DEV_OPT2), XINE_INTR_VINT, },
|
||||
{ "PMAD-BA ", 0x0C0000, C(SYS_DEV_LANCE), },
|
||||
{ "scc", 0x100000, C(SYS_DEV_SCC0), },
|
||||
{ "mc146818", 0x200000, C(SYS_DEV_BOGUS), },
|
||||
{ "isdn", 0x240000, C(SYS_DEV_ISDN), },
|
||||
{ "dtop", 0x280000, C(SYS_DEV_DTOP), },
|
||||
{ "fdc", 0x2C0000, C(SYS_DEV_FDC), },
|
||||
{ "asc", 0x300000, C(SYS_DEV_SCSI), },
|
||||
{ "(TC0)", 0x0, C(SYS_DEV_OPT0), },
|
||||
{ "(TC1)", 0x0, C(SYS_DEV_OPT1), },
|
||||
{ "(TC2)", 0x0, C(SYS_DEV_OPT2), },
|
||||
};
|
||||
static int xine_builtin_ndevs = ARRAY_SIZEOF(xine_ioasic_devs) - 3;
|
||||
static int xine_ioasic_ndevs = ARRAY_SIZEOF(xine_ioasic_devs);
|
||||
|
@ -82,14 +82,14 @@ static int xine_ioasic_ndevs = ARRAY_SIZEOF(xine_ioasic_devs);
|
|||
|
||||
#if defined(DEC_3MAXPLUS)
|
||||
static struct ioasic_dev kn03_ioasic_devs[] = {
|
||||
{ "lance", 0x0C0000, C(SYS_DEV_LANCE), IOASIC_INTR_LANCE, },
|
||||
{ "z8530 ", 0x100000, C(SYS_DEV_SCC0), IOASIC_INTR_SCC_0, },
|
||||
{ "z8530 ", 0x180000, C(SYS_DEV_SCC1), IOASIC_INTR_SCC_1, },
|
||||
{ "mc146818", 0x200000, C(SYS_DEV_BOGUS), 0, },
|
||||
{ "asc", 0x300000, C(SYS_DEV_SCSI), IOASIC_INTR_SCSI, },
|
||||
{ "(TC0)", 0x0, C(SYS_DEV_OPT0), KN03_INTR_TC_0, },
|
||||
{ "(TC1)", 0x0, C(SYS_DEV_OPT1), KN03_INTR_TC_1, },
|
||||
{ "(TC2)", 0x0, C(SYS_DEV_OPT2), KN03_INTR_TC_2, },
|
||||
{ "PMAD-BA ", 0x0C0000, C(SYS_DEV_LANCE), },
|
||||
{ "z8530 ", 0x100000, C(SYS_DEV_SCC0), },
|
||||
{ "z8530 ", 0x180000, C(SYS_DEV_SCC1), },
|
||||
{ "mc146818", 0x200000, C(SYS_DEV_BOGUS), },
|
||||
{ "asc", 0x300000, C(SYS_DEV_SCSI), },
|
||||
{ "(TC0)", 0x0, C(SYS_DEV_OPT0), },
|
||||
{ "(TC1)", 0x0, C(SYS_DEV_OPT1), },
|
||||
{ "(TC2)", 0x0, C(SYS_DEV_OPT2), },
|
||||
};
|
||||
static int kn03_builtin_ndevs = ARRAY_SIZEOF(kn03_ioasic_devs) - 3;
|
||||
static int kn03_ioasic_ndevs = ARRAY_SIZEOF(kn03_ioasic_devs);
|
||||
|
@ -134,7 +134,6 @@ ioasicattach(parent, self, aux)
|
|||
struct tc_attach_args *ta = aux;
|
||||
struct ioasic_dev *ioasic_devs;
|
||||
int ioasic_ndevs, builtin_ndevs;
|
||||
int i, imsk;
|
||||
|
||||
ioasicfound = 1;
|
||||
|
||||
|
@ -176,14 +175,16 @@ ioasicattach(parent, self, aux)
|
|||
panic("ioasicmatch: how did we get here?");
|
||||
}
|
||||
|
||||
#if 0 /* IMSK has been sanitized */
|
||||
/*
|
||||
* Turn off all device interrupt bits.
|
||||
* (This _does_ include TC option slot bits.
|
||||
* (This _does_ include TC option slot bits.)
|
||||
*/
|
||||
imsk = bus_space_read_4(sc->sc_bst, sc->sc_bsh, IOASIC_IMSK);
|
||||
for (i = 0; i < ioasic_ndevs; i++)
|
||||
imsk &= ~ioasic_devs[i].iad_intrbits;
|
||||
bus_space_write_4(sc->sc_bst, sc->sc_bsh, IOASIC_IMSK, imsk);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Try to configure each device.
|
||||
|
@ -201,7 +202,6 @@ ioasic_intr_evcnt(dev, cookie)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 1 /* XXX for now XXX */
|
||||
void
|
||||
ioasic_intr_establish(dev, cookie, level, handler, val)
|
||||
struct device *dev;
|
||||
|
@ -212,32 +212,3 @@ ioasic_intr_establish(dev, cookie, level, handler, val)
|
|||
{
|
||||
(*platform.intr_establish)(dev, cookie, level, handler, val);
|
||||
}
|
||||
|
||||
#else /* XXX eventually XXX */
|
||||
|
||||
void
|
||||
ioasic_intr_establish(ioa, cookie, level, func, arg)
|
||||
struct device *ioa;
|
||||
void *cookie, *arg;
|
||||
int level;
|
||||
int (*func) __P((void *));
|
||||
{
|
||||
struct ioasic_softc *sc = (void *)ioasic_cd.cd_devs[0];
|
||||
int i, intrbits;
|
||||
|
||||
for (i = 0; i < ioasic_ndevs; i++) {
|
||||
if (ioasic_devs[i].iad_cookie == cookie)
|
||||
goto found;
|
||||
}
|
||||
panic("ioasic_intr_establish: invalid cookie %d", (int)cookie);
|
||||
found:
|
||||
|
||||
intrtab[(int)cookie].ih_func = func;
|
||||
intrtab[(int)cookie].ih_arg = arg;
|
||||
|
||||
intrbits = ioasic_devs[i].iad_intrbits;
|
||||
i = bus_space_read_4(sc->sc_bst, sc->sc_bsh, IOASIC_IMSK);
|
||||
i |= intrbits;
|
||||
bus_space_write_4(sc->sc_bst, sc->sc_bsh, IOASIC_IMSK, i);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_le_ioasic.c,v 1.15 2000/03/30 12:45:43 augustss Exp $ */
|
||||
/* $NetBSD: if_le_ioasic.c,v 1.16 2000/07/11 04:10:25 nisimura Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Carnegie-Mellon University.
|
||||
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le_ioasic.c,v 1.15 2000/03/30 12:45:43 augustss Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le_ioasic.c,v 1.16 2000/07/11 04:10:25 nisimura Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
|
||||
|
@ -62,11 +62,14 @@ __KERNEL_RCSID(0, "$NetBSD: if_le_ioasic.c,v 1.15 2000/03/30 12:45:43 augustss E
|
|||
#include <dev/tc/ioasicreg.h>
|
||||
#include <dev/tc/ioasicvar.h>
|
||||
|
||||
#if defined(_KERNEL) && !defined(_LKM)
|
||||
#include "opt_ddb.h"
|
||||
#endif
|
||||
struct le_ioasic_softc {
|
||||
struct am7990_softc sc_am7990; /* glue to MI code */
|
||||
struct lereg1 *sc_r1; /* LANCE registers */
|
||||
/* XXX must match with le_softc of if_levar.h XXX */
|
||||
|
||||
caddr_t le_iomem;
|
||||
bus_dma_tag_t sc_dmat; /* bus dma tag */
|
||||
bus_dmamap_t sc_dmamap; /* bus dmamap */
|
||||
};
|
||||
|
||||
static int le_ioasic_match __P((struct device *, struct cfdata *, void *));
|
||||
static void le_ioasic_attach __P((struct device *, struct device *, void *));
|
||||
|
@ -75,29 +78,17 @@ struct cfattach le_ioasic_ca = {
|
|||
sizeof(struct le_softc), le_ioasic_match, le_ioasic_attach
|
||||
};
|
||||
|
||||
static void ioasic_lance_dma_setup __P((struct device *));
|
||||
static char *ioasic_lance_ether_address __P((void));
|
||||
|
||||
#ifdef DDB
|
||||
#define integrate
|
||||
#define hide
|
||||
#else
|
||||
#define integrate static __inline
|
||||
#define hide static
|
||||
#endif
|
||||
|
||||
hide void le_ioasic_copytobuf_gap2 __P((struct lance_softc *, void *,
|
||||
static void le_ioasic_copytobuf_gap2 __P((struct lance_softc *, void *,
|
||||
int, int));
|
||||
hide void le_ioasic_copyfrombuf_gap2 __P((struct lance_softc *, void *,
|
||||
static void le_ioasic_copyfrombuf_gap2 __P((struct lance_softc *, void *,
|
||||
int, int));
|
||||
static void le_ioasic_copytobuf_gap16 __P((struct lance_softc *, void *,
|
||||
int, int));
|
||||
static void le_ioasic_copyfrombuf_gap16 __P((struct lance_softc *, void *,
|
||||
int, int));
|
||||
static void le_ioasic_zerobuf_gap16 __P((struct lance_softc *, int, int));
|
||||
|
||||
hide void le_ioasic_copytobuf_gap16 __P((struct lance_softc *, void *,
|
||||
int, int));
|
||||
hide void le_ioasic_copyfrombuf_gap16 __P((struct lance_softc *, void *,
|
||||
int, int));
|
||||
hide void le_ioasic_zerobuf_gap16 __P((struct lance_softc *, int, int));
|
||||
|
||||
int
|
||||
static int
|
||||
le_ioasic_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
|
@ -105,44 +96,93 @@ le_ioasic_match(parent, match, aux)
|
|||
{
|
||||
struct ioasicdev_attach_args *d = aux;
|
||||
|
||||
if (!ioasic_submatch(match, aux))
|
||||
return (0);
|
||||
if (strncmp("lance", d->iada_modname, TC_ROM_LLEN))
|
||||
return (0);
|
||||
if (strncmp("PMAD-BA ", d->iada_modname, TC_ROM_LLEN) != 0)
|
||||
return 0;
|
||||
|
||||
return (1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
/* IOASIC LANCE DMA needs 128KB boundary aligned 128KB chunk */
|
||||
#define LE_IOASIC_MEMSIZE (128*1024)
|
||||
#define LE_IOASIC_MEMALIGN (128*1024)
|
||||
|
||||
static void
|
||||
le_ioasic_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct le_ioasic_softc *sc = (void *)self;
|
||||
struct ioasicdev_attach_args *d = aux;
|
||||
struct le_softc *lesc = (void *)self;
|
||||
struct lance_softc *sc = &lesc->sc_am7990.lsc;
|
||||
struct lance_softc *le = &sc->sc_am7990.lsc;
|
||||
bus_space_tag_t ioasic_bst;
|
||||
bus_space_handle_t ioasic_bsh;
|
||||
bus_dma_tag_t dmat;
|
||||
bus_dma_segment_t seg;
|
||||
tc_addr_t tca;
|
||||
u_int32_t ssr;
|
||||
int rseg;
|
||||
caddr_t le_iomem;
|
||||
|
||||
ioasic_lance_dma_setup(parent);
|
||||
|
||||
if (le_iomem == 0) {
|
||||
printf("%s: DMA area not set up\n", sc->sc_dev.dv_xname);
|
||||
ioasic_bst = ((struct ioasic_softc *)parent)->sc_bst;
|
||||
ioasic_bsh = ((struct ioasic_softc *)parent)->sc_bsh;
|
||||
dmat = sc->sc_dmat = ((struct ioasic_softc *)parent)->sc_dmat;
|
||||
/*
|
||||
* Allocate a DMA area for the chip.
|
||||
*/
|
||||
if (bus_dmamem_alloc(dmat, LE_IOASIC_MEMSIZE, LE_IOASIC_MEMALIGN,
|
||||
0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) {
|
||||
printf("can't allocate DMA area for LANCE\n");
|
||||
return;
|
||||
}
|
||||
if (bus_dmamem_map(dmat, &seg, rseg, LE_IOASIC_MEMSIZE,
|
||||
&le_iomem, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
|
||||
printf("can't map DMA area for LANCE\n");
|
||||
bus_dmamem_free(dmat, &seg, rseg);
|
||||
return;
|
||||
}
|
||||
/*
|
||||
* Create and load the DMA map for the DMA area.
|
||||
*/
|
||||
if (bus_dmamap_create(dmat, LE_IOASIC_MEMSIZE, 1,
|
||||
LE_IOASIC_MEMSIZE, 0, BUS_DMA_NOWAIT, &sc->sc_dmamap)) {
|
||||
printf("can't create DMA map\n");
|
||||
goto bad;
|
||||
}
|
||||
if (bus_dmamap_load(dmat, sc->sc_dmamap,
|
||||
le_iomem, LE_IOASIC_MEMSIZE, NULL, BUS_DMA_NOWAIT)) {
|
||||
printf("can't load DMA map\n");
|
||||
goto bad;
|
||||
}
|
||||
/*
|
||||
* Bind 128KB buffer with IOASIC DMA.
|
||||
*/
|
||||
tca = (tc_addr_t)sc->sc_dmamap->dm_segs[0].ds_addr;
|
||||
tca = ((tca << 3) & ~0x1f) | ((tca >> 29) & 0x1f);
|
||||
bus_space_write_4(ioasic_bst, ioasic_bsh, IOASIC_LANCE_DMAPTR, tca);
|
||||
ssr = bus_space_read_4(ioasic_bst, ioasic_bsh, IOASIC_CSR);
|
||||
ssr |= IOASIC_CSR_DMAEN_LANCE;
|
||||
bus_space_write_4(ioasic_bst, ioasic_bsh, IOASIC_CSR, ssr);
|
||||
|
||||
lesc->sc_r1 = (struct lereg1 *)
|
||||
sc->sc_r1 = (struct lereg1 *)
|
||||
TC_DENSE_TO_SPARSE(TC_PHYS_TO_UNCACHED(d->iada_addr));
|
||||
sc->sc_mem = (void *)TC_PHYS_TO_UNCACHED(le_iomem);
|
||||
le->sc_mem = (void *)TC_PHYS_TO_UNCACHED(le_iomem);
|
||||
le->sc_copytodesc = le_ioasic_copytobuf_gap2;
|
||||
le->sc_copyfromdesc = le_ioasic_copyfrombuf_gap2;
|
||||
le->sc_copytobuf = le_ioasic_copytobuf_gap16;
|
||||
le->sc_copyfrombuf = le_ioasic_copyfrombuf_gap16;
|
||||
le->sc_zerobuf = le_ioasic_zerobuf_gap16;
|
||||
|
||||
sc->sc_copytodesc = le_ioasic_copytobuf_gap2;
|
||||
sc->sc_copyfromdesc = le_ioasic_copyfrombuf_gap2;
|
||||
sc->sc_copytobuf = le_ioasic_copytobuf_gap16;
|
||||
sc->sc_copyfrombuf = le_ioasic_copyfrombuf_gap16;
|
||||
sc->sc_zerobuf = le_ioasic_zerobuf_gap16;
|
||||
|
||||
dec_le_common_attach(&lesc->sc_am7990, ioasic_lance_ether_address());
|
||||
dec_le_common_attach(&sc->sc_am7990,
|
||||
(u_char *)((struct ioasic_softc *)parent)->sc_base
|
||||
+ IOASIC_SLOT_2_START);
|
||||
|
||||
ioasic_intr_establish(parent, d->iada_cookie, TC_IPL_NET,
|
||||
am7990_intr, sc);
|
||||
return;
|
||||
|
||||
bad:
|
||||
bus_dmamem_unmap(dmat, le_iomem, LE_IOASIC_MEMSIZE);
|
||||
bus_dmamem_free(dmat, &seg, rseg);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -403,70 +443,3 @@ le_ioasic_zerobuf_gap16(sc, boff, len)
|
|||
xfer = min(len, 16);
|
||||
}
|
||||
}
|
||||
|
||||
#define LE_IOASIC_MEMSIZE (128*1024)
|
||||
#define LE_IOASIC_MEMALIGN (128*1024)
|
||||
|
||||
void
|
||||
ioasic_lance_dma_setup(parent)
|
||||
struct device *parent;
|
||||
{
|
||||
struct ioasic_softc *sc = (void *)parent;
|
||||
bus_dma_tag_t dmat = sc->sc_dmat;
|
||||
bus_dma_segment_t seg;
|
||||
tc_addr_t tca;
|
||||
u_int32_t ssr;
|
||||
int rseg;
|
||||
|
||||
/*
|
||||
* Allocate a DMA area for the chip.
|
||||
*/
|
||||
if (bus_dmamem_alloc(dmat, LE_IOASIC_MEMSIZE, LE_IOASIC_MEMALIGN,
|
||||
0, &seg, 1, &rseg, BUS_DMA_NOWAIT)) {
|
||||
printf("%s: can't allocate DMA area for LANCE\n",
|
||||
sc->sc_dv.dv_xname);
|
||||
return;
|
||||
}
|
||||
if (bus_dmamem_map(dmat, &seg, rseg, LE_IOASIC_MEMSIZE,
|
||||
&le_iomem, BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) {
|
||||
printf("%s: can't map DMA area for LANCE\n",
|
||||
sc->sc_dv.dv_xname);
|
||||
bus_dmamem_free(dmat, &seg, rseg);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create and load the DMA map for the DMA area.
|
||||
*/
|
||||
if (bus_dmamap_create(dmat, LE_IOASIC_MEMSIZE, 1,
|
||||
LE_IOASIC_MEMSIZE, 0, BUS_DMA_NOWAIT, &sc->sc_lance_dmam)) {
|
||||
printf("%s: can't create DMA map\n", sc->sc_dv.dv_xname);
|
||||
goto bad;
|
||||
}
|
||||
if (bus_dmamap_load(dmat, sc->sc_lance_dmam,
|
||||
le_iomem, LE_IOASIC_MEMSIZE, NULL, BUS_DMA_NOWAIT)) {
|
||||
printf("%s: can't load DMA map\n", sc->sc_dv.dv_xname);
|
||||
goto bad;
|
||||
}
|
||||
|
||||
tca = (tc_addr_t)sc->sc_lance_dmam->dm_segs[0].ds_addr;
|
||||
tca = ((tca << 3) & ~0x1f) | ((tca >> 29) & 0x1f);
|
||||
bus_space_write_4(sc->sc_bst, sc->sc_bsh, IOASIC_LANCE_DMAPTR, tca);
|
||||
ssr = bus_space_read_4(sc->sc_bst, sc->sc_bsh, IOASIC_CSR);
|
||||
ssr |= IOASIC_CSR_DMAEN_LANCE;
|
||||
bus_space_write_4(sc->sc_bst, sc->sc_bsh, IOASIC_CSR, ssr);
|
||||
return;
|
||||
|
||||
bad:
|
||||
bus_dmamem_unmap(dmat, le_iomem, LE_IOASIC_MEMSIZE);
|
||||
bus_dmamem_free(dmat, &seg, rseg);
|
||||
le_iomem = 0;
|
||||
}
|
||||
|
||||
/* XXX */
|
||||
char *
|
||||
ioasic_lance_ether_address()
|
||||
{
|
||||
|
||||
return (char *)(ioasic_base + IOASIC_SLOT_2_START);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue