diff options
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sound/pci/vibes.c | 24 |
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 |