Home | History | Annotate | Download | only in isa
History log of /src/sys/dev/isa/sb.c
RevisionDateAuthorComments
 1.93  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.92  24-Apr-2021  thorpej branches: 1.92.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.91  08-May-2019  isaki branches: 1.91.12;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.90  16-Mar-2019  isaki branches: 1.90.2;
Use C99 style struct initializer to audio_hw_if.
 1.89  23-Nov-2011  jmcneill branches: 1.89.50;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

Making the audio drivers MP safe is necessary before efforts
can be made to make the VM system MP safe.

The are two locks per device instance, an ISR lock and
a character device lock. The ISR lock replaces calls to
splaudio()/splx(), and will be held across calls to device
methods which were called at splaudio() before (e.g.
trigger_output). The character device lock is held across
calls to nearly all of the methods, excluding some only
used for initialization, e.g. get_locks.

Welcome to 5.99.57.
 1.88  15-Mar-2008  cube branches: 1.88.16; 1.88.38; 1.88.40;
Split device_t and softc for sb(4) and all its attachments.
 1.87  19-Oct-2007  ad branches: 1.87.12; 1.87.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.86  29-Jan-2007  hubertf branches: 1.86.4; 1.86.6; 1.86.18; 1.86.20; 1.86.24;
Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.85  03-Sep-2006  christos branches: 1.85.2;
- add missing initializers
- remove impossible comparison
 1.84  14-Apr-2006  christos Coverity CID 1540: Avoid array overrun
 1.83  13-Apr-2006  cube Fix grammar in a comment, and use named constants for better readability.
 1.82  13-Apr-2006  christos Fix the MPU attachment on Aztech 1020 that has a separate mpu pnp device
instead of having the mpu in io[1]. From doomwarriorx at gmail dot com.
 1.81  11-Dec-2005  christos branches: 1.81.4; 1.81.6; 1.81.8; 1.81.10; 1.81.12;
merge ktrace-lwp.
 1.80  13-Jan-2005  kent branches: 1.80.10;
ansify and KNF
 1.79  10-Jan-2005  kent merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

* struct audio_params
- remove sw_code, factor, factor_denom, hw_sample_rate,
hw_encoding ,hw_precision, and hw_channels. Conversion information
is conveyed by stream_filter_list_t.
- change the type of sample_rate: u_long -> u_int
- add `validbits,' which represents the valid data size in
precision bits. It is required in order to distinguish 24/32bit
from 24/24bit or 32/32bit.

* audio_hw_if
- add two parameters to set_params()
stream_filter_list_t *pfil, stream_filter_list *rfil
A HW driver should set filter recipes for requested formats
- constify audio_params parameters of trigger_output() and
trigger_input(). They represent audio formats for the hardware.
- make open() and close() optional
- add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()

* sw_code is replaced with stream_filter_t.
stream_filer_t converts audio data in an input buffer and writes
into another output buffer unlike sw_code, which converts data in
single buffer.
converters in dev/auconv.c, dev/mulaw.c, dev/aurateconv.c,
dev/tc/bba.c, dev/ic/msm6258.c, and arch/arm/iomd/vidcaudio.c are
reimplemented as stream_filter_t

* MI audio
- audiosetinfo() builds filter pipelines from stream_filter_list_t
filled by audio_hw_if::set_params()
- audiosetinfo() returns with EINVAL if mmapped and set_params()
requests filters
- audio_write(), audio_pint(), and audio_rint() invoke a filter
pipeline.
- ioctl() for FIONREAD, AUDIO_WSEEK, AUDIO_GETIOFFS,
AUDIO_GETOOFFS, and audio_prinfo::{seek,samples} for
AUDIO_GETINFO handle values for a buffer nearest to userland.

* add `struct device *' parameter to ac97_attach()

* all of audio HW drivers follow audio_hw_if and ac97 changes
 1.78  29-Oct-2004  yamt branches: 1.78.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.77  22-Apr-2004  itojun sprintf -> snprintf
 1.76  04-Dec-2003  keihan netbsd.org -> NetBSD.org

This was the last commit of this kind to src/sys, which is now totally
"NetBSD.org clean". Thanks for the patiance, and sorry for all the commits.
 1.75  29-Sep-2003  jdolecek constify a little
 1.74  03-May-2003  wiz branches: 1.74.2;
DMA, not dma nor Dma.
 1.73  02-Nov-2002  kristerw Removed unused structure.
 1.72  13-Nov-2001  lukem add RCSID
 1.71  03-Oct-2001  augustss Add a new optional method, dev_ioctl, to the audio hardware driver interface.
It is called when an unrecognized ioctl() is performed on a device,
thus allowing ioctl()s that frob the hardware driver (like loading
microcode).
 1.70  19-Dec-2000  mjl branches: 1.70.2; 1.70.4; 1.70.6;
Add quirk for Avance Logic ALS100+, which doesn't like it's irq/drq
being set in pnp mode.
 1.69  10-Oct-1999  mycroft branches: 1.69.2;
NMIDI -> NMPU, to be consistent with sbdsp.c.
 1.68  02-Aug-1999  augustss branches: 1.68.2;
Move the mpu device declaration to conf/files.
Let the mpu device attach at the sb device, and then midi at the mpu.
Update the mpu at eso attachment.
 1.67  22-Mar-1999  mycroft branches: 1.67.4;
Several things:
* Rearrange the speed mapping table and adjust the code so that the highest
rate can actually be used. Previously we ended up rounding up slightly
lower speeds and then losing because set_params couldn't set the mode
back to the current one.
* Allow 260 as a valid I/O address, since the SB1 can be jumpered to this.
* Change the MPU-401 code so it can be attached as a separate device.
(XXX Really, the SB code ought to just attach a subdevice itself.)
* Do not attach an OPL on the SB1. Writing to the OPL registers at
SB_base+0 on this card wedges my machine.
(XXX Should we access it at 388 instead? The Creative web site claims
that this board *does* have an OPL2, but I haven't played with this
extensively.)
* Allocate the SB DMA channels at open time, rather than attach time, so
that a single DRQ can be used for multiple cards (if only one is in use
at a given time).
(XXX Let me tell you why this is a horrible hack. If the ISA DMA code
tries to allocate a bounce buffer after boot time, it will generally fail,
because there is no contiguous memory below 16MB and the code to allocate
contiguous pages doesn't know how to move things around. Now, we
shouldn't ever be using bounce buffers here, because we use
isa_dmamem_alloc(). So we just turn off BUS_DMA_ALLOCNOW and we don't
actually try to. That's cool, and it even works, but isa_dmamem_alloc()
has the same problem. It just happens that we allocate the ring buffers
at boot time, and whenever we reallocate them (due to the buffer size
changing), we just deallocated the previous (contiguous) buffer, so we get
lucky. This is absolutely disgusting and needs to be fixed.)
 1.66  19-Feb-1999  mycroft Move IRQ setup into frontend. Need to move DRQ handling as well.
 1.65  18-Feb-1999  mycroft Add separate halt_output and halt_input routines.
 1.64  17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.63  17-Aug-1998  augustss * Redo the way the way the MIDI driver attaches to audio devices.
* Improve the midisyn layer a little.
* Add a driver for the Yamaha OPL[23] FM synths.
The opl driver is not finished yet; it sounds pretty awful.

For some strange reason I cannot get any FM sound from my SB64 cards,
but a regular SB16 works fine.
 1.62  12-Aug-1998  augustss Remove some white space.
 1.61  10-Aug-1998  mycroft Use the new trigger_{in,out}put interface.
Also, even on the SB1, we can leave the DMA controller in auto-initalize
mode and just send a command to the board for each block. This may help
prevent FIFO underruns.
 1.60  07-Aug-1998  augustss Add MIDI support. The MIDI devices can be accessed as ``raw'' through
the /dev/rmidiN devices, or with a sequencer interface via /dev/music.
So far the only supported MIDI device is the MPU401 port on SoundBlaster
(and only on SB on isapnp, since we do not have locators with multiple
values yet).
 1.59  29-Jun-1998  thorpej When hooking up the interrupt handler, use an interrupt share type
specified by the front-end.
 1.58  17-Jun-1998  augustss Remove a bunch of totally unnecessary #include <machine/pio.h>
left over from the olden days.
 1.57  12-Jan-1998  thorpej Update for config changes.
 1.56  12-Nov-1997  augustss XXX Workaround for ViBRA cards with two 8 bit DMA channels.
 1.55  19-Oct-1997  augustss branches: 1.55.2;
Make the audio API (almost) SunOS compatible.
The changes is to allow some limited mixer manipulation through
the audio device (instead of the mixer device).
This rendered 4 methods in audio_hw_if unused so garbage collect these.
 1.54  19-Aug-1997  augustss Change the MI audio driver so it attaches to the MD driver in the
normal way. This requires adding a line to the config files to
get audio to work again.
 1.53  31-Jul-1997  augustss Audio changes:
- Change the way attach and open works to allow multiple audio
devices.
- Split the mulaw.c file into two to avoid dragging in mulaw
convertsion when they are not needed. Add 16 bit alaw/mulaw tables.
- Change the way audio properties are gotten.
- Recognize more versions os SoundBlaster.
 1.52  28-Jul-1997  augustss branches: 1.52.2;
Audio: Remove the machine dependant code I put in audio.c by mistake.
This adds another method to audio_hw_if. Also remove a field from
audio_hw_if that was not read-only.
 1.51  27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.50  27-Jul-1997  augustss Changes to the sudio system:
- It is now possible to handle devices that want "looping" DMA,
e.g. the SoundBlaster correctly. The WSS and SB drivers use this.
To do this several new methods were introduced in audio_hw_if.
- Different silence handling (forced by previous change).
- The audio driver can now be mmap()-ed, but due to problems in
the VM system only for writing for now.
- The OSS (Linux) audio emulation takes advantage of some of the
new features.
 1.49  06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.48  23-May-1997  augustss Redo the way selecting the mode for SB cards is done completely.
It is now table driven since there are so many different variations
of SB cards out there.
Also fix a bug that stopped SB2 and SBPro from working.
 1.47  23-May-1997  augustss Check that setting IRQ and DRQ on SB16 actually succeeds.
 1.46  09-May-1997  augustss branches: 1.46.2;
Change the interface between high and lowlevel audio drivers again:
Set the encoding parameters slightly differently.
Remove the SW encoding/decodinf functions from this interface
and move them to the audio_parameter struct; this is both more efficient
and flexible.
 1.45  29-Apr-1997  augustss Change the interface between the high and low level audio drivers
so that all audio encoding parameters are set at once. This simplifies
the interface and make error checking easier.
 1.44  02-Apr-1997  mycroft Remove superfluous probe message.
 1.43  20-Mar-1997  mycroft Add 16-bit DRQ support on PnP, and enable 16-bit output.
 1.42  20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.41  13-Mar-1997  mycroft Don't share the silence block between devices. Make silence filling work for
more encodings, and make it device-independent. From Lennart Augustsson, in
PR kern/3305.
 1.40  12-Mar-1997  mikel SB minor version number is always two digits
 1.39  16-Jan-1997  christos - convert to bus_space_*
- split attachment code to sb_isa.c
 1.38  13-Oct-1996  christos branches: 1.38.2;
backout kprintf changes
 1.37  10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.36  12-May-1996  mycroft Use intr.h.
 1.35  29-Apr-1996  christos - prototype fixes
 1.34  11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.33  17-Mar-1996  thorpej New device attachment scheme:

- split softc size and match/attach out from cfdriver into
a new struct cfattach.

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.32  16-Mar-1996  jtk add MediaVision Jazz16 chipset support. It must be configured with
'flags 1' on the sb? kernel configuration file line (because it frobs a
noncontiguous IO port to configure the Jazz16 extensions).

Also, remove static sb_device structure and fill in user's buffer on
each request.
 1.31  01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.30  16-Feb-1996  mycroft Prototype the probe and attach functions.
 1.29  24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.28  10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.27  19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.26  07-Jul-1995  brezak Cleanup
 1.25  08-May-1995  brezak Remove strings
 1.24  17-Apr-1995  cgd update for new locations
 1.23  17-Apr-1995  cgd clean up several ISA device interfaces: autoconfiguration, header
inclusion, and interrupt configuration. more work still needs to be done,
but it's getting better...
 1.22  25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.21  15-Mar-1995  glass fix compilation error. don't bother checking for IRQ2
 1.20  14-Mar-1995  brezak Fixes defect port-i386/860 from John Woods (jfw@jfwhome.funhouse.com) with
supplied patch. Kernel will not link with only ProAudio Spectrum driver
specified.
 1.19  08-Mar-1995  brezak Cleanup for SB16 (From Jan Sparud)
 1.18  28-Feb-1995  brezak Use irq directly not as a mask
 1.17  21-Feb-1995  brezak SoundBlaster driver for SB, SB16 and SBPRO
 1.16  03-Jan-1995  mycroft Add interrupt sharing types.
 1.15  17-Dec-1994  mycroft Fix flags to isa_dmastart().
 1.14  18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.13  04-Nov-1994  mycroft No longer needs icu.h.
 1.12  04-Nov-1994  mycroft Change all of the uses of IRQ{0-15} and bit masks to use plain numbers
rather than bit shifting.
 1.11  03-Nov-1994  mycroft Update to match autoconfig code.
 1.10  27-Oct-1994  cgd new RCS ID format.
 1.9  24-Apr-1994  mycroft Don't need isa.h.
 1.8  22-Apr-1994  mycroft Separate DMA functions.
 1.7  07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.6  29-Mar-1994  mycroft Updates for new autoconfig.
 1.5  06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.4  02-Mar-1994  hpeyerl Make probe routines return amount of space used. Still needs some
work to determine difference between SB/SB-pro.
 1.3  28-Jan-1994  deraadt don't go boom in the presence of stray interrupts
 1.2  25-Jan-1994  hpeyerl This makes my soundblaster work.
 1.1  09-Jan-1994  cgd LBL /dev/audio and soundblaster drivers, as ported by brad@fcr.com.
both should work with both old- and new-config i386 trees.
Some notes:
bsd_audio.c has dependencies on the soundblaster. This should
be fixed, so that it can be used for the PC speaker
(when its driver has been modified), as well.
sb.c needs some cleanup, and will have sections trimmed, eventually
(when new config becomse standard for i386). additionally,
the SBPro support needs some cleanup.
 1.38.2.1  18-Jan-1997  thorpej Update from trunk.
 1.46.2.2  24-May-1997  thorpej Update from trunk.
 1.46.2.1  13-May-1997  thorpej - Garbage-collect a structure that isn't used anywhere.
- Add a comment about drq lossage on some SoundBlaster flavors.
 1.52.2.1  23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.55.2.1  13-Nov-1997  mellon Pull rev 1.56 up from trunk (augustss)
 1.67.4.1  02-Aug-1999  thorpej Update from trunk.
 1.68.2.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.69.2.1  05-Jan-2001  bouyer Sync with HEAD
 1.70.6.1  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.70.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.70.2.3  11-Nov-2002  nathanw Catch up to -current
 1.70.2.2  14-Nov-2001  nathanw Catch up to -current.
 1.70.2.1  08-Oct-2001  nathanw Catch up to -current.
 1.74.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.74.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.74.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.74.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.74.2.1  03-Aug-2004  skrll Sync with HEAD
 1.78.2.1  03-Jan-2005  kent * adopt the filter pipeline framework

* ic/ad1848.c, isa/ess.c, isa/sbdsp.c
remove direct call of set_params() for the default encoding.
It should be called by the MI audio framework.
 1.80.10.5  17-Mar-2008  yamt sync with head.
 1.80.10.4  27-Oct-2007  yamt sync with head.
 1.80.10.3  26-Feb-2007  yamt sync with head.
 1.80.10.2  30-Dec-2006  yamt sync with head.
 1.80.10.1  21-Jun-2006  yamt sync with head.
 1.81.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.81.10.1  19-Apr-2006  elad sync with head.
 1.81.8.2  03-Sep-2006  yamt sync with head.
 1.81.8.1  24-May-2006  yamt sync with head.
 1.81.6.1  22-Apr-2006  simonb Sync with head.
 1.81.4.1  09-Sep-2006  rpaulo sync with head
 1.85.2.1  01-Feb-2007  ad Sync with head.
 1.86.24.1  25-Oct-2007  bouyer Sync with HEAD.
 1.86.20.2  23-Mar-2008  matt sync with HEAD
 1.86.20.1  06-Nov-2007  matt sync with HEAD
 1.86.18.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.86.6.1  23-Oct-2007  ad Sync with head.
 1.86.4.1  27-Feb-2007  ad Add MP locking for audio drivers.
 1.87.16.1  03-Apr-2008  mjf Sync with HEAD.
 1.87.12.1  24-Mar-2008  keiichi sync with head.
 1.88.40.2  22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.88.40.1  19-Nov-2011  jmcneill port ad-audiomp2 branch changes to 5.99.56
todo:
- port ad-audiomp2 pcppi changes
- these drivers need to be fixed:
- emuxki
- gcscaudio
- hdafg
- uaudio
- umidi
- MD audio drivers
 1.88.38.1  17-Apr-2012  yamt sync with head
 1.88.16.2  09-Dec-2008  ad Checkpoint work on MIDI.
 1.88.16.1  08-Dec-2008  ad Convert some more drivers.
 1.89.50.1  10-Jun-2019  christos Sync with HEAD
 1.90.2.2  04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.90.2.1  03-May-2019  isaki Adapt sbdsp to audio2.
- Use new query_format/set_format interfaces.
The formats are created from sb[pr]modes tables.
- Drop INDEPENDENT property for models proir to SB_16.
 1.91.12.1  02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.92.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed