diff options
author | yongari <yongari@FreeBSD.org> | 2004-10-13 05:45:16 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2004-10-13 05:45:16 +0000 |
commit | 5cef8d8d2948198fbbb2185df7d8670a4d32cee8 (patch) | |
tree | 84265f45d61673c001f7a05d3b7e52b74cfa21df | |
parent | 4da86ae4d224739a308aa280b2d3ef4609e76201 (diff) | |
download | FreeBSD-src-5cef8d8d2948198fbbb2185df7d8670a4d32cee8.zip FreeBSD-src-5cef8d8d2948198fbbb2185df7d8670a4d32cee8.tar.gz |
Audio drivers failed to detect failure condition and attempted to
assign DMA address to the wrong address. It can cause system lockup
or other mysterious errors. Since most sound cards requires low DMA
address(BUS_SPACE_MAXADDR_24BIT) sndbuf_alloc() would fail when the
audio driver is loaded after long running of operations.
Approved by: jake (mentor)
Reviewed by: truckman, matk
-rw-r--r-- | sys/dev/sound/isa/ad1816.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/isa/ess.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/isa/mss.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/isa/sb16.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/isa/sb8.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/au88x0.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/aureal.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/csapcm.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/ds1.c | 4 | ||||
-rw-r--r-- | sys/dev/sound/pci/emu10k1.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/es137x.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/fm801.c | 3 | ||||
-rw-r--r-- | sys/dev/sound/pci/ich.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/maestro3.c | 4 | ||||
-rw-r--r-- | sys/dev/sound/pci/solo.c | 2 | ||||
-rw-r--r-- | sys/dev/sound/pci/t4dwave.c | 4 | ||||
-rw-r--r-- | sys/dev/sound/pci/via8233.c | 6 | ||||
-rw-r--r-- | sys/dev/sound/pci/via82c686.c | 2 |
18 files changed, 29 insertions, 23 deletions
diff --git a/sys/dev/sound/isa/ad1816.c b/sys/dev/sound/isa/ad1816.c index 10ea296..40e006b 100644 --- a/sys/dev/sound/isa/ad1816.c +++ b/sys/dev/sound/isa/ad1816.c @@ -314,7 +314,8 @@ ad1816chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channe ch->parent = ad1816; ch->channel = c; ch->buffer = b; - if (sndbuf_alloc(ch->buffer, ad1816->parent_dmat, ad1816->bufsize) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, ad1816->parent_dmat, ad1816->bufsize) != 0) + return NULL; return ch; } diff --git a/sys/dev/sound/isa/ess.c b/sys/dev/sound/isa/ess.c index ba371e1..1cf756a 100644 --- a/sys/dev/sound/isa/ess.c +++ b/sys/dev/sound/isa/ess.c @@ -557,7 +557,7 @@ esschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->parent = sc; ch->channel = c; ch->buffer = b; - if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsize) == -1) + if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsize) != 0) return NULL; ch->dir = dir; ch->hwch = 1; diff --git a/sys/dev/sound/isa/mss.c b/sys/dev/sound/isa/mss.c index d03f7b8..3473766 100644 --- a/sys/dev/sound/isa/mss.c +++ b/sys/dev/sound/isa/mss.c @@ -1131,7 +1131,8 @@ msschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->channel = c; ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, mss->parent_dmat, mss->bufsize) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, mss->parent_dmat, mss->bufsize) != 0) + return NULL; sndbuf_dmasetup(ch->buffer, (dir == PCMDIR_PLAY)? mss->drq1 : mss->drq2); return ch; } diff --git a/sys/dev/sound/isa/sb16.c b/sys/dev/sound/isa/sb16.c index aa1d416..25ad11c 100644 --- a/sys/dev/sound/isa/sb16.c +++ b/sys/dev/sound/isa/sb16.c @@ -671,7 +671,7 @@ sb16chan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) == -1) + if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) != 0) return NULL; return ch; diff --git a/sys/dev/sound/isa/sb8.c b/sys/dev/sound/isa/sb8.c index 1319328..53e508c 100644 --- a/sys/dev/sound/isa/sb8.c +++ b/sys/dev/sound/isa/sb8.c @@ -585,7 +585,7 @@ sbchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c ch->channel = c; ch->dir = dir; ch->buffer = b; - if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) == -1) + if (sndbuf_alloc(ch->buffer, sb->parent_dmat, sb->bufsize) != 0) return NULL; sndbuf_dmasetup(ch->buffer, sb->drq); return ch; diff --git a/sys/dev/sound/pci/au88x0.c b/sys/dev/sound/pci/au88x0.c index 5bd5c6c..c5f845b 100644 --- a/sys/dev/sound/pci/au88x0.c +++ b/sys/dev/sound/pci/au88x0.c @@ -332,7 +332,7 @@ au88x0_chan_init(kobj_t obj, void *arg, struct au88x0_info *aui = arg; struct au88x0_chan_info *auci = au88x0_channel(aui, dir); - if (sndbuf_alloc(buf, aui->aui_dmat, aui->aui_bufsize) == -1) + if (sndbuf_alloc(buf, aui->aui_dmat, aui->aui_bufsize) != 0) return (NULL); auci->auci_aui = aui; auci->auci_pcmchan = chan; diff --git a/sys/dev/sound/pci/aureal.c b/sys/dev/sound/pci/aureal.c index dc34322..68bebb3 100644 --- a/sys/dev/sound/pci/aureal.c +++ b/sys/dev/sound/pci/aureal.c @@ -303,7 +303,8 @@ auchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c ch->channel = c; ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, au->parent_dmat, AU_BUFFSIZE) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, au->parent_dmat, AU_BUFFSIZE) != 0) + return NULL; return ch; } diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index b914df5..c53647d 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -516,7 +516,8 @@ csachan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->channel = c; ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, csa->parent_dmat, CS461x_BUFFSIZE) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, csa->parent_dmat, CS461x_BUFFSIZE) != 0) + return NULL; return ch; } diff --git a/sys/dev/sound/pci/ds1.c b/sys/dev/sound/pci/ds1.c index 6f74e78..59890d7 100644 --- a/sys/dev/sound/pci/ds1.c +++ b/sys/dev/sound/pci/ds1.c @@ -490,7 +490,7 @@ ds1pchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel ch->fmt = AFMT_U8; ch->spd = 8000; ch->run = 0; - if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, sc->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, sc->bufsz) != 0) return NULL; else { ch->lsnum = sc->pslotfree; @@ -621,7 +621,7 @@ ds1rchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel ch->dir = dir; ch->fmt = AFMT_U8; ch->spd = 8000; - if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, sc->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, sc->buffer_dmat, sc->bufsz) != 0) return NULL; else { ch->slot = (ch->num == DS1_RECPRIMARY)? sc->rbank + 2: sc->rbank; diff --git a/sys/dev/sound/pci/emu10k1.c b/sys/dev/sound/pci/emu10k1.c index 99aef33..aeeba4d 100644 --- a/sys/dev/sound/pci/emu10k1.c +++ b/sys/dev/sound/pci/emu10k1.c @@ -889,7 +889,7 @@ emurchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, break; } sc->rnum++; - if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0) return NULL; else { snd_mtxlock(sc->lock); diff --git a/sys/dev/sound/pci/es137x.c b/sys/dev/sound/pci/es137x.c index 99d738e..7b97973 100644 --- a/sys/dev/sound/pci/es137x.c +++ b/sys/dev/sound/pci/es137x.c @@ -274,7 +274,8 @@ eschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel *c ch->bufsz = es->bufsz; ch->blksz = ch->bufsz / 2; ch->num = ch->parent->num++; - if (sndbuf_alloc(ch->buffer, es->parent_dmat, ch->bufsz) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, es->parent_dmat, ch->bufsz) != 0) + return NULL; return ch; } diff --git a/sys/dev/sound/pci/fm801.c b/sys/dev/sound/pci/fm801.c index 8ff85c6..1bc52e9 100644 --- a/sys/dev/sound/pci/fm801.c +++ b/sys/dev/sound/pci/fm801.c @@ -334,7 +334,8 @@ fm801ch_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->channel = c; ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, fm801->parent_dmat, fm801->bufsz) == -1) return NULL; + if (sndbuf_alloc(ch->buffer, fm801->parent_dmat, fm801->bufsz) != 0) + return NULL; return (void *)ch; } diff --git a/sys/dev/sound/pci/ich.c b/sys/dev/sound/pci/ich.c index f52bf87..8756993 100644 --- a/sys/dev/sound/pci/ich.c +++ b/sys/dev/sound/pci/ich.c @@ -282,7 +282,7 @@ ichchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * return NULL; } - if (sndbuf_alloc(ch->buffer, sc->dmat, sc->bufsz)) + if (sndbuf_alloc(ch->buffer, sc->dmat, sc->bufsz) != 0) return NULL; ich_wr(sc, ch->regbase + ICH_REG_X_BDBAR, (u_int32_t)(ch->desc_addr), 4); diff --git a/sys/dev/sound/pci/maestro3.c b/sys/dev/sound/pci/maestro3.c index 13f5651..35d6937 100644 --- a/sys/dev/sound/pci/maestro3.c +++ b/sys/dev/sound/pci/maestro3.c @@ -383,7 +383,7 @@ m3_pchan_init(kobj_t kobj, void *devinfo, struct snd_dbuf *b, struct pcm_channel ch->channel = c; ch->fmt = AFMT_U8; ch->spd = DSP_DEFAULT_SPEED; - if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) == -1) { + if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0) { device_printf(sc->dev, "m3_pchan_init chn_allocbuf failed\n"); return NULL; } @@ -663,7 +663,7 @@ m3_rchan_init(kobj_t kobj, void *devinfo, struct snd_dbuf *b, struct pcm_channel ch->channel = c; ch->fmt = AFMT_U8; ch->spd = DSP_DEFAULT_SPEED; - if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) == -1) { + if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0) { device_printf(sc->dev, "m3_rchan_init chn_allocbuf failed\n"); return NULL; } diff --git a/sys/dev/sound/pci/solo.c b/sys/dev/sound/pci/solo.c index dfc9cc5..5cb0c13 100644 --- a/sys/dev/sound/pci/solo.c +++ b/sys/dev/sound/pci/solo.c @@ -520,7 +520,7 @@ esschan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->channel = c; ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, sc->parent_dmat, sc->bufsz) != 0) return NULL; ch->hwch = 1; if ((dir == PCMDIR_PLAY) && (sc->duplex)) diff --git a/sys/dev/sound/pci/t4dwave.c b/sys/dev/sound/pci/t4dwave.c index bbfb6d7..8622951 100644 --- a/sys/dev/sound/pci/t4dwave.c +++ b/sys/dev/sound/pci/t4dwave.c @@ -484,7 +484,7 @@ trpchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->buffer = b; ch->parent = tr; ch->channel = c; - if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) != 0) return NULL; return ch; @@ -592,7 +592,7 @@ trrchan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->buffer = b; ch->parent = tr; ch->channel = c; - if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, tr->parent_dmat, tr->bufsz) != 0) return NULL; return ch; diff --git a/sys/dev/sound/pci/via8233.c b/sys/dev/sound/pci/via8233.c index cf14551..851d772 100644 --- a/sys/dev/sound/pci/via8233.c +++ b/sys/dev/sound/pci/via8233.c @@ -447,7 +447,7 @@ via8233wr_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, ch->rbase = VIA_WR_BASE(c->num); via_wr(via, ch->rbase + VIA_WR_RP_SGD_FORMAT, WR_FIFO_ENABLE, 1); - if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) != 0) return NULL; via8233chan_sgdinit(via, ch, c->num); via8233chan_reset(via, ch); @@ -475,7 +475,7 @@ via8233dxs_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, ch->rbase = VIA_DXS_BASE(NDXSCHANS - 1 - via->n_dxs_registered); via->n_dxs_registered++; - if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) != 0) return NULL; via8233chan_sgdinit(via, ch, NWRCHANS + c->num); via8233chan_reset(via, ch); @@ -496,7 +496,7 @@ via8233msgd_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, ch->dir = dir; ch->rbase = VIA_MC_SGD_STATUS; - if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) != 0) return NULL; via8233chan_sgdinit(via, ch, NWRCHANS + c->num); via8233chan_reset(via, ch); diff --git a/sys/dev/sound/pci/via82c686.c b/sys/dev/sound/pci/via82c686.c index f274761..9ed693b 100644 --- a/sys/dev/sound/pci/via82c686.c +++ b/sys/dev/sound/pci/via82c686.c @@ -267,7 +267,7 @@ viachan_init(kobj_t obj, void *devinfo, struct snd_dbuf *b, struct pcm_channel * ch->buffer = b; ch->dir = dir; - if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) == -1) + if (sndbuf_alloc(ch->buffer, via->parent_dmat, via->bufsz) != 0) return NULL; return ch; } |