summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pci/vibes.c
diff options
context:
space:
mode:
authororion <orion@FreeBSD.org>2001-09-03 01:03:50 +0000
committerorion <orion@FreeBSD.org>2001-09-03 01:03:50 +0000
commit9f07ad162e1e2bfb6c3a6ffa9b6e53b57cb60dc3 (patch)
tree2782b3819a6df9a03fdcbc933f440e95dfd02603 /sys/dev/sound/pci/vibes.c
parentebb84d55ed382edf827cd3fe1e2b6e0aa1d6362a (diff)
downloadFreeBSD-src-9f07ad162e1e2bfb6c3a6ffa9b6e53b57cb60dc3.zip
FreeBSD-src-9f07ad162e1e2bfb6c3a6ffa9b6e53b57cb60dc3.tar.gz
Fix return value of svchan_setblocksize.
Expand probing range.
Diffstat (limited to 'sys/dev/sound/pci/vibes.c')
-rw-r--r--sys/dev/sound/pci/vibes.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/sys/dev/sound/pci/vibes.c b/sys/dev/sound/pci/vibes.c
index 28436b8..65d840c 100644
--- a/sys/dev/sound/pci/vibes.c
+++ b/sys/dev/sound/pci/vibes.c
@@ -216,7 +216,7 @@ svchan_setblocksize(kobj_t obj, void *data, u_int32_t blocksize)
RANGE(blocksize, SV_MIN_BUFFER, SV_MAX_BUFFER / SV_INTR_PER_BUFFER);
sndbuf_resize(ch->buffer, SV_INTR_PER_BUFFER, blocksize);
DEB(printf("svchan_setblocksize: %d\n", blocksize));
- return sndbuf_getsize(ch->buffer);
+ return blocksize;
}
static int
@@ -711,7 +711,7 @@ sv_attach(device_t dev) {
struct sc_info *sc;
u_int32_t data;
char status[SND_STATUSLEN];
- u_long midi_start, games_start, count, sdmaa, sdmac;
+ u_long midi_start, games_start, count, sdmaa, sdmac, ml, mu;
d = device_get_softc(dev);
@@ -797,13 +797,25 @@ sv_attach(device_t dev) {
bus_get_resource(dev, SYS_RES_IOPORT, SV_PCI_MIDI, &midi_start, &count);
bus_get_resource(dev, SYS_RES_IOPORT, SV_PCI_GAMES, &games_start, &count);
- /* Check assumptions about space availability and alignment. */
- if ((midi_start - games_start != 0x200) || midi_start & 0xff) {
- device_printf(dev, "sv_attach: resource assumptions not met\n");
+ if (games_start < midi_start) {
+ ml = games_start;
+ mu = midi_start;
+ } else {
+ ml = midi_start;
+ mu = games_start;
+ }
+ /* Check assumptions about space availability and
+ alignment. How driver loaded can determine whether
+ games_start > midi_start or vice versa */
+ if ((mu - ml >= 0x800) ||
+ ((mu - ml) % 0x200)) {
+ device_printf(dev, "sv_attach: resource assumptions not met "
+ "(midi 0x%08lx, games 0x%08lx)\n",
+ midi_start, games_start);
goto fail;
}
- sdmaa = games_start + 0x40;
+ sdmaa = ml + 0x40;
sdmac = sdmaa + 0x40;
/* Add resources to list of pci resources for this device - from here on
OpenPOWER on IntegriCloud