sound(4): Remove pointless Giant from bus_dma_tag_create().
None of the drivers really implement asynchronous buffer loading, so they don't need lock there. The only question is which of them have BUS_DMA_NOWAIT flag there already, and to which it should be added.
This commit is contained in:
parent
440320b620
commit
1f7a6325fe
@ -620,8 +620,8 @@ ad1816_attach(device_t dev)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/ad1816->bufsize, /*nsegments*/1,
|
/*maxsize*/ad1816->bufsize, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff,
|
/*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/ &Giant, &ad1816->parent_dmat) != 0) {
|
&ad1816->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto no;
|
goto no;
|
||||||
}
|
}
|
||||||
|
@ -859,8 +859,8 @@ ess_attach(device_t dev)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/sc->bufsize, /*nsegments*/1,
|
/*maxsize*/sc->bufsize, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff,
|
/*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
|
&sc->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto no;
|
goto no;
|
||||||
}
|
}
|
||||||
|
@ -1732,7 +1732,7 @@ mss_doattach(device_t dev, struct mss_info *mss)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/mss->bufsize, /*nsegments*/1,
|
/*maxsize*/mss->bufsize, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff, /*flags*/0,
|
/*maxsegz*/0x3ffff, /*flags*/0,
|
||||||
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
|
/*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
&mss->parent_dmat) != 0) {
|
&mss->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto no;
|
goto no;
|
||||||
|
@ -846,7 +846,7 @@ sb16_attach(device_t dev)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/sb->bufsize, /*nsegments*/1,
|
/*maxsize*/sb->bufsize, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff, /*flags*/0,
|
/*maxsegz*/0x3ffff, /*flags*/0,
|
||||||
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
|
/*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
&sb->parent_dmat) != 0) {
|
&sb->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto no;
|
goto no;
|
||||||
|
@ -743,7 +743,7 @@ sb_attach(device_t dev)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/sb->bufsize, /*nsegments*/1,
|
/*maxsize*/sb->bufsize, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff, /*flags*/0,
|
/*maxsegz*/0x3ffff, /*flags*/0,
|
||||||
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
|
/*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
&sb->parent_dmat) != 0) {
|
&sb->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto no;
|
goto no;
|
||||||
|
@ -642,8 +642,8 @@ au_pci_attach(device_t dev)
|
|||||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/AU_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
/*maxsize*/AU_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &au->parent_dmat) != 0) {
|
&au->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
@ -823,8 +823,8 @@ cs4281_pci_attach(device_t dev)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff,
|
/*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
|
&sc->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
@ -716,8 +716,8 @@ csa_allocres(struct csa_info *csa, device_t dev)
|
|||||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/CS461x_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
/*maxsize*/CS461x_BUFFSIZE, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &csa->parent_dmat) != 0)
|
&csa->parent_dmat) != 0)
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -1328,8 +1328,8 @@ emu_malloc(struct sc_info *sc, u_int32_t sz, bus_addr_t *addr,
|
|||||||
*addr = 0;
|
*addr = 0;
|
||||||
if (bus_dmamem_alloc(sc->parent_dmat, &buf, BUS_DMA_NOWAIT, map))
|
if (bus_dmamem_alloc(sc->parent_dmat, &buf, BUS_DMA_NOWAIT, map))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (bus_dmamap_load(sc->parent_dmat, *map, buf, sz, emu_setmap, addr, 0)
|
if (bus_dmamap_load(sc->parent_dmat, *map, buf, sz, emu_setmap, addr,
|
||||||
|| !*addr) {
|
BUS_DMA_NOWAIT) || !*addr) {
|
||||||
bus_dmamem_free(sc->parent_dmat, buf, *map);
|
bus_dmamem_free(sc->parent_dmat, buf, *map);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -2107,8 +2107,8 @@ emu_pci_attach(device_t dev)
|
|||||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/sc->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
/*maxsize*/sc->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
|
&sc->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
@ -2700,8 +2700,8 @@ emu_init(struct emu_sc_info *sc)
|
|||||||
/* highaddr */ BUS_SPACE_MAXADDR,
|
/* highaddr */ BUS_SPACE_MAXADDR,
|
||||||
/* filter */ NULL, /* filterarg */ NULL,
|
/* filter */ NULL, /* filterarg */ NULL,
|
||||||
/* maxsize */ EMU_MAX_BUFSZ, /* nsegments */ 1, /* maxsegz */ 0x3ffff,
|
/* maxsize */ EMU_MAX_BUFSZ, /* nsegments */ 1, /* maxsegz */ 0x3ffff,
|
||||||
/* flags */ 0, /* lockfunc */ busdma_lock_mutex,
|
/* flags */ 0, /* lockfunc */NULL, /* lockarg */NULL,
|
||||||
/* lockarg */ &Giant, &(sc->mem.dmat)) != 0) {
|
&sc->mem.dmat) != 0) {
|
||||||
device_printf(sc->dev, "unable to create dma tag\n");
|
device_printf(sc->dev, "unable to create dma tag\n");
|
||||||
bus_dma_tag_destroy(sc->mem.dmat);
|
bus_dma_tag_destroy(sc->mem.dmat);
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
|
@ -2264,12 +2264,14 @@ envy24_dmainit(struct sc_info *sc)
|
|||||||
#if(0)
|
#if(0)
|
||||||
device_printf(sc->dev, "envy24_dmainit(): bus_dmamem_load(): sc->pmap\n");
|
device_printf(sc->dev, "envy24_dmainit(): bus_dmamem_load(): sc->pmap\n");
|
||||||
#endif
|
#endif
|
||||||
if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->psize, envy24_dmapsetmap, sc, 0))
|
if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->psize,
|
||||||
|
envy24_dmapsetmap, sc, BUS_DMA_NOWAIT))
|
||||||
goto bad;
|
goto bad;
|
||||||
#if(0)
|
#if(0)
|
||||||
device_printf(sc->dev, "envy24_dmainit(): bus_dmamem_load(): sc->rmap\n");
|
device_printf(sc->dev, "envy24_dmainit(): bus_dmamem_load(): sc->rmap\n");
|
||||||
#endif
|
#endif
|
||||||
if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->rsize, envy24_dmarsetmap, sc, 0))
|
if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->rsize,
|
||||||
|
envy24_dmarsetmap, sc, BUS_DMA_NOWAIT))
|
||||||
goto bad;
|
goto bad;
|
||||||
bzero(sc->pbuf, sc->psize);
|
bzero(sc->pbuf, sc->psize);
|
||||||
bzero(sc->rbuf, sc->rsize);
|
bzero(sc->rbuf, sc->rsize);
|
||||||
@ -2534,8 +2536,8 @@ envy24_alloc_resource(struct sc_info *sc)
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/BUS_SPACE_MAXSIZE_ENVY24,
|
/*maxsize*/BUS_SPACE_MAXSIZE_ENVY24,
|
||||||
/*nsegments*/1, /*maxsegsz*/0x3ffff,
|
/*nsegments*/1, /*maxsegsz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &sc->dmat) != 0) {
|
&sc->dmat) != 0) {
|
||||||
device_printf(sc->dev, "unable to create dma tag\n");
|
device_printf(sc->dev, "unable to create dma tag\n");
|
||||||
return ENXIO;
|
return ENXIO;
|
||||||
}
|
}
|
||||||
|
@ -632,8 +632,8 @@ fm801_pci_attach(device_t dev)
|
|||||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/fm801->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
/*maxsize*/fm801->bufsz, /*nsegments*/1, /*maxsegz*/0x3ffff,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &fm801->parent_dmat) != 0) {
|
&fm801->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto oops;
|
goto oops;
|
||||||
}
|
}
|
||||||
|
@ -172,8 +172,8 @@ hdspe_alloc_resources(struct sc_info *sc)
|
|||||||
/*nsegments*/2,
|
/*nsegments*/2,
|
||||||
/*maxsegsz*/HDSPE_DMASEGSIZE,
|
/*maxsegsz*/HDSPE_DMASEGSIZE,
|
||||||
/*flags*/0,
|
/*flags*/0,
|
||||||
/*lockfunc*/busdma_lock_mutex,
|
/*lockfunc*/NULL,
|
||||||
/*lockarg*/&Giant,
|
/*lockarg*/NULL,
|
||||||
/*dmatag*/&sc->dmat) != 0) {
|
/*dmatag*/&sc->dmat) != 0) {
|
||||||
device_printf(sc->dev, "Unable to create dma tag.\n");
|
device_printf(sc->dev, "Unable to create dma tag.\n");
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
@ -182,27 +182,27 @@ hdspe_alloc_resources(struct sc_info *sc)
|
|||||||
sc->bufsize = HDSPE_DMASEGSIZE;
|
sc->bufsize = HDSPE_DMASEGSIZE;
|
||||||
|
|
||||||
/* pbuf (play buffer). */
|
/* pbuf (play buffer). */
|
||||||
if (bus_dmamem_alloc(sc->dmat, (void **)&sc->pbuf,
|
if (bus_dmamem_alloc(sc->dmat, (void **)&sc->pbuf, BUS_DMA_WAITOK,
|
||||||
BUS_DMA_NOWAIT, &sc->pmap)) {
|
&sc->pmap)) {
|
||||||
device_printf(sc->dev, "Can't alloc pbuf.\n");
|
device_printf(sc->dev, "Can't alloc pbuf.\n");
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->bufsize,
|
if (bus_dmamap_load(sc->dmat, sc->pmap, sc->pbuf, sc->bufsize,
|
||||||
hdspe_dmapsetmap, sc, 0)) {
|
hdspe_dmapsetmap, sc, BUS_DMA_NOWAIT)) {
|
||||||
device_printf(sc->dev, "Can't load pbuf.\n");
|
device_printf(sc->dev, "Can't load pbuf.\n");
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rbuf (rec buffer). */
|
/* rbuf (rec buffer). */
|
||||||
if (bus_dmamem_alloc(sc->dmat, (void **)&sc->rbuf,
|
if (bus_dmamem_alloc(sc->dmat, (void **)&sc->rbuf, BUS_DMA_WAITOK,
|
||||||
BUS_DMA_NOWAIT, &sc->rmap)) {
|
&sc->rmap)) {
|
||||||
device_printf(sc->dev, "Can't alloc rbuf.\n");
|
device_printf(sc->dev, "Can't alloc rbuf.\n");
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->bufsize,
|
if (bus_dmamap_load(sc->dmat, sc->rmap, sc->rbuf, sc->bufsize,
|
||||||
hdspe_dmapsetmap, sc, 0)) {
|
hdspe_dmapsetmap, sc, BUS_DMA_NOWAIT)) {
|
||||||
device_printf(sc->dev, "Can't load rbuf.\n");
|
device_printf(sc->dev, "Can't load rbuf.\n");
|
||||||
return (ENXIO);
|
return (ENXIO);
|
||||||
}
|
}
|
||||||
|
@ -1716,8 +1716,8 @@ dma_malloc(bus_dma_tag_t dmat, u_int32_t sz, bus_addr_t *phys,
|
|||||||
|
|
||||||
if (bus_dmamem_alloc(dmat, &buf, BUS_DMA_NOWAIT, map))
|
if (bus_dmamem_alloc(dmat, &buf, BUS_DMA_NOWAIT, map))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (bus_dmamap_load(dmat, *map, buf, sz, setmap, phys, 0) != 0 ||
|
if (bus_dmamap_load(dmat, *map, buf, sz, setmap, phys,
|
||||||
*phys == 0) {
|
BUS_DMA_NOWAIT) != 0 || *phys == 0) {
|
||||||
bus_dmamem_free(dmat, buf, *map);
|
bus_dmamem_free(dmat, buf, *map);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1793,7 +1793,7 @@ agg_attach(device_t dev)
|
|||||||
/*filter*/ NULL, NULL,
|
/*filter*/ NULL, NULL,
|
||||||
/*size */ ess->bufsz, 1, 0x3ffff,
|
/*size */ ess->bufsz, 1, 0x3ffff,
|
||||||
/*flags */ 0,
|
/*flags */ 0,
|
||||||
/*lock */ busdma_lock_mutex, &Giant,
|
/*lock */ NULL, NULL,
|
||||||
&ess->buf_dmat) != 0) {
|
&ess->buf_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
@ -1807,7 +1807,7 @@ agg_attach(device_t dev)
|
|||||||
/*filter*/ NULL, NULL,
|
/*filter*/ NULL, NULL,
|
||||||
/*size */ 3*ess->bufsz, 1, 0x3ffff,
|
/*size */ 3*ess->bufsz, 1, 0x3ffff,
|
||||||
/*flags */ 0,
|
/*flags */ 0,
|
||||||
/*lock */ busdma_lock_mutex, &Giant,
|
/*lock */ NULL, NULL,
|
||||||
&ess->stat_dmat) != 0) {
|
&ess->stat_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
ret = ENOMEM;
|
ret = ENOMEM;
|
||||||
|
@ -50,9 +50,6 @@ SND_DECLARE_FILE("$FreeBSD$");
|
|||||||
/* more accurate clocks and split audio1/audio2 rates */
|
/* more accurate clocks and split audio1/audio2 rates */
|
||||||
#define ESS18XX_NEWSPEED
|
#define ESS18XX_NEWSPEED
|
||||||
|
|
||||||
/* 1 = INTR_MPSAFE, 0 = GIANT */
|
|
||||||
#define ESS18XX_MPSAFE 1
|
|
||||||
|
|
||||||
static u_int32_t ess_playfmt[] = {
|
static u_int32_t ess_playfmt[] = {
|
||||||
SND_FORMAT(AFMT_U8, 1, 0),
|
SND_FORMAT(AFMT_U8, 1, 0),
|
||||||
SND_FORMAT(AFMT_U8, 2, 0),
|
SND_FORMAT(AFMT_U8, 2, 0),
|
||||||
@ -103,20 +100,12 @@ struct ess_info {
|
|||||||
unsigned int bufsz;
|
unsigned int bufsz;
|
||||||
|
|
||||||
struct ess_chinfo pch, rch;
|
struct ess_chinfo pch, rch;
|
||||||
#if ESS18XX_MPSAFE == 1
|
|
||||||
struct mtx *lock;
|
struct mtx *lock;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if ESS18XX_MPSAFE == 1
|
|
||||||
#define ess_lock(_ess) snd_mtxlock((_ess)->lock)
|
#define ess_lock(_ess) snd_mtxlock((_ess)->lock)
|
||||||
#define ess_unlock(_ess) snd_mtxunlock((_ess)->lock)
|
#define ess_unlock(_ess) snd_mtxunlock((_ess)->lock)
|
||||||
#define ess_lock_assert(_ess) snd_mtxassert((_ess)->lock)
|
#define ess_lock_assert(_ess) snd_mtxassert((_ess)->lock)
|
||||||
#else
|
|
||||||
#define ess_lock(_ess)
|
|
||||||
#define ess_unlock(_ess)
|
|
||||||
#define ess_lock_assert(_ess)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int ess_rd(struct ess_info *sc, int reg);
|
static int ess_rd(struct ess_info *sc, int reg);
|
||||||
static void ess_wr(struct ess_info *sc, int reg, u_int8_t val);
|
static void ess_wr(struct ess_info *sc, int reg, u_int8_t val);
|
||||||
@ -868,12 +857,10 @@ ess_release_resources(struct ess_info *sc, device_t dev)
|
|||||||
sc->parent_dmat = 0;
|
sc->parent_dmat = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ESS18XX_MPSAFE == 1
|
|
||||||
if (sc->lock) {
|
if (sc->lock) {
|
||||||
snd_mtxfree(sc->lock);
|
snd_mtxfree(sc->lock);
|
||||||
sc->lock = NULL;
|
sc->lock = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
free(sc, M_DEVBUF);
|
free(sc, M_DEVBUF);
|
||||||
}
|
}
|
||||||
@ -902,14 +889,10 @@ ess_alloc_resources(struct ess_info *sc, device_t dev)
|
|||||||
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
|
||||||
RF_ACTIVE | RF_SHAREABLE);
|
RF_ACTIVE | RF_SHAREABLE);
|
||||||
|
|
||||||
#if ESS18XX_MPSAFE == 1
|
|
||||||
sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_solo softc");
|
sc->lock = snd_mtxcreate(device_get_nameunit(dev), "snd_solo softc");
|
||||||
|
|
||||||
return (sc->irq && sc->io && sc->sb && sc->vc &&
|
return (sc->irq && sc->io && sc->sb && sc->vc &&
|
||||||
sc->mpu && sc->gp && sc->lock)? 0 : ENXIO;
|
sc->mpu && sc->gp && sc->lock)? 0 : ENXIO;
|
||||||
#else
|
|
||||||
return (sc->irq && sc->io && sc->sb && sc->vc && sc->mpu && sc->gp)? 0 : ENXIO;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1008,13 +991,7 @@ ess_attach(device_t dev)
|
|||||||
#else
|
#else
|
||||||
sc->newspeed = 0;
|
sc->newspeed = 0;
|
||||||
#endif
|
#endif
|
||||||
if (snd_setup_intr(dev, sc->irq,
|
if (snd_setup_intr(dev, sc->irq, INTR_MPSAFE, ess_intr, sc, &sc->ih)) {
|
||||||
#if ESS18XX_MPSAFE == 1
|
|
||||||
INTR_MPSAFE
|
|
||||||
#else
|
|
||||||
0
|
|
||||||
#endif
|
|
||||||
, ess_intr, sc, &sc->ih)) {
|
|
||||||
device_printf(dev, "unable to map interrupt\n");
|
device_printf(dev, "unable to map interrupt\n");
|
||||||
goto no;
|
goto no;
|
||||||
}
|
}
|
||||||
@ -1032,11 +1009,7 @@ ess_attach(device_t dev)
|
|||||||
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff,
|
/*maxsegz*/0x3ffff,
|
||||||
/*flags*/0,
|
/*flags*/0,
|
||||||
#if ESS18XX_MPSAFE == 1
|
|
||||||
/*lockfunc*/NULL, /*lockarg*/NULL,
|
/*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
#else
|
|
||||||
/*lockfunc*/busdma_lock_mutex, /*lockarg*/&Giant,
|
|
||||||
#endif
|
|
||||||
&sc->parent_dmat) != 0) {
|
&sc->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto no;
|
goto no;
|
||||||
|
@ -913,8 +913,8 @@ tr_pci_attach(device_t dev)
|
|||||||
/*highaddr*/BUS_SPACE_MAXADDR,
|
/*highaddr*/BUS_SPACE_MAXADDR,
|
||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/tr->bufsz,
|
/*maxsize*/tr->bufsz, /*nsegments*/1, /*maxsegz*/tr->bufsz,
|
||||||
/*flags*/0, /*lockfunc*/busdma_lock_mutex,
|
/*flags*/0, /*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &tr->parent_dmat) != 0) {
|
&tr->parent_dmat) != 0) {
|
||||||
device_printf(dev, "unable to create dma tag\n");
|
device_printf(dev, "unable to create dma tag\n");
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
|
@ -776,8 +776,8 @@ sv_attach(device_t dev) {
|
|||||||
/*filter*/NULL, /*filterarg*/NULL,
|
/*filter*/NULL, /*filterarg*/NULL,
|
||||||
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
/*maxsize*/sc->bufsz, /*nsegments*/1,
|
||||||
/*maxsegz*/0x3ffff, /*flags*/0,
|
/*maxsegz*/0x3ffff, /*flags*/0,
|
||||||
/*lockfunc*/busdma_lock_mutex,
|
/*lockfunc*/NULL, /*lockarg*/NULL,
|
||||||
/*lockarg*/&Giant, &sc->parent_dmat) != 0) {
|
&sc->parent_dmat) != 0) {
|
||||||
device_printf(dev, "sv_attach: Unable to create dma tag\n");
|
device_printf(dev, "sv_attach: Unable to create dma tag\n");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ sndbuf_alloc(struct snd_dbuf *b, bus_dma_tag_t dmatag, int dmaflags,
|
|||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
if (bus_dmamap_load(b->dmatag, b->dmamap, b->buf, b->maxsize,
|
if (bus_dmamap_load(b->dmatag, b->dmamap, b->buf, b->maxsize,
|
||||||
sndbuf_setmap, b, 0) != 0 || b->buf_addr == 0) {
|
sndbuf_setmap, b, BUS_DMA_NOWAIT) != 0 || b->buf_addr == 0) {
|
||||||
sndbuf_free(b);
|
sndbuf_free(b);
|
||||||
return (ENOMEM);
|
return (ENOMEM);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user