Home | History | Annotate | only in /src/sys/dev/isa
History log of /src/sys/dev/isa
RevisionDateAuthorComments
 1.11 27-Jan-2019  maxv Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.10 09-Dec-2016  christos branches: 1.10.16;
put back spkrio.h for compat
 1.9 09-Dec-2016  christos move spkrio.h out of isa
 1.8 02-Apr-2008  dyoung branches: 1.8.68; 1.8.72;
Certain misguided people have complained, NetBSD only runs rare or
"retro" computers, but NetBSD also runs a growing number of rare
and retro add-on cards. With this patch, NetBSD supports the IDEC
Supervision/16, a black&white image capture board for the 16-bit
ISA bus. Approximate date of manufacture: 1991. Total instances
known to be in use throughout the world: one.

Coming soon; isvctl(8), the utility program for capturing 8-bit,
512x480 images at speeds of up to 6 frames per second.
 1.7 11-Apr-2001  jdolecek branches: 1.7.120;
Put back all header files defining ioctls
 1.6 11-Apr-2001  jdolecek Only install headers which are actually used by our userland. This
saves about 2.2MB under /usr/include/dev/. Discussed on tech-kern@
recently.

I HOPE to get the list right. The headers I left in are ones
used for MI tools and those whose usage I discovered by grep over tree sources.
Feel free to put needed includes back in if you encounter anything which
should not be removed from lists.
 1.5 23-Mar-2001  briggs if_wereg.h is no longer here.
 1.4 16-Oct-2000  thorpej branches: 1.4.2;
Register definitions for the Middle Digital, Inc. PC-Weasel
serial console board.
 1.3 19-Mar-2000  rh Track name change espvar.h -> esp_isavar.h so 'make includes' works again.
 1.2 04-Dec-1999  sommerfeld Fix "make includes" since pckbc moved to dev/ic from dev/isa
(Hi, Jason!)
 1.1 12-Jun-1998  cgd branches: 1.1.14; 1.1.20;
Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.14.3 21-Apr-2001  bouyer Sync with HEAD
 1.1.14.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.7.120.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.72.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.8.68.1 05-Feb-2017  skrll Sync with HEAD
 1.10.16.1 10-Jun-2019  christos Sync with HEAD
 1.8 08-Apr-2022  andvar fix various typos, mainly in comments, but also log messages, docs, game text.
 1.7 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.6 27-Dec-2019  msaitoh branches: 1.6.12;
s/transfered/transferred/
 1.5 11-Dec-2005  christos branches: 1.5.164;
merge ktrace-lwp.
 1.4 27-Feb-2005  perry nuke trailing whitespace
 1.3 03-May-2003  wiz branches: 1.3.2; 1.3.10; 1.3.12;
DMA, not dma nor Dma.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 03-Nov-1994  mycroft Commit this, though it really does need work.
 1.3.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.10.1 29-Apr-2005  kent sync with -current
 1.3.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.164.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.56 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.55 14-Aug-1998  mycroft Emulate ulinear_be using slinear_be on later chips.
 1.54 28-Jul-1998  augustss KNFify.
 1.53 28-Jul-1998  augustss Fix obsolete code in waiting for calibration on the ad1848.
(Sigh, the ad1848 driver should be rewritten.)
 1.52 09-Jul-1998  mycroft Fix the name of the ulinear_be mode.
 1.51 30-Jun-1998  mycroft Recognize the CS4236B (although we don't yet use any of the extensions).
 1.50 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.49 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.48 12-Mar-1998  augustss Update probing for GUS a little. From soren@t.dk,
closes PR kern/5148.
 1.47 11-Mar-1998  augustss Apply cs4236 fix from rh@vip.at. Closes PR 5143.
 1.46 24-Feb-1998  cgd don't include <machine/pio.h>. It's unneeded here now (this code
uses the bus_space_* interfaces), and therefore unwanted.
 1.45 30-Jan-1998  augustss Fix initialization and timing problem.
As per misc/4902, from Clifford Wright <cliff@snipe444.org>.
 1.44 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.43 19-Oct-1997  augustss 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.42 11-Oct-1997  mycroft AudioElinear -> AudioEslinear
 1.41 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.40 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.39 20-Aug-1997  augustss Convert WSS driver to use non-broken indirect configuration.
 1.38 19-Aug-1997  augustss Avoid munging audio_defaults.
 1.37 04-Aug-1997  augustss Get rid of `register'.
 1.36 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.35 28-Jul-1997  augustss branches: 1.35.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.34 28-Jul-1997  augustss audio: Minor cleanup and enable looping DMA for PSS and PAS.
 1.33 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.32 15-Jul-1997  augustss In the name of backwards compatibility AUDIO_ENCODING_LINEAR has been
renamed AUDIO_ENCODING_SLINEAR and AUDIO_ENCODING_LINEAR reverts to the
NetBSD 1.2 sematics. A kernel with COMPAT_12 defined will accept
AUDIO_ENCODING_LINEAR and treat it as before, without COMPAT_12 it
will be rejected.
 1.31 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.30 31-May-1997  jtk add software emulation stub for ulinear_be
 1.29 20-May-1997  augustss Make the audio default parameters into a globally accessible constant.
 1.28 13-May-1997  augustss Clean up emulation code, SB, and GUS drivers and add some more encoding
emulation to SB.
 1.27 09-May-1997  augustss branches: 1.27.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.26 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.25 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.24 06-Apr-1997  jtk fix compile error if AUDIO_DEBUG
 1.23 05-Apr-1997  augustss Busify the WSS driver.
 1.22 20-Mar-1997  mycroft Oops; fix pasto.
 1.21 20-Mar-1997  mycroft Make sure we round the block size to a multiple of the sample size.
 1.20 20-Mar-1997  mycroft Remove bogus block rounding code. If the application sets a
block size explicitly, it had better know what it's doing. From
PR 2587, by Robert Baron.
 1.19 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.18 20-Mar-1997  mycroft Fix oversights in previous.
 1.17 19-Mar-1997  mycroft ad1848_commit_settings(): Don't set the speed/format register if the
parameters haven't changed. From PR 3360, by Jason Baker.

Also, clean up several overly-complex interfaces.
 1.16 13-Mar-1997  mikel fix various AD1848/PSS misfeatures; from Jason Baker in PR kern/2045.
also did some misc cleanup of my own.
 1.15 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.14 05-Dec-1996  mikel fix AUTO_CAL_ENABLE bug, & misc. cleanup.
 1.13 16-Oct-1996  jtk fix compile errors & warnings
 1.12 13-Oct-1996  christos backout kprintf changes
 1.11 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 29-Apr-1996  christos - prototype fixes
 1.9 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.8 05-Feb-1996  scottr Allow blocksize of NBPG/2 to NBPG for higher sampling rates. From
Lennart Augustsson <augustss@cs.chalmers.se>, closes PR 2013.
 1.7 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.6 07-Jul-1995  brezak add support for cs4231
 1.5 08-May-1995  brezak Remove strings
 1.4 17-Apr-1995  cgd update for new locations
 1.3 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.2 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.1 21-Feb-1995  brezak Driver for ad1848 codec
 1.27.2.4 01-Jun-1997  thorpej Update from trunk.
 1.27.2.3 24-May-1997  thorpej Update from trunk.
 1.27.2.2 19-May-1997  thorpej Update from trunk.
 1.27.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.35.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40 08-Jun-2019  isaki Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.39 08-May-2019  isaki 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.38 23-Nov-2011  jmcneill branches: 1.38.50; 1.38.54;
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.37 02-Jun-2011  nonaka branches: 1.37.2; 1.37.4;
fix compile failure.
 1.36 28-Apr-2008  martin branches: 1.36.12; 1.36.22; 1.36.28; 1.36.32;
Remove clause 3 and 4 from TNF licenses
 1.35 28-Apr-2008  garbled Minor fixes to some of these files:
Add recognition for the CS4232C revision chip. (0xa2)
Make ic/ad1848.c compile with AUDIO_DEBUG
Add a needed machine/bus.h include to ic/cs4231.c
Add a few additional register defines to ic/cs4231reg.h
 1.34 08-Apr-2008  cegger branches: 1.34.2; 1.34.4;
use aprint_*_dev and device_xname
 1.33 19-Oct-2007  ad branches: 1.33.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.32 16-Nov-2006  christos branches: 1.32.8; 1.32.22; 1.32.24; 1.32.28;
__unused removal on arguments; approved by core.
 1.31 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.30 11-Dec-2005  christos branches: 1.30.20; 1.30.22;
merge ktrace-lwp.
 1.29 27-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28 13-Jan-2005  kent branches: 1.28.2; 1.28.4;
ansify and KNF
 1.27 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.26 09-Jul-2004  mycroft branches: 1.26.2;
Free the DMA channels as the last step.
 1.25 09-Jul-2004  mycroft Clean up. Attempt to make these safer against stray interrupts.
 1.24 09-Jul-2004  mycroft There's no need to halt in the close routine -- just clean up the ISA resources.
 1.23 09-May-2003  fvdl branches: 1.23.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.22 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.21 06-Mar-2002  itohy Fix ADPCM playback/recording.
 1.20 13-Nov-2001  lukem add RCSID
 1.19 04-Nov-2001  itohy AD1845 on my AlphaStation 255 doesn't match the AD1845 doc.
Try to detect AD1845 (unfortunately this is not always correct)
and work around the problems.
 1.18 20-Dec-2000  thorpej branches: 1.18.2; 1.18.4; 1.18.8;
Fix a debugging clause missed when fixing full-duplex support.
Noted by Wolfgang Rupprecht.
 1.17 18-Dec-2000  thorpej Use separate interrupt handlers for play and record the chip has
support for it and we're configured for separate play and record
DRQs. This makes full-duplex audio work on the Windows Sound System
(found in many Alpha systems).

Submitted by Juergen Weiss <weiss@uni-mainz.de> in kern/11178.
 1.16 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.15 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.14 07-Feb-2000  thorpej branches: 1.14.4;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.13 05-Oct-1999  itohy branches: 1.13.2;
Add power control hooks.
Make the wave output mute while playback is inactive. This significantly
reduces noises while preparing playback, especially by mpg123.
 1.12 06-Sep-1999  rh Add mode 3 support for newer CS423X chips. Modify probe to correctly
distinguish between CS4236, CS4236B, and CS4237B.
 1.11 22-Mar-1999  mycroft Create DMA maps at open time.
 1.10 22-Mar-1999  mycroft Nuke sc_iooffs from orbit. This is exactly what bus_space_subregion() is for.
 1.9 22-Mar-1999  mycroft Adjust the probe routine to work on chips where the mic preamp bit is shared
between register I0 and I1.
 1.8 22-Feb-1999  mycroft Use DMAMODE_LOOPDEMAND. Tested on a CS4231 in a WSS clone.
 1.7 18-Feb-1999  mycroft Add separate halt_input and halt_output methods in ad1848_isa, which disable
the DMA channel.
 1.6 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.5 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.4 26-Nov-1998  hannken Add support for `AdLib NSC 16 PNP' as wss, joy.
Record source selection needs work.
 1.3 06-Sep-1998  pk Debug output updates (Ezra Story; PR#6108).
 1.2 29-Aug-1998  jtk make AUDIO_DEBUG work again
 1.1 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.13.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.13.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.4.4 27-Mar-2002  he Pull up revisions 1.16,1.19-1.21 (requested by itohy):
Several changes to wss-compatible audio devices:
o Fix ADPCM playback/recording
o Add explicit support for OPL3-SA2 (YMF711), fixes PR#14819
o Add AD1845 support
o other minor bugfixes and cleanups
 1.14.4.3 26-Feb-2001  he Pull up revision 1.18 (requested by jtk):
Make this compile with AUDIO_DEBUG turned on.
 1.14.4.2 26-Dec-2000  jhawk Pull up revision 1.17 (requested by thorpej):
Support full-duplex audio on 1848 wss devices by using
seperate interrupt handlers for play and record. Fix from
Juergen Weiss <weiss@uni-mainz.de> by way of PR#11178.
 1.14.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.18.8.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.18.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.18.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.18.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.23.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.26.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.28.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.2.1 29-Apr-2005  kent sync with -current
 1.29.4.1 27-Oct-2007  yamt sync with head.
 1.30.22.2 10-Dec-2006  yamt sync with head.
 1.30.22.1 22-Oct-2006  yamt sync with head
 1.30.20.1 18-Nov-2006  ad Sync with head.
 1.32.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.32.24.1 06-Nov-2007  matt sync with HEAD
 1.32.22.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.32.8.1 23-Oct-2007  ad Sync with head.
 1.33.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.34.4.1 16-May-2008  yamt sync with head.
 1.34.2.1 18-May-2008  yamt sync with head.
 1.36.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.36.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.36.22.1 12-Jun-2011  rmind sync with head
 1.36.12.2 12-Dec-2008  ad Checkpoint work in progress.
 1.36.12.1 11-Dec-2008  ad Checkpoint work in progress.
 1.37.4.2 22-Nov-2011  jakllsch don't attempt to obtain the intr mutex again, only KASSERT we own it already
 1.37.4.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.37.2.1 17-Apr-2012  yamt sync with head
 1.38.54.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.38.54.2 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.38.54.1 03-May-2019  isaki Remove dev/auconv.[ch].
Now it is handled in dev/audio/audio.c and dev/audio/linear.c.
Remove dev/mulaw.h.
It already have been just a link to dev/audio/mulaw.h in this
branch.
 1.38.50.1 10-Jun-2019  christos Sync with HEAD
 1.3 07-Jul-1995  brezak add support for cs4231
 1.2 08-May-1995  brezak Remove strings
 1.1 21-Feb-1995  brezak Driver for ad1848 codec
 1.45 08-May-2019  isaki 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.44 23-Nov-2011  jmcneill branches: 1.44.50; 1.44.54;
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.43 28-Apr-2008  martin branches: 1.43.12; 1.43.34; 1.43.36;
Remove clause 3 and 4 from TNF licenses
 1.42 11-Dec-2005  christos branches: 1.42.70; 1.42.72; 1.42.74;
merge ktrace-lwp.
 1.41 28-Jun-2005  wiz Update comment.
 1.40 27-Feb-2005  perry nuke trailing whitespace
 1.39 13-Jan-2005  kent branches: 1.39.2; 1.39.4;
ansify and KNF
 1.38 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.37 03-May-2003  wiz branches: 1.37.2; 1.37.6;
DMA, not dma nor Dma.
 1.36 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.35 18-Dec-2000  thorpej Use separate interrupt handlers for play and record the chip has
support for it and we're configured for separate play and record
DRQs. This makes full-duplex audio work on the Windows Sound System
(found in many Alpha systems).

Submitted by Juergen Weiss <weiss@uni-mainz.de> in kern/11178.
 1.34 06-Dec-2000  matt Un __P'ed.
 1.33 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.32 07-Feb-2000  thorpej branches: 1.32.4;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.31 05-Oct-1999  itohy branches: 1.31.2;
Add power control hooks.
 1.30 22-Mar-1999  mycroft Nuke sc_iooffs from orbit. This is exactly what bus_space_subregion() is for.
 1.29 19-Feb-1999  mycroft Kill vestiges of isa_establish().
 1.28 18-Feb-1999  mycroft Add separate halt_input and halt_output methods in ad1848_isa, which disable
the DMA channel.
 1.27 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.26 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.25 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.24 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.23 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.22 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.21 19-Oct-1997  augustss 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.20 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.19 20-Aug-1997  augustss Convert WSS driver to use non-broken indirect configuration.
 1.18 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.17 28-Jul-1997  augustss branches: 1.17.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.16 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.15 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.14 09-May-1997  augustss branches: 1.14.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.13 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.12 05-Apr-1997  augustss Busify the WSS driver.
 1.11 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.10 19-Mar-1997  mycroft ad1848_commit_settings(): Don't set the speed/format register if the
parameters haven't changed. From PR 3360, by Jason Baker.

Also, clean up several overly-complex interfaces.
 1.9 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.8 29-Apr-1996  christos - prototype fixes
 1.7 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.6 07-Jul-1995  brezak add support for cs4231
 1.5 08-May-1995  brezak Remove strings
 1.4 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.3 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.2 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.1 21-Feb-1995  brezak Driver for ad1848 codec
 1.14.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.17.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.31.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.31.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.32.4.2 26-Dec-2000  jhawk Pull up revision 1.35 (requested by thorpej):
Support full-duplex audio on 1848 wss devices by using
seperate interrupt handlers for play and record. Fix from
Juergen Weiss <weiss@uni-mainz.de> by way of PR#11178.
 1.32.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.37.6.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.37.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.37.2.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.37.2.1 17-Jan-2005  skrll Sync with HEAD.
 1.39.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.39.2.1 29-Apr-2005  kent sync with -current
 1.42.74.1 16-May-2008  yamt sync with head.
 1.42.72.1 18-May-2008  yamt sync with head.
 1.42.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.43.36.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.43.34.1 17-Apr-2012  yamt sync with head
 1.43.12.1 11-Dec-2008  ad Checkpoint work in progress.
 1.44.54.1 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.44.50.1 10-Jun-2019  christos Sync with HEAD
 1.23 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.22 24-Apr-2021  thorpej branches: 1.22.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.21 11-Jul-2016  msaitoh branches: 1.21.34;
KNF. No functional change.
 1.20 27-Oct-2012  chs branches: 1.20.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.19 12-May-2009  cegger branches: 1.19.12; 1.19.22;
struct device * -> device_t, no functional changes intended.
 1.18 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 08-Apr-2008  cegger branches: 1.17.4; 1.17.18;
use aprint_*_dev and device_xname
 1.16 19-Oct-2007  ad branches: 1.16.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 16-Nov-2006  christos branches: 1.15.8; 1.15.22; 1.15.24; 1.15.28;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 11-Dec-2005  christos branches: 1.13.20; 1.13.22;
merge ktrace-lwp.
 1.12 04-Feb-2005  perry branches: 1.12.6;
de-__P
 1.11 14-Sep-2004  drochner branches: 1.11.4; 1.11.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.10 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.9 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.8 01-Jan-2003  thorpej branches: 1.8.2;
Use aprint_normal() in cfprint routines.
 1.7 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.6 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 21-Apr-2000  explorer branches: 1.2.6; 1.2.8; 1.2.10;
the status register is _always_ at 0x420 -- grr. How should I put this in the config file rather than hard-coded?
 1.1 21-Apr-2000  explorer Add driver for Addonics FlexPort 8S (and probably 4S, but not tested)
 1.2.10.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.8.5 03-Jan-2003  thorpej Sync with HEAD.
 1.2.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.2.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.8.2 11-Jan-2002  nathanw More catchup.
 1.2.8.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 21-Apr-2000  bouyer file addcom_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:11 +0000
 1.8.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.8.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.2.1 03-Aug-2004  skrll Sync with HEAD
 1.11.6.1 12-Feb-2005  yamt sync with head.
 1.11.4.1 29-Apr-2005  kent sync with -current
 1.12.6.2 27-Oct-2007  yamt sync with head.
 1.12.6.1 30-Dec-2006  yamt sync with head.
 1.13.22.2 10-Dec-2006  yamt sync with head.
 1.13.22.1 22-Oct-2006  yamt sync with head
 1.13.20.1 18-Nov-2006  ad Sync with head.
 1.15.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.24.1 06-Nov-2007  matt sync with HEAD
 1.15.22.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.15.8.1 23-Oct-2007  ad Sync with head.
 1.16.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.4.1 16-May-2009  yamt sync with head
 1.19.22.2 03-Dec-2017  jdolecek update from HEAD
 1.19.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.12.1 30-Oct-2012  yamt sync with head
 1.20.14.1 05-Oct-2016  skrll Sync with HEAD
 1.21.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.22.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.21 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.20 27-Oct-2012  chs branches: 1.20.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.19 23-Nov-2009  rmind branches: 1.19.12; 1.19.22;
Remove some unecessary includes sys/user.h header.
 1.18 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.17 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.16 28-Apr-2008  martin branches: 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 08-Apr-2008  cegger branches: 1.15.2; 1.15.4;
use aprint_*_dev and device_xname
 1.14 19-Oct-2007  ad branches: 1.14.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 16-Nov-2006  christos branches: 1.13.8; 1.13.22; 1.13.24; 1.13.28;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 27-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 04-Feb-2005  perry de-__P
 1.8 14-Sep-2004  drochner branches: 1.8.4; 1.8.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.7 02-Oct-2002  thorpej branches: 1.7.6;
Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.4 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.3 13-Nov-2001  lukem add RCSID
 1.2 12-Jun-1999  dante branches: 1.2.2; 1.2.16; 1.2.18;
Move chip version check from advlib.c to adv_isa.c
 1.1 06-Jun-1999  dante Add support for the following AdvanSys SCSI ISA cards:
Connectivity Products:
ABP510/5150 - Bus-Master ISA (240 CDB) (Footnote 1)
ABP5140 - Bus-Master ISA (16 CDB) (Footnote 1) (Footnote 2)
ABP5142 - Bus-Master ISA with floppy (16 CDB) (Footnote 3)

Single Channel Products:
ABP542 - Bus-Master ISA with floppy (240 CDB)

Footnotes:
1. This board has been shipped by HP with the 4020i CD-R drive.
The board has no BIOS so it cannot control a boot device, but
it can control any secondary SCSI device.
2. This board has been sold by SIIG as the i540 SpeedMaster.
3. This board has been sold by SIIG as the i542 SpeedMaster.
 1.2.18.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.18.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.16.5 18-Oct-2002  nathanw Catch up to -current.
 1.2.16.4 28-Feb-2002  nathanw Catch up to -current.
 1.2.16.3 11-Jan-2002  nathanw More catchup.
 1.2.16.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.16.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 12-Jun-1999  thorpej file adv_isa.c was added on branch chs-ubc2 on 1999-06-21 01:17:59 +0000
 1.7.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.7.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.6.1 12-Feb-2005  yamt sync with head.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.10.4.2 27-Oct-2007  yamt sync with head.
 1.10.4.1 30-Dec-2006  yamt sync with head.
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.13.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.24.1 06-Nov-2007  matt sync with HEAD
 1.13.22.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.13.8.1 23-Oct-2007  ad Sync with head.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.4.3 11-Mar-2010  yamt sync with head
 1.15.4.2 16-May-2009  yamt sync with head
 1.15.4.1 16-May-2008  yamt sync with head.
 1.15.2.1 18-May-2008  yamt sync with head.
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.22.2 03-Dec-2017  jdolecek update from HEAD
 1.19.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.12.1 30-Oct-2012  yamt sync with head
 1.20.14.1 09-Jul-2016  skrll Sync with HEAD
 1.20 07-Feb-1997  mycroft Move the aha ISA probe functions into a separate file.
 1.19 10-Dec-1996  thorpej branches: 1.19.4;
Fill in sc_link.max_target
 1.18 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.17 13-Oct-1996  christos backout kprintf changes
 1.16 10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
- fix unused variable warning
- include <systm.h>
 1.15 07-Sep-1996  mycroft Use bus.h.
 1.14 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.13 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.12 18-Jun-1996  mycroft Turn off *DIAG by default.
 1.11 12-May-1996  mycroft branches: 1.11.4;
Use intr.h.
 1.10 05-May-1996  mycroft Fix a trivial typo.
 1.9 29-Apr-1996  christos Fix gcc -Wall warnings.
 1.8 25-Apr-1996  is Fix an obvious typo (wrong sign of test). At the same time, make the early
probe printf prefix unambiguous.
 1.7 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.6 03-Apr-1996  mycroft Don't wait for a command complete interrupt when enabling mailbox out
interrupts.
 1.5 03-Apr-1996  mycroft Don't wait for the host adapter to be idle before enabling or disabling
mailbox out interrupts.
 1.4 28-Mar-1996  mycroft Fix the mailbox unlock code for CF and CP.
 1.3 25-Mar-1996  mycroft Remove dead variables.
 1.2 24-Mar-1996  mycroft Fix up a couple of printf()s.
 1.1 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.11.4.1 10-Dec-1996  mycroft Turn off diagnostic code by default.
 1.19.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.58 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.57 19-Mar-1996  mycroft lto3b -> _lto3b
 1.56 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.55 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.54 10-Nov-1995  mycroft Correct the format of some diagnostics.
 1.53 03-Oct-1995  mycroft Modularize the CCB/MSCP/ACB/ECB handling a little. No functional changes.
 1.52 26-Sep-1995  thorpej memcmp -> bcmp. Fixes PR #1518.
 1.51 26-Sep-1995  thorpej Don't declare Debugger(). It's handled in <sys/systm.h>
 1.50 14-Sep-1995  pk Make *print() a message if no scsibus was attached. Also, return something
valid.
 1.49 12-Aug-1995  mycroft opri --> s
 1.48 12-Aug-1995  mycroft minphys() functions really should return void.
 1.47 29-Jul-1995  mycroft Turn off the mbi diagnostics completely.
 1.46 28-Jul-1995  mycroft Don't loop if we're out of CCBs/SCBs/MSCPs.
 1.45 27-Jul-1995  mycroft Disable diagnostics related to expected mbi race condition.
 1.44 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.43 08-Jul-1995  cgd insert missing call to splx() when {aha,bt}_send_mbo() returns null.
from enami@sys.ptg.sony.co.jp.
 1.42 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.41 13-Jan-1995  mycroft Simplify some sanity checks.
 1.40 03-Jan-1995  mycroft Add interrupt sharing types.
 1.39 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.38 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.37 04-Nov-1994  mycroft No longer needs icu.h.
 1.36 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.35 03-Nov-1994  mycroft Update to match autoconfig code.
 1.34 27-Oct-1994  cgd new RCS ID format.
 1.33 27-Jul-1994  mycroft Fix the DMA setup.
 1.32 27-Jul-1994  mycroft Enable IRQ probing.
 1.31 13-Jun-1994  mycroft branches: 1.31.2;
Fix unimportant typos.
 1.30 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.29 03-May-1994  mycroft Really fix the Buslogic/DTC problem.
 1.28 29-Apr-1994  cgd change timeout/untimeout/wakeup/sleep/tsleep args to void *
 1.27 21-Apr-1994  mycroft Clean up the TUNE_1542 code.
 1.26 08-Apr-1994  mycroft Fix return values from some interrupt routines.
 1.25 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.24 29-Mar-1994  mycroft New SCSI system, based on Julian's more recent work.
 1.23 25-Mar-1994  mycroft Put controller target in scsi_switch.
 1.22 12-Mar-1994  mycroft Fix bug in last change.
 1.21 12-Mar-1994  mycroft Update to match config(8).
 1.20 10-Mar-1994  mycroft Updates to match config(8).
 1.19 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.18 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.17 03-Jan-1994  mycroft Use KERNBASE, not 0xfe000000.
 1.16 20-Dec-1993  davidb Fixed bug where with two or more SCSI controllers of the same type, you
could not have devices at the same ID on each bus.
This patch not directly applicable to magnum branch, which is using Julian's
new SCSI code.
 1.15 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.14 23-Aug-1993  cgd branches: 1.14.2;
changes from 0.9-ALPHA2 to 0.9-BETA
 1.13 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.12 06-Jul-1993  deraadt branches: 1.12.2;
clean up code for timeout/untimeout/wakeup prototypes.
 1.11 14-Jun-1993  andrew Reduced bus-on time from the default of 11ms -> 9ms, to prevent floppy from
becoming data-starved during simultaneous fd & scsi activity.
 1.10 09-Jun-1993  deraadt minor silliness related to two or more controllers
 1.9 22-May-1993  cgd add rcsids to everything and clean up headers
 1.8 04-May-1993  deraadt support for making dev->id_alive be set, this is for iostat to
find disk devices. wee bit of a kludge. sub-device attach()
routines must now return 1 for successful attach(), 0 otherwise.
Other bsd's do this too..
 1.7 19-Apr-1993  mycroft Fix subtle word-size error.
 1.6 15-Apr-1993  deraadt ioconf changes, see previous cvs's that dumped core
 1.5 15-Apr-1993  glass NDDB made a re-appearance....
 1.4 12-Apr-1993  deraadt new scsi subsystem.
changes also in config/mkioconf.c & sys/scsi/*
 1.3 10-Apr-1993  glass fixed to be compliant, subservient, and to take advantage of the newly
hacked config(8)
 1.2 08-Apr-1993  deraadt dmesg output at boottime now tries to print out information as
soon as it is available. The output looks much more like Sunos.
 1.1 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.12.2.2 13-Aug-1993  cgd from chmr@edvz.tu-graz.ac.at (Christoph Robitschko):
it seems that the bustek needs a little more time to settle down after a
reset command than the adaptecs. Up to PK-0.2.3 there was a printf there
that did the job quite well.
 1.12.2.1 29-Jul-1993  deraadt reliability fudge for dealing with drives that do scsi resets very slowly
(or so it seems)
 1.14.2.11 25-Mar-1994  mycroft Stylistic changes.
 1.14.2.10 02-Feb-1994  mycroft Change some structure names.
 1.14.2.9 02-Feb-1994  mycroft Change second arg of probe to self.
 1.14.2.8 02-Feb-1994  mycroft Add another board ID for 1542CF.
 1.14.2.7 29-Nov-1993  mycroft Add some bzero()s before it bites me.
 1.14.2.6 28-Nov-1993  mycroft Remove some unused variables.
 1.14.2.5 28-Nov-1993  mycroft No significant changes.
 1.14.2.4 27-Nov-1993  mycroft Correct argment type to aha_adapter_info().
 1.14.2.3 24-Nov-1993  mycroft Final tweaks to get it all working.
 1.14.2.2 24-Nov-1993  mycroft Still under construction...
 1.14.2.1 24-Nov-1993  mycroft Under construction...
 1.31.2.2 28-Jul-1994  cgd from trunk.
 1.31.2.1 27-Jul-1994  cgd from trunk, per mycroft
 1.6 16-May-1996  mycroft New version, with changes from Justin Gibbs and Noriyuki Soda.
 1.5 12-May-1996  mycroft Use intr.h.
 1.4 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.3 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.2 13-Jan-1996  thorpej Oops. Fix RCS id.
 1.1 13-Jan-1996  thorpej Add the "ahe" driver, autoconfiguration support for the aic7xxx-based
Adaptec 2[78]4x SCSI controllers, from Michael Graff <explorer@flame.org>.
Fixes PR #1594 from Noriyuki Soda <soda@sra.co.jp> in a different way.
 1.30 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.29 22-Sep-2009  tsutsui branches: 1.29.22;
Make local functions static.
 1.28 21-Sep-2009  tsutsui Split device_t/softc. Tested on AHA-1542CF.
 1.27 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.26 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.25 28-Apr-2008  martin branches: 1.25.14;
Remove clause 3 and 4 from TNF licenses
 1.24 08-Apr-2008  cegger branches: 1.24.2; 1.24.4;
use aprint_*_dev and device_xname
 1.23 19-Oct-2007  ad branches: 1.23.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.22 16-Nov-2006  christos branches: 1.22.8; 1.22.22; 1.22.24; 1.22.28;
__unused removal on arguments; approved by core.
 1.21 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.20 11-Dec-2005  christos branches: 1.20.20; 1.20.22;
merge ktrace-lwp.
 1.19 04-Feb-2005  perry branches: 1.19.6;
de-__P
 1.18 14-Sep-2004  drochner branches: 1.18.4; 1.18.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.17 02-Oct-2002  thorpej branches: 1.17.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.16 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.13 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.12 13-Nov-2001  lukem add RCSID
 1.11 15-Aug-1998  mycroft branches: 1.11.24; 1.11.26;
Assign my copyrights to TNF.
 1.10 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.9 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.8 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.7 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.6 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.5 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.4 06-Jun-1997  thorpej branches: 1.4.2; 1.4.4;
Pull thorpej-bus-dma branch into mainline.
 1.3 28-Mar-1997  mycroft branches: 1.3.2;
Use a temporary data structure for holding probe information, rather than a
full softc.
 1.2 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 07-Feb-1997  mycroft branches: 1.1.4;
Move the aha ISA probe functions into a separate file.
 1.1.4.2 12-Mar-1997  is Merge in changes from The Trunk
 1.1.4.1 07-Feb-1997  is file aha_isa.c was added on branch is-newarp on 1997-03-12 16:10:42 +0000
 1.3.2.2 18-May-1997  thorpej Do the __BROKEN_INDIRECT_CONFIG dance.
 1.3.2.1 18-May-1997  thorpej Update for bus dma. (Forgot to commit this file... thanks for the
heads-up, Christos!)
 1.4.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.11.26.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.24.5 18-Oct-2002  nathanw Catch up to -current.
 1.11.24.4 28-Feb-2002  nathanw Catch up to -current.
 1.11.24.3 11-Jan-2002  nathanw More catchup.
 1.11.24.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.24.1 14-Nov-2001  nathanw Catch up to -current.
 1.17.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.17.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.18.6.1 12-Feb-2005  yamt sync with head.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.19.6.2 27-Oct-2007  yamt sync with head.
 1.19.6.1 30-Dec-2006  yamt sync with head.
 1.20.22.2 10-Dec-2006  yamt sync with head.
 1.20.22.1 22-Oct-2006  yamt sync with head
 1.20.20.1 18-Nov-2006  ad Sync with head.
 1.22.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.22.24.1 06-Nov-2007  matt sync with HEAD
 1.22.22.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.22.8.1 23-Oct-2007  ad Sync with head.
 1.23.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.24.4.3 11-Mar-2010  yamt sync with head
 1.24.4.2 16-May-2009  yamt sync with head
 1.24.4.1 16-May-2008  yamt sync with head.
 1.24.2.1 18-May-2008  yamt sync with head.
 1.25.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.22.1 03-Dec-2017  jdolecek update from HEAD
 1.5 07-Feb-1997  mycroft Move the aha ISA probe functions into a separate file.
 1.4 15-Jan-1997  mikel branches: 1.4.2;
add missing copyright and RCS ID; ok'd by mycroft
 1.3 29-Apr-1996  christos branches: 1.3.2;
- prototype fixes
 1.2 28-Mar-1996  mycroft Fix the mailbox unlock code for CF and CP.
 1.1 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.3.2.1 18-Jan-1997  thorpej Update from trunk.
 1.4.2.1 12-Mar-1997  is Merge in changes from The Trunk
 1.3 07-Feb-1997  mycroft Move the aha ISA probe functions into a separate file.
 1.2 21-Oct-1996  thorpej branches: 1.2.4;
New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.1 07-Sep-1996  mycroft Use bus.h.
 1.2.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.54 06-Oct-1997  christos From Enami Tsugutomo: Busify and split the aic6360 driver.
 1.53 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.52 10-Dec-1996  thorpej branches: 1.52.8; 1.52.10;
Fill in sc_link.max_target
 1.51 13-Oct-1996  christos backout kprintf changes
 1.50 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.49 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.48 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.47 18-Jun-1996  mycroft Remove some unneeded FIFO flushes and reorder some register changes per the
6360 manual. Turn off synchronous negotiation.
 1.46 12-May-1996  mycroft Use intr.h.
 1.45 29-Apr-1996  christos - prototype fixes
 1.44 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.43 03-Apr-1996  mycroft Minor optimization, and do a CLRCH after (re)selection just to be safe.
 1.42 03-Apr-1996  mycroft * Change message priorities so that ABORT comes after IDENTIFY.
* Add an ACB_RESET flag, so that a BUS DEVICE RESET can be queued within the
driver.
* If ACB_ABORT or ACB_RESET is set during reselection, schedule a message and
assert ATN.
* Optimize aic_datain_pio(), aic_dataout_pio() and aicintr() somewhat.
* Schedule a timeout only when we select the target, so that commands can't
time out prematurely.
 1.41 01-Apr-1996  mycroft Several things:
1) If we get an unexpected disconnect, issue a REQUEST SENSE, as recommended
by the SCSI-2 spec. If the target created a contingent allegiance condition,
this will clear it. Also, if it happened while sending a SDTR or WDTR message,
disable negotiation for that target.
2) Since some lame devices still don't deal correctly, make sure we deassert
ATN if our last message out is interrupted. If we get a MESSAGE PARITY ERROR,
we'll reassert ATN anyway. This should ensure that we never have to send a
MESSAGE NO OPERATION.
3) Set AIC_ABORTING only when actually sending a BUS DEVICE RESET or ABORT,
so we get better error detection.
4) Other internal reorganization of no consequence.
 1.40 30-Mar-1996  mycroft Use `{in.out}b(iobase + ...' rather than including the base address in
the register definitions.
 1.39 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.38 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.37 30-Nov-1995  jtc merge in changes from 1.1 release branch
 1.36 03-Oct-1995  mycroft branches: 1.36.2;
Modularize the CCB/MSCP/ACB/ECB handling a little. No functional changes.
 1.35 26-Sep-1995  thorpej Don't declare Debugger(). It's handled in <sys/systm.h>
 1.34 14-Sep-1995  pk Make *print() a message if no scsibus was attached. Also, return something
valid.
 1.33 12-Aug-1995  mycroft minphys() functions really should return void.
 1.32 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.31 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.30 02-Feb-1995  mycroft Comment a potential bit of lossage.
 1.29 01-Feb-1995  mycroft Various:
* Make synchronous negotiation work.
* Use the bitbucket when the target requests too much data.
* Loop in aicintr() until we get to a state where we have to wait.
 1.28 01-Feb-1995  mycroft Correct some more of the synchronous stuff, and omit it completely if
AIC_USE_SYNCHRONOUS is 0.
 1.27 01-Feb-1995  mycroft Various:
* Always enable disconnection.
* Add some more per-controller variables: initiator ID, clock frequency,
min and max sync period.
* Correct sync period calculations.
* Remove sc_progress.
* Move most of the reselection handling into a separate function.
* Remove some outdated comments.
* Remove message bytes from FIFO even when dropping them on the floor.
* Some cosmetic cleanup.
 1.26 13-Jan-1995  mycroft Simplify some sanity checks.
 1.25 07-Jan-1995  mycroft Don't print line numbers in most of the diagnostics.
 1.24 07-Jan-1995  mycroft Cosmetic changes, to look more like the new esp.c will.
 1.23 03-Jan-1995  mycroft Add interrupt sharing types.
 1.22 31-Dec-1994  mycroft Fix non-serious typo.
 1.21 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.20 30-Nov-1994  mycroft Don't stall the queue on CHECK SENSE if we get a reselect while selecting.
 1.19 29-Nov-1994  mycroft Fix a null pointer reference.
 1.18 29-Nov-1994  mycroft Add an assertion mechanism to check for more abnormal conditions.
 1.17 29-Nov-1994  mycroft For consistency...
 1.16 29-Nov-1994  mycroft Handle BUS FREE phase a little differently, to get better error detection. Other
cleanup.
 1.15 29-Nov-1994  mycroft Disable debugging breakpoints by default.
 1.14 29-Nov-1994  mycroft * Redo most of the message and phase state machines. Multiple pending
message outs should now work correctly (including retransmissions).
Multiple messages ins should be more efficient. Missing REQ after
reselection phase should now (correctly) cause a wait with ENREQINIT
set.

* Abstract out the reselection out sequence, and use it directly to
get sense info. (This is somewhat faster than the generic done/sched
sequence.)

* If there are no ACBs available, wait interruptibly for one.

* Leave the interrupt registers alone during message in/out; just
watch for phase change. Don't (incorrectly) reenable interrupts
during data in/out; defer that to aicintr().

* Handle command pointer per SCSI 2 spec.

* Other minor coding improvements.
 1.13 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.12 04-Nov-1994  mycroft No longer needs icu.h.
 1.11 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.10 03-Nov-1994  mycroft Update to match autoconfig code.
 1.9 27-Oct-1994  cgd new RCS ID format.
 1.8 17-Oct-1994  cgd change, requested by Jarle Greipsland
 1.7 08-Aug-1994  mycroft Minor update.
 1.6 07-Aug-1994  mycroft Avoid using DFIFOHF, which doesn't exist on 6260 chips. Turn off
AIC_USE_DWORDS by default.
 1.5 05-May-1994  cgd branches: 1.5.2;
lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.4 03-May-1994  mycroft Fix argument to aic_sched_msgout() is several places, and condense some code.
 1.3 29-Apr-1994  cgd change timeout/untimeout/wakeup/sleep/tsleep args to void *
 1.2 26-Apr-1994  mycroft Style nits.
 1.1 26-Apr-1994  mycroft Add Adaptec 6360 driver from Jarle Greipsland, with some changes by me.
 1.5.2.3 17-Oct-1994  cgd from trunk
 1.5.2.2 08-Aug-1994  mycroft update from trunk
 1.5.2.1 07-Aug-1994  mycroft update from trunk
 1.36.2.1 18-Oct-1995  pk Add missing parentheses (from Jarle Greipsland; PR#1603).
 1.52.10.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.10.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.8.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.26 23-Nov-2009  rmind Remove some unecessary includes sys/user.h header.
 1.25 22-Sep-2009  tsutsui Don't declare ISA specific aic_isa_attach() in MI header, and
also make local functions in aic_isa.c static.
 1.24 22-Sep-2009  tsutsui Split device_t/softc. Tested on AHA-1520B at ISA and ISAPnP.

XXX: ISA attachment shouldn't match cards in ISAPnP mode.
 1.23 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.22 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.21 08-Apr-2008  cegger branches: 1.21.4; 1.21.18;
use aprint_*_dev and device_xname
 1.20 19-Oct-2007  ad branches: 1.20.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 16-Nov-2006  christos branches: 1.19.8; 1.19.22; 1.19.24; 1.19.28;
__unused removal on arguments; approved by core.
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 17-Aug-2006  christos branches: 1.17.2; 1.17.4;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
 1.16 11-Dec-2005  christos branches: 1.16.4; 1.16.8;
merge ktrace-lwp.
 1.15 04-Feb-2005  perry branches: 1.15.6;
de-__P
 1.14 14-Sep-2004  drochner branches: 1.14.4; 1.14.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.13 02-Oct-2002  thorpej branches: 1.13.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.12 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.9 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.8 13-Nov-2001  lukem add RCSID
 1.7 09-Jun-1998  thorpej branches: 1.7.26; 1.7.28;
Nuke __BROKEN_INDIRECT_CONFIG.
 1.6 13-Jan-1998  enami Don't include <machine/pio.h>. Include <machine/bus.h> explicitly.
 1.5 30-Nov-1997  drochner make it compile without "__BROKEN_INDIRECT_CONFIG"
 1.4 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.3 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.2 16-Oct-1997  enami Create new structure aic_isa_softc and hold interrupt handler in it.
 1.1 06-Oct-1997  christos branches: 1.1.2;
From Enami Tsugutomo: Busify and split the aic6360 driver.
 1.1.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 06-Oct-1997  thorpej file aic_isa.c was added on branch marc-pcmcia on 1997-10-14 10:23:15 +0000
 1.7.28.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.26.5 18-Oct-2002  nathanw Catch up to -current.
 1.7.26.4 28-Feb-2002  nathanw Catch up to -current.
 1.7.26.3 11-Jan-2002  nathanw More catchup.
 1.7.26.2 08-Jan-2002  nathanw Catch up to -current.
 1.7.26.1 14-Nov-2001  nathanw Catch up to -current.
 1.13.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.13.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.14.6.1 12-Feb-2005  yamt sync with head.
 1.14.4.1 29-Apr-2005  kent sync with -current
 1.15.6.2 27-Oct-2007  yamt sync with head.
 1.15.6.1 30-Dec-2006  yamt sync with head.
 1.16.8.1 03-Sep-2006  yamt sync with head.
 1.16.4.1 09-Sep-2006  rpaulo sync with head
 1.17.4.2 10-Dec-2006  yamt sync with head.
 1.17.4.1 22-Oct-2006  yamt sync with head
 1.17.2.1 18-Nov-2006  ad Sync with head.
 1.19.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.19.24.1 06-Nov-2007  matt sync with HEAD
 1.19.22.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.19.8.1 23-Oct-2007  ad Sync with head.
 1.20.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.21.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.4.2 11-Mar-2010  yamt sync with head
 1.21.4.1 16-May-2009  yamt sync with head
 1.20 17-Feb-2025  andvar s/bye/byte/ in comments.
 1.19 09-Feb-2024  andvar branches: 1.19.2;
fix spelling mistakes, mainly in comments and log messages.
 1.18 29-Jun-2022  mlelstv unregister sensors only when registered.
 1.17 23-Apr-2015  pgoyette Update module dependencies for all the existing modules that depend on sysmon components.
 1.16 16-Nov-2014  ozaki-r branches: 1.16.2;
Replace callout_stop with callout_halt

In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.

Discussed with martin@ and riastradh@.
 1.15 14-Aug-2012  jruoho branches: 1.15.2; 1.15.14;
Collect rnd(9) entropy from coretemp(4), acpibat(4), aibs(4), hpacel(4),
thinkpad(4), and aps(4).
 1.14 16-Feb-2011  jruoho branches: 1.14.4; 1.14.10;
As suggested by Sverre Froyen in a follow-up to PR # 41698, change the
sensor names to real words (e.g. "temperature 1" instead of "TEMP_1").
No functional change; only consistent envstat(8) output with other sensors.
 1.13 18-Jan-2011  jmcneill branches: 1.13.2;
treat temperature readings of 0xff as invalid, as I'm somewhat confident
that my Thinkpad isn't idling at 255 degC.
 1.12 16-Jan-2011  jmcneill branches: 1.12.2;
save a line of dmesg
 1.11 16-Jan-2011  jmcneill - catch up with OpenBSD driver, adding support for newer Thinkpad models
- add module hooks
 1.10 24-Feb-2010  dyoung branches: 1.10.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.9 08-Jan-2010  dyoung branches: 1.9.2;
Expand PMF_FN_* macros.
 1.8 04-Apr-2008  xtraeme branches: 1.8.4;
Don't forget to unmap I/O space in the error paths.
Split device_t/softc and other related cosmetic changes.
 1.7 29-Feb-2008  dyoung Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.6 21-Dec-2007  xtraeme branches: 1.6.2; 1.6.6;
Do not append the device name into the sensor's description, that's
useless and redundant.
 1.5 09-Dec-2007  jmcneill branches: 1.5.2;
Merge jmcneill-pm branch.
 1.4 17-Nov-2007  kefren branches: 1.4.2; 1.4.4;
Initialize sensor's state
on behalf of xtraeme
 1.3 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.2 19-Oct-2007  ad branches: 1.2.2; 1.2.4; 1.2.6;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.1 11-Sep-2007  xtraeme branches: 1.1.4; 1.1.6; 1.1.8;
New aps(4) driver for IBM Thinkpad Active Protection System.
Exports some sensors through the envsys(4) framework available
in some Thinkpad laptops.

Ported by Pierre Pronchery from OpenBSD, via PR port-i386/36852.

Tweaks, LKM and misc improvements by me. Added into i386/GENERIC
commented out.
 1.1.8.2 18-Nov-2007  bouyer Sync with HEAD
 1.1.8.1 25-Oct-2007  bouyer Sync with HEAD.
 1.1.6.3 23-Oct-2007  ad Sync with head.
 1.1.6.2 09-Oct-2007  ad Sync with head.
 1.1.6.1 11-Sep-2007  ad file aps.c was added on branch vmlocking on 2007-10-09 13:41:36 +0000
 1.1.4.7 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.1.4.6 21-Nov-2007  joerg Sync with HEAD.
 1.1.4.5 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.1.4.4 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.1.4.3 05-Oct-2007  joerg Convert aps(4) to PNP power management.
 1.1.4.2 02-Oct-2007  joerg Sync with HEAD.
 1.1.4.1 11-Sep-2007  joerg file aps.c was added on branch jmcneill-pm on 2007-10-02 18:28:28 +0000
 1.2.6.4 23-Mar-2008  matt sync with HEAD
 1.2.6.3 09-Jan-2008  matt sync with HEAD
 1.2.6.2 06-Nov-2007  matt sync with HEAD
 1.2.6.1 19-Oct-2007  matt file aps.c was added on branch matt-armv6 on 2007-11-06 23:27:28 +0000
 1.2.4.2 27-Dec-2007  mjf Sync with HEAD.
 1.2.4.1 19-Nov-2007  mjf Sync with HEAD.
 1.2.2.5 17-Mar-2008  yamt sync with head.
 1.2.2.4 21-Jan-2008  yamt sync with head
 1.2.2.3 07-Dec-2007  yamt sync with head
 1.2.2.2 27-Oct-2007  yamt sync with head.
 1.2.2.1 19-Oct-2007  yamt file aps.c was added on branch yamt-lazymbuf on 2007-10-27 11:31:22 +0000
 1.4.4.1 11-Dec-2007  yamt sync with head.
 1.4.2.1 26-Dec-2007  ad Sync with head.
 1.5.2.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.6.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.2.1 24-Mar-2008  keiichi sync with head.
 1.8.4.1 11-Mar-2010  yamt sync with head
 1.9.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.10.2.1 05-Mar-2011  rmind sync with head
 1.12.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.14.10.1 07-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #1201):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111-1.112 (patch)
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23 (patch)
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28 (patch)

Replace callout_stop with callout_halt and ensure the callout
is not running before destroying it.
 1.14.4.1 30-Oct-2012  yamt sync with head
 1.15.14.1 01-Dec-2014  martin Pull up following revision(s) (requested by ozaki-r in ticket #279):
sys/kern/kern_ktrace.c: revision 1.166
sys/dev/isa/aps.c: revision 1.16
sys/dev/sysmon/sysmonvar.h: revision 1.45
sys/dev/ir/irframe_tty.c: revision 1.60
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.111
sys/dev/sysmon/sysmon_envsys_events.c: revision 1.112
sys/dev/pci/pccbb.c: revision 1.207
sys/dev/wscons/wskbd.c: revision 1.135
sys/dev/usb/ohci.c: revision 1.254
sys/net/if_ecosubr.c: revision 1.41
sys/dev/pcmcia/btbc.c: revision 1.17
sys/arch/x86/x86/via_padlock.c: revision 1.23
sys/dev/sdmmc/sdmmc.c: revision 1.23
sys/dev/bluetooth/btkbd.c: revision 1.17
sys/dev/bluetooth/bcsp.c: revision 1.25
sys/arch/x86/pci/fwhrng.c: revision 1.8
sys/dev/ic/nslm7x.c: revision 1.61
share/man/man9/callout.9: revision 1.28
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
Discussed with martin@ and riastradh@.
Make it clear that we should use not callout_stop but callout_halt
before callout_destroy
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete.
Reviewed by riastradh@.
Kill sme_callout_mtx and use sme_mtx instead
We can use sme_mtx for the callout as well. Actually we should do so
because sme_events_list and some other data that are touched in the
callout should be protected by sme_mtx, not sme_callout_mtx.
Discussed with riastradh@ in
http://mail-index.netbsd.org/tech-kern/2014/11/11/msg017956.html
Replace callout_stop with callout_halt
In order to call callout_destroy for a callout safely, we have to ensure
the function of the callout is not running and pending. To do so, we should
use callout_halt, not callout_stop.
In this case, we need to pass an interlock to callout_halt to wait for
the callout complete. And also we make sure that SME_CALLOUT_INITIALIZED
is unset before calling callout_halt to prevent the callout from calling
callout_schedule. This is the same as what we did in sys/netinet6/mld6.c@1.61.
Reviewed by riastradh@.
 1.15.2.1 03-Dec-2017  jdolecek update from HEAD
 1.16.2.1 06-Jun-2015  skrll Sync with HEAD
 1.19.2.1 02-Aug-2025  perseant Sync with HEAD
 1.41 08-Jun-2019  isaki Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.40 08-May-2019  isaki 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.39 16-Mar-2019  isaki branches: 1.39.2;
Use C99 style struct initializer to audio_hw_if.
 1.38 16-Mar-2019  isaki Swap wrong ordered halt_input and halt_output (since rev1.1).
But I guess that it didn't lead a big impact. Because hw_if->close
is called immediately after that in most cases.
 1.37 27-Oct-2012  chs branches: 1.37.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.36 24-Nov-2011  jakllsch branches: 1.36.8;
Make this compile without warnings.
(No static is better than inconsistent and partial use of static.)
 1.35 24-Nov-2011  mrg put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.34 23-Nov-2011  jmcneill 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.33 27-Jul-2010  jakllsch branches: 1.33.8; 1.33.10;
Allow aria(4) to compile with AUDIO_DEBUG on LP64.
 1.32 27-Oct-2009  elric branches: 1.32.2; 1.32.4;
Assign copyright to TNF on these old files.
 1.31 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.30 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.29 08-Apr-2008  cegger branches: 1.29.4; 1.29.16; 1.29.18;
use aprint_*_dev and device_xname
 1.28 19-Oct-2007  ad branches: 1.28.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.27 16-Nov-2006  christos branches: 1.27.6; 1.27.8; 1.27.22; 1.27.24; 1.27.28;
__unused removal on arguments; approved by core.
 1.26 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.25 27-Aug-2006  christos branches: 1.25.2; 1.25.4;
Fix incomplete declaration.
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.8;
merge ktrace-lwp.
 1.23 12-Jan-2005  kent branches: 1.23.10;
- make this compile
- style fixes
 1.22 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.21 29-Oct-2004  yamt branches: 1.21.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.20 09-Jul-2004  mycroft Clean up a little.
 1.19 22-Apr-2004  itojun sprintf -> snprintf
 1.18 03-May-2003  wiz branches: 1.18.2;
DMA, not dma nor Dma.
 1.17 06-Apr-2003  wiz Respect the law: Use A-law and mu-law as spellings as far as easily possible.
Inspired by Igor Sobrado in PR 19680.
 1.16 10-Dec-2002  thorpej Don't include <i386/isa/icu.h>
 1.15 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.11 13-Nov-2001  lukem add RCSID
 1.10 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.9 26-Sep-2001  thorpej "aria" does not needs-flag
 1.8 28-Jun-2000  mrg branches: 1.8.2; 1.8.4; 1.8.6;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 01-Nov-1999  augustss Make little endian and big endian version of all functions
that deal with 16 bit samples. Let the drivers decide which ones
to use.
 1.6 17-Aug-1998  augustss branches: 1.6.12; 1.6.14; 1.6.16;
* 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.5 21-Jul-1998  mycroft Add RCS IDs.
 1.4 17-Jun-1998  augustss Remove a bunch of totally unnecessary #include <machine/pio.h>
left over from the olden days.
 1.3 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.2 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.1 06-Jun-1998  augustss Add an Aria sound driver.
From "R. C. Dowdeswell" <elric@imrryr.org>.
 1.6.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.14.1 15-Nov-1999  fvdl Sync with -current
 1.6.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.6.2 11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.8.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.8.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.8.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.2.6 11-Dec-2002  thorpej Sync with HEAD.
 1.8.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.8.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.3 11-Jan-2002  nathanw More catchup.
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.18.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.18.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.21.2.2 09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.21.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.23.10.2 27-Oct-2007  yamt sync with head.
 1.23.10.1 30-Dec-2006  yamt sync with head.
 1.24.8.1 03-Sep-2006  yamt sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.4.2 10-Dec-2006  yamt sync with head.
 1.25.4.1 22-Oct-2006  yamt sync with head
 1.25.2.1 18-Nov-2006  ad Sync with head.
 1.27.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.27.24.1 06-Nov-2007  matt sync with HEAD
 1.27.22.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.27.8.1 23-Oct-2007  ad Sync with head.
 1.27.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.28.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.16.2 12-Dec-2008  ad Checkpoint work in progress.
 1.29.16.1 11-Dec-2008  ad Checkpoint work in progress.
 1.29.4.3 11-Aug-2010  yamt sync with head.
 1.29.4.2 11-Mar-2010  yamt sync with head
 1.29.4.1 16-May-2009  yamt sync with head
 1.32.4.1 05-Mar-2011  rmind sync with head
 1.32.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.33.10.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.33.10.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.33.8.2 30-Oct-2012  yamt sync with head
 1.33.8.1 17-Apr-2012  yamt sync with head
 1.36.8.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.37.38.1 10-Jun-2019  christos Sync with HEAD
 1.39.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.39.2.1 21-Apr-2019  isaki Adapt to audio2.
- Drop FULLDUPLEX property. The driver doesn't seem to be written
as full duplex.
 1.6 27-Oct-2009  elric Assign copyright to TNF on these old files.
 1.5 11-Dec-2005  christos branches: 1.5.74;
merge ktrace-lwp.
 1.4 13-Jan-2005  kent ansify and KNF
 1.3 24-Feb-2004  wiz Spell interrupt with two rs. From Peter Postma.
 1.2 21-Jul-1998  mycroft branches: 1.2.48;
Add RCS IDs.
 1.1 06-Jun-1998  augustss Add an Aria sound driver.
From "R. C. Dowdeswell" <elric@imrryr.org>.
 1.2.48.4 17-Jan-2005  skrll Sync with HEAD.
 1.2.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.48.1 03-Aug-2004  skrll Sync with HEAD
 1.5.74.1 11-Mar-2010  yamt sync with head
 1.68 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.67 24-Apr-2021  thorpej branches: 1.67.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.66 11-Jul-2016  msaitoh branches: 1.66.34;
KNF. No functional change.
 1.65 27-Oct-2012  chs branches: 1.65.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.64 12-May-2009  cegger branches: 1.64.12; 1.64.22;
struct device * -> device_t, no functional changes intended.
 1.63 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.62 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.61 30-May-2008  martin branches: 1.61.6; 1.61.12;
Pass the com softc to comintr, not the device_t.
Fixes PR kern/38776.
 1.60 08-Apr-2008  cegger branches: 1.60.2; 1.60.4; 1.60.6;
use aprint_*_dev and device_xname
 1.59 19-Oct-2007  ad branches: 1.59.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.58 16-Nov-2006  christos branches: 1.58.8; 1.58.22; 1.58.24; 1.58.28;
__unused removal on arguments; approved by core.
 1.57 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.56 11-Dec-2005  christos branches: 1.56.20; 1.56.22;
merge ktrace-lwp.
 1.55 04-Feb-2005  perry branches: 1.55.6;
de-__P
 1.54 14-Sep-2004  drochner branches: 1.54.4; 1.54.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.53 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.52 01-Jan-2003  thorpej branches: 1.52.2;
Use aprint_normal() in cfprint routines.
 1.51 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.50 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.49 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.48 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.47 13-Nov-2001  lukem add RCSID
 1.46 20-May-2000  thorpej branches: 1.46.6; 1.46.8;
Rather than using a magic constant, use `com_scratch' as the offset
in UART space to the interrupt CSR.
 1.45 18-Sep-1998  enami branches: 1.45.12;
Make these files compile again; no longer necessary to pass
iobase to comprobe1.
 1.44 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.43 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.42 12-Jan-1998  thorpej Update for config changes.
 1.41 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.40 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.39 16-Oct-1997  thorpej Adjust for the new "com" driver home.
 1.38 03-Oct-1997  cjs Make this compile on alpha and, presumably, other non
_BROKEN_INDIRECT_CONFIG machines.
 1.37 12-Sep-1997  drochner Make console on multiport cards more likely to work (obvious bug,
fix still untested).
Closes PR kern/4095 by enami tsugutomo.
 1.36 23-Aug-1997  drochner Use the new com_is_console() to decide if the port is already initialized.
XXX shouldn't the attach() use the existing handle if present???
 1.35 16-Aug-1997  drochner Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
 1.34 13-Aug-1997  jtk fix multi-port serial drivers to reflect recent changes to com driver for console/kgdb
 1.33 09-Apr-1997  mycroft branches: 1.33.4;
Update for new com driver.
 1.32 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.31 13-Oct-1996  christos backout kprintf changes
 1.30 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.29 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.28 12-May-1996  mycroft Use intr.h.
 1.27 05-May-1996  christos Make those compile again; they were missing a declaration for bc.
Also fix prototypes.
 1.26 15-Apr-1996  cgd include <sys/termios.h> to make comvar.h happy
 1.25 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.24 04-Apr-1996  cgd remove tricky open-coded variants of config_found(), by using the
child device pointer now returned by config_found(). (previously,
the code played games to get that pointer; now they are unnecesary.)
 1.23 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.22 10-Mar-1996  cgd convert these to use new <machine/bus.h> interfaces. This involved
substantial reworking of the multi-port drivers, as they need to frob
bits in the io-port spaces of their children. As a result, the
commulti->com attachment interface is substantially more complex.
(This may be fixable in the future by making some of the code common,
but as long as io-port allocation checking is planned, it's necessary.)
 1.21 09-Mar-1996  cgd Include comvar.h, for comprobe1() prototype and for commulti_attach_args.
Remove multiple identical definitions for the arg struct used by multiport
boards' to attach slave com ports.
 1.20 09-Mar-1996  cgd minor cleanup. mostly: use COM_NPORTS and a new (driver-specific) NSLAVES
macro where appropriate. No point in hard-coding numbers in multiple places.
At the very least, this makes the drivers slightly easier to diff/understand.
 1.19 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.18 26-Jun-1995  cgd if subdevices specified with wildcarded unit number, config_attach()
can change the cf_unit, so save it before attach and use saved value.
 1.17 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.16 04-Jan-1995  mycroft Fix oversight in previous.
 1.15 03-Jan-1995  mycroft \
These files have been 99% rewritten from the original ast driver. Add an
appropriate copyright notice.
 1.14 03-Jan-1995  mycroft Add interrupt sharing types.
 1.13 02-Jan-1995  mycroft Use direct config for subdevices.
 1.12 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.11 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.10 07-Nov-1994  mycroft Update for new autoconfig.
 1.9 27-Oct-1994  cgd new RCS ID format.
 1.8 14-Aug-1994  mycroft Slight optimization, and don't go bonkers if one of the sub-devices is not
configured.
 1.7 07-Apr-1994  mycroft branches: 1.7.2;
Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.6 29-Mar-1994  mycroft astprobe(): Set ia_iosize.
 1.5 29-Mar-1994  mycroft Updates for new autoconfig.
 1.4 23-Mar-1994  cgd copyright foo
 1.3 23-Mar-1994  mycroft Don't poll more than 4 ports.
 1.2 23-Mar-1994  mycroft Some stylistic cleanup, and a very minor speedup.
 1.1 23-Mar-1994  cgd add AST-style serial multiport support, from Roland McGrath
<roland@frob.com>. Needs light clean by Mr. I386, but mostly
OK.
 1.7.2.1 14-Aug-1994  mycroft update from trunk
 1.33.4.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.33.4.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.46.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.46.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.46.6.5 03-Jan-2003  thorpej Sync with HEAD.
 1.46.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.46.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.46.6.2 11-Jan-2002  nathanw More catchup.
 1.46.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.52.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.52.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.52.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.54.6.1 12-Feb-2005  yamt sync with head.
 1.54.4.1 29-Apr-2005  kent sync with -current
 1.55.6.2 27-Oct-2007  yamt sync with head.
 1.55.6.1 30-Dec-2006  yamt sync with head.
 1.56.22.2 10-Dec-2006  yamt sync with head.
 1.56.22.1 22-Oct-2006  yamt sync with head
 1.56.20.1 18-Nov-2006  ad Sync with head.
 1.58.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.58.24.1 06-Nov-2007  matt sync with HEAD
 1.58.22.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.58.8.1 23-Oct-2007  ad Sync with head.
 1.59.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.60.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.60.4.2 16-May-2009  yamt sync with head
 1.60.4.1 04-May-2009  yamt sync with head.
 1.60.2.1 04-Jun-2008  yamt sync with head
 1.61.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.61.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.64.22.2 03-Dec-2017  jdolecek update from HEAD
 1.64.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.64.12.1 30-Oct-2012  yamt sync with head
 1.65.14.1 05-Oct-2016  skrll Sync with HEAD
 1.66.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.67.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.17 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.16 03-Dec-2021  andvar fix various typos in comments, log messages and documentation.
 1.15 26-May-2011  jakllsch Convert ltsleep() in atppc(4) to modern interfaces.

Reviewed by rmind@.
 1.14 16-Apr-2008  cegger branches: 1.14.26; 1.14.32;
device_t / softc split. From Hans Rosenfeld.
 1.13 15-Apr-2008  cegger device_t / softc split. From Hans Rosenfeld
 1.12 08-Apr-2008  cegger use aprint_*_dev and device_xname
 1.11 19-Oct-2007  ad branches: 1.11.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.10 04-Mar-2007  christos branches: 1.10.2; 1.10.14; 1.10.16; 1.10.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 29-Mar-2006  thorpej branches: 1.9.14;
Use device_cfdata().
 1.8 11-Dec-2005  christos branches: 1.8.4; 1.8.6; 1.8.8; 1.8.10; 1.8.12;
merge ktrace-lwp.
 1.7 04-Feb-2005  perry branches: 1.7.6;
de-__P
 1.6 14-Sep-2004  drochner branches: 1.6.4; 1.6.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.5 28-Jan-2004  drochner branches: 1.5.4;
-unmap port range after probe, so that the attach function has
a chance to map it again
-minor cleanup
 1.4 25-Jan-2004  jdolecek reorganize the ISA DMA setup/use code so that it could be shared
with ACPI and PNPBIOS attachments; move it to new atppc_isadma.[ch]
and g/c previous atppc_isa_subr.[ch]

move attppc_isa_softc struct definition to atppc_isa.c, and reorganize
the attachment somewhat for better readability; also g/c detach support code
 1.3 25-Jan-2004  bjh21 Remove dollar signs from foreign RCSIDs per doc/3RDPARTY.
Add __KERNEL_RCSID() to .c files.
 1.2 21-Jan-2004  bjh21 Add RCSID comments.
 1.1 19-Jan-2004  jdolecek branches: 1.1.1;
Initial revision
 1.1.1.1 19-Jan-2004  jdolecek Import Gary Thorpe's netbsd-ppbus 1.3. This is NetBSD port
of FreeBSD Parallel Port Bus framework. Work in progress.
 1.5.4.5 04-Feb-2005  skrll Sync with HEAD.
 1.5.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.5.4.2 03-Aug-2004  skrll Sync with HEAD
 1.5.4.1 28-Jan-2004  skrll file atppc_isa.c was added on branch ktrace-lwp on 2004-08-03 10:47:57 +0000
 1.6.6.1 12-Feb-2005  yamt sync with head.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.7.6.3 27-Oct-2007  yamt sync with head.
 1.7.6.2 03-Sep-2007  yamt sync with head.
 1.7.6.1 21-Jun-2006  yamt sync with head.
 1.8.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.8.10.1 19-Apr-2006  elad sync with head.
 1.8.8.1 01-Apr-2006  yamt sync with head.
 1.8.6.1 22-Apr-2006  simonb Sync with head.
 1.8.4.1 09-Sep-2006  rpaulo sync with head
 1.9.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.16.1 06-Nov-2007  matt sync with HEAD
 1.10.14.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.10.2.1 23-Oct-2007  ad Sync with head.
 1.11.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.32.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.26.1 31-May-2011  rmind sync with head
 1.4 25-Jan-2004  jdolecek reorganize the ISA DMA setup/use code so that it could be shared
with ACPI and PNPBIOS attachments; move it to new atppc_isadma.[ch]
and g/c previous atppc_isa_subr.[ch]

move attppc_isa_softc struct definition to atppc_isa.c, and reorganize
the attachment somewhat for better readability; also g/c detach support code
 1.3 25-Jan-2004  bjh21 Remove dollar signs from foreign RCSIDs per doc/3RDPARTY.
Add __KERNEL_RCSID() to .c files.
 1.2 21-Jan-2004  bjh21 Add RCSID comments.
 1.1 19-Jan-2004  jdolecek branches: 1.1.1;
Initial revision
 1.1.1.1 19-Jan-2004  jdolecek Import Gary Thorpe's netbsd-ppbus 1.3. This is NetBSD port
of FreeBSD Parallel Port Bus framework. Work in progress.
 1.4 25-Jan-2004  jdolecek reorganize the ISA DMA setup/use code so that it could be shared
with ACPI and PNPBIOS attachments; move it to new atppc_isadma.[ch]
and g/c previous atppc_isa_subr.[ch]

move attppc_isa_softc struct definition to atppc_isa.c, and reorganize
the attachment somewhat for better readability; also g/c detach support code
 1.3 25-Jan-2004  bjh21 Remove dollar signs from foreign RCSIDs per doc/3RDPARTY.
Add __KERNEL_RCSID() to .c files.
 1.2 21-Jan-2004  bjh21 Add RCSID comments.
 1.1 19-Jan-2004  jdolecek branches: 1.1.1;
Initial revision
 1.1.1.1 19-Jan-2004  jdolecek Import Gary Thorpe's netbsd-ppbus 1.3. This is NetBSD port
of FreeBSD Parallel Port Bus framework. Work in progress.
 1.8 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.7 15-Apr-2008  cegger device_t / softc split. From Hans Rosenfeld
 1.6 08-Apr-2008  cegger use aprint_*_dev and device_xname
 1.5 19-Oct-2007  ad branches: 1.5.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.4 04-Mar-2007  christos branches: 1.4.2; 1.4.14; 1.4.16; 1.4.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.3 11-Dec-2005  christos branches: 1.3.26;
merge ktrace-lwp.
 1.2 27-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 25-Jan-2004  jdolecek branches: 1.1.4; 1.1.10; 1.1.12;
reorganize the ISA DMA setup/use code so that it could be shared
with ACPI and PNPBIOS attachments; move it to new atppc_isadma.[ch]
and g/c previous atppc_isa_subr.[ch]

move attppc_isa_softc struct definition to atppc_isa.c, and reorganize
the attachment somewhat for better readability; also g/c detach support code
 1.1.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.10.1 29-Apr-2005  kent sync with -current
 1.1.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.4.2 03-Aug-2004  skrll Sync with HEAD
 1.1.4.1 25-Jan-2004  skrll file atppc_isadma.c was added on branch ktrace-lwp on 2004-08-03 10:47:57 +0000
 1.2.4.2 27-Oct-2007  yamt sync with head.
 1.2.4.1 03-Sep-2007  yamt sync with head.
 1.3.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.4.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.16.1 06-Nov-2007  matt sync with HEAD
 1.4.14.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.4.2.1 23-Oct-2007  ad Sync with head.
 1.5.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 27-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 28-Jan-2004  jdolecek branches: 1.2.4; 1.2.10; 1.2.12;
copyright notice as in netbsd-ppbus 1.4 (this files is based
on atppc_isa_subr.h which has this copyright notice in v1.4)
 1.1 25-Jan-2004  jdolecek reorganize the ISA DMA setup/use code so that it could be shared
with ACPI and PNPBIOS attachments; move it to new atppc_isadma.[ch]
and g/c previous atppc_isa_subr.[ch]

move attppc_isa_softc struct definition to atppc_isa.c, and reorganize
the attachment somewhat for better readability; also g/c detach support code
 1.2.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.10.1 29-Apr-2005  kent sync with -current
 1.2.4.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.4.3 18-Sep-2004  skrll Sync with HEAD.
 1.2.4.2 03-Aug-2004  skrll Sync with HEAD
 1.2.4.1 28-Jan-2004  skrll file atppc_isadma.h was added on branch ktrace-lwp on 2004-08-03 10:47:57 +0000
 1.3.4.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.13 23-Aug-2009  jmcneill Not much sense in printing 'AT Timer' when the 'attimer' driver attaches.
 1.12 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.11 29-Apr-2008  martin branches: 1.11.14;
Convert to new 2 clause license
 1.10 04-Mar-2008  cube branches: 1.10.2; 1.10.4;
- Split device_t and softc for pcppi(4) and attimer(4)
- Change the attimer <-> pcppi communication using device_t so that
pcppi(4) doesn't have to know about the contents of struct attimer_softc.

XXX pcppi's childdet function is completely wrong. This has to be
XXX revisited later.
 1.9 03-Jan-2008  dyoung branches: 1.9.2; 1.9.6;
Detach attimer at acpi, attimer at isa.
 1.8 31-Dec-2007  dyoung Use device_t, device_private(), aprint_error_dev().
 1.7 19-Oct-2007  ad branches: 1.7.2; 1.7.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.6 10-Sep-2007  cube branches: 1.6.4;
Remove 3rd clause and my name from all the licences which were only in my
name.
 1.5 10-Dec-2006  uwe branches: 1.5.6; 1.5.18; 1.5.20;
Add missing aprint_naive to the attach routine.
 1.4 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.3 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.2 11-Dec-2005  christos branches: 1.2.20; 1.2.22;
merge ktrace-lwp.
 1.1 25-Mar-2005  cube branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Add attimer(4) driver, with ISA and ACPI attachments.

attimer(4) is the new body of the part of pcppi(4) that mapped the TIMER1
register to set the pitch of the bell. It was necessary to separate them
in order to have a working ACPI attachment (as the two appear as different
devices in the ACPI structures).
 1.1.8.4 17-Mar-2008  yamt sync with head.
 1.1.8.3 21-Jan-2008  yamt sync with head
 1.1.8.2 27-Oct-2007  yamt sync with head.
 1.1.8.1 30-Dec-2006  yamt sync with head.
 1.1.6.2 29-Apr-2005  kent sync with -current
 1.1.6.1 25-Mar-2005  kent file attimer_isa.c was added on branch kent-audio2 on 2005-04-29 11:28:54 +0000
 1.1.4.2 01-Apr-2005  skrll Sync with HEAD.
 1.1.4.1 25-Mar-2005  skrll file attimer_isa.c was added on branch ktrace-lwp on 2005-04-01 14:29:52 +0000
 1.1.2.2 26-Mar-2005  yamt sync with head.
 1.1.2.1 25-Mar-2005  yamt file attimer_isa.c was added on branch yamt-km on 2005-03-26 18:19:19 +0000
 1.2.22.2 10-Dec-2006  yamt sync with head.
 1.2.22.1 22-Oct-2006  yamt sync with head
 1.2.20.2 12-Jan-2007  ad Sync with head.
 1.2.20.1 18-Nov-2006  ad Sync with head.
 1.5.20.3 23-Mar-2008  matt sync with HEAD
 1.5.20.2 09-Jan-2008  matt sync with HEAD
 1.5.20.1 06-Nov-2007  matt sync with HEAD
 1.5.18.2 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.5.18.1 02-Oct-2007  joerg Sync with HEAD.
 1.5.6.2 23-Oct-2007  ad Sync with head.
 1.5.6.1 09-Oct-2007  ad Sync with head.
 1.6.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.7.8.2 08-Jan-2008  bouyer Sync with HEAD
 1.7.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.7.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.9.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.9.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.9.2.1 24-Mar-2008  keiichi sync with head.
 1.10.4.3 16-Sep-2009  yamt sync with head
 1.10.4.2 16-May-2009  yamt sync with head
 1.10.4.1 16-May-2008  yamt sync with head.
 1.10.2.1 18-May-2008  yamt sync with head.
 1.11.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.16 12-May-2009  cegger branches: 1.16.12; 1.16.22;
struct device * -> device_t, no functional changes intended.
 1.15 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.14 08-Apr-2008  cegger branches: 1.14.4; 1.14.18;
use aprint_*_dev and device_xname
 1.13 19-Oct-2007  ad branches: 1.13.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.12 16-Nov-2006  christos branches: 1.12.8; 1.12.22; 1.12.24; 1.12.28;
__unused removal on arguments; approved by core.
 1.11 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.22;
merge ktrace-lwp.
 1.9 29-Oct-2004  yamt branches: 1.9.12;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.8 14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.7 02-Oct-2002  thorpej branches: 1.7.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.6 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 07-Jan-2002  thorpej branches: 1.4.2; 1.4.4;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 03-Jan-2002  augustss Add \n in attach messages.
 1.2 02-Jan-2002  augustss Change the probe code. You cannot unmap bus space and then use it.
 1.1 01-Jan-2002  augustss Add support for radio cards. Written by Maxim Tsyplakov and Vladimir Popov
for OpenBSD, from where it was imported.
 1.4.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.1 07-Jan-2002  thorpej file aztech.c was added on branch kqueue on 2002-01-10 19:55:18 +0000
 1.4.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.3 11-Jan-2002  nathanw More catchup.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 07-Jan-2002  nathanw file aztech.c was added on branch nathanw_sa on 2002-01-08 00:30:21 +0000
 1.7.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.12.2 27-Oct-2007  yamt sync with head.
 1.9.12.1 30-Dec-2006  yamt sync with head.
 1.10.22.2 10-Dec-2006  yamt sync with head.
 1.10.22.1 22-Oct-2006  yamt sync with head
 1.10.20.1 18-Nov-2006  ad Sync with head.
 1.12.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.12.24.1 06-Nov-2007  matt sync with HEAD
 1.12.22.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.12.8.1 23-Oct-2007  ad Sync with head.
 1.13.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.4.1 16-May-2009  yamt sync with head
 1.16.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.16.12.1 30-Oct-2012  yamt sync with head
 1.37 14-Jul-2016  msaitoh KNF. No functional change.
 1.36 18-Oct-2014  snj branches: 1.36.2;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.35 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.34 12-May-2009  cegger branches: 1.34.12; 1.34.22;
struct device * -> device_t, no functional changes intended.
 1.33 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.32 28-Apr-2008  martin branches: 1.32.14;
Remove clause 3 and 4 from TNF licenses
 1.31 08-Apr-2008  cegger branches: 1.31.2; 1.31.4;
use aprint_*_dev and device_xname
 1.30 19-Oct-2007  ad branches: 1.30.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.29 16-Nov-2006  christos branches: 1.29.8; 1.29.22; 1.29.24; 1.29.28;
__unused removal on arguments; approved by core.
 1.28 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.27 11-Dec-2005  christos branches: 1.27.20; 1.27.22;
merge ktrace-lwp.
 1.26 04-Feb-2005  perry branches: 1.26.6;
de-__P
 1.25 14-Sep-2004  drochner branches: 1.25.4; 1.25.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.24 02-Oct-2002  thorpej branches: 1.24.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.23 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.22 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.21 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.20 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.19 13-Nov-2001  lukem add RCSID
 1.18 03-May-2001  ross branches: 1.18.2;
Split pci and eisa/isa attachment calls, plus misc cleanup.
 1.17 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.16 03-Oct-2000  simonb branches: 1.16.2;
Revert rev 1.31 of bha.c (and associtated changes in the headers and
config glue files).

Fixes PR kern/9841. Tested by Tracy J. Di Marco White with a bt948
and 6 disks.
 1.15 01-Oct-1999  thorpej branches: 1.15.2; 1.15.12;
Fix compilation of ISA bha front-end. PR #8528, Takahiro Kambe.
 1.14 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.13 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.12 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.11 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.10 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.9 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.8 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.7 06-Jun-1997  thorpej branches: 1.7.2; 1.7.4;
Pull thorpej-bus-dma branch into mainline.
 1.6 28-Mar-1997  mycroft branches: 1.6.2;
Use a temporary data structure for holding probe information, rather than a
full softc.
 1.5 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.4 13-Oct-1996  christos backout kprintf changes
 1.3 10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
- Remove unused variable
- include <systm.h>
 1.2 01-Sep-1996  mycroft Minor changes.
 1.1 31-Aug-1996  mycroft Split the BusLogic driver apart, and rename it to `bha (like BSDi).
 1.6.2.2 18-May-1997  thorpej Do the __BROKEN_INDIRECT_CONFIG dance.
 1.6.2.1 13-May-1997  thorpej - Stash the bus dma tag and bus-specific DMA flags in the softc.
- Adapt to new software interface to the on-board ISA DMA controller.
- Detect buggy VLB variants of this card. Buggy cards get 24-bit
ISA DMA, working cards (rev. 3.37 and higher) get to use 32-bit DMA.
 1.7.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.15.12.1 04-Oct-2000  simonb Pull up rev 1.16 (approved by thorpej):
Revert rev 1.31 of bha.c (and associtated changes in the headers and
config glue files).

Fixes PR kern/9841. Tested by Tracy J. Di Marco White with a bt948
and 6 disks.
 1.15.2.2 27-Mar-2001  bouyer Convert these drivers to thorpej_scsipi (untested).
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.16.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.16.2.4 11-Jan-2002  nathanw More catchup.
 1.16.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.16.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.18.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.18.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.24.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.25.6.1 12-Feb-2005  yamt sync with head.
 1.25.4.1 29-Apr-2005  kent sync with -current
 1.26.6.2 27-Oct-2007  yamt sync with head.
 1.26.6.1 30-Dec-2006  yamt sync with head.
 1.27.22.2 10-Dec-2006  yamt sync with head.
 1.27.22.1 22-Oct-2006  yamt sync with head
 1.27.20.1 18-Nov-2006  ad Sync with head.
 1.29.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.29.24.1 06-Nov-2007  matt sync with HEAD
 1.29.22.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.29.8.1 23-Oct-2007  ad Sync with head.
 1.30.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.4.2 16-May-2009  yamt sync with head
 1.31.4.1 16-May-2008  yamt sync with head.
 1.31.2.1 18-May-2008  yamt sync with head.
 1.32.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.22.2 03-Dec-2017  jdolecek update from HEAD
 1.34.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.34.12.1 30-Oct-2012  yamt sync with head
 1.36.2.1 05-Oct-2016  skrll Sync with HEAD
 1.57 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.56 24-Apr-2021  thorpej branches: 1.56.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.55 11-Jul-2016  msaitoh branches: 1.55.34;
KNF. No functional change.
 1.54 27-Oct-2012  chs branches: 1.54.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.53 12-May-2009  cegger branches: 1.53.12; 1.53.22;
struct device * -> device_t, no functional changes intended.
 1.52 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.51 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.50 08-Apr-2008  cegger branches: 1.50.4; 1.50.12; 1.50.18;
use aprint_*_dev and device_xname
 1.49 19-Oct-2007  ad branches: 1.49.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.48 09-Jul-2007  ad branches: 1.48.6; 1.48.8; 1.48.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.47 16-Nov-2006  christos branches: 1.47.8; 1.47.10;
__unused removal on arguments; approved by core.
 1.46 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.45 11-Dec-2005  christos branches: 1.45.20; 1.45.22;
merge ktrace-lwp.
 1.44 04-Feb-2005  perry branches: 1.44.6;
de-__P
 1.43 14-Sep-2004  drochner branches: 1.43.4; 1.43.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.42 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.41 01-Jan-2003  thorpej branches: 1.41.2;
Use aprint_normal() in cfprint routines.
 1.40 17-Nov-2002  chs move initialization of iobase to before we first use it.
 1.39 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.38 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.37 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.36 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.35 13-Nov-2001  lukem add RCSID
 1.34 27-Jul-2000  bouyer branches: 1.34.2; 1.34.4;
My 16 port boca seems to fail to update the interrupt bit in it's interrupt
register for a port under high load. The effect is that the port is wedged
waiting for an interrupt that will never come.
Add a callout-based watchdog which periodically (hz/10) scan trough the ports
for missed interrupts.
Problem also noted by Chris Jones, and this fix also helped him.
 1.33 20-May-2000  thorpej branches: 1.33.4;
Rather than using a magic constant, use `com_scratch' as the offset
in UART space to the interrupt CSR.
 1.32 18-Sep-1998  enami branches: 1.32.12;
Make these files compile again; no longer necessary to pass
iobase to comprobe1.
 1.31 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.30 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.29 14-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.28 12-Jan-1998  thorpej Update for config changes.
 1.27 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.26 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.25 16-Oct-1997  thorpej Adjust for the new "com" driver home.
 1.24 12-Sep-1997  drochner Make console on multiport cards more likely to work (obvious bug,
fix still untested).
Closes PR kern/4095 by enami tsugutomo.
 1.23 23-Aug-1997  drochner Use the new com_is_console() to decide if the port is already initialized.
XXX shouldn't the attach() use the existing handle if present???
 1.22 16-Aug-1997  drochner Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
 1.21 13-Aug-1997  jtk fix multi-port serial drivers to reflect recent changes to com driver for console/kgdb
 1.20 09-Apr-1997  mycroft branches: 1.20.4;
Update for new com driver.
 1.19 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.18 13-Oct-1996  christos backout kprintf changes
 1.17 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.16 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.15 12-May-1996  mycroft Use intr.h.
 1.14 05-May-1996  christos Make those compile again; they were missing a declaration for bc.
Also fix prototypes.
 1.13 15-Apr-1996  cgd include <sys/termios.h> to make comvar.h happy
 1.12 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.11 04-Apr-1996  cgd remove tricky open-coded variants of config_found(), by using the
child device pointer now returned by config_found(). (previously,
the code played games to get that pointer; now they are unnecesary.)
 1.10 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.9 10-Mar-1996  cgd convert these to use new <machine/bus.h> interfaces. This involved
substantial reworking of the multi-port drivers, as they need to frob
bits in the io-port spaces of their children. As a result, the
commulti->com attachment interface is substantially more complex.
(This may be fixable in the future by making some of the code common,
but as long as io-port allocation checking is planned, it's necessary.)
 1.8 09-Mar-1996  cgd Include comvar.h, for comprobe1() prototype and for commulti_attach_args.
Remove multiple identical definitions for the arg struct used by multiport
boards' to attach slave com ports.
 1.7 09-Mar-1996  cgd minor cleanup. mostly: use COM_NPORTS and a new (driver-specific) NSLAVES
macro where appropriate. No point in hard-coding numbers in multiple places.
At the very least, this makes the drivers slightly easier to diff/understand.
 1.6 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.5 26-Jun-1995  cgd if subdevices specified with wildcarded unit number, config_attach()
can change the cf_unit, so save it before attach and use saved value.
 1.4 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.3 04-Jan-1995  mycroft Fix oversight in previous.
 1.2 03-Jan-1995  mycroft \
These files have been 99% rewritten from the original ast driver. Add an
appropriate copyright notice.
 1.1 03-Jan-1995  mycroft Add a multiplexer for BOCA serial boards.
 1.20.4.4 16-Oct-1997  thorpej Sync w/ trunk.
 1.20.4.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.20.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.33.4.1 27-Jul-2000  bouyer Pull up 1.33->1.34, approved by thorpej:
boca "hang because of lost interupts" workaround.
 1.34.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.34.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.34.2.6 03-Jan-2003  thorpej Sync with HEAD.
 1.34.2.5 11-Dec-2002  thorpej Sync with HEAD.
 1.34.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.34.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.34.2.2 11-Jan-2002  nathanw More catchup.
 1.34.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.41.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.41.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.41.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.43.6.1 12-Feb-2005  yamt sync with head.
 1.43.4.1 29-Apr-2005  kent sync with -current
 1.44.6.3 27-Oct-2007  yamt sync with head.
 1.44.6.2 03-Sep-2007  yamt sync with head.
 1.44.6.1 30-Dec-2006  yamt sync with head.
 1.45.22.2 10-Dec-2006  yamt sync with head.
 1.45.22.1 22-Oct-2006  yamt sync with head
 1.45.20.1 18-Nov-2006  ad Sync with head.
 1.47.10.1 11-Jul-2007  mjf Sync with head.
 1.47.8.2 23-Oct-2007  ad Sync with head.
 1.47.8.1 01-Jul-2007  ad Adapt to callout API change.
 1.48.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.48.8.1 06-Nov-2007  matt sync with HEAD
 1.48.6.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.49.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.50.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.50.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.50.4.2 16-May-2009  yamt sync with head
 1.50.4.1 04-May-2009  yamt sync with head.
 1.53.22.2 03-Dec-2017  jdolecek update from HEAD
 1.53.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.12.1 30-Oct-2012  yamt sync with head
 1.54.14.1 05-Oct-2016  skrll Sync with HEAD
 1.55.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.56.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.14 31-Aug-1996  mycroft Split the BusLogic driver apart, and rename it to `bha (like BSDi).
 1.13 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.12 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.11 18-Jun-1996  mycroft Turn off *DIAG by default.
 1.10 12-May-1996  mycroft branches: 1.10.4;
Use intr.h.
 1.9 29-Apr-1996  christos - prototype fixes
 1.8 25-Apr-1996  is Fix an obvious typo (wrong sign of test). At the same time, make the early
probe printf prefix unambiguous.
 1.7 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.6 03-Apr-1996  mycroft Don't wait for a command complete interrupt when enabling mailbox out
interrupts.
 1.5 03-Apr-1996  mycroft Don't wait for the host adapter to be idle before enabling or disabling
mailbox out interrupts.
 1.4 25-Mar-1996  mycroft Remove dead variables.
 1.3 25-Mar-1996  mycroft Display the right sync period for fast devices.
 1.2 24-Mar-1996  mycroft Fix up a couple of printf()s.
 1.1 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.10.4.1 10-Dec-1996  mycroft Turn off diagnostic code by default.
 1.58 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.57 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.56 17-Mar-1996  cgd clean up a comment, delete unnecessary local variable in probe
 1.55 16-Mar-1996  cgd print out hardware type, and print firmware version more precisely.
Information about structures & commands to do this gleaned from
the FreeBSD bt driver.
 1.54 16-Mar-1996  cgd prototype bt_cmd(), using varargs/stdarg (ooh, ahh!). Fix up resulting
pointer warnings.
 1.53 16-Mar-1996  cgd convert to not assume existence of softc at probe time.
 1.52 16-Mar-1996  cgd A foolish consistency... General cleanup: get rid of spaces and tabs at
ends of lines, turn aligned blocks of eight spaces into tabs, name all
softc elements with the "sc_" prefix, and call the softc by the commonly
used name, "sc", when passing it around.
 1.51 16-Mar-1996  cgd Change register definitions to be offset from the I/O base, rather than
complete I/O addresses. Access ports via "iobase + REGISTER."
 1.50 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.49 03-Oct-1995  mycroft Modularize the CCB/MSCP/ACB/ECB handling a little. No functional changes.
 1.48 26-Sep-1995  thorpej Don't declare Debugger(). It's handled in <sys/systm.h>
 1.47 14-Sep-1995  pk Make *print() a message if no scsibus was attached. Also, return something
valid.
 1.46 12-Aug-1995  mycroft opri --> s
 1.45 12-Aug-1995  mycroft minphys() functions really should return void.
 1.44 29-Jul-1995  mycroft Turn off the mbi diagnostics completely.
 1.43 28-Jul-1995  mycroft Don't loop if we're out of CCBs/SCBs/MSCPs.
 1.42 27-Jul-1995  mycroft Disable diagnostics related to expected mbi race condition.
 1.41 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.40 08-Jul-1995  cgd insert missing call to splx() when {aha,bt}_send_mbo() returns null.
from enami@sys.ptg.sony.co.jp.
 1.39 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.38 13-Jan-1995  mycroft Simplify some sanity checks.
 1.37 03-Jan-1995  mycroft Add interrupt sharing types.
 1.36 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.35 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.34 04-Nov-1994  mycroft No longer needs icu.h.
 1.33 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.32 03-Nov-1994  mycroft Update to match autoconfig code.
 1.31 27-Oct-1994  cgd new RCS ID format.
 1.30 31-Jul-1994  mycroft Add some missing newlines in the attach messages.
 1.29 27-Jul-1994  mycroft Enable IRQ probing, and fix the DMA setup.
 1.28 03-Jun-1994  mycroft branches: 1.28.2;
Allow the probe to succeed again on 445S cards.
 1.27 24-May-1994  mycroft Check the bus type, and don't attempt to enable the round-robin algorithm
on early boards. As suggested by Atsushi Murai.
 1.26 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.25 29-Apr-1994  cgd change timeout/untimeout/wakeup/sleep/tsleep args to void *
 1.24 08-Apr-1994  mycroft Fix return values from some interrupt routines.
 1.23 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.22 06-Apr-1994  mycroft Remove spurious arg to printf(), per JT Conklin.
 1.21 29-Mar-1994  mycroft New SCSI system, based on Julian's more recent work.
 1.20 25-Mar-1994  mycroft Put controller target in scsi_switch.
 1.19 12-Mar-1994  mycroft Fix bug in last change.
 1.18 12-Mar-1994  mycroft Update to match config(8).
 1.17 10-Mar-1994  mycroft Updates to match config(8).
 1.16 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.15 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.14 01-Mar-1994  deraadt Driver should now work on new & old bt742/747/445 versions of the
BusTech cards. Fixes from Michael VanLoon <michaelv@iastate.edu>
KNF'd too.
 1.13 05-Jan-1994  deraadt small cleanup
 1.12 03-Jan-1994  mycroft Use KERNBASE, not 0xfe000000.
 1.11 20-Dec-1993  davidb Fixed bug where with two or more SCSI controllers of the same type, you
could not have devices at the same ID on each bus.
This patch not directly applicable to magnum branch, which is using Julian's
new SCSI code.
 1.10 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.9 07-Dec-1993  deraadt __386BSD__ -> __NetBSD__
 1.8 17-Jul-1993  deraadt branches: 1.8.4;
scsi_switch had wrong entries for these controllers...
 1.7 09-Jun-1993  deraadt minor silliness related to two or more controllers
 1.6 22-May-1993  cgd add rcsids to everything and clean up headers
 1.5 04-May-1993  deraadt support for making dev->id_alive be set, this is for iostat to
find disk devices. wee bit of a kludge. sub-device attach()
routines must now return 1 for successful attach(), 0 otherwise.
Other bsd's do this too..
 1.4 15-Apr-1993  deraadt ioconf changes, see previous cvs's that dumped core
 1.3 12-Apr-1993  deraadt new scsi subsystem.
changes also in config/mkioconf.c & sys/scsi/*
 1.2 10-Apr-1993  glass fixed to be compliant, subservient, and to take advantage of the newly
hacked config(8)
 1.1 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.8.4.9 25-Mar-1994  mycroft Stylistic changes.
 1.8.4.8 02-Feb-1994  mycroft Change some structure names.
 1.8.4.7 02-Feb-1994  mycroft Change second arg of probe to self.
 1.8.4.6 29-Nov-1993  mycroft Add some bzero()s before it bites me.
 1.8.4.5 29-Nov-1993  mycroft Change format of attach message, as suggested by Julian.
 1.8.4.4 28-Nov-1993  mycroft Remove some unused variables.
 1.8.4.3 28-Nov-1993  mycroft Remove redundant decl.
 1.8.4.2 28-Nov-1993  mycroft Should work.
 1.8.4.1 25-Nov-1993  mycroft New code from Julian, not yet converted.
 1.28.2.2 01-Aug-1994  cgd From trunk.
 1.28.2.1 28-Jul-1994  cgd from trunk.
 1.4 11-Mar-1997  mikel eliminate leftover header from bt -> bha conversion; noted by Enami
Tsusgutomo in PR kern/3310.
 1.3 29-Apr-1996  christos branches: 1.3.6;
- prototype fixes
 1.2 25-Mar-1996  mycroft Display the right sync period for fast devices.
 1.1 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.3.6.1 12-Mar-1997  is Merge in changes from The Trunk
 1.16 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.15 24-Apr-2021  thorpej branches: 1.15.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.14 11-Jul-2016  msaitoh branches: 1.14.34;
KNF. No functional change.
 1.13 27-Oct-2012  chs branches: 1.13.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.12 12-Sep-2009  tsutsui branches: 1.12.12; 1.12.22;
Make compile with options DEBUG.
 1.11 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.10 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.9 28-Apr-2008  martin branches: 1.9.14;
Remove clause 3 and 4 from TNF licenses
 1.8 08-Apr-2008  cegger branches: 1.8.2; 1.8.4;
use aprint_*_dev and device_xname
 1.7 19-Oct-2007  ad branches: 1.7.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.6 09-Jul-2007  ad branches: 1.6.6; 1.6.8; 1.6.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.5 10-Jan-2007  cube branches: 1.5.6; 1.5.8;
Complete initialiser.
 1.4 11-Dec-2005  christos branches: 1.4.20;
merge ktrace-lwp.
 1.3 27-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 14-Sep-2004  drochner branches: 1.2.4; 1.2.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.1 02-Jun-2003  gmcgarry branches: 1.1.2;
Driver for GPIB controllers boards based on the uPD7210 GPIB controller,
including boards made by Captial Equipment Corp.
 1.1.2.3 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.4.1 29-Apr-2005  kent sync with -current
 1.3.4.3 27-Oct-2007  yamt sync with head.
 1.3.4.2 03-Sep-2007  yamt sync with head.
 1.3.4.1 26-Feb-2007  yamt sync with head.
 1.4.20.1 12-Jan-2007  ad Sync with head.
 1.5.8.1 11-Jul-2007  mjf Sync with head.
 1.5.6.2 23-Oct-2007  ad Sync with head.
 1.5.6.1 01-Jul-2007  ad Adapt to callout API change.
 1.6.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.6.8.1 06-Nov-2007  matt sync with HEAD
 1.6.6.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.7.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.4.3 16-Sep-2009  yamt sync with head
 1.8.4.2 16-May-2009  yamt sync with head
 1.8.4.1 16-May-2008  yamt sync with head.
 1.8.2.1 18-May-2008  yamt sync with head.
 1.9.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.22.2 03-Dec-2017  jdolecek update from HEAD
 1.12.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.12.12.1 30-Oct-2012  yamt sync with head
 1.13.14.1 05-Oct-2016  skrll Sync with HEAD
 1.14.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.15.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.23 08-May-2019  isaki 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.22 10-Dec-2016  maya branches: 1.22.16; 1.22.20;
Be explicit about precedence of operators
Appeases clang when building an ALL kernel
 1.21 09-Apr-2012  plunky branches: 1.21.2; 1.21.16; 1.21.20;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.20 24-Nov-2011  jakllsch branches: 1.20.2;
This hopefully completes the audiomp conversion of cms(4).
 1.19 23-Nov-2011  jmcneill 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.18 28-Apr-2008  martin branches: 1.18.12; 1.18.34; 1.18.36;
Remove clause 3 and 4 from TNF licenses
 1.17 16-Mar-2008  cube branches: 1.17.2; 1.17.4;
Fix compilation. Noted by yamt@.
 1.16 15-Mar-2008  cube Split device_t and softc for opl(4). That should have been done along with
midi(4), because opl_softc embed a midi_softc.
Fixes PR#38242 by Onno van der Linden.
 1.15 19-Oct-2007  ad branches: 1.15.12; 1.15.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 16-Nov-2006  christos branches: 1.14.8; 1.14.22; 1.14.24; 1.14.28;
__unused removal on arguments; approved by core.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 30-Jun-2006  chap branches: 1.12.4; 1.12.6;
Ankh-Morpork, we have a MIDI driver....

Merge from chap-midi branch, after
~month for review
Comments by thorpej@ drochner@ and Alexandre Ratchov

Incorporated: points by thorpej@ drochner@; preliminary support for
a stats-collecting ioctl suggested by martin@ from comments by A.R.

PR kern/32441 kern/32442 kern/32567 kern/32588 kern/32694 kern/33590
kern/33614 and one instance of kern/32651

ok martin@
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.8; 1.11.14; 1.11.16;
merge ktrace-lwp.
 1.10 27-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 04-Feb-2005  perry de-__P
 1.8 14-Sep-2004  drochner branches: 1.8.4; 1.8.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.7 02-Oct-2002  thorpej branches: 1.7.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.6 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 26-Sep-2001  thorpej "cms" is not needs-flag
 1.1 01-May-2000  augustss branches: 1.1.6; 1.1.8; 1.1.10; 1.1.12;
Add Creative Music System driver. From Gregory McGarry <g.mcgarry@ieee.org>
 1.1.12.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.10.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.8.5 18-Oct-2002  nathanw Catch up to -current.
 1.1.8.4 28-Feb-2002  nathanw Catch up to -current.
 1.1.8.3 11-Jan-2002  nathanw More catchup.
 1.1.8.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.8.1 08-Oct-2001  nathanw Catch up to -current.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 01-May-2000  bouyer file cms.c was added on branch thorpej_scsipi on 2000-11-20 11:41:11 +0000
 1.7.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.7.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.6.1 12-Feb-2005  yamt sync with head.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.10.4.3 17-Mar-2008  yamt sync with head.
 1.10.4.2 27-Oct-2007  yamt sync with head.
 1.10.4.1 30-Dec-2006  yamt sync with head.
 1.11.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.11.14.3 09-Jun-2006  chap Bit of housecleaning.

"miditune" wasn't a good name for the pitch representation (even if it
did come from the MIDI Tuning Specification) because for too many people
a 'tune' is a little ditty, not a single pitch. Changed the name to
midipitch and added a typedef midipitch_t; renamed the associated macros
consistently.

The type and operations on it are now in <sys/midiio.h> because they could
show up in userland for manipulation of the MIDI Tuning messages that
RP-012 defines. The macro MIDIPITCH_TO_HZ18 expands in userland to
ordinary libm calls, and in-kernel to the no-floating-point version in
midisyn. A few more operations are defined in userland where libm is
available.

At the same time, made midipitch_t signed. It has the bits to spare,
and such manipulations as adding several corrections and clamping the
result will be simpler with it signed.
 1.11.14.2 08-Jun-2006  chap Rototill of midisyn <-> synth driver i/f.

The DOALLOC and FREQXLATE flags are on the way out. Whether a driver wants
allocation service is deducible from whether it provides an allocv method, and
anyway none does. As for freq, they all get a miditune and can convert it
whichever way they want.

Controller handling with midictl is hooked in but few controllers watched yet.

Some macros for manipulating the miditune type are currently in midisynvar.h
but should perhaps be exported in midiio.h.

opl no longer has its own master volume state (there was no setter for it
anyway, it never changed); soon that will be handled centrally in midisyn.

Builds a kernel. Not all functionality tested yet.
 1.11.14.1 07-Jun-2006  chap The midisyn clients now use designated initializers so the method
structure can evolve. Only opl currently provides any methods beyond
open/close/note-on/note-off. Only cms takes a note number; the others
want a frequency. This is good because it is much easier that way to
put a common handler for tuning/pitchbend/portamento in midisyn itself.

Next up, axe most methods nobody implements. Split note-on into two
methods, one with a frequency, one with a note number, of which a driver
provides one or the other. So far all of the clients delegate voice
allocation to midisyn, so clarify that the method is getting an actual
voice number for the device and not a MIDI channel. If a device that can
do its own allocation is later to be supported, let appropriate different
methods be added then.
 1.11.8.1 11-Aug-2006  yamt sync with head
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.6.2 10-Dec-2006  yamt sync with head.
 1.12.6.1 22-Oct-2006  yamt sync with head
 1.12.4.1 18-Nov-2006  ad Sync with head.
 1.14.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.24.2 23-Mar-2008  matt sync with HEAD
 1.14.24.1 06-Nov-2007  matt sync with HEAD
 1.14.22.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.14.8.1 23-Oct-2007  ad Sync with head.
 1.15.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.15.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.15.12.1 24-Mar-2008  keiichi sync with head.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.18.36.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.18.34.1 17-Apr-2012  yamt sync with head
 1.18.12.1 11-Dec-2008  ad Checkpoint work in progress.
 1.20.2.1 29-Apr-2012  mrg sync to latest -current.
 1.21.20.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.21.16.1 05-Feb-2017  skrll Sync with HEAD
 1.21.2.1 03-Dec-2017  jdolecek update from HEAD
 1.22.20.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.22.20.1 03-May-2019  isaki Remove unnecessary header file.
 1.22.16.1 10-Jun-2019  christos Sync with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 11-Dec-2005  christos branches: 1.3.70; 1.3.72; 1.3.74;
merge ktrace-lwp.
 1.2 27-Feb-2005  perry nuke trailing whitespace
 1.1 01-May-2000  augustss branches: 1.1.6; 1.1.30; 1.1.38; 1.1.40;
Add Creative Music System driver. From Gregory McGarry <g.mcgarry@ieee.org>
 1.1.40.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.38.1 29-Apr-2005  kent sync with -current
 1.1.30.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 01-May-2000  bouyer file cmsreg.h was added on branch thorpej_scsipi on 2000-11-20 11:41:11 +0000
 1.3.74.1 16-May-2008  yamt sync with head.
 1.3.72.1 18-May-2008  yamt sync with head.
 1.3.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.113 16-Oct-1997  thorpej Moved by repository copy magick to sys/dev/ic.
 1.112 03-Oct-1997  mikel fix missing com_kgdb_attached() argdecl, from Michael C. Richardson in PR 4196
 1.111 30-Sep-1997  christos Add TIOCM{BI{C,S},{S,G}ET} from revision 1.98. As Charles says these
interfaces are slightly broken and should be obsoleted, but some programs
are using them and also they are useful for debugging.
 1.110 19-Sep-1997  enami Cosmetic Changes; make coding style closer to other part of this file.
(This version is identical with version 1.109 except whitespace changes.)
 1.109 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.108 27-Aug-1997  is Make this work with __GENERIC_SOFT_INTERRUPTS.
 1.107 24-Aug-1997  drochner Check for KGDB port == console port in a consistent way.
 1.106 23-Aug-1997  drochner clean up the serial console / KGDB attachment:
-put all early console / KGDB initialization into 1 exported function
(com_*_attach()) each, dont use global variables anymore
-use the passed tcflag_t for port settings instead of hardwiring 8N1
-at autoconfiguration attach time, decide if the attaching device is
already console / KGDB by comparing bus tag and base addr (cgd's wish)
-export a function "com_is_console()" for use by driver frontends for
this comparision
-delay setting of cn_tab->cn_dev until autoconfiguration attach
to get the minor number right
-delete unused comcnprobe() and comcninit()
 1.105 16-Aug-1997  drochner Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
 1.104 14-Aug-1997  drochner -Export variables needed for system console initialization.
-Enable line break interrupt for DDB on a serial console.
-Share initialization code between DDB and KGDB.
 1.103 12-Aug-1997  drochner KGDB improvements:
-Separate KGDB port initialization and softc related stuff to allow
KGDB to be attached in early system startup, before autoconfiguration.
-Export the variables needed by md code to hand-craft bus tag/handle.
-Fix initialization to enable interrupt by line break.
-Call DDB/KGDB at line break (move DDB call from the softirq handler
to the hard handler because it should work without a tty attached too).
 1.102 05-Jul-1997  thorpej branches: 1.102.2;
Add support for remote serial KGDB.
 1.101 15-Jun-1997  mycroft Implement a better backpressure mechanism so that data is collected
in the driver's buffer if the tty buffer is full. If the driver's buffer
becomes full, turn off receive interrupts until it drains a bit.
 1.100 26-May-1997  mycroft Remove unneeded call to comstop() in commsrint(). This fixes a problem
where the driver would sometimes retransmit bytes.
 1.99 04-Apr-1997  mycroft New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance. Many odd
protocols bugs also fixed.
 1.98 04-Apr-1997  mycroft comdefaultrate -> comconsrate
comconsbah -> comconsioh
Only use comconsrate on the console.
 1.97 30-Jan-1997  cgd don't clobber IER in cominit(). (suggested by mycroft.)
 1.96 14-Dec-1996  mycroft If attaching the console, reinitialize it immediately.
 1.95 14-Dec-1996  mycroft Turn off the baud rate changing optimization.
 1.94 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.93 13-Nov-1996  cgd move cominit() prototype to comvar.h, so that ports which use 'com'
for serial console, but don't use the (i386-specific)
comcninit()/comcnprobe() functions, can do the right thing.
 1.92 22-Oct-1996  cgd add missing argument to bus_space_map in ESP code
 1.91 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.90 13-Oct-1996  christos backout kprintf changes
 1.89 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.88 06-Oct-1996  mycroft If we get a RXRDY interrupt, but RXRDY is not set in the LSR, briefly set IER
to 0. This fixes a condition where some UARTs send an infinite stream of
RXRDY interrupts.
 1.87 06-Oct-1996  mycroft Serial console changes:
* Enable FIFO with trigger level 1.
* Set DTR and RTS so terminals are happy.
 1.86 05-Sep-1996  mycroft compoll() -> comsoft()
 1.85 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.84 10-Jul-1996  cgd move DDB-only label inside an #ifdef, so that -Wall works
 1.83 30-May-1996  cgd add tty_attach() where appropriate.
 1.82 12-May-1996  mycroft branches: 1.82.4;
Use intr.h.
 1.81 05-May-1996  christos Move comintr() prototype to comvar.h; needed by the multi-port cards.
 1.80 29-Apr-1996  christos - prototype fixes
 1.79 15-Apr-1996  cgd define and export the global variable "comconscflag", the default tty
'cflag' for the console. Normally set to TTYDEF_CFLAG, may be
overridden by machine-dependent console attachment code, as necessary.
(Alpha uses it to set cs8 -parenb.) Files including comvar.h now
need to include <sys/termios.h>, because comconscflag is of type
tcflag_t.
 1.78 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.77 17-Mar-1996  cgd Add #ifdef's at the right places, on NCOM_ISA and NCOM_COMMULTI, to
only include the relevant code in the probe & attach functions. Still
one probe and one attach function, with #ifdefs, but this is a step
in the right direction and saves a few hundred bytes (ooh, ahh!).
 1.76 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.75 10-Mar-1996  cgd convert these to use new <machine/bus.h> interfaces. This involved
substantial reworking of the multi-port drivers, as they need to frob
bits in the io-port spaces of their children. As a result, the
commulti->com attachment interface is substantially more complex.
(This may be fixable in the future by making some of the code common,
but as long as io-port allocation checking is planned, it's necessary.)
 1.74 09-Mar-1996  cgd include comvar.h for comprobe1() prototype
 1.73 26-Feb-1996  scottr Fix typo (PR 2123, from Michael VanLoon)
 1.72 20-Feb-1996  mycroft Add more debugging code.
 1.71 19-Feb-1996  mycroft Update copyright notice.
 1.70 19-Feb-1996  mycroft Set IER_ETXRDY before outputting any bytes, to prevent race condition.
 1.69 19-Feb-1996  mycroft Handle break more correctly.
Make IER_ETXRDY track TS_BUSY. (Prevents a loop in comintr() if no output
is available.)
Add a bunch of debugging code.
 1.68 18-Feb-1996  mycroft Fix a race condition where we might stop outputting if a write follows a
flush too closely.
 1.67 17-Feb-1996  mycroft Add some text describing the UART lossage worked around in the previous.
 1.66 17-Feb-1996  mycroft Drain the transmitter FIFO before changing the baud rate or FIFO depth
registers. Fixes PR 2046.
Also, if COMCONSOLE is defined, expect CONSPEED to be the baud rate.
 1.65 10-Feb-1996  christos Hayes ESP patches [from PR database]
 1.64 14-Jan-1996  christos Hayes ESP support from Michael Van Loon, with minor cleanups. Tested on
a single port ESP card; works great!
 1.63 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.62 15-Oct-1995  mycroft Use SET(), CLR(), and ISSET() macros.
Rename CFCR to LCR, and cache its value.
Check MSR before transmitting, for better flow control.
Preserve LCR_SBREAK inside comparam().
 1.61 04-Jul-1995  mycroft Fix a condition where ttywait() wouldn't be woken up. Also, short-circuit
the case of no pending input in compoll().
 1.60 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.59 05-Jun-1995  mycroft Various:
* Check for CTS in the correct register.
* Only do a selwakeup() if we output something.
* Don't make assumptions about what TTYDISC does.
 1.58 04-Jun-1995  mycroft Handle BREAK correctly when not entering DDB.
 1.57 04-Jun-1995  mycroft Add an input FIFO, and fix several flow control problems. Based on code from
Felix A. Croes.
 1.56 01-Jun-1995  jtc Changed ns82450 to ns8250 and dropped ns82550 from probe console messages.
 1.55 28-May-1995  mycroft Only use the `no pending interrupt' bit in the IIR; the other bits
are too unreliable on clone chips.
 1.54 12-May-1995  cgd (1) conditionalize debugger usage in comeint with DDB, not COMCONSOLE;
latter would lead to undefined symbols if DDB not defined.
(2) check for break on console, and therefore debugger entry (if ddb
in kernel) earlier, so that the device doesn't need to be open.
(3) return immediately after breaking into the debugger in comeint().
(4) only do the normal character input routine in comintr if receive
mask yeilds _EXACLTY_ LSR_RXRDY. if there's only a receive
error, or there's a receive error _and_ a received character,
do comeint().
(former two by me. latter two from Bob Baron <rvb@cs.cmu.edu>.)
 1.53 28-Apr-1995  hpeyerl <break> --> ddb if defined(comconsole).
(if you have a serial console and you hit break, you get ddb).
 1.52 19-Apr-1995  mycroft Fix thinko in previous change.
 1.51 19-Apr-1995  mycroft Garbage collect #includes.
 1.50 19-Apr-1995  mycroft Implement comtty().
 1.49 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.48 10-Apr-1995  mycroft Most of the console functions return void. Also change interrupt logic
slightly.
 1.47 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.46 29-Jan-1995  cgd use chip headers in /dev/ic
 1.45 11-Jan-1995  pk Explicitly test the RXRDY status bit on incoming characters.
 1.44 04-Jan-1995  mycroft Fix oversight in previous.
 1.43 03-Jan-1995  mycroft Add interrupt sharing types.
 1.42 25-Nov-1994  mycroft Minor update for new autoconfig.
 1.41 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.40 03-Nov-1994  mycroft Update to match autoconfig code.
 1.39 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.38 27-Oct-1994  cgd new RCS ID format.
 1.37 26-Oct-1994  mycroft Implement *cnpollc().
 1.36 16-Sep-1994  mycroft Only reset FIFO if changing baud rate. From John Kohl (slightly edited).
 1.35 24-Aug-1994  mycroft Set the FIFO threshold based on the receive speed, per Mark Weaver.
 1.34 21-Aug-1994  mycroft Look for MDMBUF in cflag, not lflag.
 1.33 07-Aug-1994  mycroft Count up the silo overflows and only log a warning at most once per minute.
 1.32 31-Jul-1994  mycroft Bug fixes from Mark Weaver.
 1.31 10-Apr-1994  cgd branches: 1.31.2;
allow MDMBUF flags to be set (oops)
 1.30 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.29 29-Mar-1994  mycroft Updates for new autoconfig.
 1.28 25-Mar-1994  mycroft Fix off-by-one error in comopen() unit number sanity check. From Brian de
Alwis.
 1.27 23-Mar-1994  mycroft Some stylistic cleanup, and a very minor speedup.
 1.26 23-Mar-1994  cgd add AST-style serial multiport support, from Roland McGrath
<roland@@frob.com>. Needs light clean by Mr. I386, but mostly
OK. For some reason, Bad Things (TM) happened on the last cvs commit.
 1.25 18-Mar-1994  cgd add reasonable support for MDMBUF output flow control. input to be done later
 1.24 12-Mar-1994  cgd copy appropriate hardware config bits from config's flags
 1.23 12-Mar-1994  cgd fix some of the last; thanks to charles for looking it over...
 1.22 12-Mar-1994  cgd support new ioctls. fix the way CRTSCTS is used, etc. Seperate 'hardware'
and 'software' flags. beginnings of multiport support.
 1.21 08-Mar-1994  mycroft Major cleanup and many bugs fixed; based in part on Brad Huntting's version
for BSD/386. More to be done when the low-level interrupt system is replaced.
 1.20 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.19 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.18 01-Feb-1994  cgd oops
 1.17 01-Feb-1994  cgd new cons.h location, etc.
 1.16 30-Jan-1994  ws Traditional behaviour is to reset all modes if device isn't open already
 1.15 13-Jan-1994  mycroft Junk comselect(); it's the same at ttselect().
 1.14 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.13 29-Sep-1993  cgd ifdef out the ttyfree()'s, so that fill_eproc doesn't panic when
a process's session still holds a ref to a tty which has been deallocated
and reused.
 1.12 29-Aug-1993  deraadt branches: 1.12.2;
tty XXstart() routines return void
 1.11 12-Jul-1993  mycroft Change tty code to use clist interface, but with ring buffer implementation.
Also, fix a couple of bugs in tty.c and pccons.c, and some gross kluginess
in the hp300 stuff.
 1.10 07-Jul-1993  deraadt pccons.c now dynamically allocates it's "struct tty"
cons.c's "struct tty *cn_tty" wasn't used by any of the kernel, and goes away.
 1.9 06-Jun-1993  cgd make getc() and ungetc() be rb{un,}getc(), so getc() and ungetc()
don't conflict w/ansi prototypes...
 1.8 26-May-1993  deraadt tty dynamic allocation
 1.7 18-May-1993  cgd make kernel select interface be one-stop shopping & clean it all up.
 1.6 10-Apr-1993  glass fixed to be compliant, subservient, and to take advantage of the newly
hacked config(8)
 1.5 09-Apr-1993  cgd have probe return size of io space on successful return, rather
than simply 1.
 1.4 08-Apr-1993  deraadt dmesg output at boottime now tries to print out information as
soon as it is available. The output looks much more like Sunos.
 1.3 27-Mar-1993  cgd moved closing #endif to include comselect
 1.2 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.12.2.17 01-Feb-1994  mycroft Updates from main branch.
 1.12.2.16 29-Oct-1993  mycroft Minor cleanup.
 1.12.2.15 29-Oct-1993  mycroft c_cflag is a tcflag_t, not a u_char. (Duh.)
 1.12.2.14 18-Oct-1993  mycroft Fix a small typo.
 1.12.2.13 18-Oct-1993  mycroft Check bits in the fifo reg during probe to make sure they are on.
 1.12.2.12 17-Oct-1993  mycroft Minor cleanup.
 1.12.2.11 16-Oct-1993  mycroft Add missing dv_class entry to cfdrivers, and use dv_xname where appropriate.
 1.12.2.10 15-Oct-1993  mycroft Nuke a wakeup() I left in accidentally.
 1.12.2.9 15-Oct-1993  mycroft Flush any pending I/O on open. After a transmit interrupt, don't call
comstart() if TS_FLUSH is set.
 1.12.2.8 13-Oct-1993  mycroft Use stupid indirection to avoid a compiler warning.
 1.12.2.7 12-Oct-1993  mycroft Minor cleanup.
 1.12.2.6 11-Oct-1993  mycroft #include pio.h where needed, and remove cpufunc.h.
 1.12.2.5 07-Oct-1993  mycroft Don't #include isa.h.
 1.12.2.4 06-Oct-1993  mycroft Change comforceintr() to not use loopback. Change attach messages.
 1.12.2.3 30-Sep-1993  mycroft Change some uses of IRQUNK to IRQNONE. #include isa.h and icu.h.
 1.12.2.2 30-Sep-1993  mycroft clock.c: Remove unnecessary casts.
com.c: Update for new config. Add bis() and bic() macros like BSDI's.
Add comspeed() and tiocm_xxx2mcr() from BSDI.
comreg.h: Add COM_FREQ, COM_TOLERANCE, and COM_NPORTS.
fd.c: Remove casts and clean up fdioctl().
[lm]ms.c: Add necessary gunk to [lm]ms_softc and remove casts.
 1.12.2.1 14-Sep-1993  mycroft New i386 code.
 1.31.2.5 16-Sep-1994  cgd from trunk.
 1.31.2.4 24-Aug-1994  mycroft update from trunk
 1.31.2.3 21-Aug-1994  mycroft update from trunk
 1.31.2.2 07-Aug-1994  mycroft update from trunk
 1.31.2.1 01-Aug-1994  cgd From trunk.
 1.82.4.3 16-Feb-1997  rat Patch supplied by Charles Hannmum.
 1.82.4.2 10-Dec-1996  mycroft From trunk:
Set serial port parameters sanely for a serial console.
 1.82.4.1 02-Jun-1996  mrg pull up tty stats "bug fix".
 1.102.2.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.102.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.102.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.102.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.102.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.41 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.40 18-Oct-2016  jdolecek branches: 1.40.14; 1.40.16;
provide intr xname
 1.39 24-Feb-2010  dyoung branches: 1.39.20; 1.39.38; 1.39.42;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.38 08-Jan-2010  dyoung branches: 1.38.2;
Expand PMF_FN_* macros.
 1.37 23-Nov-2009  rmind Remove some unecessary includes sys/user.h header.
 1.36 12-Nov-2009  dyoung Call the common detach routine, com_detach(), and get out on error,
before starting the bus-specific detachment.

com_activate() is going away, so don't use it any more.
 1.35 02-Apr-2009  dyoung During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
 1.34 28-Apr-2008  martin branches: 1.34.8; 1.34.14;
Remove clause 3 and 4 from TNF licenses
 1.33 14-Mar-2008  cube branches: 1.33.2; 1.33.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.32 29-Feb-2008  dyoung Use pmf_device_register1() instead of shutdownhook_establish() to
register com_cleanup() as the shutdown hook.

Add a generic suspend routine. Suspend and resume com@isa.

Protect against dereferencing a NULL softc in comioctl().

Destroy both a mutex and a callout in com_detach().

Cosmetic: use aprint_*_dev(). Use PMF_FN_ARGS, PMF_FN_PROTO.
 1.31 28-Feb-2008  dyoung Use device_t and accessors.
 1.30 14-Dec-2007  dyoung branches: 1.30.2; 1.30.6;
Add a resume handler for com@isa, using Jared McNeill's suggested
code from current-users. com@acpi, et cetera, remain to be done.
 1.29 19-Oct-2007  ad branches: 1.29.4; 1.29.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.28 10-Jan-2007  cube branches: 1.28.6; 1.28.18; 1.28.20; 1.28.24;
Make COM_HAYESP compile again. It assumes no register mapping is needed.
 1.27 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.26 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.25 13-Jul-2006  gdamore branches: 1.25.4; 1.25.6;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

Additionally, we use a common com_cleanup routine rather than having a
zillion copies of it in the attachment points.

This has been tested on a number architectures, and it has been shown to get
close to comparable performance when COM_REGMAP is defined, and comparable
when it is not defined.

Approved by core@. Fixes PR port-evbmips/32362.
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.8; 1.24.16;
merge ktrace-lwp.
 1.23 04-Feb-2005  perry branches: 1.23.6;
de-__P
 1.22 14-Sep-2004  drochner branches: 1.22.4; 1.22.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.21 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.20 02-Oct-2002  thorpej branches: 1.20.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.19 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.18 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.17 07-Jan-2002  thorpej branches: 1.17.6;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.16 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.15 13-Nov-2001  lukem add RCSID
 1.14 29-Mar-2000  simonb branches: 1.14.6; 1.14.8;
Don't need to include <sys/conf.h> here.
 1.13 16-Sep-1998  is branches: 1.13.12;
Garbage collect unused 3rd parameter to comprobe1().
 1.12 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.11 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.10 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.9 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.8 16-Oct-1997  thorpej Adjust for the new "com" driver home.
 1.7 15-Oct-1997  thorpej Pulldown from marc-pcmcia branch.
 1.6 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.5 23-Aug-1997  drochner Use the new com_is_console() to decide if the port is already initialized.
 1.4 16-Aug-1997  drochner Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
 1.3 12-Aug-1997  drochner KGDB improvements:
-Separate KGDB port initialization and softc related stuff to allow
KGDB to be attached in early system startup, before autoconfiguration.
-Export the variables needed by md code to hand-craft bus tag/handle.
-Fix initialization to enable interrupt by line break.
-Call DDB/KGDB at line break (move DDB call from the softirq handler
to the hard handler because it should work without a tty attached too).
 1.2 24-May-1997  thorpej branches: 1.2.4;
Where _is_ that brick when you need it?!
 1.1 04-Apr-1997  mycroft New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance. Many odd
protocols bugs also fixed.
 1.2.4.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.2.4.4 15-Oct-1997  thorpej Move a few bus-specific things into bus-specific softc structures and
nesting a com_softc within them.
 1.2.4.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.6.5 18-Oct-2002  nathanw Catch up to -current.
 1.14.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.14.6.3 11-Jan-2002  nathanw More catchup.
 1.14.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.14.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.17.6.1 06-Apr-2002  eeh Attach through devprops instead of aux.
 1.20.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.20.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.6.1 03-Aug-2004  skrll Sync with HEAD
 1.22.6.1 12-Feb-2005  yamt sync with head.
 1.22.4.1 29-Apr-2005  kent sync with -current
 1.23.6.5 17-Mar-2008  yamt sync with head.
 1.23.6.4 21-Jan-2008  yamt sync with head
 1.23.6.3 27-Oct-2007  yamt sync with head.
 1.23.6.2 26-Feb-2007  yamt sync with head.
 1.23.6.1 30-Dec-2006  yamt sync with head.
 1.24.16.4 17-Jun-2006  gdamore Undo the undo. Restore COM_INIT_REGS.
 1.24.16.3 17-Jun-2006  gdamore Back out COM_INIT_REGS.
 1.24.16.2 16-Jun-2006  gdamore Adapt to KNF. Note tested yet.
 1.24.16.1 15-Jun-2006  gdamore Adapt to new com framework.
 1.24.8.1 11-Aug-2006  yamt sync with head
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.6.2 10-Dec-2006  yamt sync with head.
 1.25.6.1 22-Oct-2006  yamt sync with head
 1.25.4.2 12-Jan-2007  ad Sync with head.
 1.25.4.1 18-Nov-2006  ad Sync with head.
 1.28.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.28.20.3 23-Mar-2008  matt sync with HEAD
 1.28.20.2 09-Jan-2008  matt sync with HEAD
 1.28.20.1 06-Nov-2007  matt sync with HEAD
 1.28.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.28.6.1 23-Oct-2007  ad Sync with head.
 1.29.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.29.4.1 26-Dec-2007  ad Sync with head.
 1.30.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.30.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.30.2.1 24-Mar-2008  keiichi sync with head.
 1.33.4.3 11-Mar-2010  yamt sync with head
 1.33.4.2 04-May-2009  yamt sync with head.
 1.33.4.1 16-May-2008  yamt sync with head.
 1.33.2.1 18-May-2008  yamt sync with head.
 1.34.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.38.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.39.42.1 04-Nov-2016  pgoyette Sync with HEAD
 1.39.38.1 05-Dec-2016  skrll Sync with HEAD
 1.39.20.1 03-Dec-2017  jdolecek update from HEAD
 1.40.16.1 10-Jun-2019  christos Sync with HEAD
 1.40.14.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.30 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.29 23-Nov-2009  rmind branches: 1.29.62; 1.29.64;
Remove some unecessary includes sys/user.h header.
 1.28 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.27 28-Apr-2008  martin branches: 1.27.14;
Remove clause 3 and 4 from TNF licenses
 1.26 14-Mar-2008  cube branches: 1.26.2; 1.26.4;
Split device_t and softc for all com(4) devices (well, everything that
uses a com_softc backend). Use proper types and ansify where appropriate.
 1.25 19-Oct-2007  ad branches: 1.25.12; 1.25.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.24 16-Nov-2006  christos branches: 1.24.8; 1.24.22; 1.24.24; 1.24.28;
__unused removal on arguments; approved by core.
 1.23 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.22 13-Jul-2006  gdamore branches: 1.22.4; 1.22.6;
Add an option COM_REGMAP to allow com(4) to use an array of register indices.
This allows us to convert aucom to just another com attachment, and cleanup
some code in the com_arbus.c.

Additionally, we use a common com_cleanup routine rather than having a
zillion copies of it in the attachment points.

This has been tested on a number architectures, and it has been shown to get
close to comparable performance when COM_REGMAP is defined, and comparable
when it is not defined.

Approved by core@. Fixes PR port-evbmips/32362.
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.8; 1.21.16;
merge ktrace-lwp.
 1.20 27-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 04-Feb-2005  perry de-__P
 1.18 14-Sep-2004  drochner branches: 1.18.4; 1.18.6;
include "locators.h" explicitely where it is needed, so that
it can be removed in the isavar.h header eventually
 1.17 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 02-Oct-2002  thorpej branches: 1.16.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.15 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.12 13-Nov-2001  lukem add RCSID
 1.11 16-Sep-1998  is branches: 1.11.24; 1.11.26;
Garbage collect unused 3rd parameter to comprobe1().
 1.10 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.9 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.8 16-Oct-1997  thorpej Adjust for the new "com" driver home.
 1.7 03-Oct-1997  cjs Make this compile on alpha and, presumably, other non
_BROKEN_INDIRECT_CONFIG machines.
 1.6 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.5 23-Aug-1997  drochner Use the new com_is_console() to decide if the port is already initialized.
 1.4 16-Aug-1997  drochner Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
 1.3 13-Aug-1997  jtk fix multi-port serial drivers to reflect recent changes to com driver for console/kgdb
 1.2 17-Jul-1997  jtk branches: 1.2.2;
use locator defines in "locators.h" to index cf_loc[]

still to be done and/or decided not to be done: replace all *UNK uses in
isa code with the native names from locators.h
 1.1 04-Apr-1997  mycroft New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance. Many odd
protocols bugs also fixed.
 1.2.2.5 16-Oct-1997  thorpej Sync w/ trunk.
 1.2.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.3 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.26.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.24.3 18-Oct-2002  nathanw Catch up to -current.
 1.11.24.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.24.1 14-Nov-2001  nathanw Catch up to -current.
 1.16.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.6.1 12-Feb-2005  yamt sync with head.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.20.4.3 17-Mar-2008  yamt sync with head.
 1.20.4.2 27-Oct-2007  yamt sync with head.
 1.20.4.1 30-Dec-2006  yamt sync with head.
 1.21.16.4 17-Jun-2006  gdamore Undo the undo. Restore COM_INIT_REGS.
 1.21.16.3 17-Jun-2006  gdamore Revert COM_INIT_REGS.
 1.21.16.2 15-Jun-2006  gdamore ARC com(4) fixes. Somehow a syntax error in com_multi.c escaped me, too.
 1.21.16.1 15-Jun-2006  gdamore Adapt to new com framework.
 1.21.8.1 11-Aug-2006  yamt sync with head
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.22.6.2 10-Dec-2006  yamt sync with head.
 1.22.6.1 22-Oct-2006  yamt sync with head
 1.22.4.1 18-Nov-2006  ad Sync with head.
 1.24.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.24.24.2 23-Mar-2008  matt sync with HEAD
 1.24.24.1 06-Nov-2007  matt sync with HEAD
 1.24.22.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.24.8.1 23-Oct-2007  ad Sync with head.
 1.25.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.25.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.25.12.1 24-Mar-2008  keiichi sync with head.
 1.26.4.3 11-Mar-2010  yamt sync with head
 1.26.4.2 16-May-2009  yamt sync with head
 1.26.4.1 16-May-2008  yamt sync with head.
 1.26.2.1 18-May-2008  yamt sync with head.
 1.27.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.64.1 10-Jun-2019  christos Sync with HEAD
 1.29.62.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.1 04-Apr-1997  mycroft branches: 1.1.56;
New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance. Many odd
protocols bugs also fixed.
 1.1.56.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.56.1 18-Sep-2004  skrll Sync with HEAD.
 1.4 11-Dec-2007  lukem use __KERNEL_RCSID()
 1.3 19-Oct-2007  ad branches: 1.3.4; 1.3.6; 1.3.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.2 11-Dec-2005  christos branches: 1.2.30; 1.2.44; 1.2.46; 1.2.50;
merge ktrace-lwp.
 1.1 14-Sep-2004  drochner branches: 1.1.2; 1.1.14;
replace 7 identical instances if cfprint functions by a single one
 1.1.14.2 21-Jan-2008  yamt sync with head
 1.1.14.1 27-Oct-2007  yamt sync with head.
 1.1.2.4 22-Sep-2004  skrll Fix.
 1.1.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.1 14-Sep-2004  skrll file commultiprint.c was added on branch ktrace-lwp on 2004-09-18 14:47:46 +0000
 1.2.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.2.46.2 09-Jan-2008  matt sync with HEAD
 1.2.46.1 06-Nov-2007  matt sync with HEAD
 1.2.44.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.2.30.1 23-Oct-2007  ad Sync with head.
 1.3.8.2 02-Jan-2008  bouyer Sync with HEAD
 1.3.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.3.6.1 11-Dec-2007  yamt sync with head.
 1.3.4.1 26-Dec-2007  ad Sync with head.
 1.11 16-Oct-1997  thorpej Moved by repository copy magick to sys/dev/ic.
 1.10 15-Oct-1997  thorpej Garbage-collect some old i386 console stuff that is no longer used, and
add a comment about something to be fixed later.
 1.9 06-Sep-1996  mycroft branches: 1.9.10;
Wrap the definitions of CONADDR and CONUNIT in #ifndef.
 1.8 05-Feb-1996  scottr branches: 1.8.4;
Document this file better, mostly from John Vinopal
<banshee@gabriella.resort.com>. Closes PR #1864.
 1.7 15-Oct-1995  mycroft Use SET(), CLR(), and ISSET() macros.
Rename CFCR to LCR, and cache its value.
Check MSR before transmitting, for better flow control.
Preserve LCR_SBREAK inside comparam().
 1.6 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.5 29-Jan-1995  cgd use chip headers in /dev/ic
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 08-Mar-1994  mycroft Major cleanup and many bugs fixed; based in part on Brad Huntting's version
for BSD/386. More to be done when the low-level interrupt system is replaced.
 1.2 22-May-1993  cgd branches: 1.2.4;
add rcsids to everything and clean up headers
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.2.4.2 17-Oct-1993  mycroft Minor cleanup.
 1.2.4.1 30-Sep-1993  mycroft clock.c: Remove unnecessary casts.
com.c: Update for new config. Add bis() and bic() macros like BSDI's.
Add comspeed() and tiocm_xxx2mcr() from BSDI.
comreg.h: Add COM_FREQ, COM_TOLERANCE, and COM_NPORTS.
fd.c: Remove casts and clean up fdioctl().
[lm]ms.c: Add necessary gunk to [lm]ms_softc and remove casts.
 1.8.4.1 10-Dec-1996  mycroft From trunk:
Allow CONADDR and CONUNIT to be overridden in the config file.
 1.9.10.2 16-Oct-1997  thorpej Sync w/ trunk.
 1.9.10.1 15-Oct-1997  thorpej Sync w/ trunk.
 1.17 16-Oct-1997  thorpej Moved by repository copy magick to sys/dev/ic.
 1.16 15-Oct-1997  thorpej Pulldown from marc-pcmcia branch.
 1.15 16-Sep-1997  is Support for the upcoming NetBSD/Amiga Hypercom driver family:
* support chip clocks != COM_FREQ, by introducing sc_frequency (for the
mainline code) and adding a frequency parameter right after the rate
parameter to comcnattach() and com_kgdb_attach().
- Make com_isa and com_multi initialize sc_frequency to COM_FREQ.
- Make i386/machdep.c and alpha/dec_xxx.c call com*attach() with the freq.
parameter.
* supio_attach_args get two more fields: a sc_ipl and a sc_arg, both ints.
- com_supio uses the first for interupt establishment (all childs will, as
soon as they exist) and the 2nd for sc_frequency.
- drsupio passes sc_ipl alway as 5, and for the "com"s, sc_arg as 16*115200
- hyper will pass sc_ipl as 6, and sc_arg as 16 * 460800
 1.14 23-Aug-1997  drochner clean up the serial console / KGDB attachment:
-put all early console / KGDB initialization into 1 exported function
(com_*_attach()) each, dont use global variables anymore
-use the passed tcflag_t for port settings instead of hardwiring 8N1
-at autoconfiguration attach time, decide if the attaching device is
already console / KGDB by comparing bus tag and base addr (cgd's wish)
-export a function "com_is_console()" for use by driver frontends for
this comparision
-delay setting of cn_tab->cn_dev until autoconfiguration attach
to get the minor number right
-delete unused comcnprobe() and comcninit()
 1.13 14-Aug-1997  drochner -Export variables needed for system console initialization.
-Enable line break interrupt for DDB on a serial console.
-Share initialization code between DDB and KGDB.
 1.12 12-Aug-1997  drochner KGDB improvements:
-Separate KGDB port initialization and softc related stuff to allow
KGDB to be attached in early system startup, before autoconfiguration.
-Export the variables needed by md code to hand-craft bus tag/handle.
-Fix initialization to enable interrupt by line break.
-Call DDB/KGDB at line break (move DDB call from the softirq handler
to the hard handler because it should work without a tty attached too).
 1.11 05-Jul-1997  thorpej branches: 1.11.2;
Add support for remote serial KGDB.
 1.10 15-Jun-1997  mycroft Implement a better backpressure mechanism so that data is collected
in the driver's buffer if the tty buffer is full. If the driver's buffer
becomes full, turn off receive interrupts until it drains a bit.
 1.9 24-May-1997  thorpej Where _is_ that brick when you need it?!
 1.8 04-Apr-1997  mycroft New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance. Many odd
protocols bugs also fixed.
 1.7 13-Nov-1996  cgd move cominit() prototype to comvar.h, so that ports which use 'com'
for serial console, but don't use the (i386-specific)
comcninit()/comcnprobe() functions, can do the right thing.
 1.6 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.5 05-May-1996  christos Move comintr() prototype to comvar.h; needed by the multi-port cards.
 1.4 15-Apr-1996  cgd define and export the global variable "comconscflag", the default tty
'cflag' for the console. Normally set to TTYDEF_CFLAG, may be
overridden by machine-dependent console attachment code, as necessary.
(Alpha uses it to set cs8 -parenb.) Files including comvar.h now
need to include <sys/termios.h>, because comconscflag is of type
tcflag_t.
 1.3 10-Mar-1996  cgd convert these to use new <machine/bus.h> interfaces. This involved
substantial reworking of the multi-port drivers, as they need to frob
bits in the io-port spaces of their children. As a result, the
commulti->com attachment interface is substantially more complex.
(This may be fixable in the future by making some of the code common,
but as long as io-port allocation checking is planned, it's necessary.)
 1.2 09-Mar-1996  cgd Fix copyright year
 1.1 09-Mar-1996  cgd define the common structure used to attach 'com' units as slaves to
multiport cards. prototype comprobe1(), which is used by multiport card
drivers.
 1.11.2.6 16-Oct-1997  thorpej Sync w/ trunk.
 1.11.2.5 15-Oct-1997  thorpej Move a few bus-specific things into bus-specific softc structures and
nesting a com_softc within them.
 1.11.2.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.3 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.2 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.7 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.6 11-Dec-2005  christos branches: 1.6.70; 1.6.72; 1.6.74;
merge ktrace-lwp.
 1.5 27-Feb-2005  perry nuke trailing whitespace
 1.4 04-Feb-2005  perry de-__P
 1.3 09-Oct-1997  jtc branches: 1.3.50; 1.3.58; 1.3.60;
Fix tipo inherited from old version of TNF copyright template.
 1.2 05-Feb-1996  jtc branches: 1.2.12;
Fix error in copyright notice
 1.1 07-Jul-1995  brezak add support for cs4231
 1.2.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.60.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.60.1 12-Feb-2005  yamt sync with head.
 1.3.58.1 29-Apr-2005  kent sync with -current
 1.3.50.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.50.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.74.1 16-May-2008  yamt sync with head.
 1.6.72.1 18-May-2008  yamt sync with head.
 1.6.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.23 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.22 26-Nov-2001  yamt - add power management code.
- use ether_ioctl instead of its own code.
(make ifconfig down works properly.)
 1.21 24-Nov-2001  yamt - add (partial?) i/o mode support.
- add partial cs8920 support.
- add detach code.
- add a quirk for EtherJet PCMCIA with cardbus bridge.
(above "partial" means "engough to support EtherJet PCMCIA")
 1.20 13-Nov-2001  lukem add RCSID
 1.19 18-Jul-2001  thorpej bcopy -> memcpy
 1.18 18-Jul-2001  thorpej bcmp -> memcmp
 1.17 14-Dec-2000  thorpej branches: 1.17.2; 1.17.4;
ALTQ'ify.
 1.16 15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.15 01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.14 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 08-Feb-2000  thorpej Cast bus_size_t to u_long for printing.
 1.12 08-Feb-2000  tron Fix printf() format string.
 1.11 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.10 18-May-1999  thorpej branches: 1.10.2;
Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.9 30-Mar-1999  mycroft branches: 1.9.4;
Enable this is a non-entropy rnd source.
 1.8 25-Mar-1999  thorpej Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.7 13-Nov-1998  mycroft branches: 1.7.2;
Fix one last bug in the multicast filter calculation.
sdr and vic work now, at least.
 1.6 12-Nov-1998  mycroft Fix yet another bogon in the multicast filter calculation.
 1.5 11-Aug-1998  mycroft Actually set all the logical filter bits. Doh!
 1.4 11-Aug-1998  mycroft Fix an obvious bug that caused the multicast filter to always be all 0s.
 1.3 08-Aug-1998  mycroft Use splnet(), not splimp().
 1.2 07-Aug-1998  thorpej Track our carrier status and report it in the media status callback.
 1.1 27-Jul-1998  thorpej Split up the Shark CS8900 driver into front-ends and core back-end (which
is here, since the chip can only live on an ISA bus; only the autoconfig
glue is different).
 1.7.2.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.9.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.10.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.10.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.10.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.4.1 03-Aug-2001  lukem update to -current
 1.17.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.17.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.17.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.20 02-Aug-2021  andvar fix various typos in comments and log messages.
 1.19 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.18 10-Jun-2016  ozaki-r branches: 1.18.18; 1.18.26;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.17 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.16 02-Feb-2012  tls branches: 1.16.6; 1.16.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.15 22-Sep-2009  tsutsui branches: 1.15.12; 1.15.16;
Split device_t/softc. Tested only on cs at ofisa on shark.
 1.14 08-Apr-2008  cegger branches: 1.14.4;
use aprint_*_dev and device_xname
 1.13 19-Oct-2007  ad branches: 1.13.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.12 04-Mar-2007  christos branches: 1.12.2; 1.12.14; 1.12.16; 1.12.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 27-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 14-Sep-2004  drochner branches: 1.9.4; 1.9.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.8 05-Aug-2004  drochner simplify some pointer arithmetics which uses typecasts on the LHS
so that gcc-3.4 doesn't complain
 1.7 09-May-2003  fvdl branches: 1.7.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.6 03-May-2003  wiz DMA, not dma nor Dma.
 1.5 02-Feb-2003  wiz guarantee, not guarentee. Idea from miod@openbsd.
 1.4 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.3 31-Dec-2001  thorpej branches: 1.3.2; 1.3.4;
Labels must be followed by statements.
 1.2 26-Nov-2001  yamt add $NetBSD$ and copyright notice and rcsid.
 1.1 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.3.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.1 31-Dec-2001  thorpej file cs89x0isa.c was added on branch kqueue on 2002-01-10 19:55:20 +0000
 1.3.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1 31-Dec-2001  nathanw file cs89x0isa.c was added on branch nathanw_sa on 2002-01-08 00:30:22 +0000
 1.7.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 12-Aug-2004  skrll Sync with HEAD.
 1.9.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.4.1 29-Apr-2005  kent sync with -current
 1.10.4.2 27-Oct-2007  yamt sync with head.
 1.10.4.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.12.16.1 06-Nov-2007  matt sync with HEAD
 1.12.14.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.12.2.1 23-Oct-2007  ad Sync with head.
 1.13.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.4.1 11-Mar-2010  yamt sync with head
 1.15.16.1 18-Feb-2012  mrg merge to -current.
 1.15.12.1 17-Apr-2012  yamt sync with head
 1.16.24.2 09-Jul-2016  skrll Sync with HEAD
 1.16.24.1 06-Jun-2015  skrll Sync with HEAD
 1.16.6.1 03-Dec-2017  jdolecek update from HEAD
 1.18.26.1 29-Feb-2020  ad Sync with head.
 1.18.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.5 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.4 11-Dec-2005  christos branches: 1.4.26;
merge ktrace-lwp.
 1.3 04-Feb-2005  perry branches: 1.3.6;
de-__P
 1.2 26-Nov-2001  yamt branches: 1.2.2; 1.2.4; 1.2.20; 1.2.28; 1.2.30;
add $NetBSD$ and copyright notice and rcsid.
 1.1 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.2.30.1 12-Feb-2005  yamt sync with head.
 1.2.28.1 29-Apr-2005  kent sync with -current
 1.2.20.1 04-Feb-2005  skrll Sync with HEAD.
 1.2.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.1 26-Nov-2001  thorpej file cs89x0isavar.h was added on branch kqueue on 2002-01-10 19:55:20 +0000
 1.2.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.1 26-Nov-2001  nathanw file cs89x0isavar.h was added on branch nathanw_sa on 2002-01-08 00:30:22 +0000
 1.3.6.1 03-Sep-2007  yamt sync with head.
 1.4.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.7 24-Nov-2001  yamt - add (partial?) i/o mode support.
- add partial cs8920 support.
- add detach code.
- add a quirk for EtherJet PCMCIA with cardbus bridge.
(above "partial" means "engough to support EtherJet PCMCIA")
 1.6 25-Jul-1998  thorpej branches: 1.6.26; 1.6.28;
Define the CS8900 memory size, and macros to test for valid memory
base and IRQ.
 1.5 21-Jul-1998  thorpej Define autonegotiation bits.
 1.4 21-Jul-1998  thorpej Define a couple more of the PacketPage registers.
 1.3 21-Jul-1998  thorpej Correct the name of the CS8920M id, and fix some whitespace lossage.
 1.2 21-Jul-1998  thorpej G/c unused definition.
 1.1 21-Jul-1998  thorpej Split the CS8900 register description from the SHARK-specific header file,
and place it here.
 1.6.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.26.1 28-Feb-2002  nathanw Catch up to -current.
 1.12 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.11 26-Nov-2001  yamt - add power management code.
- use ether_ioctl instead of its own code.
(make ifconfig down works properly.)
 1.10 24-Nov-2001  yamt - add (partial?) i/o mode support.
- add partial cs8920 support.
- add detach code.
- add a quirk for EtherJet PCMCIA with cardbus bridge.
(above "partial" means "engough to support EtherJet PCMCIA")
 1.9 28-Sep-2000  tsutsui branches: 1.9.2; 1.9.4;
6 -> ETHER_ADDR_LEN
 1.8 30-Mar-1999  mycroft branches: 1.8.8;
Enable this is a non-entropy rnd source.
 1.7 07-Aug-1998  thorpej Track our carrier status and report it in the media status callback.
 1.6 27-Jul-1998  thorpej Sigh, make this work with the i386 bus_space functions (which have debugging
glue in them, and thus subtle syntax quirks).
 1.5 27-Jul-1998  thorpej Split up the Shark CS8900 driver into front-ends and core back-end (which
is here, since the chip can only live on an ISA bus; only the autoconfig
glue is different).
 1.4 23-Jul-1998  thorpej Remember the product ID and revision.
 1.3 23-Jul-1998  thorpej G/c a now unsed config flag.
 1.2 21-Jul-1998  thorpej Add support for ifmedia.
 1.1 21-Jul-1998  thorpej Move the cs8900 driver's softc, etc. definitions to an MI location.
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.2.1 28-Feb-2002  nathanw Catch up to -current.
 1.16 25-Sep-1996  thorpej This file is now obsolete.
 1.15 05-Sep-1996  mycroft Remove cyselect().
 1.14 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.13 30-May-1996  cgd add tty_attach() where appropriate.
 1.12 28-Jun-1995  cgd branches: 1.12.6;
note that most of dev/ic's contents have changed names
 1.11 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.10 29-Jan-1995  cgd use chip headers in /dev/ic
 1.9 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.8 27-Oct-1994  cgd new RCS ID format.
 1.7 24-May-1994  mycroft MIN --> min
 1.6 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.5 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.4 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.3 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.2 29-Oct-1993  andrew ttyfree() bugfix edition, plus various minor tweaks.
 1.1 06-Oct-1993  andrew Cyclades Cyclom-{4/8/16}Y multiport async serial board driver.
 1.12.6.1 02-Jun-1996  mrg pull up tty stats "bug fix".
 1.24 20-Nov-2023  thorpej cy_isa_probe(): No need to put a ~3KB cy_softc on the stack.
 1.23 26-Mar-2008  matt split device_t/softc. Use aprint_*_dev and device_xname.
switch to device_lookup_private.
 1.22 19-Oct-2007  ad branches: 1.22.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 16-Nov-2006  christos branches: 1.21.8; 1.21.22; 1.21.24; 1.21.28;
__unused removal on arguments; approved by core.
 1.20 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.19 11-Dec-2005  christos branches: 1.19.20; 1.19.22;
merge ktrace-lwp.
 1.18 14-Sep-2004  drochner branches: 1.18.12;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.17 02-Oct-2002  thorpej branches: 1.17.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.16 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.13 13-Nov-2001  lukem add RCSID
 1.12 20-Jan-2001  thorpej branches: 1.12.2; 1.12.4;
Only need to pass a cy_softc * to cy_attach().
 1.11 20-Jan-2001  thorpej Clean up the PCI attachment a bit, and adjust the other pieces
to suit.
 1.10 09-Jun-1998  thorpej branches: 1.10.14;
Nuke __BROKEN_INDIRECT_CONFIG.
 1.9 31-Jan-1998  christos PR/4883: Andreas Wrede: Check for wildcard mem address not io ports.
 1.8 14-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.7 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.6 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.5 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.4 13-Oct-1996  christos backout kprintf changes
 1.3 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 26-Sep-1996  thorpej Fix a bus mem space leak; always unmap the card, regardless of the success
of cy_find().
 1.1 24-Sep-1996  christos New cyclades driver from Timo Rossi
 1.10.14.1 11-Feb-2001  bouyer Sync with HEAD.
 1.12.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.12.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.12.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.12.2.2 11-Jan-2002  nathanw More catchup.
 1.12.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.17.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.18.12.1 27-Oct-2007  yamt sync with head.
 1.19.22.2 10-Dec-2006  yamt sync with head.
 1.19.22.1 22-Oct-2006  yamt sync with head
 1.19.20.1 18-Nov-2006  ad Sync with head.
 1.21.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.24.1 06-Nov-2007  matt sync with HEAD
 1.21.22.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.21.8.1 23-Oct-2007  ad Sync with head.
 1.22.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.21 19-Sep-2018  maxv Remove daic(4), it has never been functional.

ok martin@
 1.20 27-Oct-2012  chs branches: 1.20.36; 1.20.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.19 12-May-2009  cegger branches: 1.19.12; 1.19.22;
struct device * -> device_t, no functional changes intended.
 1.18 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.16 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.15 28-Apr-2008  martin branches: 1.15.8; 1.15.14;
Remove clause 3 and 4 from TNF licenses
 1.14 19-Oct-2007  ad branches: 1.14.16; 1.14.18; 1.14.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 11-Dec-2005  christos branches: 1.13.30; 1.13.44; 1.13.46; 1.13.50;
merge ktrace-lwp.
 1.12 04-Feb-2005  perry branches: 1.12.6;
de-__P
 1.11 04-Dec-2003  keihan branches: 1.11.8; 1.11.10;
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.10 02-Oct-2002  thorpej branches: 1.10.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 14-Apr-2002  martin Fix copyright notice.
 1.6 25-Mar-2002  martin Fix confusion about the return value from the internal MI probe routine.
Make the ISA probe actually (silently) fail if no card is found.

XXX - need to aquire the SBUS variant of this card some day or have
Jaromir find an MCA one.
 1.5 22-Mar-2002  martin Bring the daic driver into the new ISDN world order.
Enable active card support in the ISDN subsystem. (Had been disabled since
it couldn't be tested before.)
 1.4 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.3 13-Nov-2001  lukem add RCSID
 1.2 13-Jun-2001  wiz branches: 1.2.2;
withough -> without
 1.1 18-Feb-2001  martin branches: 1.1.2; 1.1.4;
Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.4.1 18-Feb-2001  bouyer file daic_isa.c was added on branch thorpej_scsipi on 2001-03-12 13:30:36 +0000
 1.1.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.1.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.2.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.10.1 12-Feb-2005  yamt sync with head.
 1.11.8.1 29-Apr-2005  kent sync with -current
 1.12.6.1 27-Oct-2007  yamt sync with head.
 1.13.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.46.1 06-Nov-2007  matt sync with HEAD
 1.13.44.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.13.30.1 23-Oct-2007  ad Sync with head.
 1.14.20.3 16-May-2009  yamt sync with head
 1.14.20.2 04-May-2009  yamt sync with head.
 1.14.20.1 16-May-2008  yamt sync with head.
 1.14.18.1 18-May-2008  yamt sync with head.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.12.1 30-Oct-2012  yamt sync with head
 1.20.38.1 10-Jun-2019  christos Sync with HEAD
 1.20.36.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.16 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.15 19-Jan-2010  pooka branches: 1.15.12; 1.15.22;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.14 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13 04-Apr-2008  tsutsui branches: 1.13.2; 1.13.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.12 19-Oct-2007  ad branches: 1.12.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.11 16-Nov-2006  christos branches: 1.11.8; 1.11.22; 1.11.24; 1.11.28;
__unused removal on arguments; approved by core.
 1.10 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.9 11-Dec-2005  christos branches: 1.9.20; 1.9.22;
merge ktrace-lwp.
 1.8 14-Sep-2004  drochner branches: 1.8.12;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 11-Aug-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus. This board is commonly found
on Alpha Jensen systems.
 1.1.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.6.2 11-Jan-2002  nathanw More catchup.
 1.1.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.4.1 11-Aug-2000  bouyer file depca_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:12 +0000
 1.1.2.2 11-Aug-2000  thorpej Pullup from trunk:
Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus. This board is commonly found
on Alpha Jensen systems.
 1.1.2.1 11-Aug-2000  thorpej file depca_isa.c was added on branch netbsd-1-5 on 2000-08-11 18:16:51 +0000
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.12.2 27-Oct-2007  yamt sync with head.
 1.8.12.1 30-Dec-2006  yamt sync with head.
 1.9.22.2 10-Dec-2006  yamt sync with head.
 1.9.22.1 22-Oct-2006  yamt sync with head
 1.9.20.1 18-Nov-2006  ad Sync with head.
 1.11.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.11.24.1 06-Nov-2007  matt sync with HEAD
 1.11.22.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.11.8.1 23-Oct-2007  ad Sync with head.
 1.12.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.13.4.2 11-Mar-2010  yamt sync with head
 1.13.4.1 16-May-2008  yamt sync with head.
 1.13.2.1 18-May-2008  yamt sync with head.
 1.15.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.12.1 30-Oct-2012  yamt sync with head
 1.23 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.22 27-Oct-2012  chs branches: 1.22.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.21 07-Aug-2011  jakllsch branches: 1.21.2; 1.21.12;
Appease _LP64 build with GCC 4.5.
 1.20 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.19 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.18 19-Oct-2007  ad branches: 1.18.20; 1.18.34;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 16-Nov-2006  christos branches: 1.17.8; 1.17.22; 1.17.24; 1.17.28;
__unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 11-Dec-2005  christos branches: 1.15.20; 1.15.22;
merge ktrace-lwp.
 1.14 27-Feb-2005  perry branches: 1.14.4;
nuke trailing whitespace
 1.13 14-Sep-2004  drochner branches: 1.13.4; 1.13.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.12 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.11 07-Dec-2002  ad branches: 1.11.6;
Implement the DPT EATA ioctl() interface.
 1.10 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 07-Jan-2002  thorpej branches: 1.7.10;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.6 13-Nov-2001  lukem add RCSID
 1.5 25-Apr-2001  bouyer branches: 1.5.2;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.4 30-Jun-2000  ad branches: 1.4.2; 1.4.4;
Use my proper name in copyrights.
 1.3 25-Mar-2000  ad branches: 1.3.4;
The bus_space stuff handles byte order conversions for us.
 1.2 16-Mar-2000  ad Cosmetic change.
 1.1 24-Feb-2000  ad Add a DPT ISA HBA frontend, tested lightly with a PM2021A/9X. There are some
issues.
 1.3.4.1 06-Jul-2000  ad Pull-up revision 1.4: use my proper name in copyrights.

Approved by releng.
 1.4.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.4.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.4.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.4.3 11-Jan-2002  nathanw More catchup.
 1.4.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.3 01-Apr-2001  ad - Make this work.
- Restructure a bit.
- KNF, const.
 1.4.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 30-Jun-2000  bouyer file dpt_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:12 +0000
 1.5.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.10.1 12-Dec-2002  he Pull up revision 1.11 (requested by ad in ticket #1031):
Implement DPT EATA ioctl interface.
 1.11.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.14.4.2 27-Oct-2007  yamt sync with head.
 1.14.4.1 30-Dec-2006  yamt sync with head.
 1.15.22.2 10-Dec-2006  yamt sync with head.
 1.15.22.1 22-Oct-2006  yamt sync with head
 1.15.20.1 18-Nov-2006  ad Sync with head.
 1.17.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.17.24.1 06-Nov-2007  matt sync with HEAD
 1.17.22.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.17.8.1 23-Oct-2007  ad Sync with head.
 1.18.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.20.1 16-May-2009  yamt sync with head
 1.21.12.2 03-Dec-2017  jdolecek update from HEAD
 1.21.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.21.2.1 30-Oct-2012  yamt sync with head
 1.22.14.1 05-Oct-2016  skrll Sync with HEAD
 1.33 14-Jul-2025  andvar s/swith size/with the size/ and s/swich/switch/ in comments.
 1.32 07-Aug-2021  thorpej branches: 1.32.12;
Merge thorpej-cfargs2.
 1.31 24-Apr-2021  thorpej branches: 1.31.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.30 27-Oct-2012  chs branches: 1.30.54;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.29 12-May-2009  cegger branches: 1.29.12; 1.29.22;
struct device * -> device_t, no functional changes intended.
 1.28 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.27 16-Mar-2009  dsl ANSIfy functions with function-pointer arguments
 1.26 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.25 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.24 19-Oct-2007  ad branches: 1.24.20; 1.24.28; 1.24.34;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 28-Jul-2007  mjf branches: 1.23.4; 1.23.6; 1.23.10; 1.23.12;
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
 1.22 09-Jul-2007  ad branches: 1.22.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.21 04-Mar-2007  christos branches: 1.21.2; 1.21.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 12-Apr-2006  jmmv branches: 1.20.12; 1.20.14; 1.20.18;
Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.19 11-Dec-2005  christos branches: 1.19.4; 1.19.6; 1.19.8; 1.19.10; 1.19.12;
merge ktrace-lwp.
 1.18 27-Feb-2005  perry branches: 1.18.2; 1.18.4; 1.18.12; 1.18.14;
nuke trailing whitespace
 1.17 14-Sep-2004  drochner branches: 1.17.4; 1.17.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.16 24-Mar-2004  drochner branches: 1.16.2; 1.16.4; 1.16.6;
remove license clauses 3 and 4 from my cpoyright notices
 1.15 02-Oct-2002  thorpej branches: 1.15.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 07-Jul-2002  junyoung Remove __P.
 1.11 07-Jul-2002  junyoung Rename vc_ccol and vc_crow in struct pcdisplayscreen to cursorcol
and cursorrow, respectively, to be consistent with other members
in the structure.
 1.10 04-Jul-2002  junyoung alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.9 17-Mar-2002  atatat branches: 1.9.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.8 08-Jan-2002  christos Deal with lossage caused by recent isa changes [/briq potr]
 1.7 13-Nov-2001  lukem add RCSID
 1.6 18-Jul-2001  thorpej bcopy -> memcpy
 1.5 26-Jun-2000  simonb branches: 1.5.2; 1.5.4; 1.5.6;
Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.4 23-Mar-2000  thorpej branches: 1.4.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.3 25-Jan-2000  ad Finish with fixing the SOFTCURSOR stuff.
 1.2 05-Jan-2000  ad Use pcdisplay_cursor_init().
 1.1 13-Dec-1999  drochner branches: 1.1.2;
First cut on an EGA driver. For initial testing, lacks some EGA vs CGA/MGA
identification. Can share more code with VGA later.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.5.6.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.6.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.6.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.6.1 03-Aug-2001  lukem update to -current
 1.5.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.5.4.6 01-Aug-2002  nathanw Catch up to -current.
 1.5.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.5.4.3 11-Jan-2002  nathanw More catchup.
 1.5.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 26-Jun-2000  bouyer file ega.c was added on branch thorpej_scsipi on 2000-11-20 11:41:12 +0000
 1.9.4.1 15-Jul-2002  gehenna catch up with -current.
 1.15.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.16.6.1 12-Aug-2007  bouyer Pull up following revision(s) (requested by mjf in ticket #11348):
Pull up following revision(s) (requested by mjf in ticket #11348):
sys/dev/ic/pcdisplay_subr.c: revision 1.33 via patch
sys/dev/ic/vga_raster.c: revision 1.29 via patch
sys/dev/ic/vga.c: revision 1.95 via patch
sys/dev/rasops/rasops.c: revision 1.56 via patch
sys/dev/isa/ega.c: revision 1.23 via patch
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.16.4.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by mjf in ticket #11348):
sys/dev/ic/pcdisplay_subr.c: revision 1.33 via patch
sys/dev/ic/vga_raster.c: revision 1.29 via patch
sys/dev/ic/vga.c: revision 1.95 via patch
sys/dev/rasops/rasops.c: revision 1.56 via patch
sys/dev/isa/ega.c: revision 1.23 via patch
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.16.2.1 12-Aug-2007  bouyer Pull up following revision(s) (requested by mjf in ticket #11348):
Pull up following revision(s) (requested by mjf in ticket #11348):
sys/dev/ic/pcdisplay_subr.c: revision 1.33 via patch
sys/dev/ic/vga_raster.c: revision 1.29 via patch
sys/dev/ic/vga.c: revision 1.95 via patch
sys/dev/rasops/rasops.c: revision 1.56 via patch
sys/dev/isa/ega.c: revision 1.23 via patch
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.17.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.17.4.1 29-Apr-2005  kent sync with -current
 1.18.14.1 06-Aug-2007  ghen Pull up following revision(s) (requested by mjf in ticket #1815):
sys/dev/ic/pcdisplay_subr.c: revision 1.33 via patch
sys/dev/ic/vga_raster.c: revision 1.29 via patch
sys/dev/ic/vga.c: revision 1.95 via patch
sys/dev/rasops/rasops.c: revision 1.56 via patch
sys/dev/isa/ega.c: revision 1.23 via patch
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.18.12.1 06-Aug-2007  ghen Pull up following revision(s) (requested by mjf in ticket #1815):
sys/dev/ic/pcdisplay_subr.c: revision 1.33 via patch
sys/dev/ic/vga_raster.c: revision 1.29 via patch
sys/dev/ic/vga.c: revision 1.95 via patch
sys/dev/rasops/rasops.c: revision 1.56 via patch
sys/dev/isa/ega.c: revision 1.23 via patch
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.18.4.3 27-Oct-2007  yamt sync with head.
 1.18.4.2 03-Sep-2007  yamt sync with head.
 1.18.4.1 21-Jun-2006  yamt sync with head.
 1.18.2.1 06-Aug-2007  ghen Pull up following revision(s) (requested by mjf in ticket #1815):
sys/dev/ic/pcdisplay_subr.c: revision 1.33 via patch
sys/dev/ic/vga_raster.c: revision 1.29 via patch
sys/dev/ic/vga.c: revision 1.95 via patch
sys/dev/rasops/rasops.c: revision 1.56 via patch
sys/dev/isa/ega.c: revision 1.23 via patch
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.19.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.19.10.1 19-Apr-2006  elad sync with head.
 1.19.8.1 24-May-2006  yamt sync with head.
 1.19.6.1 22-Apr-2006  simonb Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.20.18.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.20.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.12.1 30-Jul-2007  liamjfoy Pull up following revision(s) (requested by mjf in ticket #799):
sys/dev/ic/pcdisplay_subr.c: revision 1.33
sys/dev/wscons/wsdisplay_vcons.c: revision 1.12
sys/dev/wscons/wsdisplay_vcons.c: revision 1.13
sys/dev/ic/vga_raster.c: revision 1.29
sys/dev/pci/chipsfb.c: revision 1.10
sys/dev/ic/vga.c: revision 1.95
sys/dev/rasops/rasops.c: revision 1.56
sys/dev/isa/ega.c: revision 1.23
Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
Set the 'ri' pointer before use.
 1.21.4.1 11-Jul-2007  mjf Sync with head.
 1.21.2.3 23-Oct-2007  ad Sync with head.
 1.21.2.2 20-Aug-2007  ad Sync with HEAD.
 1.21.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.22.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.23.12.2 28-Jul-2007  mjf Implement bounds checking in some places in display driver code to avoid
the possibility of a local user panic.
 1.23.12.1 28-Jul-2007  mjf file ega.c was added on branch matt-mips64 on 2007-07-28 20:28:58 +0000
 1.23.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.6.1 06-Nov-2007  matt sync with HEAD
 1.23.4.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.24.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.24.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.24.20.2 16-May-2009  yamt sync with head
 1.24.20.1 04-May-2009  yamt sync with head.
 1.29.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.29.12.1 30-Oct-2012  yamt sync with head
 1.30.54.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.31.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.32.12.1 02-Aug-2025  perseant Sync with HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 24-Mar-2004  drochner remove license clauses 3 and 4 from my cpoyright notices
 1.2 07-Jul-2002  junyoung branches: 1.2.6;
Remove __P.
 1.1 13-Dec-1999  drochner branches: 1.1.2; 1.1.8; 1.1.10; 1.1.12; 1.1.24;
First cut on an EGA driver. For initial testing, lacks some EGA vs CGA/MGA
identification. Can share more code with VGA later.
 1.1.24.1 15-Jul-2002  gehenna catch up with -current.
 1.1.12.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.10.1 01-Aug-2002  nathanw Catch up to -current.
 1.1.8.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.8.1 13-Dec-1999  bouyer file egavar.h was added on branch thorpej_scsipi on 2000-11-20 11:41:12 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19 25-Sep-2022  thorpej malloc(9) -> kmem(9)
 1.18 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.17 14-Mar-2009  dsl branches: 1.17.64;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16 28-Apr-2008  martin branches: 1.16.8; 1.16.14;
Remove clause 3 and 4 from TNF licenses
 1.15 19-Oct-2007  ad branches: 1.15.16; 1.15.18; 1.15.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 13-Nov-2001  lukem branches: 1.14.32; 1.14.74; 1.14.88; 1.14.90; 1.14.94;
add RCSID
 1.13 30-Mar-2000  augustss branches: 1.13.6; 1.13.8;
Remove register declarations.
 1.12 15-Aug-1998  mycroft branches: 1.12.12;
Assign copyrights to TNF.
 1.11 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.10 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.9 03-May-1996  christos - Fix random return value in the probe function.
- Add <sys/systm.h> to get prototypes
 1.8 30-Apr-1996  thorpej Adapt the elink_reset() and elink_idseq() routines for <machine/bus.h>.
In elink_reset(), since some machines may have more than one ISA bus,
implement a way of keeping track of which ISA bus has received an
elink_reset(); The static variable which was used previously didn't
scale.
 1.7 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.6 07-Jan-1995  mycroft Actually, do the ID reset in elink_reset().
 1.5 06-Jan-1995  mycroft Do the reset in the individual drivers, not in elink_idseq().
 1.4 03-Jan-1995  hpeyerl This is correct according to the docs on both cards.
Doesn't seem to make any difference to the known problems though.
 1.3 27-Oct-1994  cgd new RCS ID format.
 1.2 16-Feb-1994  mycroft Add copyright notices.
 1.1 16-Feb-1994  mycroft Move elink_reset() into a separate file, and add a generic elink_idseq().
 1.12.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.14.94.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.90.1 06-Nov-2007  matt sync with HEAD
 1.14.88.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.14.74.1 23-Oct-2007  ad Sync with head.
 1.14.32.1 27-Oct-2007  yamt sync with head.
 1.15.20.2 04-May-2009  yamt sync with head.
 1.15.20.1 16-May-2008  yamt sync with head.
 1.15.18.1 18-May-2008  yamt sync with head.
 1.15.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.17.64.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.11 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.70; 1.10.72; 1.10.74;
merge ktrace-lwp.
 1.9 04-Feb-2005  perry de-__P
 1.8 22-Mar-1999  bad branches: 1.8.42; 1.8.50; 1.8.52;
Add TLINK_619_POLY.
 1.7 15-Aug-1998  mycroft Assign copyrights to TNF.
 1.6 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.5 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.4 30-Apr-1996  thorpej Adapt the elink_reset() and elink_idseq() routines for <machine/bus.h>.
In elink_reset(), since some machines may have more than one ISA bus,
implement a way of keeping track of which ISA bus has received an
elink_reset(); The static variable which was used previously didn't
scale.
 1.3 27-Oct-1994  cgd new RCS ID format.
 1.2 16-Feb-1994  mycroft Add copyright notices.
 1.1 16-Feb-1994  mycroft Move elink_reset() into a separate file, and add a generic elink_idseq().
 1.8.52.1 12-Feb-2005  yamt sync with head.
 1.8.50.1 29-Apr-2005  kent sync with -current
 1.8.42.1 04-Feb-2005  skrll Sync with HEAD.
 1.10.74.1 16-May-2008  yamt sync with head.
 1.10.72.1 18-May-2008  yamt sync with head.
 1.10.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.37 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.36 28-Apr-2008  martin branches: 1.36.44;
Remove clause 3 and 4 from TNF licenses
 1.35 13-Apr-2008  tsutsui branches: 1.35.2; 1.35.4;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.34 08-Apr-2008  cegger use aprint_*_dev and device_xname
 1.33 19-Oct-2007  ad branches: 1.33.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.32 04-Mar-2007  christos branches: 1.32.2; 1.32.14; 1.32.16; 1.32.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.31 11-Dec-2005  christos branches: 1.31.26;
merge ktrace-lwp.
 1.30 27-Feb-2005  perry branches: 1.30.4;
nuke trailing whitespace
 1.29 04-Feb-2005  perry de-__P
 1.28 14-Sep-2004  drochner branches: 1.28.4; 1.28.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.27 02-Oct-2002  thorpej branches: 1.27.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.26 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.25 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.24 08-Jan-2002  christos Deal with lossage caused by recent isa changes [/briq potr]
 1.23 13-Nov-2001  lukem add RCSID
 1.22 25-Apr-2001  bouyer branches: 1.22.2;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.21 05-Jun-2000  tsutsui branches: 1.21.4;
Adapt MI ncr53c9x changes.
 1.20 20-Mar-2000  tsutsui branches: 1.20.2;
Cosmetics. ( 0x80 -> NCRSTAT_INT )
 1.19 19-Mar-2000  mycroft Adapt to ncr53c9x change.
 1.18 18-Mar-2000  mycroft esp -> esp_isa
 1.17 18-Mar-2000  mycroft esp -> esp_isa
 1.16 19-Nov-1998  thorpej branches: 1.16.10;
Adapt to the new scsipi_adapter interface.
 1.15 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.

Inspired by PR #6090, from Matt Jacob.
 1.14 05-Sep-1998  pk Relinquish my copyright claim on this file.
 1.13 15-Aug-1998  mycroft Minor edit.
 1.12 15-Aug-1998  mycroft Assign copyright to TNF.
 1.11 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.10 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.9 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.8 14-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.7 12-Jan-1998  thorpej Update for config changes.
 1.6 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.5 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.4 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.3 06-Jun-1997  thorpej branches: 1.3.2; 1.3.4;
Pull thorpej-bus-dma branch into mainline.
 1.2 18-May-1997  thorpej branches: 1.2.2;
Add NetBSD RCS IDs.
 1.1 17-May-1997  pk An ESP406/FAS408 ISA SCSI adapter driver (from Eric S. Hvozda; PR#3581)
 1.2.2.2 18-May-1997  thorpej Update for new calling convention of isa_dma*() functions.
 1.2.2.1 18-May-1997  thorpej file esp_isa.c was added on branch thorpej-bus-dma on 1997-05-18 06:15:32 +0000
 1.3.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.16.10.2 22-Jan-2001  bouyer fill in adapt_minphys and adapt_request
 1.16.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.20.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.21.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.21.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.21.4.3 11-Jan-2002  nathanw More catchup.
 1.21.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.21.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.22.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.27.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.27.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.27.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.28.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.6.1 12-Feb-2005  yamt sync with head.
 1.28.4.1 29-Apr-2005  kent sync with -current
 1.30.4.2 27-Oct-2007  yamt sync with head.
 1.30.4.1 03-Sep-2007  yamt sync with head.
 1.31.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.32.16.1 06-Nov-2007  matt sync with HEAD
 1.32.14.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.32.2.1 23-Oct-2007  ad Sync with head.
 1.33.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.35.4.1 16-May-2008  yamt sync with head.
 1.35.2.1 18-May-2008  yamt sync with head.
 1.36.44.1 03-Dec-2017  jdolecek update from HEAD
 1.5 13-Apr-2008  tsutsui Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.4 11-Dec-2005  christos branches: 1.4.70;
merge ktrace-lwp.
 1.3 04-Feb-2005  perry de-__P
 1.2 19-Mar-2000  mycroft branches: 1.2.6; 1.2.30; 1.2.38; 1.2.40;
Adapt to ncr53c9x change.
 1.1 18-Mar-2000  mycroft esp -> esp_isa
 1.2.40.1 12-Feb-2005  yamt sync with head.
 1.2.38.1 29-Apr-2005  kent sync with -current
 1.2.30.1 04-Feb-2005  skrll Sync with HEAD.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 19-Mar-2000  bouyer file esp_isavar.h was added on branch thorpej_scsipi on 2000-11-20 11:41:13 +0000
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5 18-Mar-2000  mycroft esp -> esp_isa
 1.4 19-Feb-1999  mycroft branches: 1.4.8;
Kill vestiges of isa_establish().
 1.3 14-Jan-1998  drochner "device" structure is not used in probe anymore
 1.2 18-May-1997  thorpej Add NetBSD RCS IDs.
 1.1 17-May-1997  pk An ESP406/FAS408 ISA SCSI adapter driver (from Eric S. Hvozda; PR#3581)
 1.4.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.91 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.90 24-Dec-2022  andvar s/reqest/request/, s/requst/request/ and s/reuqest/request/ in comments.
 1.89 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.88 26-Apr-2021  thorpej branches: 1.88.6;
- The "ess" device does not need a "midibus" interface attribute; it
attaches an "opl" instance which itself attaches the "midi".
- Be explicit about using the "ess" interface attribute when attaching
the "joy" and "opl" instances.
 1.87 24-Apr-2021  thorpej branches: 1.87.2;
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.86 08-Jun-2019  isaki branches: 1.86.12;
Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.85 08-May-2019  isaki 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.84 16-Mar-2019  isaki branches: 1.84.2;
Use C99 style struct initializer to audio_hw_if.
 1.83 14-Jul-2016  msaitoh branches: 1.83.18;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.82 16-Aug-2014  nakayama branches: 1.82.2;
Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).

Tested on my old laptop, mobio NX.
 1.81 15-Aug-2014  nakayama Remove redundant colon.
 1.80 24-Nov-2011  mrg branches: 1.80.8; 1.80.24;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.79 23-Nov-2011  jmcneill 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.78 22-May-2010  tsutsui branches: 1.78.8; 1.78.10;
Split device_t/softc. Based on patch from cegger@.
ess_pnpbios.c and ess_ofisa.c fixes by me.

Tested on ess_isapnp.c, and no crash with ess_ofisa.c on shark.
 1.77 23-Jan-2010  cegger branches: 1.77.2; 1.77.4;
essattach: printf -> aprint_*
 1.76 08-Apr-2008  cegger branches: 1.76.4; 1.76.16;
use aprint_*_dev and device_xname
 1.75 19-Oct-2007  ad branches: 1.75.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.74 09-Jul-2007  ad branches: 1.74.6; 1.74.8; 1.74.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.73 16-Nov-2006  christos branches: 1.73.6; 1.73.8; 1.73.10;
__unused removal on arguments; approved by core.
 1.72 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.71 04-Oct-2006  christos Fix empty if
 1.70 30-Aug-2006  christos branches: 1.70.2; 1.70.4;
fix incomplete initializer
 1.69 11-Dec-2005  christos branches: 1.69.4; 1.69.8;
merge ktrace-lwp.
 1.68 30-May-2005  christos branches: 1.68.2;
- add const
- avoid variable shadowing.
 1.67 27-Feb-2005  perry nuke trailing whitespace
 1.66 13-Jan-2005  kent branches: 1.66.2; 1.66.4;
ansify and KNF
 1.65 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.64 29-Oct-2004  yamt branches: 1.64.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.63 07-Aug-2004  mycroft Attempt to support the 688 as well. It looks vaguely right from inspecting
esl.
 1.62 06-Aug-2004  mycroft Add code to recognize the 1688, per PR 11910. Also reduce some control logic.
 1.61 04-Aug-2004  drochner This is definitely what the world has been waiting for:-)
Allow to enable the game port on an ES1888, in case the firmware didn't
this. (Otherwise we still rely on the firmware having mapped the sound
related registers.)
Limit this to the "isa" attachment for now because this is the only
one I'm able to test.
Attach the "joy" device directly at "ess" to make sure the port is
enabled before the "joy" probe/attach.
This makes the joystick port usable on a "PWS" alpha (Miata).
 1.60 09-Jul-2004  mycroft Don't halt in the close routine.
Don't reset in the open routine -- this causes our mute settings to get
toasted.
 1.59 22-Apr-2004  itojun sprintf -> snprintf
 1.58 09-May-2003  fvdl branches: 1.58.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.57 03-May-2003  wiz DMA, not dma nor Dma.
 1.56 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.55 13-Nov-2001  lukem add RCSID
 1.54 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.53 06-Jan-2001  nathanw branches: 1.53.2; 1.53.4; 1.53.6;
Do ess_config_addr() in the ofisa front end, rather than in the match
routine. Prevents problems with non-SCR ess chips, as described in
PR 11630.
 1.52 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.51 23-Mar-2000  thorpej branches: 1.51.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.50 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.49 18-Jan-2000  mycroft Mute the DAC -- not the master volume -- on close, so that CD passthrough is
unaffected.
 1.48 02-Nov-1999  augustss Set mixer controls after a reset.
 1.47 01-Nov-1999  augustss Make little endian and big endian version of all functions
that deal with 16 bit samples. Let the drivers decide which ones
to use.
 1.46 18-Jun-1999  augustss branches: 1.46.2; 1.46.4; 1.46.6;
Add support for ES18[67][89]. From PR #7427 by AW9K-NNK@asahi-net.or.jp,
Nonaka Kimihiro.
 1.45 30-May-1999  nathanw Fix bug uncovered by audio.c fix: Since the monitor control on the ESS
is a muting control, not a level control, change the name to reflect that.

XXX The fact that the audio code depends on the string names of the
XXX mixer devices is bogus.
 1.44 19-Mar-1999  mycroft branches: 1.44.2; 1.44.4; 1.44.6;
Allow DRQ[A-C] to be used on the 1888 as well.
 1.43 18-Mar-1999  mycroft dmapos should start at 0, in theory.
Also experimentally force polling mode.
 1.42 18-Mar-1999  mycroft Add support for polling.
 1.41 18-Mar-1999  mycroft Confirm that there was an interrupt before handling it. Allows IRQs to be
shared with other devices.
 1.40 17-Mar-1999  mycroft Fix a couple of other places we should avoid the Audio2 DRQ on the 1788.
 1.39 17-Mar-1999  mycroft More redux:
* Use a single routine to halt both input and output on Audio1.
* Reduce the number of register reads/writes used to set up a channel.
* A few other minor things.
 1.38 16-Mar-1999  mycroft Audio1 does not support 16-bit DMA. Eliminate some code that tried to handle
that case.
 1.37 16-Mar-1999  mycroft Fix old typo.
 1.36 16-Mar-1999  mycroft A little more cleanup.
 1.35 16-Mar-1999  mycroft Minor fix to some debugging output.
 1.34 16-Mar-1999  mycroft Clean up the previous:
* Separate the interrupt handlers based on which channel (audio1/audio2)
rather than which direction (input/output). Only register the handler for
audio1 on the 1788.
* Since the input sides are actually the same, GC the duplicated code.
* Re-KNF in a bunch of places.
* Make this work again on the 1887 in the Shark.
 1.33 02-Mar-1999  nathanw Add support for the 1788 AudioDrive chip.
Some minor cleanup; refer to more registers by macros rather
than raw hex constants.
 1.32 22-Feb-1999  mycroft Use DMAMODE_LOOPDEMAND.
Fixes the audible glitches (due to FIFO underruns) when receiving network
packets on the Shark.
 1.31 20-Feb-1999  mycroft Fix the halt_input and halt_output routines to actually disable the channel,
not just the DMA FIFO. Fixes problems with sample misalignment.
 1.30 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.29 17-Feb-1999  mycroft If we have an 8-bit DRQ, always pass that to isa_malloc().
 1.28 08-Jan-1999  augustss Fix more `void *' arithmetic.
 1.27 25-Nov-1998  mycroft Minor format change.
 1.26 26-Aug-1998  augustss Less debug printing.
 1.25 26-Aug-1998  augustss Make the OPL driver turn on the sound on sound cards that require it.
That makes it much more likely that we get any sound. DUH!
 1.24 22-Aug-1998  augustss Let opl attach to ess.
WARNING: it doesn't work yet.
 1.23 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.22 12-Aug-1998  mycroft The mic preamp is really a property of the input stage, and affects both
pass-through and recording.
 1.21 12-Aug-1998  mycroft enhanced -> preamp
 1.20 11-Aug-1998  matthias ess_audio_channel:active is now used even when DIAGNOSTICS is not defined.
 1.19 10-Aug-1998  mycroft Use the new trigger interface.
 1.18 09-Aug-1998  mycroft Use 4- and 8-byte DMA transfers.
 1.17 09-Aug-1998  mycroft Don't actually touch the hardware in set_params; defer that until we actually
start a transfer. Instead, just check that the parameters are valid.
Also, use 16-bit output for u-law and a-law.
 1.16 09-Aug-1998  mycroft Oops; fix typo.
 1.15 09-Aug-1998  mycroft Clarify with a specific reference to the manual page in question.
 1.14 09-Aug-1998  mycroft Make the previous slightly more robust, and set AUDIO_PROP_INDEPENDENT.
 1.13 09-Aug-1998  mycroft Make sure the sample rate is the same on both channels, tracking the change
from one channel to the other if only one is active.
 1.12 09-Aug-1998  mycroft The manual says to use the other crystal for 22050Hz.
 1.11 09-Aug-1998  mycroft Set the FIFO control bits correctly so that stereo recording works.
 1.10 09-Aug-1998  mycroft Use auto-initialize DMA for recording.
 1.9 08-Aug-1998  mycroft Sleeping forever kinda sucks.
 1.8 08-Aug-1998  mycroft Set the correct modes for the record channel.
 1.7 07-Aug-1998  matt Make the irq checking logic somewhat less bogus.
 1.6 04-Aug-1998  augustss Use looping DMA for play channel.
More cleanup.
 1.5 31-Jul-1998  augustss Make it compile without DIAGNOSTIC
 1.4 31-Jul-1998  augustss Major cleanup of the ESS driver. It now sorta works. More to come.
 1.3 30-Jul-1998  thorpej Squash unused variable.
 1.2 30-Jul-1998  augustss A first stab at making the SHARK sound work. It doesn't really work
yet, but it probes and makes a noise when used. Stay tuned!
 1.1 29-Jun-1998  augustss branches: 1.1.2;
A first stab at an ESS1887 driver. The code is from the SHARK port
and needs a lot of polishing. The code compiles (on i386), but is
untested. See ess.c for a TODO list.
 1.1.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.44.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.44.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.44.2.2 20-Jan-2000  he Pull up revision 1.49 (requested by mycroft):
Make CD passthrough work when the audio playback/record device
is closed.
 1.44.2.1 22-Jun-1999  perry pullup 1.44->1.45 (nathanw)
 1.46.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.46.4.1 15-Nov-1999  fvdl Sync with -current
 1.46.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.46.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.51.4.2 25-Jan-2001  jhawk Pull up revision 1.53 (requested by nathanw):
Support certain ISAPnP ESS 1868 and 1869 cards. Per PR port-i386/11630.
 1.51.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.53.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.53.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.53.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.53.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.58.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.58.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.58.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.58.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.58.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.58.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.58.2.2 12-Aug-2004  skrll Sync with HEAD.
 1.58.2.1 03-Aug-2004  skrll Sync with HEAD
 1.64.2.2 09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.64.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.66.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.66.2.1 29-Apr-2005  kent sync with -current
 1.68.2.3 27-Oct-2007  yamt sync with head.
 1.68.2.2 03-Sep-2007  yamt sync with head.
 1.68.2.1 30-Dec-2006  yamt sync with head.
 1.69.8.1 03-Sep-2006  yamt sync with head.
 1.69.4.1 09-Sep-2006  rpaulo sync with head
 1.70.4.2 10-Dec-2006  yamt sync with head.
 1.70.4.1 22-Oct-2006  yamt sync with head
 1.70.2.1 18-Nov-2006  ad Sync with head.
 1.73.10.1 11-Jul-2007  mjf Sync with head.
 1.73.8.2 23-Oct-2007  ad Sync with head.
 1.73.8.1 01-Jul-2007  ad Adapt to callout API change.
 1.73.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.74.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.74.8.1 06-Nov-2007  matt sync with HEAD
 1.74.6.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.75.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.76.16.2 12-Dec-2008  ad Checkpoint work in progress.
 1.76.16.1 11-Dec-2008  ad Checkpoint work in progress.
 1.76.4.2 11-Aug-2010  yamt sync with head.
 1.76.4.1 11-Mar-2010  yamt sync with head
 1.77.4.1 30-May-2010  rmind sync with head
 1.77.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.78.10.3 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.78.10.2 20-Nov-2011  mrg make sure to return from the end of essattach() before destroying
the callouts and mutexes. with an uncommited audio.c change, i can
now play audio on my shark with the branch.
 1.78.10.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.78.8.1 17-Apr-2012  yamt sync with head
 1.80.24.1 23-Aug-2014  riz Pull up following revision(s) (requested by nakayama in ticket #50):
sys/dev/isa/ess.c: revision 1.81
sys/dev/isa/ess.c: revision 1.82
sys/dev/isa/essvar.h: revision 1.27
sys/dev/isa/essreg.h: revision 1.17
Remove redundant colon.
Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).
Tested on my old laptop, mobio NX.
 1.80.8.1 03-Dec-2017  jdolecek update from HEAD
 1.82.2.1 05-Oct-2016  skrll Sync with HEAD
 1.83.18.1 10-Jun-2019  christos Sync with HEAD
 1.84.2.4 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.84.2.3 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.84.2.2 25-Apr-2019  isaki Adapt to audio2.
- Drop INDEPENDENT property. Both play and rec share the sample rate.
 1.84.2.1 21-Apr-2019  isaki Use C99 style struct initializer to audio_format.
 1.86.12.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.87.2.1 13-May-2021  thorpej Sync with HEAD.
 1.88.6.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.24 22-May-2010  tsutsui Split device_t/softc. Based on patch from cegger@.
ess_pnpbios.c and ess_ofisa.c fixes by me.

Tested on ess_isapnp.c, and no crash with ess_ofisa.c on shark.
 1.23 29-Sep-2009  cegger branches: 1.23.2; 1.23.4;
use aprint_* in attach routines
 1.22 05-May-2009  cegger struct device * -> device_t, use device_private()
 1.21 28-Apr-2008  martin branches: 1.21.14;
Remove clause 3 and 4 from TNF licenses
 1.20 08-Apr-2008  cegger branches: 1.20.2; 1.20.4;
use aprint_*_dev and device_xname
 1.19 19-Oct-2007  ad branches: 1.19.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.18 16-Nov-2006  christos branches: 1.18.8; 1.18.22; 1.18.24; 1.18.28;
__unused removal on arguments; approved by core.
 1.17 20-Oct-2006  reinoud Define DPRINTF(x) as an empty block to prevent gcc from complaining about
empty statements. This is still an empty statement but it will be filtered
out still.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 29-Mar-2006  thorpej branches: 1.15.8; 1.15.10;
Use device_cfdata().
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.6; 1.14.8; 1.14.10; 1.14.12;
merge ktrace-lwp.
 1.13 13-Jan-2005  kent branches: 1.13.10;
ansify and KNF
 1.12 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.11 04-Aug-2004  drochner This is definitely what the world has been waiting for:-)
Allow to enable the game port on an ES1888, in case the firmware didn't
this. (Otherwise we still rely on the firmware having mapped the sound
related registers.)
Limit this to the "isa" attachment for now because this is the only
one I'm able to test.
Attach the "joy" device directly at "ess" to make sure the port is
enabled before the "joy" probe/attach.
This makes the joystick port usable on a "PWS" alpha (Miata).
 1.10 02-Oct-2002  thorpej branches: 1.10.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.6 13-Nov-2001  lukem add RCSID
 1.5 18-Jun-1999  augustss branches: 1.5.14; 1.5.16;
Add support for ES18[67][89]. From PR #7427 by AW9K-NNK@asahi-net.or.jp,
Nonaka Kimihiro.
 1.4 18-Mar-1999  mycroft branches: 1.4.4;
Also fix ia_iosize.
 1.3 18-Mar-1999  mycroft Some fixes to the IRQ/DRQ configuration, and the probe output.
 1.2 16-Mar-1999  mycroft Adjustments for structure name changes.
 1.1 02-Mar-1999  nathanw Add ISA attachment for ess chips.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.14.2 18-Oct-2002  nathanw Catch up to -current.
 1.5.14.1 28-Feb-2002  nathanw Catch up to -current.
 1.10.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 12-Aug-2004  skrll Sync with HEAD.
 1.13.10.3 27-Oct-2007  yamt sync with head.
 1.13.10.2 30-Dec-2006  yamt sync with head.
 1.13.10.1 21-Jun-2006  yamt sync with head.
 1.14.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.14.10.1 19-Apr-2006  elad sync with head.
 1.14.8.1 01-Apr-2006  yamt sync with head.
 1.14.6.1 22-Apr-2006  simonb Sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.10.2 10-Dec-2006  yamt sync with head.
 1.15.10.1 22-Oct-2006  yamt sync with head
 1.15.8.1 18-Nov-2006  ad Sync with head.
 1.18.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.24.1 06-Nov-2007  matt sync with HEAD
 1.18.22.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.18.8.1 23-Oct-2007  ad Sync with head.
 1.19.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.4.4 11-Aug-2010  yamt sync with head.
 1.20.4.3 11-Mar-2010  yamt sync with head
 1.20.4.2 16-May-2009  yamt sync with head
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.4.1 30-May-2010  rmind sync with head
 1.23.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.18 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.17 16-Aug-2014  nakayama Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).

Tested on my old laptop, mobio NX.
 1.16 11-Dec-2005  christos branches: 1.16.120; 1.16.138;
merge ktrace-lwp.
 1.15 13-Jan-2005  kent ansify and KNF
 1.14 06-Aug-2004  mycroft Add code to recognize the 1688, per PR 11910. Also reduce some control logic.
 1.13 29-Sep-2001  augustss branches: 1.13.18;
Add a missing command.
 1.12 18-Jun-1999  augustss branches: 1.12.14; 1.12.16; 1.12.18;
Add support for ES18[67][89]. From PR #7427 by AW9K-NNK@asahi-net.or.jp,
Nonaka Kimihiro.
 1.11 19-Mar-1999  mycroft branches: 1.11.4;
Allow DRQ[A-C] to be used on the 1888 as well.
 1.10 18-Mar-1999  mycroft The chip is only rated for 44.1KHz, and will not record faster that 46.794KHz,
so adjust ESS_MAXRATE. ESS_MINRATE was also wrong, not that anyone cares.
 1.9 16-Mar-1999  mycroft Clean up the previous:
* Separate the interrupt handlers based on which channel (audio1/audio2)
rather than which direction (input/output). Only register the handler for
audio1 on the 1788.
* Since the input sides are actually the same, GC the duplicated code.
* Re-KNF in a bunch of places.
* Make this work again on the 1887 in the Shark.
 1.8 02-Mar-1999  nathanw Add support for the 1788 AudioDrive chip.
Some minor cleanup; refer to more registers by macros rather
than raw hex constants.
 1.7 15-Feb-1999  hubertf RCS ID police
 1.6 09-Aug-1998  mycroft Set the FIFO control bits correctly so that stereo recording works.
 1.5 09-Aug-1998  mycroft Use auto-initialize DMA for recording.
 1.4 05-Aug-1998  augustss Add macro to test iobase validity.
 1.3 04-Aug-1998  augustss Use looping DMA for play channel.
More cleanup.
 1.2 31-Jul-1998  augustss Major cleanup of the ESS driver. It now sorta works. More to come.
 1.1 29-Jun-1998  augustss branches: 1.1.2;
A first stab at an ESS1887 driver. The code is from the SHARK port
and needs a lot of polishing. The code compiles (on i386), but is
untested. See ess.c for a TODO list.
 1.1.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.11.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.18.1 01-Oct-2001  fvdl Catch up with -current.
 1.12.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.14.1 08-Oct-2001  nathanw Catch up to -current.
 1.13.18.4 17-Jan-2005  skrll Sync with HEAD.
 1.13.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.18.1 12-Aug-2004  skrll Sync with HEAD.
 1.16.138.1 23-Aug-2014  riz Pull up following revision(s) (requested by nakayama in ticket #50):
sys/dev/isa/ess.c: revision 1.81
sys/dev/isa/ess.c: revision 1.82
sys/dev/isa/essvar.h: revision 1.27
sys/dev/isa/essreg.h: revision 1.17
Remove redundant colon.
Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).
Tested on my old laptop, mobio NX.
 1.16.120.1 03-Dec-2017  jdolecek update from HEAD
 1.27 16-Aug-2014  nakayama Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).

Tested on my old laptop, mobio NX.
 1.26 23-Nov-2011  jmcneill branches: 1.26.8; 1.26.24;
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.25 22-May-2010  tsutsui branches: 1.25.8; 1.25.10;
Split device_t/softc. Based on patch from cegger@.
ess_pnpbios.c and ess_ofisa.c fixes by me.

Tested on ess_isapnp.c, and no crash with ess_ofisa.c on shark.
 1.24 11-Dec-2005  christos branches: 1.24.28; 1.24.74; 1.24.88; 1.24.96; 1.24.98;
merge ktrace-lwp.
 1.23 27-Feb-2005  perry nuke trailing whitespace
 1.22 13-Jan-2005  kent branches: 1.22.2; 1.22.4;
ansify and KNF
 1.21 07-Aug-2004  mycroft Attempt to support the 688 as well. It looks vaguely right from inspecting
esl.
 1.20 06-Aug-2004  mycroft Add code to recognize the 1688, per PR 11910. Also reduce some control logic.
 1.19 04-Aug-2004  drochner This is definitely what the world has been waiting for:-)
Allow to enable the game port on an ES1888, in case the firmware didn't
this. (Otherwise we still rely on the firmware having mapped the sound
related registers.)
Limit this to the "isa" attachment for now because this is the only
one I'm able to test.
Attach the "joy" device directly at "ess" to make sure the port is
enabled before the "joy" probe/attach.
This makes the joystick port usable on a "PWS" alpha (Miata).
 1.18 06-Jan-2001  nathanw branches: 1.18.24;
Do ess_config_addr() in the ofisa front end, rather than in the match
routine. Prevents problems with non-SCR ess chips, as described in
PR 11630.
 1.17 23-Mar-2000  thorpej branches: 1.17.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.16 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.15 18-Jun-1999  augustss branches: 1.15.2;
Add support for ES18[67][89]. From PR #7427 by AW9K-NNK@asahi-net.or.jp,
Nonaka Kimihiro.
 1.14 18-Mar-1999  mycroft branches: 1.14.4;
Add support for polling.
 1.13 16-Mar-1999  mycroft Clean up the previous:
* Separate the interrupt handlers based on which channel (audio1/audio2)
rather than which direction (input/output). Only register the handler for
audio1 on the 1788.
* Since the input sides are actually the same, GC the duplicated code.
* Re-KNF in a bunch of places.
* Make this work again on the 1887 in the Shark.
 1.12 02-Mar-1999  nathanw Add support for the 1788 AudioDrive chip.
Some minor cleanup; refer to more registers by macros rather
than raw hex constants.
 1.11 19-Feb-1999  mycroft Kill vestiges of isa_establish().
 1.10 15-Feb-1999  hubertf RCS ID police
 1.9 11-Aug-1998  matthias ess_audio_channel:active is now used even when DIAGNOSTICS is not defined.
 1.8 10-Aug-1998  matt Remove unused field (sc_ih) in ess_softc (interrupt handlers are kept
in a per-direction structure).
 1.7 10-Aug-1998  mycroft Use the new trigger interface.
 1.6 09-Aug-1998  mycroft Don't actually touch the hardware in set_params; defer that until we actually
start a transfer. Instead, just check that the parameters are valid.
Also, use 16-bit output for u-law and a-law.
 1.5 09-Aug-1998  mycroft Make sure the sample rate is the same on both channels, tracking the change
from one channel to the other if only one is active.
 1.4 04-Aug-1998  augustss Use looping DMA for play channel.
More cleanup.
 1.3 31-Jul-1998  augustss Major cleanup of the ESS driver. It now sorta works. More to come.
 1.2 30-Jul-1998  augustss A first stab at making the SHARK sound work. It doesn't really work
yet, but it probes and makes a noise when used. Stay tuned!
 1.1 29-Jun-1998  augustss branches: 1.1.2;
A first stab at an ESS1887 driver. The code is from the SHARK port
and needs a lot of polishing. The code compiles (on i386), but is
untested. See ess.c for a TODO list.
 1.1.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.14.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.17.4.1 25-Jan-2001  jhawk Pull up revision 1.18 (requested by nathanw):
Support certain ISAPnP ESS 1868 and 1869 cards. Per PR port-i386/11630.
 1.18.24.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.24.4 17-Jan-2005  skrll Sync with HEAD.
 1.18.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.24.1 12-Aug-2004  skrll Sync with HEAD.
 1.22.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.2.1 29-Apr-2005  kent sync with -current
 1.24.98.1 30-May-2010  rmind sync with head
 1.24.96.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.24.88.2 12-Dec-2008  ad Checkpoint work in progress.
 1.24.88.1 11-Dec-2008  ad Checkpoint work in progress.
 1.24.74.1 11-Aug-2010  yamt sync with head.
 1.24.28.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.25.10.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.25.8.1 17-Apr-2012  yamt sync with head
 1.26.24.1 23-Aug-2014  riz Pull up following revision(s) (requested by nakayama in ticket #50):
sys/dev/isa/ess.c: revision 1.81
sys/dev/isa/ess.c: revision 1.82
sys/dev/isa/essvar.h: revision 1.27
sys/dev/isa/essreg.h: revision 1.17
Remove redundant colon.
Add support for Spatializer, 3D audio effects embedded in ES1869
and ES1879 to ess(4).
Tested on my old laptop, mobio NX.
 1.26.8.1 03-Dec-2017  jdolecek update from HEAD
 1.117 25-Sep-2022  thorpej malloc(9) -> kmem(9)
 1.116 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.115 24-Apr-2021  thorpej branches: 1.115.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.114 10-Nov-2019  chs branches: 1.114.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.113 03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.112 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.111 20-Jan-2018  tsutsui branches: 1.111.2; 1.111.4;
Handle yet another atari specific quirk in the MI ISA fdc(4)/fd(4) driver.

This makes fd(4) drive(s) (which is necessary for installation)
properly attached on Milan.

atari uses "fdcisa" and "fdisa" for ISA fdc to co-exist other fd(4)
drivers, on-board (atari/dev/fd.c) one and Hades (atari/dev/hdfd.c) one.
 1.110 08-Dec-2015  christos branches: 1.110.2; 1.110.8; 1.110.10;
Replace DIOCGPART -> DIOCGPARTINFO which returns the data needed instead of
pointers.
 1.109 26-Apr-2015  mlelstv Use C99-style initializers for struct dkdriver.
 1.108 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.107 02-Jan-2015  christos We have three sets of DTYPE_ constants in the kernel:
altq Drop Type
disklabel Disk Type
file Descriptor Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
 1.106 31-Dec-2014  christos make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
 1.105 10-Aug-2014  tls branches: 1.105.4;
Merge tls-earlyentropy branch into HEAD.
 1.104 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.103 25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.102 16-Mar-2014  dholland branches: 1.102.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.101 29-May-2013  christos branches: 1.101.2;
phase 1 of disk geometry cleanup:
- centralize the geometry -> plist code so that we don't have
n useless copies of it.
 1.100 02-Feb-2012  tls branches: 1.100.6;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.99 13-Nov-2010  uebayasi branches: 1.99.8; 1.99.12;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.98 11-Aug-2010  pgoyette Keep condvar wmesg within 8-char limit
 1.97 08-Aug-2010  chs move a debug printf to FD_DEBUG.
 1.96 16-Mar-2010  he Allow this driver to build for ofppc as well.
 1.95 24-Feb-2010  dyoung branches: 1.95.2;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.94 08-Jan-2010  dyoung branches: 1.94.2;
Expand PMF_FN_* macros.
 1.93 05-Jun-2009  haad Add support for DIOCGDISKINFO to disk like device drivers. Change
partutil.c::getdiskinfo to use it to get disk geometry info.
Use DIOCGWEDGEINFO ioctl to get information about partition size, if disk
driver doesn't support it use old DIOCGDINFO. This patch adds support for
wedge like devices(lvm logical volumes, ZFS zvol partitions) to newfs and
other tools.

No objections on tech-userlevel@.
 1.92 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.91 13-Jan-2009  yamt branches: 1.91.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.90 29-Dec-2008  mlelstv fdcintr1 requires the mutex to be held.
 1.89 24-Dec-2008  tsutsui Set all default geometry parameters (not only secpercyl and secsize)
before readdisklabel(9) on DIOCGDINFO so that we can get correct
media size via the ioctl. (usually floppy doesn't have a real disklabel)

Tested on i386 with 1.44M floppy.
 1.88 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.87 03-May-2008  plunky branches: 1.87.8; 1.87.10;
after the "struct disk" is finished with, it should be
destroyed with disk_destroy(9) to stave off LOCKDEBUG
panics.
 1.86 30-Apr-2008  ad - If x86, trust the nvram and elminate long probe delays.
- Update for amd64.
 1.85 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.84 11-Apr-2008  cegger branches: 1.84.2; 1.84.4;
make this build with FD_DEBUG
 1.83 29-Mar-2008  mlelstv PPC systems predating prep and running the mvmeppc port
have compatible hardware.
 1.82 16-Mar-2008  cube Split device_t and softc for the ... wait for it ... [air quotes] MI
variant of fdc(4)/fd(4). Other cosmetic changes as appropriate.
 1.81 22-Feb-2008  dyoung Suspend, resume, detach.

Use mutex(9) and condvar(9) instead of splbio(9)/splx(9) and
tsleep(9)/wakeup(9).

Use device_t and accessors. Use aprint_*_dev().
 1.80 31-Jan-2008  dyoung branches: 1.80.2; 1.80.6;
Let the compiler decide: inline -> static, register -> .
 1.79 31-Jan-2008  dyoung Cosmetic: constify, KNF, use device_t and accessors, use
aprint_normal_dev() instead of printf("%s: ...", dv->dv_xname).
 1.78 02-Jan-2008  ad Merge vmlocking2 to head.
 1.77 19-Oct-2007  ad branches: 1.77.2; 1.77.4; 1.77.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.76 08-Oct-2007  ad branches: 1.76.2;
Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.75 29-Jul-2007  ad branches: 1.75.4; 1.75.6; 1.75.8; 1.75.10;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.74 09-Jul-2007  ad branches: 1.74.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.73 08-Mar-2007  jnemeth branches: 1.73.2; 1.73.4;
add support for devctl properties
 1.72 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.71 15-Feb-2007  reinoud branches: 1.71.2;
Rename the B_XXX flag to B_DEVPRIVATE flag since it was never used for
debugging and its main use is in device drivers. Its used there to signal
that the flagged buffer has a special meaning or should be handled
differently.

OK'd by Bill Sudenmund on tech-kern.
 1.70 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.69 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.68 30-Aug-2006  christos branches: 1.68.2; 1.68.4;
add missing initializer
 1.67 14-Apr-2006  blymn Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
 1.66 28-Mar-2006  thorpej Use device_unit().
 1.65 25-Mar-2006  thorpej Use device_parent().
 1.64 06-Jan-2006  yamt branches: 1.64.2; 1.64.4; 1.64.6; 1.64.8; 1.64.10;
initialize necessary members of struct buf. PR/32462 from Reinoud Zandijk.
 1.63 04-Jan-2006  yamt - add simple functions to allocate/free a buffer for i/o.
- make bufpool static.
 1.62 24-Dec-2005  perry branches: 1.62.2;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.61 11-Dec-2005  christos merge ktrace-lwp.
 1.60 15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.59 30-Jul-2005  christos Fix compilation with FD_DEBUG.
 1.58 29-May-2005  christos branches: 1.58.2;
sprinkle const.
 1.57 04-Feb-2005  perry de-__P
 1.56 01-Feb-2005  drochner Whitespace police. The rest remains crap.
 1.55 28-Oct-2004  yamt branches: 1.55.4; 1.55.6;
move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.54 18-Sep-2004  yamt change some members of struct buf from long to int.
ride on 2.0H.
 1.53 14-Sep-2004  drochner include "locators.h" explicitely where it is needed, so that
it can be removed in the isavar.h header eventually
 1.52 04-Jun-2004  thorpej Wrap a noisy probe message in FD_DEBUG.
 1.51 04-Dec-2003  keihan branches: 1.51.2;
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.50 27-Sep-2003  mycroft Fix a non-fatal race condition.
 1.49 25-Sep-2003  mycroft Modify the fdcattach() interface again, splitting it into two parts, so that
DRQ allocation is done earlier.
 1.48 25-Sep-2003  mycroft Do fd probing after interrupts are enabled, and use tsleep() for delays.
Also try to accept a recalibrate interrupt to terminate the delay -- but that
doesn't seem to work reliably, so do a 2s timeout as well.
 1.47 23-Sep-2003  mycroft Small changes -- if your controller clears DRV_BUSY when recalibrate completes,
you get lucky and the probe is faster. A more complete fix will require making
the probe use interrupts, since there is no reliable way to poll.
 1.46 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.45 29-Jun-2003  fvdl branches: 1.45.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.44 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.43 12-Jun-2003  drochner nuke unnecessary #include <sys/dkstat.h>
 1.42 09-May-2003  fvdl A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.41 26-Feb-2003  leo Make this work as fdisa again on the Atari/Milan.
 1.40 25-Feb-2003  thorpej Add missing splbio() protecting of bufpool access. Add a clarifying
comment to <sys/buf.h> reminding everyone of the need for splbio().
 1.39 25-Feb-2003  thorpej Add a new BUF_INIT() macro which initializes b_dep and b_interlock, and
use it. This fixes a few places where either b_dep or b_interlock were
not properly initialized.
 1.38 05-Feb-2003  pk Remove unused variable.
 1.37 05-Feb-2003  pk Make the buffer cache code MP-safe.
 1.36 25-Jan-2003  kleink Fix further printf format warnings for DEBUG, in the wake of daddr_t
having changed.
 1.35 25-Jan-2003  tron Use PRId64 instead of hard coding "%lld" to fix build problems under
LP64 ports.
 1.34 25-Jan-2003  tron Fix printf() format strings problems caused by "daddr_t" change.
 1.33 08-Jan-2003  jmcneill Support for 'plug and play' of floppy drives, to be used soon by the
ACPI fdc attachment. Reviewed by fvdl.
 1.32 01-Jan-2003  thorpej Use aprint_normal() in cfprint routines.
 1.31 01-Nov-2002  mrg implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
when processing hw.diskstats, add the read&write bytes/transfers for
the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail. however, the next time this is
change it will not fail again.

this is just the kernel portion.
 1.30 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.29 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.28 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.27 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.26 11-Sep-2002  thorpej Fix signed/unsigned comparison warnings from gcc 3.3.
 1.25 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.24 24-Jul-2002  hannken Convert to new device buffer queue interface.
 1.23 26-Jun-2002  simonb Add evbmips to the list of platforms supported by this driver.
 1.22 10-Mar-2002  jdolecek branches: 1.22.4;
use TAILQ_FIRST()/TAILQ_NEXT()/TAILQ_EMPTY macros rather than dereferencing
appropriate structure members
 1.21 12-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of memset() after malloc().
 1.20 29-Dec-2001  thorpej Add a case for x86_64.
 1.19 13-Nov-2001  lukem add RCSID
 1.18 08-Jul-2001  wiz branches: 1.18.2; 1.18.4;
Correct various misspellings of 'transfer' and inflected forms.
 1.17 07-Jun-2001  briggs Compile on sandpoint.
 1.16 27-May-2001  thorpej Add support for the Algorithmics ISA floppy controller.
 1.15 19-May-2001  tsutsui space/TAB cosmetics
 1.14 16-Mar-2001  leo Some minor, atari only, changes to make this work on the Milan:
- Adjust for the driver to be configured as fdisa
- Add a for the atari correct fd_types array
- Work around the fact that the atari has no machine/conf.h
 1.13 18-Jan-2001  jdolecek branches: 1.13.2;
constify
 1.12 08-Jan-2001  fvdl Return error in the case of using ODIOCGDINFO or ODIOCGDEFLABEL when
the number of partitions is > OLDMAXPARTITIONS. This is better
than silently truncating the label (don't want to silently throw
away partitions when using an old disklabel binary on a label with
> 8 partitions). From Enami Tsugutomo.
 1.11 07-Jan-2001  fvdl Adapt all disk devices in MI directories to handle ODIOC* calls
for ports that have bumped MAXPARTITIONS (and thus define
__HAVE_OLD_DISKLABEL).
 1.10 17-Dec-2000  jmc In fdcattach() reset the controller before moving on as some probes (ala pnpbios) may not have reset during match
 1.9 27-Nov-2000  matt Add prep support. change all __foo__ to foo. We don't __foo__ in the kernel
 1.8 24-Aug-2000  nathanw branches: 1.8.2;
In fdioctl(), allocate fd_formb dynamically when needed, rather than on
the stack, and remove the no-longer-necessary PHOLD()/PRELE() calls
in fdformat().

(This eliminates 1/3 of the instances of PHOLD()/PRELE() in the kernel code.)

XXX We still have too many mostly-redundant floppy drivers.
 1.7 06-Jul-2000  thorpej Use device_lookup().
 1.6 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5 11-May-2000  jdolecek branches: 1.5.4;
MI part of MicroChannel Architecture bus support

This work is based on code written by Scott D. Telford, the IBM
Token Ring card attachment was written by Gregory McGarry.

XXX this is still very experimental and development version; use at your
XXX own risk
 1.4 02-May-2000  thorpej Nuke some dead code.
 1.3 23-Apr-2000  thorpej Carve off the ISA configuration bits from the floppy driver. Driver is
still ISA-specific, but we can attach ISA instances with different
configuration mechanisms now.
 1.2 07-Apr-2000  thorpej Use separate callouts for motor-on and motor-off. Fixes a condition
where the floppy driver would wedge because a motor-on timeout would
be cancelled by another I/O operation cancelling a motor-off timeout.

From enami tsugutomo <enami@sm.sony.co.jp>.
 1.1 07-Apr-2000  thorpej Combine the Alpha, BeBox, and i386 ISA floppy drivers with a sledgehammer.
Not a perfect solution, but this is two less versions of this driver I
now have to modify.
 1.5.4.1 01-May-2001  he Pull up revisions 1.11-1.12 (requested by fvdl):
Increase the number of BSD disklabel partitions on i386 to 16.
 1.8.2.7 27-Mar-2001  bouyer Sync with HEAD.
 1.8.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.8.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.8.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.8.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.8.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 24-Aug-2000  bouyer file fd.c was added on branch thorpej_scsipi on 2000-11-20 11:41:13 +0000
 1.13.2.13 15-Jan-2003  thorpej Sync with HEAD.
 1.13.2.12 03-Jan-2003  thorpej Sync with HEAD.
 1.13.2.11 11-Nov-2002  nathanw Catch up to -current
 1.13.2.10 18-Oct-2002  nathanw Catch up to -current.
 1.13.2.9 17-Sep-2002  nathanw Catch up to -current.
 1.13.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.13.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.13.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.13.2.5 08-Jan-2002  nathanw Catch up to -current.
 1.13.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.13.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.13.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.13.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.18.4.2 26-Sep-2001  fvdl * add a VCLONED vnode flag that indicates a vnode representing a cloned
device.
* rename REVOKEALL to REVOKEALIAS, and add a REVOKECLONE flag, to pass
to VOP_REVOKE
* the revoke system call will revoke all aliases, as before, but not the
clones
* vdevgone is called when detaching a device, so make it use REVOKECLONE
to get rid of all clones as well
* clean up all uses of VOP_OPEN wrt. locking.
* add a few VOPS to spec_vnops that need to do something when it's a
clone vnode (access and getattr)
* add a copy of the vnode vattr structure of the original 'master' vnode
to the specinfo of a cloned vnode. could possibly redirect getattr to
the 'master' vnode, but this has issues with revoke
* add a vdev_reassignvp function that disassociates a vnode from its
original device, and reassociates it with the specified dev_t. to be
used by cloning devices only, in case a new minor is allocated.
* change all direct references in drivers to v_devcookie and v_rdev
to vdev_privdata(vp) and vdev_rdev(vp). for diagnostic purposes
when debugging race conditions that still exist wrt. locking and
revoking vnodes.
* make the locking state of a vnode consistent when passed to
d_open and d_close (unlocked). locked would be better, but has
some deadlock issues
 1.18.4.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.18.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.18.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.18.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.18.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.18.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.4.3 29-Aug-2002  gehenna catch up with -current.
 1.22.4.2 15-Jul-2002  gehenna catch up with -current.
 1.22.4.1 16-May-2002  gehenna Add the block/character device switches.
 1.45.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.45.2.7 04-Feb-2005  skrll Sync with HEAD.
 1.45.2.6 02-Nov-2004  skrll Sync with HEAD.
 1.45.2.5 24-Sep-2004  skrll Sync with HEAD.
 1.45.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.45.2.2 03-Aug-2004  skrll Sync with HEAD
 1.45.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.51.2.1 04-Jun-2004  jmc Pullup rev 1.52 (requested by thorpej in ticket #437)

Wrap a noisy probe message in FD_DEBUG.
 1.55.6.1 12-Feb-2005  yamt sync with head.
 1.55.4.1 29-Apr-2005  kent sync with -current
 1.58.2.9 17-Mar-2008  yamt sync with head.
 1.58.2.8 27-Feb-2008  yamt sync with head.
 1.58.2.7 04-Feb-2008  yamt sync with head.
 1.58.2.6 21-Jan-2008  yamt sync with head
 1.58.2.5 27-Oct-2007  yamt sync with head.
 1.58.2.4 03-Sep-2007  yamt sync with head.
 1.58.2.3 26-Feb-2007  yamt sync with head.
 1.58.2.2 30-Dec-2006  yamt sync with head.
 1.58.2.1 21-Jun-2006  yamt sync with head.
 1.62.2.1 15-Jan-2006  yamt sync with head.
 1.64.10.3 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.64.10.2 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.64.10.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.64.8.1 19-Apr-2006  elad sync with head.
 1.64.6.3 03-Sep-2006  yamt sync with head.
 1.64.6.2 24-May-2006  yamt sync with head.
 1.64.6.1 01-Apr-2006  yamt sync with head.
 1.64.4.1 22-Apr-2006  simonb Sync with head.
 1.64.2.1 09-Sep-2006  rpaulo sync with head
 1.68.4.2 10-Dec-2006  yamt sync with head.
 1.68.4.1 22-Oct-2006  yamt sync with head
 1.68.2.1 18-Nov-2006  ad Sync with head.
 1.71.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.73.4.1 11-Jul-2007  mjf Sync with head.
 1.73.2.6 23-Oct-2007  ad Sync with head.
 1.73.2.5 24-Aug-2007  ad Sync with buffer cache locking changes. See buf.h/vfs_bio.c for details.
Some minor portions are incomplete and needs to be verified as a whole.
 1.73.2.4 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.73.2.3 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.73.2.2 01-Jul-2007  ad Adapt to callout API change.
 1.73.2.1 13-May-2007  ad - Pass the error number and residual count to biodone(), and let it handle
setting error indicators. Prepare to eliminate B_ERROR.
- Add a flag argument to brelse() to be set into the buf's flags, instead
of doing it directly. Typically used to set B_INVAL.
- Add a "struct cpu_info *" argument to kthread_create(), to be used to
create bound threads. Change "bool mpsafe" to "int flags".
- Allow exit of LWPs in the IDL state when (l != curlwp).
- More locking fixes & conversion to the new API.
 1.74.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.75.10.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.75.10.1 29-Jul-2007  ad file fd.c was added on branch matt-mips64 on 2007-07-29 12:50:22 +0000
 1.75.8.1 14-Oct-2007  yamt sync with head.
 1.75.6.3 23-Mar-2008  matt sync with HEAD
 1.75.6.2 09-Jan-2008  matt sync with HEAD
 1.75.6.1 06-Nov-2007  matt sync with HEAD
 1.75.4.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.76.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.77.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.77.4.1 04-Dec-2007  ad Pull the vmlocking changes into a new branch.
 1.77.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.80.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.80.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.80.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.80.2.1 24-Mar-2008  keiichi sync with head.
 1.84.4.7 09-Oct-2010  yamt sync with head
 1.84.4.6 11-Aug-2010  yamt sync with head.
 1.84.4.5 11-Mar-2010  yamt sync with head
 1.84.4.4 20-Jun-2009  yamt sync with head
 1.84.4.3 16-May-2009  yamt sync with head
 1.84.4.2 04-May-2009  yamt sync with head.
 1.84.4.1 16-May-2008  yamt sync with head.
 1.84.2.1 18-May-2008  yamt sync with head.
 1.87.10.1 22-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #283):
sys/dev/isa/fd.c: revision 1.90
fdcintr1 requires the mutex to be held.
 1.87.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.91.2.2 23-Jul-2009  jym Sync with HEAD.
 1.91.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.94.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.94.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.95.2.2 05-Mar-2011  rmind sync with head
 1.95.2.1 30-May-2010  rmind sync with head
 1.99.12.1 18-Feb-2012  mrg merge to -current.
 1.99.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.99.8.1 17-Apr-2012  yamt sync with head
 1.100.6.3 03-Dec-2017  jdolecek update from HEAD
 1.100.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.100.6.1 23-Jun-2013  tls resync from head
 1.101.2.1 18-May-2014  rmind sync with head
 1.102.2.2 10-Aug-2014  tls Rebase.
 1.102.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.105.4.3 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.105.4.2 06-Jun-2015  skrll Sync with HEAD
 1.105.4.1 06-Apr-2015  skrll Sync with HEAD
 1.110.10.1 13-Mar-2018  martin Pull up following revision(s) (requested by tsutsui in ticket #624):
sys/arch/atari/stand/xxboot/sdboot/milan/Makefile: revision 1.4
sys/arch/atari/dev/nvram.c: revision 1.21
sys/arch/atari/conf/MILAN.in: revision 1.28
sys/arch/atari/atari/pmap_bootstrap.c: revision 1.9
sys/dev/isa/fd.c: revision 1.111
sys/arch/atari/atari/bus.c: revision 1.60
sys/arch/atari/stand/xxboot/ahdi-xxboot/milan/Makefile: revision 1.4
sys/arch/atari/atari/locore.s: revision 1.111
sys/arch/atari/isa/isa_machdep.c: revision 1.41
distrib/sets/lists/base/md.atari: revision 1.55
sys/arch/atari/pci/pci_machdep.c: revision 1.55
sys/arch/atari/pci/pci_machdep.c: revision 1.56
sys/arch/atari/include/vmparam.h: revision 1.32
sys/arch/atari/isa/isa_milan.c: revision 1.15
sys/arch/atari/isa/isa_milan.c: revision 1.16
sys/arch/atari/atari/bus.c: revision 1.59
sys/arch/atari/atari/atari_init.c: revision 1.101
sys/arch/atari/pci/pci_milan.c: revision 1.15
Fix I/O access failures for regions allocated by bus_space_map(9) on Milan.

Passing to PMAP_WIRED against I/O spaces seems problematic,
probably after yamt-km branch merge, which was committed
between NetBSD 3.0 and NetBSD 4.0.
(i.e. ISA and PCI devices on Milan didn't work after 4.0 release)

XXX:
According to pmap(9) man page, the "flags" arg for pmap_enter(9)
doesn't take VM_PROT_READ and VM_PROT_WRITE, but pmap_enter()
implementation in sys/arch/m68k/m68k/pmap_motolora.c historically
checks them.

Fix silent hang during config_console() (before consinit()) on Milan.
config_console() was a dirty hack used by ancient m68k ports
to probe and initialize console devices before "real" configure(9),
using subset of configure(9) functions.

In that case, most device specific data (except I/O access method)
are not initialized so we must not access device specific device_t and
softc structures in config_console() cases.

Fix silent hang after isa_intr_establish() on Milan.
The problems (wrong macro replacements) were slipped in rev 1.107:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/atari/atari/locore.s#rev1.107
Handle yet another atari specific quirk in the MI ISA fdc(4)/fd(4) driver.
This makes fd(4) drive(s) (which is necessary for installation)
properly attached on Milan.
atari uses "fdcisa" and "fdisa" for ISA fdc to co-exist other fd(4)
drivers, on-board (atari/dev/fd.c) one and Hades (atari/dev/hdfd.c) one.

Use a proper PSL value to be passed to splx(9) functions.
This should have been changed on yamt-splraiseipl branch merge
back in 2006, which made MI IPL_xxx values independent from
m68k MD PSL values for the %sr register.

Restore piixide(4) for Milan and disable other pciide devices.
piixide was removed in rev 1.18 and the log message said
"because Intel IDE disk controllers only exist as part of
Intel chipsets for x86 systems" but the Milan actually has
the Intel 82371FB southbridge on its board.
Other pciide devices are unlikely necessary for the default
kernel for such a rare machine.
Also fix pasto in comment.

Skip NVRAM checksum check and re-initialization on Milan.
Milan's firmware seems to use different check method.

Ack EOI for IRQ_SLAVE of the master PIC after ack for IRQ of the slave PIC.
I'm not sure if there are possible races in the original code, but
this is what i8259_asm_ack2() in sys/arch/x86/include/i8259.h does
and it looks this change makes a Milan kernel a bit stable.
Replace CRTC register values with ones taken from sys/dev/ic/vga_subr.c.
This fixes noise around column 3 and 4 and makes screen output clearer
on Milan with S3 Trio64V.

Explicitly setup the secondary IDE interrupt of PIIX on Milan.
The secondary IDE interrupt is connected to MBIRQ0 on PIIX, but
the Milan's ROM bootloader (at least version 0.99.7) doesn't seem
to setup the MBIRQ0 register to route it to IRQ15.

On Milan, also explicitly disable MBIRQ1 on PIIX.
Milan's ROM bootloader v1.2 and v1.4 incorrectly set MBIRQ0 connected
to the secondary IDE to IRQ14 (not 15) and unused MBIRQ1 to IRQ15,
so both IDE channels don't work properly.

Add dumb memory probe routines for Milan to use all available memory.
Tested on Milan with 32Mx1, 32Mx4, 128MBx1, and 128MBx3.
(bootloader ROM fails to load TOS with 128MBx4)
No particular comment on port-atari@:
http://mail-index.netbsd.org/port-atari/2018/02/09/msg000580.html

Provide wdboot as a copy of sdboot for Milan.
It looks Milan's bootloader ROM emulates IDE disks as SCSI disks
so sdboot works for them, but atari's installboot checks a specified
device name and requires wdboot for wd(4) devices.

Fix another possible out of bounds.

Replace bus_dmamap_sync(9) op with a newer one taken from m68k/bus_dma.c.
This could fix memory corruption issue caused by PREREAD ops with regions
whose boundaries are not aligned at cacheline size.
 1.110.8.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.110.2.2 25-Jul-2016  pgoyette Redo previous
 1.110.2.1 25-Jul-2016  pgoyette Update a few drivers for localcount(9)
 1.111.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.111.4.1 10-Jun-2019  christos Sync with HEAD
 1.111.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.114.10.2 02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.114.10.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.115.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.21 18-Apr-2022  jmcneill Do not attach if the parent bus failed to provide an ISA chipset tag.
 1.20 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.19 02-Feb-2012  tls branches: 1.19.6; 1.19.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.18 28-Apr-2008  martin branches: 1.18.34; 1.18.38;
Remove clause 3 and 4 from TNF licenses
 1.17 16-Mar-2008  cube branches: 1.17.2; 1.17.4;
Split device_t and softc for the ... wait for it ... [air quotes] MI
variant of fdc(4)/fd(4). Other cosmetic changes as appropriate.
 1.16 22-Feb-2008  dyoung Suspend, resume, detach.

Use mutex(9) and condvar(9) instead of splbio(9)/splx(9) and
tsleep(9)/wakeup(9).

Use device_t and accessors. Use aprint_*_dev().
 1.15 19-Oct-2007  ad branches: 1.15.12; 1.15.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 16-Nov-2006  christos branches: 1.14.8; 1.14.22; 1.14.24; 1.14.28;
__unused removal on arguments; approved by core.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 11-Dec-2005  christos branches: 1.12.20; 1.12.22;
merge ktrace-lwp.
 1.11 14-Sep-2004  drochner branches: 1.11.12;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.10 25-Sep-2003  mycroft Modify the fdcattach() interface again, splitting it into two parts, so that
DRQ allocation is done earlier.
 1.9 25-Sep-2003  mycroft Do fd probing after interrupts are enabled, and use tsleep() for delays.
Also try to accept a recalibrate interrupt to terminate the delay -- but that
doesn't seem to work reliably, so do a 2s timeout as well.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 02-Oct-2002  thorpej branches: 1.7.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.6 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 02-May-2000  thorpej branches: 1.2.6; 1.2.8; 1.2.10;
Traditionally, the floppy controller was configured at 0x3f0 for 8 ports,
but the registers actually begin at 0x3f2, and this is what PNPBIOS reports
for the floppy controller resources. Adjust the register offsets and the
mapping of them for the ISA front-end to compensate, so that the PNPBIOS
attachment of the floppy controller actually works.
 1.1 23-Apr-2000  thorpej Carve off the ISA configuration bits from the floppy driver. Driver is
still ISA-specific, but we can attach ISA instances with different
configuration mechanisms now.
 1.2.10.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.2.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.8.2 11-Jan-2002  nathanw More catchup.
 1.2.8.1 14-Nov-2001  nathanw Catch up to -current.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 02-May-2000  bouyer file fdc_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:13 +0000
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.12.3 17-Mar-2008  yamt sync with head.
 1.11.12.2 27-Feb-2008  yamt sync with head.
 1.11.12.1 27-Oct-2007  yamt sync with head.
 1.12.22.2 10-Dec-2006  yamt sync with head.
 1.12.22.1 22-Oct-2006  yamt sync with head
 1.12.20.1 18-Nov-2006  ad Sync with head.
 1.14.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.24.2 23-Mar-2008  matt sync with HEAD
 1.14.24.1 06-Nov-2007  matt sync with HEAD
 1.14.22.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.14.8.1 23-Oct-2007  ad Sync with head.
 1.15.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.15.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.15.12.1 24-Mar-2008  keiichi sync with head.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.18.38.1 18-Feb-2012  mrg merge to -current.
 1.18.34.1 17-Apr-2012  yamt sync with head
 1.19.24.1 06-Jun-2015  skrll Sync with HEAD
 1.19.6.1 03-Dec-2017  jdolecek update from HEAD
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 16-Mar-2008  cube branches: 1.9.2; 1.9.4;
Split device_t and softc for the ... wait for it ... [air quotes] MI
variant of fdc(4)/fd(4). Other cosmetic changes as appropriate.
 1.8 22-Feb-2008  dyoung Suspend, resume, detach.

Use mutex(9) and condvar(9) instead of splbio(9)/splx(9) and
tsleep(9)/wakeup(9).

Use device_t and accessors. Use aprint_*_dev().
 1.7 11-Dec-2005  christos branches: 1.7.46; 1.7.66; 1.7.70;
merge ktrace-lwp.
 1.6 04-Feb-2005  perry branches: 1.6.6;
de-__P
 1.5 25-Sep-2003  mycroft branches: 1.5.8; 1.5.10;
Modify the fdcattach() interface again, splitting it into two parts, so that
DRQ allocation is done earlier.
 1.4 25-Sep-2003  mycroft Do fd probing after interrupts are enabled, and use tsleep() for delays.
Also try to accept a recalibrate interrupt to terminate the delay -- but that
doesn't seem to work reliably, so do a 2s timeout as well.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 08-Jan-2003  jmcneill branches: 1.2.2;
Support for 'plug and play' of floppy drives, to be used soon by the
ACPI fdc attachment. Reviewed by fvdl.
 1.1 23-Apr-2000  thorpej branches: 1.1.6; 1.1.8;
Carve off the ISA configuration bits from the floppy driver. Driver is
still ISA-specific, but we can attach ISA instances with different
configuration mechanisms now.
 1.1.8.1 15-Jan-2003  thorpej Sync with HEAD.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 23-Apr-2000  bouyer file fdcvar.h was added on branch thorpej_scsipi on 2000-11-20 11:41:14 +0000
 1.2.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.2.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.1 03-Aug-2004  skrll Sync with HEAD
 1.5.10.1 12-Feb-2005  yamt sync with head.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.6.6.2 17-Mar-2008  yamt sync with head.
 1.6.6.1 27-Feb-2008  yamt sync with head.
 1.7.70.2 02-Jun-2008  mjf Sync with HEAD.
 1.7.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.66.1 24-Mar-2008  keiichi sync with head.
 1.7.46.1 23-Mar-2008  matt sync with HEAD
 1.9.4.1 16-May-2008  yamt sync with head.
 1.9.2.1 18-May-2008  yamt sync with head.
 1.7 30-Jun-2011  wiz dependant -> dependent
 1.6 11-Dec-2005  christos merge ktrace-lwp.
 1.5 27-Feb-2005  perry nuke trailing whitespace
 1.4 23-Sep-2003  mycroft branches: 1.4.8; 1.4.10;
Small changes -- if your controller clears DRV_BUSY when recalibrate completes,
you get lucky and the probe is faster. A more complete fix will require making
the probe use interrupts, since there is no reliable way to poll.
 1.3 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 02-May-2000  thorpej branches: 1.2.6; 1.2.30;
Traditionally, the floppy controller was configured at 0x3f0 for 8 ports,
but the registers actually begin at 0x3f2, and this is what PNPBIOS reports
for the floppy controller resources. Adjust the register offsets and the
mapping of them for the ISA front-end to compensate, so that the PNPBIOS
attachment of the floppy controller actually works.
 1.1 07-Apr-2000  thorpej Combine the Alpha, BeBox, and i386 ISA floppy drivers with a sledgehammer.
Not a perfect solution, but this is two less versions of this driver I
now have to modify.
 1.2.30.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.30.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.30.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.30.1 03-Aug-2004  skrll Sync with HEAD
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 02-May-2000  bouyer file fdreg.h was added on branch thorpej_scsipi on 2000-11-20 11:41:14 +0000
 1.4.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.9 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.8 02-Feb-2012  tls branches: 1.8.6; 1.8.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.7 19-Nov-2011  tls branches: 1.7.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.6 28-Apr-2008  martin branches: 1.6.34;
Remove clause 3 and 4 from TNF licenses
 1.5 16-Mar-2008  cube branches: 1.5.2; 1.5.4;
Split device_t and softc for the ... wait for it ... [air quotes] MI
variant of fdc(4)/fd(4). Other cosmetic changes as appropriate.
 1.4 22-Feb-2008  dyoung Suspend, resume, detach.

Use mutex(9) and condvar(9) instead of splbio(9)/splx(9) and
tsleep(9)/wakeup(9).

Use device_t and accessors. Use aprint_*_dev().
 1.3 11-Dec-2005  christos branches: 1.3.46; 1.3.66; 1.3.70;
merge ktrace-lwp.
 1.2 15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.1 08-Jan-2003  jmcneill branches: 1.1.2; 1.1.4; 1.1.20;
Support for 'plug and play' of floppy drives, to be used soon by the
ACPI fdc attachment. Reviewed by fvdl.
 1.1.20.3 17-Mar-2008  yamt sync with head.
 1.1.20.2 27-Feb-2008  yamt sync with head.
 1.1.20.1 21-Jun-2006  yamt sync with head.
 1.1.4.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.2 15-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 08-Jan-2003  thorpej file fdvar.h was added on branch nathanw_sa on 2003-01-15 18:44:18 +0000
 1.3.70.2 02-Jun-2008  mjf Sync with HEAD.
 1.3.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.3.66.1 24-Mar-2008  keiichi sync with head.
 1.3.46.1 23-Mar-2008  matt sync with HEAD
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.34.1 17-Apr-2012  yamt sync with head
 1.7.2.1 18-Feb-2012  mrg merge to -current.
 1.8.24.1 06-Jun-2015  skrll Sync with HEAD
 1.8.6.1 03-Dec-2017  jdolecek update from HEAD
 1.177 26-Apr-2021  thorpej - The "ess" device does not need a "midibus" interface attribute; it
attaches an "opl" instance which itself attaches the "midi".
- Be explicit about using the "ess" interface attribute when attaching
the "joy" and "opl" instances.
 1.176 23-May-2020  jmcneill branches: 1.176.6;
GC toaster drivers
 1.175 19-Jan-2020  thorpej Remove Token Ring support.
 1.174 25-Oct-2019  martin branches: 1.174.2;
Add support for Nuvoton NCT5104D GPIO chips, as found on PC Engines APU
systems. From Andrew Doran in PR kern/54648.
 1.173 08-May-2019  isaki 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.172 27-Jan-2019  maxv branches: 1.172.2;
Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.171 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.170 19-Sep-2018  maxv Remove daic(4), it has never been functional.

ok martin@
 1.169 02-Jan-2018  christos branches: 1.169.2; 1.169.4; 1.169.6;
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.
 1.168 13-Dec-2017  knakahara Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.167 09-Dec-2016  christos branches: 1.167.8;
more spkr rework.
 1.166 09-Dec-2016  christos split out the pcppi attachment of the speaker
XXX: needs more work
 1.165 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.164 17-Oct-2016  jdolecek provide stub intr xname establish for xen
 1.163 10-Jun-2013  kardel branches: 1.163.10; 1.163.14;
adjust soekrisgpio driver to NetBSD
 1.162 22-Jan-2012  christos branches: 1.162.6;
add a tpm driver from bsssd.sourceforge.net
 1.161 17-Jan-2012  jakllsch update for wbsio and lm changes
 1.160 13-Jun-2010  tsutsui branches: 1.160.8; 1.160.12;
Tidy up a comment.
 1.159 21-Feb-2010  cnst branches: 1.159.2;
New wbsio(4) driver for Winbond Super I/O attachment of lm(4) on any port.

http://mail-index.netbsd.org/tech-kern/2010/02/17/msg007338.html

Reviewed by <pgoyette>, <tech-kern>.
 1.158 19-Jan-2010  pooka branches: 1.158.2;
hp@isa was marked non-compiling and broken 14 years ago. I'm sure
the tens of well-tested changes since then have been necessary,
but now i'll just spoil the fun for everyone by sending the driver
to the attic.
 1.157 03-Apr-2008  xtraeme branches: 1.157.4;
Add the finsio(4) driver. This driver supports the Hardware Monitor
device in the Fintek LPC Super I/O chips, this includes the following
list:

- F71805F
- F71806F
- F71862FG
- F71872F
- F71882
- F71883F

This has been adapted from the fins(4) driver available in OpenBSD, which
only supported F71805F.

Tobias Nygren <tnn> and myself added support for the other chips; thanks go
to Tobias for testing the driver with a Fintek F71882 chip.
 1.156 02-Apr-2008  dyoung Certain misguided people have complained, NetBSD only runs rare or
"retro" computers, but NetBSD also runs a growing number of rare
and retro add-on cards. With this patch, NetBSD supports the IDEC
Supervision/16, a black&white image capture board for the 16-bit
ISA bus. Approximate date of manufacture: 1991. Total instances
known to be in use throughout the world: one.

Coming soon; isvctl(8), the utility program for capturing 8-bit,
512x480 images at speeds of up to 6 frames per second.
 1.155 31-Dec-2007  wiz branches: 1.155.6;
Proxy-commit for xtraeme:
add dependency for itesio on sysmon_wdog.
 1.154 13-Dec-2007  garbled Move the elink probe code from files.isa to the common conf/files so that
MCA without isa can compile. fix by cube.
 1.153 15-Nov-2007  xtraeme branches: 1.153.2; 1.153.6;
Rename it(4) to itesio(4) to accomodate for the following changes:

- The driver now uses the Super I/O address port as port argument in
the configuration file. The Environmental Controller base address is
fetched by the Super I/O EC LDN configuration registers.

- Invalidate voltage sensors if data returned is 0xff.

- Use the Super I/O Global Configuration Registers Chip ID[12] and Device
Revision to store/print the correct information.

- Use only the Fan Extended Tachometer registers on IT871[68]F for now;
this gives us correct data for IT8705/IT8712F again.

Inspired by the smsc(4) driver. The UPDATING file has been updated to
reflect the rename.
 1.152 12-Sep-2007  xtraeme branches: 1.152.4; 1.152.6;
Fix aps(4) attachment.
 1.151 12-Sep-2007  xtraeme Forgot to add aps(4) device.
 1.150 01-Jun-2007  blymn branches: 1.150.6; 1.150.8;
Add driver for the hardware monitoring portion of the SMSC LPC47B397
 1.149 08-May-2007  xtraeme Split the ug(4) driver in three components:

* dev/ic/ug.c (main code shared by the attachments)
* dev/isa/ug_isa.c (isa attachment)
* dev/acpi/ug_acpi.c (acpi attachment)

That means that ug(4) can now be attached via ACPI.

Thanks to Mihai Chelaru for the good work.
 1.148 09-Jan-2007  cube branches: 1.148.2; 1.148.6; 1.148.8;
Remove traces of scd(4), which apparently never actually had a driver in
the tree.
 1.147 09-Jan-2007  cube Remove stale config(5) entries for unexistent wl(4).

Ok'd by matt@.
 1.146 09-Jan-2007  cube Disable daic(4). The driver is not finished.
Ok'd by martin@.
 1.145 06-Jan-2007  xtraeme Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.

Thanks.
 1.144 13-May-2006  xtraeme branches: 1.144.8; 1.144.12;
Driver for iTE IT87xxF and compatibles hardware monitor. Add
commented out entries on GENERIC and GENERIC_LAPTOP.

Adapted from OpenBSD.
 1.143 11-Apr-2006  garbled Add an option PCKBCNOTEST and defopt it. On the prep 7043 and 7248
machines, the keyboard controller will not pass this test, but if you
attach anyway, it works fine. Note that this test is specifically
disabled in ic/pckbc.c, but given that it seems to work fine on other
machines, leave it defaulted to on.
 1.142 11-Dec-2005  christos branches: 1.142.4; 1.142.6; 1.142.8; 1.142.10; 1.142.12;
merge ktrace-lwp.
 1.141 27-Sep-2005  jmcneill Attach to gpiobus. From OpenBSD.
 1.140 14-Aug-2005  joff Add toaster, tsdio, toasterlcd devices
 1.139 28-Jun-2005  kent branches: 1.139.2;
remove pss(4) driver. It has never been workable and has not been
compilable for a long time.
 1.138 25-Mar-2005  cube Add attimer(4) driver, with ISA and ACPI attachments.

attimer(4) is the new body of the part of pcppi(4) that mapped the TIMER1
register to set the pitch of the bell. It was necessary to separate them
in order to have a working ACPI attachment (as the two appear as different
devices in the ACPI structures).
 1.137 27-Feb-2005  perry nuke trailing whitespace
 1.136 08-Jan-2005  joff branches: 1.136.2; 1.136.4;
add tscs
 1.135 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.134 30-Aug-2004  drochner add centralized {eisa,isa,pci,agp,mca}busprint() functions which do
what tens of the bus' parents foo{...}bridge_print()s scattered around do
 1.133 04-Aug-2004  drochner This is definitely what the world has been waiting for:-)
Allow to enable the game port on an ES1888, in case the firmware didn't
this. (Otherwise we still rely on the firmware having mapped the sound
related registers.)
Limit this to the "isa" attachment for now because this is the only
one I'm able to test.
Attach the "joy" device directly at "ess" to make sure the port is
enabled before the "joy" probe/attach.
This makes the joystick port usable on a "PWS" alpha (Miata).
 1.132 31-Jan-2004  jdolecek add dependency on isadma for atppc attachments
add atppc_isadma.c for atppc@isapnp and atppc@ofisa, too
 1.131 25-Jan-2004  jdolecek reorganize the ISA DMA setup/use code so that it could be shared
with ACPI and PNPBIOS attachments; move it to new atppc_isadma.[ch]
and g/c previous atppc_isa_subr.[ch]

move attppc_isa_softc struct definition to atppc_isa.c, and reorganize
the attachment somewhat for better readability; also g/c detach support code
 1.130 20-Jan-2004  jdolecek cleanup old lpt(4) attachment, and glue ppbus in so that they can coexist:
* lpt device is defined in MI place (dev/ppbus/files.ppbus), dev/ic/lpt.c
is included there too; dev/ic/lpt.c is not included if ppbus is
configured or if there is alternative platform lpt (like for pc532)
* g/c MD lpt definitions and custom puc/upc attachments,
glue moved to conf/files and dev/pci/files.pci respectively; remove
device lpt definition from dev/isa/files.isa
* add ppbus parport attribute, atppc device attachments, adjust plip and lpt
glue
 1.129 02-Jun-2003  gmcgarry branches: 1.129.2;
Driver for GPIB controllers boards based on the uPD7210 GPIB controller,
including boards made by Captial Equipment Corp.
 1.128 03-Mar-2003  mycroft The DMA support here never worked, so yank it out.
 1.127 05-Oct-2002  tsutsui Overhaul of fmv(4) driver:
- Split if_fmv.c into MI/MD part and add ISA-PnP attachment for FMV-183.
(XXX FMV-184 is not tested. It would require extra media-select functions..)
- Fix probe functions of fmv_isa so that FMV-181A/182A will also match.
Fixes port-i386/9476.
 1.126 11-Aug-2002  isaki Add driver for ScanLogic SL811HS/T USB Host Controller.
XXX It's experimental code yet.

For x68k: USB part of Nereid USB/Ethernet/memory board
For ISA: ISA USB Host board from Morphy planning
 1.125 17-Jul-2002  drochner adda driver to read the temerature sensors on a NSC PC87366 Super IO chip
(the chip provides voltage / fan rpm control too, but we don't care yet)
 1.124 22-Apr-2002  augustss branches: 1.124.2;
Rename the audio "bus" attribute audiobus to avoid confusion with audio
device.
 1.123 02-Feb-2002  jdolecek Reduce the massive code duplication regarding joy(4). Split it into
MI and MD parts, and make ISA/ISAPNP/PCI joy(4) attachments MI.
 1.122 07-Jan-2002  drochner "attach radio at radio":
using one word as both attribute and device doesn't work well,
radio.c is pulled in even with no such device in the configuration,
and the kernel doesn't link due to missing "radio_cd".
So call the attribute "radiodev" to avoid confusion.
 1.121 01-Jan-2002  augustss Add support for radio cards. Written by Maxim Tsyplakov and Vladimir Popov
for OpenBSD, from where it was imported.
 1.120 16-Dec-2001  thorpej Rename weasel.c to weasel_isa.c in preparation for supporting the
PCI version of the Weasel.
 1.119 28-Nov-2001  lukem - convert usage of "defopt" to "defflag" where the relevant option does
not support a value (e.g., it's to be used as "options FOO" instead of
"options FOO=xxx"). options that take a value were converted to
defparam recently.
- minor whitespace & formatting cleanups
 1.118 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.117 20-Nov-2001  lukem - replace "defopt" with "defparam" for options which must take a value,
as config(8) will warn for value-less defparam options
- minor whitespace/formatting cleanup
- consolidate opt_tcp_recvspace.h and opt_tcp_sendspace.h into opt_tcp_space.h
 1.116 26-Sep-2001  thorpej "cms" is not needs-flag
 1.115 26-Sep-2001  thorpej "aria" does not needs-flag
 1.114 21-Jul-2001  jdolecek branches: 1.114.2;
dev/isa/if_ate.c depends upon 'ate_isa', not just 'ate'
 1.113 31-Mar-2001  jdolecek branches: 1.113.2;
Prepare for MCA attachment:
* split off sharable stuff to dev/ic/ate_subr.[ch], move ate(4) device
definition to conf/files
* cosmetic: attach with ate_isa
 1.112 23-Mar-2001  jdolecek Forgot this one:

if_we.c was split and ISA-specific part is now in if_we_isa.c,
we(4) device is defined in conf/files.
 1.111 02-Mar-2001  thorpej branches: 1.111.2;
pckbc_isa.c should only be compiled when pckbc at isa is configured.
 1.110 24-Feb-2001  lukem whitespace police
 1.109 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.108 17-Feb-2001  martin Rename isa_isic.c to i4b_isic_isa.c and isadaic.c to i4b_daic_isa.c
to improve naming consistency.
 1.107 05-Jan-2001  martin Enable the imported ISDN4BSD based ISDN subsystem.

This is the kernel part (userland to follow soon) of the latest (and
very probably last) release (version 0.96) of ISDN4BSD. ISDN4BSD has a
homepage at http://www.freebsd-support.de/i4b/.

It gives the user various ways to use the isdn connection: raw data (via
the i4brbch "raw b-channel" device), ppp (via the isp "isdn PPP" device),
voice/answering machine (the i4btel "telephone" device) and ip over isdn
(the ipr device, "IP over raw ISDN").

Supported are a bunch of common and older cards, more to be added soon
after some cleanup. Currently only the european E-DSS1 variant of the
ISDN D channel protocol is supported.
 1.106 20-Nov-2000  jdolecek Add an attachment for MOXA 168P isa multiport card. This code was
written by Christoph Badura.
This was reported to work by user of this code. It's not tested
by me, but it's probably more useful in tree anyway.
 1.105 05-Nov-2000  thorpej pcweasel carries the sysmon_wdog attribute.
 1.104 04-Nov-2000  thorpej Add a device driver for the Middle Digital, Inc. PC-Weasel serial
console board. This glues into the `pcdisplay' driver and provides
support for the watchdog timer function on the PC-Weasel.
 1.103 11-Aug-2000  thorpej Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus. This board is commonly found
on Alpha Jensen systems.
 1.102 01-May-2000  augustss branches: 1.102.4;
Add Creative Music System driver. From Gregory McGarry <g.mcgarry@ieee.org>
 1.101 21-Apr-2000  explorer Add driver for Addonics FlexPort 8S (and probably 4S, but not tested)
 1.100 25-Mar-2000  mycroft Move esp declaration to conf/files.
 1.99 20-Mar-2000  pk Move `nca' declaration to `conf/files'.
 1.98 18-Mar-2000  mycroft Move some code around in preparation for nca_pcmcia.
 1.97 25-Feb-2000  groo Initial import of National Semiconductor LM7[89] Hardware Monitor with isa and
pnpbios attach.

examples:

lm0 at pnpbios0 index?
lm0 at isa? port 0x290


TODO: spinlocks, i2c interface.
 1.96 24-Feb-2000  ad Add a DPT ISA HBA frontend, tested lightly with a PM2021A/9X. There are some
issues.
 1.95 04-Jan-2000  chopps add if_ntwo_isa driver for the Riscom/N2 card.
 1.94 13-Dec-1999  drochner First cut on an EGA driver. For initial testing, lacks some EGA vs CGA/MGA
identification. Can share more code with VGA later.
 1.93 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.92 15-Nov-1999  mcr added support for BOCA 6port ISA adapter. 3x16552 with an
interrupt status register at yet-another-address.
ioat0 at isa? port 0x220 irq 5 flags 1# BOCA 'ioat66' 6-port cards
com* at ioat? slave ?
 1.91 29-Oct-1999  matt fix entry for lemac on isa. add entry for wavelan on isa
 1.90 05-Oct-1999  itohy branches: 1.90.2; 1.90.4; 1.90.6;
Add "opl at ym" and "mpu at ym" attachment.
Options for ym driver are defopt'ed.
 1.89 09-Sep-1999  is The nca.c probe routine falsely claims i82595tx chips to itself.
Move it to after the iy driver.
 1.88 14-Aug-1999  augustss Implement opl at wss.
 1.87 02-Aug-1999  augustss 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.86 01-Aug-1999  augustss Move the MPU driver isa/ to ic/.
(I didn't move it in the repository because the revision history
is very short and uninteresting. :)
 1.85 01-Aug-1999  augustss Make an MPU attachment to ISA. Used for old Roland cards. Written
by me and gson@araneus.fi (Andreas Gustafsson).
 1.84 06-Jun-1999  dante Add adv_isa.c entry
 1.83 22-Mar-1999  bad branches: 1.83.2; 1.83.4;
config(8) glue for Token-Ring and TROPIC drivers.
 1.82 22-Mar-1999  mycroft 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.81 16-Dec-1998  christos Add Byte Runner Technologies TC-400 and TC-800 driver from Eric S. Hvozda
 1.80 22-Nov-1998  pk Move the `wdc' device into `conf/files'.
 1.79 31-Oct-1998  thorpej Add code to detect a RealTek 8019 chip, and use the media selection
support if present.
 1.78 25-Oct-1998  christos PR/6274: John Ruschmeyer: Add isa/i386 ncr53c80 driver.
XXX: Needs work. We need to fix the probe/find goo, and add support for the
pas16 cards.
 1.77 12-Oct-1998  bouyer Merge bouyer-ide
 1.76 26-Aug-1998  augustss Make the OPL driver attach directly to ISA as well.
 1.75 26-Aug-1998  augustss Make the OPL driver turn on the sound on sound cards that require it.
That makes it much more likely that we get any sound. DUH!
 1.74 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.73 22-Aug-1998  augustss Let opl attach to ess.
WARNING: it doesn't work yet.
 1.72 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.71 13-Aug-1998  kim device ess was listed twice
 1.70 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.69 12-Aug-1998  augustss Add a MIDI driver for the PC speaker. This is mostly of hack value,
but, hey, lotsa people got a MIDI device now! (A truly pitiful one. :-)
 1.68 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.67 31-Jul-1998  thorpej Pull in files.isapnp here; the two busses are linked together quite closely
(more than we'd like maybe, but don't we wish ISA didn't suck...)
 1.66 30-Jul-1998  augustss A first stab at making the SHARK sound work. It doesn't really work
yet, but it probes and makes a noise when used. Stay tuned!
 1.65 27-Jul-1998  thorpej branches: 1.65.2;
Add CS8900 Ethernet driver, and ISA front-end.
 1.64 23-Jul-1998  drochner update comment ("John F. Woods" <jfw@funhouse.com>, PR kern/5798)
 1.63 21-Jul-1998  drochner adapt to LANCE driver split
 1.62 23-Jun-1998  jonathan * Add defopt MCD_PROMISC for more conservative probes.
Before, the probe routine (mcd_find() would succeed even if the probe
code thought it had a response, but didn't recognize the ID-code byte.
Now, only do the promiscuous match if MCD_PROMISC is configured.
 1.61 06-Jun-1998  augustss Add an Aria sound driver.
From "R. C. Dowdeswell" <elric@imrryr.org>.
 1.60 28-May-1998  drochner branches: 1.60.2;
Add a graphics device driver for wscons which supports legacy PC display
adapters. (minimal functionality - no virtual screens, no colors)
 1.59 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.58 16-Apr-1998  drochner Make the ISA LANCE drivers work without BROKEN_INDIRECT_CONFIG.
DEPCA is now split out into a separate driver.
Because there can be only one attachment of a device to a bus, for
each card type a separate pseudo-bus was introduced which attaches to "isa"
and where "le" attaches to.
 1.57 15-Apr-1998  drochner add MI ISA VGA and the speaker driver
 1.56 03-Apr-1998  enami Delete entry for fe*.
 1.55 22-Mar-1998  drochner MI driver for the infamous PC keyboard controller, primarily for use with
the new wscons code (but may be interfaced with other drivers as well).
needs testing
 1.54 22-Mar-1998  enami Define new device `ate' and `fmv'.
 1.53 27-Feb-1998  pk Replace the `ie' driver by three separate front-ends: `ix', `ef' and `ai'.
 1.52 16-Feb-1998  thorpej Remove "class" declarations, and add "devclass" declarations where
appropriate. Fix several inconsistencies between device class and
attributes. Mostly from Chris Demetriou.
 1.51 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.50 15-Jan-1998  cgd fix typo in comment that i just added
 1.49 14-Jan-1998  cgd Shuffle wd/wdc driver files around (via repository copies). wdc
now lives in dev/ic, wd now lives in dev/ata. there's now a 'ata'
interface attribute defined in conf/files, but wdc can't go there
yet because some ports still use private versions based on the old
ISA version.
 1.48 12-Jan-1998  thorpej ast, boca, and rtfps are not ttys, but rather "busses". Similarly,
the lpt doesn't export a tty-like interface, so it's dull, too.
 1.47 21-Nov-1997  bouyer Move the we driver at the begining of ethernet board, other board's probe
clobbers my SMC. Now I can really use a generic kernel with my SMC @0x300.
This change has been tested on various machines with ne2000 and 3c509 baords.
XXX All these probes sould be reordered after the release, with invasive
XXX probes at the end.
 1.46 21-Nov-1997  bouyer The if_ie probe is invasive in such a way that it can clobber other's board
config. Now that this driver is bussified, move it last in the ethernet
adapter list.
 1.45 07-Nov-1997  enami Add the missing attribute `dp8390nic' for the device `we'.
 1.44 05-Nov-1997  thorpej Add an ISA front-end to the SMC91cxx Ethernet driver ("sm"). This
supports generic SMC91cxx-based ISA cards and the built-in SMC
Ethernet found in some laptop docking stations.

Thanks much to Andrew Gillham <gillhaa@ghost.whirlpool.com> for
making this work!
 1.43 03-Nov-1997  thorpej Add "we" driver, remove "ed" driver.
 1.42 02-Nov-1997  thorpej Front-end to the dp8390 chip driver for the 3Com 3c503 Ethernet interface.
Supports changing media with ifconfig's "media" directive.

This splits the 3c503 functionality out of the ISA "ed" driver, much the
same way NE2000 support was split out.
 1.41 16-Oct-1997  thorpej branches: 1.41.2;
Garbage-collect "com" device declaration.
 1.40 14-Oct-1997  thorpej Pulldown from marc-pcmcia branch: ISA front-end for "ne" driver.
 1.39 14-Oct-1997  is Finalize the isa/lpt.c split:
The isa attachment code is in isa/lpt_isa.c now, which attaches to the
already created ic/lpt* files.
You don't need to change your config files, but you need to re-"config" if
using lpt at isa.
XXX The "lpt" device definition should be in sys/conf/files instead, but to
my knowledge, there are some ports which have private copies of lpt, and would
choke on that. No need to make people unhappy 7 days before release branching.
 1.38 06-Oct-1997  christos From Enami Tsugutomo: Busify and split the aic6360 driver.
 1.37 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.36 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.35 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.34 31-Jul-1997  matt Add the ISA inteface for the lc (LEMAC, EtherWORKS III) driver.
 1.33 20-Jul-1997  pk branches: 1.33.2;
config.new => config
 1.32 14-Jul-1997  kleink Do not compile in satlink unconditionally; from Thorsten Frueauf
<frueauf@ira.uka.de> in PR port-i386/3864.
 1.31 13-Jul-1997  hpeyerl Satellite receiver driver for ISA cards from PlanetConnect by Jason and
Herb for Canada Connect Corp.
 1.30 17-May-1997  pk branches: 1.30.2;
Mods for ESP406/FAS408 ISA SCSI driver (from Eric S. Hvozda; PR#3581)
 1.29 09-May-1997  augustss 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.28 04-Apr-1997  mycroft New version of com driver. Uses a different queueing mechanism and a split
hardware/software interrupt mechanism for improved performance. Many odd
protocols bugs also fixed.
 1.27 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.26 07-Feb-1997  mycroft Move the aha ISA probe functions into a separate file.
 1.25 16-Jan-1997  christos branches: 1.25.2;
- convert to bus_space_*
- split attachment code to sb_isa.c
 1.24 24-Sep-1996  christos branches: 1.24.2;
New cyclades driver from Timo Rossi
 1.23 07-Sep-1996  mycroft Use bus.h.
 1.22 01-Sep-1996  mycroft Update.
 1.21 16-May-1996  mycroft New version, with changes from Justin Gibbs and Noriyuki Soda.
 1.20 07-May-1996  thorpej Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.

Break up ISA LANCE driver into ISA and PCI front-ends.

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
to take a struct ifnet *, rather than a unit number.
 1.19 06-May-1996  is Add "iy" driver for Ethernet ISA boards using the Intel i82595 chip, e.g.
(and only tested on) Intel Etherexpress PRO. Should work on any i82595 ISA
board which uses an EEPROM for config information; NETBLKID not yet supported.
TODO: change to BUS interface, add multicast support.
 1.18 25-Apr-1996  thorpej Break up the ep driver into isa, eisa, and pci front-ends and a
bus-independent core driver. Tested on all three bus types, including
an isa 3c509 masquerading as an eisa device (use ep* at eisa? slot ? in
your kernel config file to catch this one).
XXX Driver still needs to be converted to <machine/bus.h>
 1.17 29-Mar-1996  mycroft Working WD7000 and TMC-7000 driver, from Julian Highfield, with additional work by me.
Needs some refinement, but it works.
 1.16 24-Mar-1996  mycroft Various, including:
* Display as much revision info as we can get.
* Fix a race condition that could cause interrupts to be lost.
* Handle `out of mailbox' conditions (much) more gracefully.
* Schedule timeouts more safely.
* Add diagnostic code to (correctly) detect if a CCB times out before its
outgoing mailbox is emptied.
 1.15 17-Mar-1996  cgd adjust to deal with expression support for optional file specs
 1.14 17-Mar-1996  cgd change the name of com's attachment to commulti, and provide flags
for that and the isa attachment in com.h (in addition to the flag for
the presence of 'com' itself).
 1.13 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.12 04-Mar-1996  cgd the i386 port no longer attaches isa, eisa, and pci at root.
 1.11 28-Feb-1996  cgd make ISA bus match/attach, and sub-device configuration machine-independent.
 1.10 13-Jan-1996  thorpej Add the "ahe" driver, autoconfiguration support for the aic7xxx-based
Adaptec 2[78]4x SCSI controllers, from Michael Graff <explorer@flame.org>.
Fixes PR #1594 from Noriyuki Soda <soda@sra.co.jp> in a different way.
 1.9 10-Nov-1995  christos Add support for the 3c59x (pci) cards in the 3c5x9 driver. In addition
add the necessary bits for the 3c589 (pcmcia) card without adding any
of the pcmcia framework.
 1.8 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.7 03-May-1995  cgd uncomment cy driver spec; i386 conf.c needs the header file.
 1.6 26-Apr-1995  brezak Fix nits from Mike Long <mike.long@analog.com> PR#996
 1.5 19-Apr-1995  mycroft Change `needs-count' to `needs-flag'.
 1.4 19-Apr-1995  mycroft Correct a couple of things, and add a `fe' device.
 1.3 17-Apr-1995  cgd if_le conflicts with the Alpha; move description back to i386
 1.2 17-Apr-1995  cgd try to actually (gasp!) describe the drivers.
 1.1 17-Apr-1995  cgd ISA config.new files description.
 1.24.2.1 18-Jan-1997  thorpej Update from trunk.
 1.25.2.1 09-Mar-1997  is Ethernet devices depend on "arp". While we're here, pull up a change from
The Trunk.
 1.30.2.4 14-Aug-1997  bouyer Sync with trunk.
 1.30.2.3 22-Jul-1997  bouyer Sync with trunk.
 1.30.2.2 17-Jul-1997  bouyer Update from trunck.
 1.30.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.33.2.8 16-Oct-1997  thorpej Sync w/ trunk (lpt definition got mangled).
 1.33.2.7 16-Oct-1997  thorpej Sync w/ trunk.
 1.33.2.6 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.5 14-Oct-1997  thorpej Split off NE2000 support from the ISA "ed" driver, and create a new "ne"
driver that deals with NE2000s and compatibles on ISA, PCI, and PCMCIA
busses.

This driver uses the generic DP8390 core chipset back-end.
 1.33.2.4 28-Aug-1997  marc Remove the pcic stuff from here for now. From files.i386's commit
message:

Move all the pcic-related devices to the bottom of the file. This is
a temporary situation, as having the pcic attachments here instead of
in files.{isa,pci,...} is wrong. However, it is the only way to get
pcmcia devices to attach at the end, so that dynamic resource
allocation can work. Before this gets to the mainline, this needs a
better answer.
 1.33.2.3 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.2 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.41.2.4 22-Nov-1997  mellon Pull rev 1.46 and 1.47 up from trunk (bouyer)
 1.41.2.3 07-Nov-1997  thorpej Pull up from trunk: missing dp8390nic attribute.
 1.41.2.2 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.41.2.1 05-Nov-1997  thorpej Pull up from trunk: ISA front-end to the SMC91Cxx driver.
 1.60.2.6 11-Sep-1998  bouyer Sync with HEAD.
 1.60.2.5 13-Aug-1998  bouyer - sync with -current
- b* -> mem*
 1.60.2.4 27-Jul-1998  bouyer Sync with -current
 1.60.2.3 25-Jun-1998  bouyer Sync with HEAD.
 1.60.2.2 06-Jun-1998  bouyer Sync with HEAD.
 1.60.2.1 04-Jun-1998  bouyer Commit changes to the IDE system in a branch. This allows a better separation
between higth-level and low-level (i.e. registers read/write) and generalize
the queue for all commands. This also add supports for IDE DMA.
 1.65.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.83.4.2 02-Aug-1999  thorpej Update from trunk.
 1.83.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.83.2.1 10-Sep-1999  he Pull up revision 1.89:
The nca driver mistakenly detects an i82585tx as its hardware.
Move the nca driver probe after the iy probe (which is more
friendly to other hardware). (is)
 1.90.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.90.4.1 15-Nov-1999  fvdl Sync with -current
 1.90.2.6 21-Apr-2001  bouyer Sync with HEAD
 1.90.2.5 27-Mar-2001  bouyer Sync with HEAD.
 1.90.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.90.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.90.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.90.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.102.4.1 11-Aug-2000  thorpej Pullup from trunk:
Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus. This board is commonly found
on Alpha Jensen systems.
 1.111.2.10 18-Oct-2002  nathanw Catch up to -current.
 1.111.2.9 13-Aug-2002  nathanw Catch up to -current.
 1.111.2.8 01-Aug-2002  nathanw Catch up to -current.
 1.111.2.7 20-Jun-2002  nathanw Catch up to -current.
 1.111.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.111.2.5 11-Jan-2002  nathanw More catchup.
 1.111.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.111.2.3 08-Oct-2001  nathanw Catch up to -current.
 1.111.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.111.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.113.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.113.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.113.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.113.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.113.2.1 03-Aug-2001  lukem update to -current
 1.114.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.124.2.2 29-Aug-2002  gehenna catch up with -current.
 1.124.2.1 20-Jul-2002  gehenna catch up with -current.
 1.129.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.129.2.8 01-Apr-2005  skrll Sync with HEAD.
 1.129.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.129.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.129.2.5 21-Sep-2004  skrll Fix the sync with head I botched.
 1.129.2.4 18-Sep-2004  skrll Sync with HEAD.
 1.129.2.3 03-Sep-2004  skrll Sync with HEAD
 1.129.2.2 12-Aug-2004  skrll Sync with HEAD.
 1.129.2.1 03-Aug-2004  skrll Sync with HEAD
 1.136.4.2 26-Mar-2005  yamt sync with head.
 1.136.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.136.2.1 29-Apr-2005  kent sync with -current
 1.139.2.6 21-Jan-2008  yamt sync with head
 1.139.2.5 07-Dec-2007  yamt sync with head
 1.139.2.4 27-Oct-2007  yamt sync with head.
 1.139.2.3 03-Sep-2007  yamt sync with head.
 1.139.2.2 26-Feb-2007  yamt sync with head.
 1.139.2.1 21-Jun-2006  yamt sync with head.
 1.142.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.142.10.1 19-Apr-2006  elad sync with head.
 1.142.8.1 24-May-2006  yamt sync with head.
 1.142.6.2 01-Jun-2006  kardel Sync with head.
 1.142.6.1 22-Apr-2006  simonb Sync with head.
 1.142.4.1 09-Sep-2006  rpaulo sync with head
 1.144.12.2 13-May-2007  pavel Pull up patch (requested by xtraeme in ticket #633):
sys/arch/amd64/conf/GENERIC: patch
sys/arch/i386/conf/ALL: patch
sys/arch/i386/conf/GENERIC: patch
sys/conf/files: patch
sys/dev/acpi/files.acpi: patch
sys/dev/acpi/ug_acpi.c: patch
sys/dev/ic/ug.c: patch
sys/dev/ic/ugreg.h: patch
sys/dev/ic/ugvar.h: patch
sys/dev/isa/files.isa: patch
sys/dev/isa/ug_isa.c: patch
share/man/man4/ug.4: patch
doc/CHANGES: patch
sys/dev/isa/ug.c: delete
sys/dev/isa/ugvar.h: delete

Add an acpi attachement for the ug hardware monitor driver.
 1.144.12.1 12-Jan-2007  bouyer Pull up following revision(s) (requested by xtraeme in ticket #341):
distrib/sets/lists/man/mi: revision 1.965
share/man/man4/ug.4: revision 1.1
sys/dev/isa/files.isa: revision 1.145
sys/arch/amd64/conf/GENERIC: revision 1.124
sys/dev/isa/ug.c: revision 1.1
sys/dev/isa/ugvar.h: revision 1.1
share/man/man4/envsys.4: revision 1.21
share/man/man4/Makefile: revision 1.418
Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.
Thanks.
Add ug0 at isa? commented out (driver for the Abit uGuru
Hardware system monitor).
ug(4): manual page for the Abit uGuru hardware system monitor
(wiz please review, thanks).
+ ug(4)
 1.144.8.1 12-Jan-2007  ad Sync with head.
 1.148.8.1 11-Jul-2007  mjf Sync with head.
 1.148.6.3 09-Oct-2007  ad Sync with head.
 1.148.6.2 09-Jun-2007  ad Sync with head.
 1.148.6.1 27-May-2007  ad Sync with head.
 1.148.2.1 17-May-2007  yamt sync with head.
 1.150.8.2 09-Jan-2008  matt sync with HEAD
 1.150.8.1 06-Nov-2007  matt sync with HEAD
 1.150.6.2 21-Nov-2007  joerg Sync with HEAD.
 1.150.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.152.6.3 18-Feb-2008  mjf Sync with HEAD.
 1.152.6.2 27-Dec-2007  mjf Sync with HEAD.
 1.152.6.1 19-Nov-2007  mjf Sync with HEAD.
 1.152.4.1 18-Nov-2007  bouyer Sync with HEAD
 1.153.6.1 02-Jan-2008  bouyer Sync with HEAD
 1.153.2.1 26-Dec-2007  ad Sync with head.
 1.155.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.155.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.157.4.2 11-Aug-2010  yamt sync with head.
 1.157.4.1 11-Mar-2010  yamt sync with head
 1.158.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.158.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.159.2.1 03-Jul-2010  rmind sync with head
 1.160.12.1 18-Feb-2012  mrg merge to -current.
 1.160.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.160.8.1 17-Apr-2012  yamt sync with head
 1.162.6.2 03-Dec-2017  jdolecek update from HEAD
 1.162.6.1 23-Jun-2013  tls resync from head
 1.163.14.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.163.14.1 04-Nov-2016  pgoyette Sync with HEAD
 1.163.10.2 05-Feb-2017  skrll Sync with HEAD
 1.163.10.1 05-Dec-2016  skrll Sync with HEAD
 1.167.8.1 19-Feb-2018  snj Pull up following revision(s) (requested by yamaguchi in ticket #558):
share/man/man4/wbsio.4: 1.7-1.8
sys/dev/isa/files.isa: 1.168-1.169
sys/dev/isa/wbsio.c: 1.16-1.21
sys/dev/isa/wbsioreg.h: 1.6-1.7
Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Fix NCT6779 gpio pin configuration. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Add Watchdog timer implementation to wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Add an option to enable GPIO function of wbsio. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Improve the error log message to use product name. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Update the manual of wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
New sentence, new line. Fix xref. Sort SEE ALSO.
--
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.
--
Now that watchdog support has been added, make sure that a modular driver
requires the sysmon_wdog module.
 1.169.6.1 24-Sep-2018  jdolecek partial HEAD sync - ISDN device removal
 1.169.4.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.169.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.169.4.1 10-Jun-2019  christos Sync with HEAD
 1.169.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.172.2.1 05-May-2019  isaki Remove obsoleted au{,rate,vol}conv and mulaw attributes.
audio provides the equivalent of them inseparably.
 1.174.2.1 25-Jan-2020  ad Sync with head.
 1.176.6.1 13-May-2021  thorpej Sync with HEAD.
 1.9 29-Jun-2022  mlelstv unregister sensors only when registered.
 1.8 23-Apr-2015  pgoyette Update module dependencies for all the existing modules that depend on sysmon components.
 1.7 31-Jul-2011  jakllsch branches: 1.7.12; 1.7.30;
The Fintek base address registers implement the bottom 3 bits as read/write,
but the address decoder in the chip ignores these three bits. Do the same.
 1.6 31-Jul-2011  jmcneill modularize and recognize ASUS F8000 Super I/O chips
 1.5 20-Jun-2011  pgoyette Initialize sensors states before registering.
 1.4 22-Apr-2008  xtraeme branches: 1.4.6; 1.4.36;
Set the ENVSYS_FCHANGERFACT flag in voltage sensors, so that we
can use the 'rfact' property in /etc/envsys.conf to change the
resistor factor (in case the converted data is not correct).
 1.3 05-Apr-2008  xtraeme branches: 1.3.2;
Add the autoconf(9) detach method; useful for the LKM.
 1.2 03-Apr-2008  xtraeme Remove an unused softc member.
 1.1 03-Apr-2008  xtraeme Add the finsio(4) driver. This driver supports the Hardware Monitor
device in the Fintek LPC Super I/O chips, this includes the following
list:

- F71805F
- F71806F
- F71862FG
- F71872F
- F71882
- F71883F

This has been adapted from the fins(4) driver available in OpenBSD, which
only supported F71805F.

Tobias Nygren <tnn> and myself added support for the other chips; thanks go
to Tobias for testing the driver with a Fintek F71882 chip.
 1.3.2.1 18-May-2008  yamt sync with head.
 1.4.36.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.4.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.4.6.1 22-Apr-2008  mjf file finsio_isa.c was added on branch mjf-devfs2 on 2008-06-02 13:23:31 +0000
 1.7.30.1 06-Jun-2015  skrll Sync with HEAD
 1.7.12.1 03-Dec-2017  jdolecek update from HEAD
 1.119 06-Feb-2021  isaki Calling halt_{input,output} is done by the MI audio layer if necessary.
 1.118 29-Feb-2020  isaki branches: 1.118.6;
Remove rounding by 4 bytes on round_blocksize().
For drivers which supports only 16bit * 2channels sampling,
rounding by 4 bytes no longer meaningful.
 1.117 08-Jun-2019  isaki branches: 1.117.4;
Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.116 08-May-2019  isaki 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.115 16-Mar-2019  isaki branches: 1.115.2;
Use C99 style struct initializer to audio_hw_if.
 1.114 03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.113 23-Jun-2018  maxv branches: 1.113.2;
constify
 1.112 31-Oct-2017  nat branches: 1.112.2;
Add padding to gus.c so fields match up when it ts cast to a ad1848_isa
softc for the allocation of hw ring buffers.

Locking fixes as gus KASSERTS / uses the codec locks.

Ok christos@.
 1.111 01-Feb-2017  jakllsch branches: 1.111.6;
Use boolean logical and operation on booleans, rather than bitwise and.

From David Binderman in PR kern/51936.
 1.110 11-Jul-2016  msaitoh branches: 1.110.2; 1.110.4;
KNF. No functional change.
 1.109 27-Oct-2012  chs branches: 1.109.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.108 24-Nov-2011  mrg branches: 1.108.8;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.107 23-Nov-2011  jmcneill 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.106 02-Jul-2011  mrg branches: 1.106.2; 1.106.4;
fix sequence point errors. diff explains best:
- sc->sc_playbuf = ++sc->sc_playbuf % sc->sc_nbufs;
+ sc->sc_playbuf = (sc->sc_playbuf + 1) % sc->sc_nbufs;
 1.105 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.104 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.103 17-Dec-2008  cegger branches: 1.103.2;
kill MALLOC and FREE macros.
 1.102 28-Apr-2008  martin branches: 1.102.8; 1.102.12;
Remove clause 3 and 4 from TNF licenses
 1.101 08-Apr-2008  cegger branches: 1.101.2; 1.101.4;
use aprint_*_dev and device_xname
 1.100 19-Oct-2007  ad branches: 1.100.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.99 25-Sep-2007  ad branches: 1.99.2;
Use splhigh(), not disable_intr().
 1.98 09-Jul-2007  ad branches: 1.98.6; 1.98.8; 1.98.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.97 04-Mar-2007  christos branches: 1.97.2; 1.97.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.96 16-Nov-2006  christos branches: 1.96.4; 1.96.6;
__unused removal on arguments; approved by core.
 1.95 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.94 30-Aug-2006  christos branches: 1.94.2; 1.94.4;
add missing initializers
 1.93 14-Apr-2006  christos Coverity CID 2453: Add negative checks.
 1.92 25-Mar-2006  thorpej Use device_parent().
 1.91 17-Mar-2006  christos don't use MALLOC with a non-constant size; use malloc instead.
 1.90 11-Dec-2005  christos branches: 1.90.4; 1.90.6; 1.90.8; 1.90.10; 1.90.12;
merge ktrace-lwp.
 1.89 30-May-2005  christos branches: 1.89.2;
- add const
- avoid variable shadowing.
 1.88 27-Feb-2005  perry nuke trailing whitespace
 1.87 13-Jan-2005  kent branches: 1.87.2; 1.87.4;
ansify and KNF
 1.86 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.85 29-Oct-2004  yamt branches: 1.85.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.84 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.83 22-Apr-2004  itojun sprintf -> snprintf
 1.82 21-Nov-2003  gson Code enabled by option AUDIO_DEBUG exhibited undefined behavior and
caused compiler warnings with gcc 3.3.2.
 1.81 09-May-2003  fvdl branches: 1.81.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.80 03-May-2003  wiz DMA, not dma nor Dma.
 1.79 06-Apr-2003  wiz Respect the law: Use A-law and mu-law as spellings as far as easily possible.
Inspired by Igor Sobrado in PR 19680.
 1.78 11-Oct-2002  fvdl Don't include <i386/isa/icu.h>
 1.77 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.76 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.75 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.74 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.73 13-Nov-2001  lukem add RCSID
 1.72 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.71 18-Jul-2001  thorpej branches: 1.71.2;
bcopy -> memcpy
 1.70 18-Jan-2001  jdolecek branches: 1.70.2; 1.70.4;
constify
 1.69 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.68 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.67 30-Mar-1999  mycroft branches: 1.67.8;
The AD1848/CS4231 attachment doesn't create DMA maps any more, so we have to
do it here. This is preferrable anyway, since we're not actually doing DMA
through the AD/CS chip.
 1.66 19-Feb-1999  mycroft Fix structure names.
 1.65 17-Feb-1999  mycroft Update comments.
 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 09-Sep-1998  thorpej Add mmap support for gus and gusmax, PR #5988, Feico Dillema.
 1.62 06-Sep-1998  jtk Correct the remaining uses of ad1848_softc to ad1848_isa_softc
 1.61 01-Sep-1998  jtk use ad1848_isa_attach, so GUS cards with CS4231 don't panic the kernel
 1.60 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.59 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.58 02-Jul-1998  mycroft Cosmetic change.
 1.57 17-Jun-1998  augustss Remove a bunch of totally unnecessary #include <machine/pio.h>
left over from the olden days.
 1.56 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.55 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.54 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.53 12-Mar-1998  augustss Update probing for GUS a little. From soren@t.dk,
closes PR kern/5148.
 1.52 09-Mar-1998  mikel let panic() call DDB, don't do it ourselves; from Nathan Williams in PR 5131
 1.51 25-Jan-1998  mycroft Make sure we create DMA maps if the CD4231 probe fails.
 1.50 13-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.49 12-Jan-1998  thorpej Update for config changes.
 1.48 19-Oct-1997  augustss branches: 1.48.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.47 11-Oct-1997  mycroft AudioElinear -> AudioEslinear
 1.46 11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
 1.45 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.44 12-Sep-1997  augustss Create DMA maps on ordinary GUS (non-MAX) cards. Now it should work again.
 1.43 06-Sep-1997  augustss Bus-ify the GUS driver.
 1.42 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.41 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.40 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.39 07-Aug-1997  augustss Add A-law support and fix bug on opening GUS max.
From Feico Dillema <dillema@spam.aurum>.
 1.38 04-Aug-1997  augustss Get rid of `register'.
 1.37 04-Aug-1997  augustss Use gusmax_get_props instead of gus_get_props for gusmax.
 1.36 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.35 28-Jul-1997  augustss branches: 1.35.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.34 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.33 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.32 15-Jul-1997  augustss In the name of backwards compatibility AUDIO_ENCODING_LINEAR has been
renamed AUDIO_ENCODING_SLINEAR and AUDIO_ENCODING_LINEAR reverts to the
NetBSD 1.2 sematics. A kernel with COMPAT_12 defined will accept
AUDIO_ENCODING_LINEAR and treat it as before, without COMPAT_12 it
will be rejected.
 1.31 09-Jul-1997  jtk fix mixer goof on GUS max
 1.30 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.29 29-May-1997  jtk fix popping noises on 16-bit ulinear output.
add big-endian support
XXX ULINEAR_BE still needs ad1848 emulation on gusmax
 1.28 13-May-1997  augustss Clean up emulation code, SB, and GUS drivers and add some more encoding
emulation to SB.
 1.27 12-May-1997  jtk branches: 1.27.2;
restore accidentally-lost set of nchannels in driver layer
 1.26 10-May-1997  jtk use normal linear names/values for 8-bit encodings
mark mulaw as emulated (it's done via a mapping table)
use GUS query encoding routine, even on GUS max, since the encoding
stuff is handled by the GF1.
XXX might not be right for recording, but it's correct for playback.
 1.25 09-May-1997  augustss 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.24 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.23 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.22 06-Apr-1997  augustss Make sure the bus tag is set where we need it.
 1.21 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.20 19-Mar-1997  mycroft Check for errors returned by AD1848 routines.
 1.19 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.18 13-Oct-1996  christos backout kprintf changes
 1.17 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.16 12-May-1996  mycroft Use intr.h.
 1.15 03-May-1996  jtk make it work with GUSPLAYDEBUG defined
 1.14 29-Apr-1996  christos - prototype fixes
 1.13 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.12 31-Mar-1996  jtk add include file for function prototypes
 1.11 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.10 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.9 17-Feb-1996  jtk fix compile error from gusprobe() cleanup
 1.8 17-Feb-1996  jtk avoid panic'ing when driver gets confused--just spit out a message and
keep going.
Improve error messages to include device name.
use STATIC for function declarations/definitions so it's easier to get a
useful symbol table by flipping a switch.
 1.7 16-Feb-1996  mycroft Prototype the probe and attach functions.
 1.6 05-Feb-1996  jtc Fix error in copyright notice
 1.5 05-Feb-1996  jtc Received copyright assignment
 1.4 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.3 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.2 24-Jul-1995  cgd fix function prototypes, usages, to match what the code actually does
 1.1 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.27.2.3 01-Jun-1997  thorpej Update from trunk.
 1.27.2.2 19-May-1997  thorpej Update from trunk.
 1.27.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.35.2.5 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.2.4 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.2.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.35.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.48.2.1 29-Jan-1998  mellon Pull up 1.51 (mycroft)
 1.67.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.67.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.70.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.70.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.70.4.1 03-Aug-2001  lukem update to -current
 1.70.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.70.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.70.2.4 11-Jan-2002  nathanw More catchup.
 1.70.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.70.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.70.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.71.2.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.81.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.81.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.81.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.81.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.81.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.81.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.81.2.1 03-Aug-2004  skrll Sync with HEAD
 1.85.2.3 09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.85.2.2 03-Jan-2005  kent * remove stream_filter_list_append and stream_filter_list_prepend
* add stream_filter_list_t::{append(), prepend(), set()}
 1.85.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.87.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.87.2.1 29-Apr-2005  kent sync with -current
 1.89.2.4 27-Oct-2007  yamt sync with head.
 1.89.2.3 03-Sep-2007  yamt sync with head.
 1.89.2.2 30-Dec-2006  yamt sync with head.
 1.89.2.1 21-Jun-2006  yamt sync with head.
 1.90.12.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.90.12.1 28-Mar-2006  tron Merge 2006-03-28 NetBSD-current into the "peter-altq" branch.
 1.90.10.1 19-Apr-2006  elad sync with head.
 1.90.8.3 03-Sep-2006  yamt sync with head.
 1.90.8.2 24-May-2006  yamt sync with head.
 1.90.8.1 01-Apr-2006  yamt sync with head.
 1.90.6.1 22-Apr-2006  simonb Sync with head.
 1.90.4.1 09-Sep-2006  rpaulo sync with head
 1.94.4.2 10-Dec-2006  yamt sync with head.
 1.94.4.1 22-Oct-2006  yamt sync with head
 1.94.2.1 18-Nov-2006  ad Sync with head.
 1.96.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.96.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.97.4.1 11-Jul-2007  mjf Sync with head.
 1.97.2.3 23-Oct-2007  ad Sync with head.
 1.97.2.2 09-Oct-2007  ad Sync with head.
 1.97.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.98.10.1 06-Oct-2007  yamt sync with head.
 1.98.8.1 06-Nov-2007  matt sync with HEAD
 1.98.6.2 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.98.6.1 02-Oct-2007  joerg Sync with HEAD.
 1.99.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.100.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.100.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.101.4.3 16-May-2009  yamt sync with head
 1.101.4.2 04-May-2009  yamt sync with head.
 1.101.4.1 16-May-2008  yamt sync with head.
 1.101.2.1 18-May-2008  yamt sync with head.
 1.102.12.2 12-Dec-2008  ad Checkpoint work in progress.
 1.102.12.1 11-Dec-2008  ad Checkpoint work in progress.
 1.102.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.103.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.106.4.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.106.4.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.106.2.2 30-Oct-2012  yamt sync with head
 1.106.2.1 17-Apr-2012  yamt sync with head
 1.108.8.2 03-Dec-2017  jdolecek update from HEAD
 1.108.8.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.109.14.2 05-Feb-2017  skrll Sync with HEAD
 1.109.14.1 05-Oct-2016  skrll Sync with HEAD
 1.110.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.110.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.111.6.1 16-Apr-2018  martin Pull up following revision(s) (requested by nat in ticket #760):

sys/dev/isa/gus.c: revision 1.112

Add padding to gus.c so fields match up when it ts cast to a ad1848_isa
softc for the allocation of hw ring buffers.

Locking fixes as gus KASSERTS / uses the codec locks.

Ok christos@.
 1.112.2.1 25-Jun-2018  pgoyette Sync with HEAD
 1.113.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.113.2.1 10-Jun-2019  christos Sync with HEAD
 1.115.2.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.115.2.2 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.115.2.1 21-Apr-2019  isaki Adapt ad1848/cs4231 families to audio2.
 1.117.4.1 29-Feb-2020  ad Sync with head.
 1.118.6.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.10 24-May-2022  andvar fix various typos in comments, docs and log messages.
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 11-Dec-2005  christos branches: 1.8.70; 1.8.72; 1.8.74;
merge ktrace-lwp.
 1.7 27-Feb-2005  perry nuke trailing whitespace
 1.6 09-Oct-1997  jtc branches: 1.6.50; 1.6.58; 1.6.60;
Fix tipo inherited from old version of TNF copyright template.
 1.5 06-Sep-1997  augustss Bus-ify the GUS driver.
 1.4 19-Mar-1997  mikel branches: 1.4.4;
normalize off-by-four ad1848 register offsets.
 1.3 05-Feb-1996  jtc Fix error in copyright notice
 1.2 05-Feb-1996  jtc Received copyright assignment
 1.1 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.4.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.4.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.60.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.58.1 29-Apr-2005  kent sync with -current
 1.6.50.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.74.1 16-May-2008  yamt sync with head.
 1.8.72.1 18-May-2008  yamt sync with head.
 1.8.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file i4b_avm_a1.c was added on branch thorpej_scsipi on 2001-01-05 17:35:51 +0000
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 17-Feb-2001  martin Rename isa_isic.c to i4b_isic_isa.c and isadaic.c to i4b_daic_isa.c
to improve naming consistency.
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 17-Feb-2001  martin Rename isa_isic.c to i4b_isic_isa.c and isadaic.c to i4b_daic_isa.c
to improve naming consistency.
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file i4b_itk_ix1.c was added on branch thorpej_scsipi on 2001-01-05 17:35:51 +0000
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file i4b_tel_s016.c was added on branch thorpej_scsipi on 2001-01-05 17:35:51 +0000
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file i4b_tel_s0163.c was added on branch thorpej_scsipi on 2001-01-05 17:35:51 +0000
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file i4b_tel_s08.c was added on branch thorpej_scsipi on 2001-01-05 17:35:51 +0000
 1.2 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file i4b_usr_sti.c was added on branch thorpej_scsipi on 2001-01-05 17:35:51 +0000
 1.7 20-Oct-1997  thorpej Moved to src/sys/dev/ic/i82365.c via repository copy.
 1.6 19-Oct-1997  enami Fix typo; hang binary operator at the end of previous line.
 1.5 19-Oct-1997  enami Include locators.h and use symbolic name comes from it.
 1.4 17-Oct-1997  enami Define width_names[] only when PCICDEBUG is defined.
 1.3 17-Oct-1997  enami No need to cast a generic pointer.
 1.2 16-Oct-1997  thorpej Pull marc-pcmcia branch down to trunk.
 1.1 30-Jul-1997  marc branches: 1.1.2;
file i82365.c was initially added on branch marc-pcmcia.
 1.1.2.16 17-Oct-1997  enami Define width_names[] only when PCICDEBUG is defined.
 1.1.2.15 16-Oct-1997  thorpej Copyright/license update.
 1.1.2.14 16-Oct-1997  thorpej Pass down the start and side of the i/o space allocation range to
the "pcmcia" layer so that drivers with Very Special i/o space allocation
needs can know what range they should be dealing with.
 1.1.2.13 16-Oct-1997  enami Handle the case PCMCIA_WIDTH_AUTO.
 1.1.2.12 16-Oct-1997  thorpej KNF, RCS IDs.
 1.1.2.11 14-Oct-1997  thorpej Allow the i/o address alignment to be specified in the call to
pcmcia_io_alloc(). If the caller does not care about the alignment, 0
should be passed.
 1.1.2.10 27-Sep-1997  marc add power management support.
 1.1.2.9 04-Sep-1997  jtk fix typo resulting from code cut&paste
 1.1.2.8 28-Aug-1997  marc Rip out all the isa-specific code, so this can be shared with a pci
attachment.
 1.1.2.7 23-Aug-1997  thorpej Add stub socket enable/disable functions.
 1.1.2.6 14-Aug-1997  jtk add PCIC_ALLOC_IOBASE option & patchable value, so hardware with
missing address lines can be configured to allocate addresses that work

fix case where irq on pcic? is hardwired in config file

print out port ranges used by configured devices
 1.1.2.5 11-Aug-1997  thorpej In the chip-level interrupt establish functions, check the pcmcia function's
configuration entry, making note of the interrupt sharing type. Pass the
correct type to isa_intr_alloc(), so that dynamically allocated interrupts
can be shared.

Also, provide a compile-time/patchable variable that sets the valid
IRQ mask for IRQ allocation, in order to deal with some chipsets that
seem to only allow one IRQ for PCMCIA devices.
 1.1.2.4 10-Aug-1997  thorpej Create a structure to encapsulate information about allocated i/o and
mem space on the pcmcia bus. Use this in chip-level window enable
functions rather than making assumptions about the bus space handles.
 1.1.2.3 31-Jul-1997  thorpej In pcic_chip_intr_establish():
- Update for additional "irqmask" argument.
- Don't attempt to allocate IRQs that are not in the PCIC's list of
valid IRQs.
- Clear the IRQ bits in the PCIC_INTR register value before OR'ing in
the new value, to avoid accidentally setting a bogus IRQ.

In pcic_chip_intr_disestablish():
- Before removing the interrupt handler, clear the IRQ and "enable" bits
in the PCIC_INTR register so that we don't get spurious interrupts
later.
 1.1.2.2 30-Jul-1997  thorpej If Really Verbse Debugging is compiled in, use a patchable variable to
turn the messages on/off, so you can clean up the output without rebuilding.
 1.1.2.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.36 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.35 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.34 27-Oct-2012  chs branches: 1.34.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.33 17-Sep-2009  tsutsui branches: 1.33.12; 1.33.22;
Misc KNF and cosmetics, and remove unnecessary casts etc.
 1.32 14-Sep-2009  tsutsui Use device_private(), proper types or variables for device_t and softc.
(not yet split though)

No crash on gxemul emulating hpcmips mobilepro.
 1.31 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.30 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.29 26-Jun-2008  drochner branches: 1.29.10;
constify the pcmcia/cardbus method tables
 1.28 19-Oct-2007  ad branches: 1.28.16; 1.28.20; 1.28.22; 1.28.24;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.27 16-Nov-2006  christos branches: 1.27.8; 1.27.22; 1.27.24; 1.27.28;
__unused removal on arguments; approved by core.
 1.26 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.25 02-Sep-2006  christos branches: 1.25.2; 1.25.4;
add missing initializers
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.8;
merge ktrace-lwp.
 1.23 04-Feb-2005  perry branches: 1.23.6;
de-__P
 1.22 14-Sep-2004  drochner branches: 1.22.4; 1.22.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.21 11-Aug-2004  mycroft Rather than having a call up from the low-level driver to get the card type,
instead have a call down from the PCMCIA mid-layer to set it. Use this from
pcmcia_function_enable(). (Currently the policy is the same, but this would
allow for more flexibility in deciding which mode to use.)

Now it is safe to hold the socket enabled during attach, so do that. Only
one enable/disable cycle to attach a card now!
 1.20 02-Oct-2002  thorpej branches: 1.20.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.19 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.18 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.17 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.16 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.15 13-Nov-2001  lukem add RCSID
 1.14 28-Jun-2000  mrg branches: 1.14.2; 1.14.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 22-Feb-2000  thorpej Don't use void * for chipset tags. Bad hacker, no biscuit.
 1.12 01-Feb-2000  chopps implement probing for available irqs on non-cirrus pcmcia controllers
including cardbus controllers running in pcic mode
 1.11 09-Jun-1998  thorpej branches: 1.11.14;
Nuke __BROKEN_INDIRECT_CONFIG.
 1.10 07-Jun-1998  sommerfe Add ISAPnP attachment for PCMCIA bus controller; reorganize ISA
attachment to let it share code with PnP attachment.
 1.9 23-May-1998  matt Changes so that these compile on NetBSD/alpha as well as NetBSD/i386.
 1.8 30-Nov-1997  drochner make it compile without "__BROKEN_INDIRECT_CONFIG"
 1.7 05-Nov-1997  thorpej The bus width probe doesn't always work properly, producing a false positive
for 12-bit addresses. This causes PCMCIA cards mapped at 0x400 and higher
to not function properly. However, the range 0x300-0x3ff causes some
laptops (e.g. the NEC Versa 6030X) to hang if cards are mapped there.

So, after some experimentation, we compromise. If the probe discovers
a 12-bit address bus, don't trust it. Instead, use the range 0x330-0x3ff.
This has been shown to work on the laptops that the 0x300-0x3ff range is
known to fail on.
 1.6 29-Oct-1997  thorpej - Move all of the configurable parameters (alloc_iobase, alloc_iosize,
intr_alloc_mask) into one place, comment them, and defopt them.
- Rename pcic_intr_alloc_mask to pcic_isa_intr_alloc_mask, since it's
an ISA-specific thing.
- When allocating/establishing the PCIC's interrupt (for card events),
do error checking, and pay attention to the intr_alloc_mask.
 1.5 29-Oct-1997  thorpej Take IRQ 10 out of the default IRQ allocation mask. That IRQ is reserved
for the built-in SCSI on NEC Versa docking stations, and if a card
allocates that IRQ, it will never get interrupts. This caused the
default kernel to not work on these laptops, as IRQ 10 was often the
first free IRQ.
 1.4 20-Oct-1997  thorpej branches: 1.4.2;
Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.3 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.2 16-Oct-1997  thorpej Pull marc-pcmcia branch down to trunk.
 1.1 28-Aug-1997  marc branches: 1.1.2;
file i82365_isa.c was initially added on branch marc-pcmcia.
 1.1.2.4 16-Oct-1997  thorpej Copyright/license update.
 1.1.2.3 16-Oct-1997  thorpej KNF, RCS IDs.
 1.1.2.2 27-Sep-1997  marc - add code to probe for the io bus width. Some machines have 10-bit
io busses, some 12-bit. This adds two new config options
(PCIC_ISA_ALLOC_IOBASE, PCIC_ISA_ALLOC_IOSIZE) for overriding this at
config-time
- for power management, remember the card irq so it can be restored.
 1.1.2.1 28-Aug-1997  marc isa-specific code from i82365 driver bus split
 1.4.2.3 05-Nov-1997  thorpej Pull up from trunk: compromise on the i/o allocation range if the
buswidth probe returns a false "12-bit" answer.
 1.4.2.2 29-Oct-1997  thorpej Pull up from trunk: group options, defopt them, and be better with
interrupt allocation.
 1.4.2.1 29-Oct-1997  thorpej Pull up from trunk: Take IRQ 10 out of the default allocation mask.
 1.11.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.14.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.14.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.14.2.3 11-Jan-2002  nathanw More catchup.
 1.14.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.14.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.20.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.20.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.6.1 12-Aug-2004  skrll Sync with HEAD.
 1.22.6.1 12-Feb-2005  yamt sync with head.
 1.22.4.1 29-Apr-2005  kent sync with -current
 1.23.6.2 27-Oct-2007  yamt sync with head.
 1.23.6.1 30-Dec-2006  yamt sync with head.
 1.24.8.1 03-Sep-2006  yamt sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.4.2 10-Dec-2006  yamt sync with head.
 1.25.4.1 22-Oct-2006  yamt sync with head
 1.25.2.1 18-Nov-2006  ad Sync with head.
 1.27.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.27.24.1 06-Nov-2007  matt sync with HEAD
 1.27.22.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.27.8.1 23-Oct-2007  ad Sync with head.
 1.28.24.1 27-Jun-2008  simonb Sync with head.
 1.28.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.28.20.4 11-Mar-2010  yamt sync with head
 1.28.20.3 16-Sep-2009  yamt sync with head
 1.28.20.2 16-May-2009  yamt sync with head
 1.28.20.1 04-May-2009  yamt sync with head.
 1.28.16.1 29-Jun-2008  mjf Sync with HEAD.
 1.29.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.33.22.2 03-Dec-2017  jdolecek update from HEAD
 1.33.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.12.1 30-Oct-2012  yamt sync with head
 1.34.14.1 05-Oct-2016  skrll Sync with HEAD
 1.50 08-Sep-2024  rillig fix a/an grammar in obvious cases
 1.49 25-Sep-2022  thorpej branches: 1.49.10;
Remove unnecessary include of <sys/malloc.h>.
 1.48 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.47 23-May-2010  jym branches: 1.47.8; 1.47.18;
Cast the sum of iobase and iosize to long, not just iobase. Avoids size
warnings during build when bus_addr_t is 64 bits.
 1.46 22-Mar-2010  dyoung Do not disestablish the interrupt handler inside of the interrupt
handler! Stops a crash on the HP Pavilion N3270.

Cosmetic: sc->ih is a pointer, so set to NULL instead of 0. Compare
with NULL instead of testing truth.
 1.45 17-Sep-2009  tsutsui branches: 1.45.2; 1.45.4;
Misc KNF and cosmetics, and remove unnecessary casts etc.
 1.44 14-Sep-2009  tsutsui Use device_private(), proper types or variables for device_t and softc.
(not yet split though)

No crash on gxemul emulating hpcmips mobilepro.
 1.43 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.42 16-Mar-2009  cegger ansify function definitions
 1.41 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.40 08-Apr-2008  cegger branches: 1.40.4; 1.40.12; 1.40.18;
use aprint_*_dev and device_xname
 1.39 19-Oct-2007  ad branches: 1.39.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.38 29-Mar-2006  thorpej branches: 1.38.18; 1.38.32; 1.38.34; 1.38.38;
Use device_cfdata().
 1.37 11-Dec-2005  christos branches: 1.37.4; 1.37.6; 1.37.8; 1.37.10; 1.37.12;
merge ktrace-lwp.
 1.36 27-Feb-2005  perry branches: 1.36.4;
nuke trailing whitespace
 1.35 04-Feb-2005  perry de-__P
 1.34 14-Sep-2004  drochner branches: 1.34.4; 1.34.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.33 05-Sep-2003  mycroft Several changes to eliminate bogus controllers and sockets from being found:

PCIC_VENDOR_NONE: New.
PCIC_VENDOR_CIRRUS_*: Collapse the 2 chips into one vendor ID.

pcic_ident_ok(): Check the ID revision field -- if it's 0, punt.

pcic_vendor(): Check the ID revision field -- if it's 0, or the ID register
is all-1s, assume there is no chip present. (Previously this would return
"Unknown controller" -- which, AFAICT, *never* resulted in a working device.)
Do the Cirrus check only after verifying that we got the Intel ID.

pcic_attach(): Use a priori knowledge of the Cirrus chips to determine the
number of sockets rather than trying (unsuccessfully) to probe. Also, just
blast all of PCIC_INTR -- we do this in pcic_deactivate_card() anyway.
 1.32 02-Sep-2003  mycroft If the frontend passes in sc->irq=0, set PCIC_INTR_ENABLE. Also, don't clear
that bit all over the bloody place
 1.31 06-Jan-2003  wiz branches: 1.31.2;
interrupt with two rs.
 1.30 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.29 13-Nov-2001  lukem add RCSID
 1.28 26-Sep-2001  thorpej IRQUNK -> ISACF_IRQ_DEFAULT
 1.27 19-Dec-2000  mycroft branches: 1.27.2; 1.27.4; 1.27.6;
Add a big comment in the previous section of code...
 1.26 19-Dec-2000  mycroft Back out previous change.
I removed this once before a long time ago, because it's wrong and breaks
PCMCIA on some machines. It also doesn't fix the Multia problems.
 1.25 18-Dec-2000  thorpej Use IST_LEVEL as appropriate. Fixes PCMCIA interrupt problems
on the DEC Multia. From Juergen Weiss <weiss@Uni-Mainz.DE>.
 1.24 09-Dec-2000  matt Don't use __hpcmips__, but hpcmips
 1.23 12-Jul-2000  soren Update comment.
 1.22 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.21 09-May-2000  jhawk Back out rev 1.7 of i82365_isa.c; 0x300-0x3ff, or even 0x330-0x3ff
is not a reasonable place to allocate 12-bit pcmcia iospace.
It seems to cause conflicts on a large number of modern laptops,
necesitating hand-patching of the kernel (mostly due to
video devices in the upper range of that space).

This will presumably cause problems on the NEC Versa 6030X,
however that appears to be a vastly less common case than
the laptops that are inconvenienced by the current state.

12-bit iospace now uses 0x400-0xfff.
 1.20 28-Feb-2000  enami Fix naming think-o.
 1.19 27-Feb-2000  mycroft Fix the same race condition while initializing the socket.
 1.18 27-Feb-2000  mycroft Reorder the usage of intr_establish/intr_disestablish with respect to setting
the CSC_INTR register, to insure that the IRQ is not left floating and enabled
at any point. Eliminates stray interrupts during the IRQ probe.
 1.17 27-Feb-2000  mycroft Allow a flag to be set to force polling for socket events.
 1.16 25-Feb-2000  mycroft I told them not to use IST_LEVEL here. Now PCMCIA works on my AS200. *sigh*
 1.15 22-Feb-2000  thorpej Don't use void * for chipset tags. Bad hacker, no biscuit.
 1.14 08-Feb-2000  mycroft In light of the previous change, whack the clearing of CSC_INTR
again.
 1.13 08-Feb-2000  mycroft The final read of the CSC register does not appear to be needed any
more.
 1.12 08-Feb-2000  chopps deal with loops that we get stuck in due to unhandled interrupts.
 1.11 08-Feb-2000  mycroft Be more careful with the CSC_INTR register while probing.
Make some output more specific.
 1.10 04-Feb-2000  chopps only enable interrupts from the controller if the socket is enabled
 1.9 04-Feb-2000  chopps doh, remove debugging leftover (forcing irq 15 to always be avail).
 1.8 03-Feb-2000  enami Cosmetic change; use IRQUNK instead of -1 always.
 1.7 02-Feb-2000  enami Make irq probing controled by patchable variable and disable on hpcmips
by default. It doesn't work on hpcmips.
 1.6 01-Feb-2000  chopps restore irq 10 to pcic_isa_intr_alloc_mask
 1.5 01-Feb-2000  chopps implement probing for available irqs on non-cirrus pcmcia controllers
including cardbus controllers running in pcic mode
 1.4 15-Oct-1999  haya branches: 1.4.2;
This is the first check-in of CardBus driver. CardBus driver contains
CardBus bus stub, YENTA PCI-CardBus bridge (cbb), 3Com 3C575TX driver
(ex) and Intel fxp driver.

TODO:
o Conform to the KNF more strictly.
o Be unified with pcmcia code as much as possible.
o Add more drivers for CardBus card, such as APA-1480 or USB card.

The affected files are listed below.

sys/arch/i386/conf/files.i386
sys/arch/macppc/conf/files.macppc
sys/conf/files
sys/dev/ic/elinkxl.c
sys/dev/ic/elinkxlvar.h
sys/dev/ic/i82365.c
sys/dev/ic/i82365var.h
sys/dev/isa/i82365_isasubr.c
sys/dev/pci/files.pci
sys/dev/pcmcia/pcmcia.c
sys/dev/pcmcia/pcmciachip.h

The added files are listed below.

sys/arch/i386/conf/CARDBUS
sys/arch/i386/include/rbus_machdep.h
sys/arch/i386/i386/rbus_machdep.c
sys/arch/macppc/include/rbus_machdep.h
sys/arch/macppc/macppc/rbus_machdep.c
sys/dev/cardbus/if_ex_cardbus.c
sys/dev/cardbus/Makefile.cardbusdevs
sys/dev/cardbus/cardbus.c
sys/dev/cardbus/cardbus_map.c
sys/dev/cardbus/cardbusdevs
sys/dev/cardbus/cardbusdevs.h
sys/dev/cardbus/cardbusdevs_data.h
sys/dev/cardbus/cardbusvar.h
sys/dev/cardbus/cardslot.c
sys/dev/cardbus/cardslotvar.h
sys/dev/cardbus/devlist2h.awk
sys/dev/cardbus/files.cardbus
sys/dev/cardbus/if_fxp_cardbus.c
sys/dev/cardbus/pccardcis.h
sys/dev/cardbus/rbus.c
sys/dev/cardbus/rbus.h
sys/dev/pci/pccbb.c
sys/dev/pci/pccbbreg.h
sys/dev/pci/pccbbvar.h
 1.3 19-Feb-1999  mycroft branches: 1.3.2; 1.3.8;
Oops; PCIC_INTR_ENABLE does something *very* different.
 1.2 18-Feb-1999  mycroft Use the correct interrupt sharing type, and set PCIC_INTR_ENABLE(!).
 1.1 07-Jun-1998  sommerfe Add ISAPnP attachment for PCMCIA bus controller; reorganize ISA
attachment to let it share code with PnP attachment.
 1.3.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.3.2.1 22-May-2000  he Pull up revision 1.21 (requested by jhawk):
Revert 12-bit iospace for PCMCIA to 0x400-0xfff.
 1.4.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.4.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.27.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.27.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.4 07-Jan-2003  thorpej Sync with HEAD.
 1.27.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.27.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.27.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.31.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.31.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.31.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.31.2.1 03-Aug-2004  skrll Sync with HEAD
 1.34.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.34.6.1 12-Feb-2005  yamt sync with head.
 1.34.4.1 29-Apr-2005  kent sync with -current
 1.36.4.2 27-Oct-2007  yamt sync with head.
 1.36.4.1 21-Jun-2006  yamt sync with head.
 1.37.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.37.10.1 19-Apr-2006  elad sync with head.
 1.37.8.1 01-Apr-2006  yamt sync with head.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.38.38.1 25-Oct-2007  bouyer Sync with HEAD.
 1.38.34.1 06-Nov-2007  matt sync with HEAD
 1.38.32.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.38.18.1 23-Oct-2007  ad Sync with head.
 1.39.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.40.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.40.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.40.4.5 11-Aug-2010  yamt sync with head.
 1.40.4.4 11-Mar-2010  yamt sync with head
 1.40.4.3 16-Sep-2009  yamt sync with head
 1.40.4.2 16-May-2009  yamt sync with head
 1.40.4.1 04-May-2009  yamt sync with head.
 1.45.4.1 30-May-2010  rmind sync with head
 1.45.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.45.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.47.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47.8.1 30-Oct-2012  yamt sync with head
 1.49.10.1 02-Aug-2025  perseant Sync with HEAD
 1.9 17-Sep-2009  tsutsui Misc KNF and cosmetics, and remove unnecessary casts etc.
 1.8 14-Sep-2009  tsutsui u_intNN_t -> uintNN_t
 1.7 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.6 11-Dec-2005  christos branches: 1.6.74; 1.6.90;
merge ktrace-lwp.
 1.5 27-Feb-2005  perry nuke trailing whitespace
 1.4 04-Feb-2005  perry de-__P
 1.3 22-Feb-2000  thorpej branches: 1.3.28; 1.3.36; 1.3.38;
Don't use void * for chipset tags. Bad hacker, no biscuit.
 1.2 01-Feb-2000  chopps implement probing for available irqs on non-cirrus pcmcia controllers
including cardbus controllers running in pcic mode
 1.1 07-Jun-1998  sommerfe branches: 1.1.14;
Add ISAPnP attachment for PCMCIA bus controller; reorganize ISA
attachment to let it share code with PnP attachment.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.38.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.38.1 12-Feb-2005  yamt sync with head.
 1.3.36.1 29-Apr-2005  kent sync with -current
 1.3.28.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.28.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.74.3 11-Mar-2010  yamt sync with head
 1.6.74.2 16-Sep-2009  yamt sync with head
 1.6.74.1 16-May-2009  yamt sync with head
 1.18 08-May-2019  isaki 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.17 23-Nov-2011  jmcneill branches: 1.17.50; 1.17.54;
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.16 14-Mar-2009  dsl branches: 1.16.12; 1.16.14;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.15 28-Apr-2008  martin branches: 1.15.8; 1.15.12; 1.15.14;
Remove clause 3 and 4 from TNF licenses
 1.14 19-Oct-2007  ad branches: 1.14.16; 1.14.18; 1.14.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 30-Aug-2006  christos branches: 1.13.12; 1.13.26; 1.13.28; 1.13.32;
comment out impossible comparison.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.8;
merge ktrace-lwp.
 1.11 27-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 04-Feb-2005  perry de-__P
 1.9 13-Nov-2001  lukem branches: 1.9.16; 1.9.24; 1.9.26;
add RCSID
 1.8 30-Mar-2000  augustss branches: 1.8.6; 1.8.8;
Remove register declarations.
 1.7 17-Jun-1998  augustss branches: 1.7.14;
Remove a bunch of totally unnecessary #include <machine/pio.h>
left over from the olden days.
 1.6 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.5 06-Sep-1997  augustss Bus-ify GUS driver.
 1.4 29-Apr-1996  christos branches: 1.4.12;
- prototype fixes
 1.3 05-Feb-1996  jtc Fix error in copyright notice
 1.2 05-Feb-1996  jtc Received copyright assignment
 1.1 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.4.12.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.12.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.9.26.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.26.1 12-Feb-2005  yamt sync with head.
 1.9.24.1 29-Apr-2005  kent sync with -current
 1.9.16.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.16.1 04-Feb-2005  skrll Sync with HEAD.
 1.11.4.2 27-Oct-2007  yamt sync with head.
 1.11.4.1 30-Dec-2006  yamt sync with head.
 1.12.8.1 03-Sep-2006  yamt sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.32.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.28.1 06-Nov-2007  matt sync with HEAD
 1.13.26.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.13.12.1 23-Oct-2007  ad Sync with head.
 1.14.20.2 04-May-2009  yamt sync with head.
 1.14.20.1 16-May-2008  yamt sync with head.
 1.14.18.1 18-May-2008  yamt sync with head.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.12.1 12-Dec-2008  ad Checkpoint work in progress.
 1.15.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.16.14.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.16.12.1 17-Apr-2012  yamt sync with head
 1.17.54.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.17.50.1 10-Jun-2019  christos Sync with HEAD
 1.9 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.8 11-Dec-2005  christos branches: 1.8.70; 1.8.72; 1.8.74;
merge ktrace-lwp.
 1.7 27-Feb-2005  perry nuke trailing whitespace
 1.6 04-Feb-2005  perry de-__P
 1.5 09-Oct-1997  jtc branches: 1.5.50; 1.5.58; 1.5.60;
Fix tipo inherited from old version of TNF copyright template.
 1.4 06-Sep-1997  augustss Bus-ify GUS driver.
 1.3 05-Feb-1996  jtc branches: 1.3.12;
Fix error in copyright notice
 1.2 05-Feb-1996  jtc Received copyright assignment
 1.1 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.3.12.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.12.1 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.60.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.60.1 12-Feb-2005  yamt sync with head.
 1.5.58.1 29-Apr-2005  kent sync with -current
 1.5.50.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.50.1 04-Feb-2005  skrll Sync with HEAD.
 1.8.74.1 16-May-2008  yamt sync with head.
 1.8.72.1 18-May-2008  yamt sync with head.
 1.8.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.36 12-Jul-2022  thorpej Remove unneeded bus_space_barrier() calls.
 1.35 09-Apr-2019  msaitoh Make it compilable with AI_DEBUG.
 1.34 09-Apr-2019  msaitoh KNF. No functional change.
 1.33 03-Jun-2011  tsutsui branches: 1.33.54;
Split device_t/softc of i82586. No crash on TME emulating sun2.
 1.32 12-May-2009  cegger branches: 1.32.4; 1.32.6; 1.32.10;
struct device * -> device_t, no functional changes intended.
 1.31 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.30 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.29 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.28 28-Apr-2008  martin branches: 1.28.8; 1.28.14;
Remove clause 3 and 4 from TNF licenses
 1.27 08-Apr-2008  cegger branches: 1.27.2; 1.27.4;
use aprint_*_dev and device_xname
 1.26 19-Oct-2007  ad branches: 1.26.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.25 16-Nov-2006  christos branches: 1.25.8; 1.25.22; 1.25.24; 1.25.28;
__unused removal on arguments; approved by core.
 1.24 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.23 11-Dec-2005  christos branches: 1.23.20; 1.23.22;
merge ktrace-lwp.
 1.22 30-May-2005  christos branches: 1.22.2;
- add const
- avoid variable shadowing.
 1.21 27-Feb-2005  perry nuke trailing whitespace
 1.20 04-Feb-2005  perry de-__P
 1.19 14-Sep-2004  drochner branches: 1.19.4; 1.19.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.18 22-Apr-2004  itojun sprintf -> snprintf
 1.17 02-Oct-2002  thorpej branches: 1.17.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.16 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.13 26-Nov-2001  fredette Added macros for the bits in the SYSBUS byte, and macros
for the i82596 PORT access interface, from the documentation
for that chip. These help clarify writes to the SYSBUS
part of the SCP, and PORT usage by i82596-aware drivers.
 1.12 13-Nov-2001  lukem add RCSID
 1.11 18-Jul-2001  thorpej bzero -> memset
 1.10 10-Mar-2001  jdolecek branches: 1.10.2;
add 'why' argument to the channel attention hook function; this argument
is similar to the one passed to hwreset hook function
 1.9 22-Jan-2001  bjh21 branches: 1.9.2;
Patch from PR kern/8001, submitted by Rafal Boni.

This adds support for EtherExpress/16 cards with 16k of RAM, and in the
process adds general support for PIO mode on these cards. This entails
changing the way the i82586 driver handles bus barriers, since it doesn't
allow for strange cases like this.

This has been tested on the i386 port with the 'ix' driver in both
16KB (which was the source of the problem) and 32KB modes, as well
as with the 'ef' driver. I've tested it (briefly) with 'ei' on arm26
as well. In theory, drivers other than 'ix' should follow precisely the
same code paths as before.
 1.8 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 08-Jan-1999  augustss branches: 1.7.8;
Fix more `void *' arithmetic.
 1.6 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.5 08-Jun-1998  pk Fix the obvious bogons reported in PR#5552.
The problem in the memory size probe is still pending.
 1.4 15-Apr-1998  thorpej Fixup RCS IDs.
 1.3 03-Mar-1998  pk Cheesily work-around reliance on __BROKEN_INDIRECT_CONFIG; should we
bother trying to find the board's memory size in the match routine at all?
 1.2 28-Feb-1998  pk * Remove `_NEW_I82586'.
* KNF.
* erase ghost spaces and tabs.
 1.1 27-Feb-1998  pk AT&T/StarLan i82586 front-end driver from Rafal Boni.
 1.7.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.7.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.7.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.9.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.9.2.5 11-Jan-2002  nathanw More catchup.
 1.9.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.9.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.9.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.9.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.10.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.2.1 03-Aug-2001  lukem update to -current
 1.17.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.6.1 12-Feb-2005  yamt sync with head.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.22.2.2 27-Oct-2007  yamt sync with head.
 1.22.2.1 30-Dec-2006  yamt sync with head.
 1.23.22.2 10-Dec-2006  yamt sync with head.
 1.23.22.1 22-Oct-2006  yamt sync with head
 1.23.20.1 18-Nov-2006  ad Sync with head.
 1.25.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.25.24.1 06-Nov-2007  matt sync with HEAD
 1.25.22.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.25.8.1 23-Oct-2007  ad Sync with head.
 1.26.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.4.3 16-May-2009  yamt sync with head
 1.27.4.2 04-May-2009  yamt sync with head.
 1.27.4.1 16-May-2008  yamt sync with head.
 1.27.2.1 18-May-2008  yamt sync with head.
 1.28.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.32.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.32.4.1 12-Jun-2011  rmind sync with head
 1.33.54.1 10-Jun-2019  christos Sync with HEAD
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 28-Feb-1998  pk branches: 1.2.146; 1.2.148; 1.2.150;
Remove extraneous `$Id$' lines.
 1.1 27-Feb-1998  pk AT&T/StarLan i82586 front-end driver from Rafal Boni.
 1.2.150.1 16-May-2008  yamt sync with head.
 1.2.148.1 18-May-2008  yamt sync with head.
 1.2.146.1 02-Jun-2008  mjf Sync with HEAD.
 1.51 03-Feb-2019  mrg - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.50 12-Apr-2008  tsutsui branches: 1.50.92;
Split device_t/softc for MI mb86960, with misc cosmetics.
 1.49 08-Apr-2008  cegger use aprint_*_dev and device_xname
 1.48 19-Oct-2007  ad branches: 1.48.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.47 16-Nov-2006  christos branches: 1.47.8; 1.47.22; 1.47.24; 1.47.28;
__unused removal on arguments; approved by core.
 1.46 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.45 30-Aug-2006  christos branches: 1.45.2; 1.45.4;
fix incomplete initializers.
 1.44 24-Dec-2005  perry branches: 1.44.4; 1.44.8;
__inline__ -> inline
 1.43 11-Dec-2005  christos merge ktrace-lwp.
 1.42 09-Jan-2005  tsutsui branches: 1.42.10;
Some cosmetics:
- remove __P()
- use ansi decls
- u_int8_t, u_char -> uint8_t
- use macro for debug printfs
- some KNF
 1.41 12-Dec-2004  abs Fix comments regarding configration bounaries
 1.40 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.39 30-Nov-2002  tsutsui branches: 1.39.6;
More cleanup of MI mb86960 driver:
- Add support for byte system bus mode. Based on patch in kern/17193 by
Christian Groessler, with some improvements by me.
- Rename sc_flags in mb86960_softc to sc_stat, rename "type" to sc_flags
to specify controller quirks and remove enum mb86960_type.
- Pass controller type via new sc_flags in mb86960_softc rather than
via an mb86960_attach() arg.
- Handle unaligned mbufs properly in mb86960_write_mbufs(). (from ne2000.c)
- Fix a signed/unsigned comparision warning.
- Add definitions of status bits in the RX packed header.
- Change types of some members in mb86960_softc.
 1.38 05-Oct-2002  tsutsui Slightly modify attach messages.
 1.37 04-Oct-2002  tsutsui Allied-Telesyn AT-1700xT and Allied-Telesis RE200x are actually identical,
so show both names in attachment. (From FreeBSD's if_fe_isa.c)
 1.36 04-Oct-2002  tsutsui - Merge dev/ic/ate_subr.c into dev/ic/mb86960.c since it only has EEPROM
read function which can also be used for other MB86965 based boards.
- Rewrite EEPROM read function as per 93C06 EEPROM datasheet.
- Misc cleanup.
 1.35 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.34 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.33 28-Sep-2002  tsutsui Move AT1700/RE2000 EEPROM definitions from isa/if_fereg.h to ic/ate_subr.h.

XXX Maybe all stuff in ate_subr.* should be merged into ic/mb86960*.[ch].
 1.32 28-Sep-2002  tsutsui Remove unused code in #if NetBSD <= 199712 part.
 1.31 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.30 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.29 21-Nov-2001  wiz Presence looks better with a 'c' instead of an 's'.
 1.28 13-Nov-2001  lukem add RCSID
 1.27 18-Jul-2001  thorpej bcopy -> memcpy
 1.26 31-Mar-2001  jdolecek branches: 1.26.2;
fix typo in comment
 1.25 31-Mar-2001  jdolecek Prepare for MCA attachment:
* split off sharable stuff to dev/ic/ate_subr.[ch], move ate(4) device
definition to conf/files
* cosmetic: attach with ate_isa
 1.24 29-May-2000  jhawk branches: 1.24.4;
For all network drivers that call ether_ifattach(), and also
have _detach() functions:
Ensure that softc keeps state about whether the attach succeeded,
and make the detach function return immediately if the attach did
not complete.
 1.23 07-Oct-1998  enami branches: 1.23.12; 1.23.20;
Enable early probe stage printf's not by DIAGNOSTIC but more driver
specific macro constants.
 1.22 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.21 22-Mar-1998  enami Split Fujitsu MB9696x based ethernet card driver into bus
dependent/independent code and bus.h'fied.
 1.20 12-Jan-1998  thorpej Update for config changes.
 1.19 05-Jan-1998  perry RCSID Police.
 1.18 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.17 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.16 17-Oct-1996  thorpej branches: 1.16.4;
Appease the compiler: get rid of some unused variables, add some
prototypes, and suppress a bogus "might be used uninitialized" warning.
It's clear from reading the logic of the function that produces the
warning that the variable will not be used uninitialized, but the
compiler just isn't smart enough, I guess. Marked XXX for future reference.
 1.15 13-Oct-1996  christos backout kprintf changes
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 12-May-1996  mycroft Use intr.h.
 1.12 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.11 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.10 08-Apr-1996  mycroft If we dequeue a packet due to excessive collisions, make sure we check
to see if the queue length has dropped to 0.
 1.9 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.8 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.7 07-Aug-1995  mycroft Fix another comment.
 1.6 07-Aug-1995  mycroft Make this interface simplex. It's more efficient, and sidesteps the
problem of receiving our own multicasts in promiscuous mode. Also, fix
some outdated comments.
 1.5 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.4 23-Jul-1995  mycroft Always use m_pkthdr.len on output. Panic if M_PKTHDR is not set.
 1.3 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.2 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.1 01-May-1995  mycroft Add Masahiro SEKIGUCHI's MB8696[05] driver, ported, with some additional
changes by me:
* Make autoconfiguration work correctly for more models of AT1700.
* Make the debugging code more robust and complete.
* Tweak the output routine for better performance, and to eliminate an ugly
kluge.
Various other style cleanup. Needs more work.
 1.16.4.3 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.16.4.2 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.16.4.1 25-Feb-1997  is Convert to the new world order.
 1.23.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.23.12.2 21-Apr-2001  bouyer Sync with HEAD
 1.23.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.24.4.8 11-Dec-2002  thorpej Sync with HEAD.
 1.24.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.24.4.6 28-Feb-2002  nathanw Catch up to -current.
 1.24.4.5 11-Jan-2002  nathanw More catchup.
 1.24.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.24.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.24.4.2 24-Aug-2001  nathanw Catch up with -current.
 1.24.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.26.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.26.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.2.1 03-Aug-2001  lukem update to -current
 1.39.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.39.6.3 18-Dec-2004  skrll Sync with HEAD.
 1.39.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.39.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.42.10.3 27-Oct-2007  yamt sync with head.
 1.42.10.2 30-Dec-2006  yamt sync with head.
 1.42.10.1 21-Jun-2006  yamt sync with head.
 1.44.8.1 03-Sep-2006  yamt sync with head.
 1.44.4.1 09-Sep-2006  rpaulo sync with head
 1.45.4.2 10-Dec-2006  yamt sync with head.
 1.45.4.1 22-Oct-2006  yamt sync with head
 1.45.2.1 18-Nov-2006  ad Sync with head.
 1.47.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.47.24.1 06-Nov-2007  matt sync with HEAD
 1.47.22.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.47.8.1 23-Oct-2007  ad Sync with head.
 1.48.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.50.92.1 10-Jun-2019  christos Sync with HEAD
 1.27 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.26 02-Feb-2012  tls branches: 1.26.6; 1.26.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.25 22-Sep-2009  tsutsui branches: 1.25.12; 1.25.16;
Make local functions static.
 1.24 22-Sep-2009  tsutsui Split device_t/softc. Tested only on cs at ofisa on shark.
 1.23 22-Sep-2009  tsutsui Fix wrong softc size in CFATTACH_DECL(). (not cs_softc but cs_softc_isa)
 1.22 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.21 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.20 08-Apr-2008  cegger branches: 1.20.4; 1.20.18;
use aprint_*_dev and device_xname
 1.19 19-Oct-2007  ad branches: 1.19.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.18 16-Nov-2006  christos branches: 1.18.8; 1.18.22; 1.18.24; 1.18.28;
__unused removal on arguments; approved by core.
 1.17 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.16 11-Dec-2005  christos branches: 1.16.20; 1.16.22;
merge ktrace-lwp.
 1.15 27-Feb-2005  perry branches: 1.15.4;
nuke trailing whitespace
 1.14 04-Feb-2005  perry de-__P
 1.13 14-Sep-2004  drochner branches: 1.13.4; 1.13.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.12 29-Oct-2003  mycroft Recode the probe slightly to remove a bogus initializer.
Also, don't do the rest of the probe work if the product ID mismatches, since
we'll return 0 anyway.
 1.11 25-Oct-2003  christos Fix uninitialized variable warnings
 1.10 02-Oct-2002  thorpej branches: 1.10.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 21-May-2002  augustss Make it possible to override the way register access is done.
This is needed for some really screwball attachments of the CS8900.
 1.6 07-Jan-2002  thorpej branches: 1.6.8;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.5 26-Nov-2001  yamt move dev/isa/cs89x0{.c,{var,reg}.h} into dev/ic
and split isadma parts into /dev/isa/cs89x0isa*.
 1.4 13-Nov-2001  lukem add RCSID
 1.3 26-Dec-2000  mycroft branches: 1.3.2; 1.3.4;
Um, we need rnd.h so that cs_softc is defined properly. Overrunning structures
is bad.
NOTE: #IFDEF IN SOFTC DEFINITIONS IS BAD.
 1.2 27-Jul-1998  thorpej branches: 1.2.14; 1.2.24;
Fix cfattach naming botch.
 1.1 27-Jul-1998  thorpej ISA front-end for CS8900 driver.
 1.2.24.1 25-Jan-2001  jhawk Pull up revision 1.3 (requested by mycroft):
Include <sys/rnd.h> as appropriate to properly size cs_softc.
 1.2.14.1 05-Jan-2001  bouyer Sync with HEAD
 1.3.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.5 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.3 11-Jan-2002  nathanw More catchup.
 1.3.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.6.8.1 30-May-2002  gehenna Catch up with -current.
 1.10.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.13.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.6.1 12-Feb-2005  yamt sync with head.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.15.4.2 27-Oct-2007  yamt sync with head.
 1.15.4.1 30-Dec-2006  yamt sync with head.
 1.16.22.2 10-Dec-2006  yamt sync with head.
 1.16.22.1 22-Oct-2006  yamt sync with head
 1.16.20.1 18-Nov-2006  ad Sync with head.
 1.18.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.24.1 06-Nov-2007  matt sync with HEAD
 1.18.22.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.18.8.1 23-Oct-2007  ad Sync with head.
 1.19.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.20.4.2 11-Mar-2010  yamt sync with head
 1.20.4.1 16-May-2009  yamt sync with head
 1.25.16.1 18-Feb-2012  mrg merge to -current.
 1.25.12.1 17-Apr-2012  yamt sync with head
 1.26.24.1 06-Jun-2015  skrll Sync with HEAD
 1.26.6.1 03-Dec-2017  jdolecek update from HEAD
 1.6 11-Aug-2000  thorpej Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus. This board is commonly found
on Alpha Jensen systems.
 1.5 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 15-Aug-1998  mycroft branches: 1.4.12; 1.4.22;
Assign my copyrights to TNF.
 1.3 21-Jul-1998  drochner adapt to LANCE driver split
 1.2 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.1 16-Apr-1998  drochner Split out from if_le_isa.c - this card is quite different.
The driver is known not to work (timeout on send attempts).
 1.4.22.1 11-Aug-2000  thorpej Pullup from trunk:
Add support for the DEC DE422 Ethernet, which is a DEPCA
attached to the EISA bus. This board is commonly found
on Alpha Jensen systems.
 1.4.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.37 08-Feb-2024  andvar s/transeiver/transceiver/ in comments.
 1.36 29-May-2019  msaitoh KNF. No functional change.
 1.35 08-Feb-2018  dholland branches: 1.35.4;
Typos.
 1.34 24-Apr-2011  plunky use static inline for ec_readmem(), it is not referenced elsewhere

(avoids C99 vs GNU semantics for external inline functions)
 1.33 28-Apr-2008  martin branches: 1.33.22; 1.33.28;
Remove clause 3 and 4 from TNF licenses
 1.32 12-Mar-2008  cube branches: 1.32.2; 1.32.4;
Split device_t and softc for the NE2000 Ethernet chip and all its variants
and attachments. Use device_t accessors, correct types, and ANSIfy when
appropriate.
 1.31 19-Oct-2007  ad branches: 1.31.12; 1.31.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.30 04-Mar-2007  christos branches: 1.30.2; 1.30.14; 1.30.16; 1.30.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.29 16-Nov-2006  christos branches: 1.29.4;
__unused removal on arguments; approved by core.
 1.28 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.27 29-Mar-2006  thorpej branches: 1.27.8; 1.27.10;
Use device_cfdata().
 1.26 24-Dec-2005  perry branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.25 11-Dec-2005  christos merge ktrace-lwp.
 1.24 27-Feb-2005  perry branches: 1.24.4;
nuke trailing whitespace
 1.23 04-Feb-2005  perry de-__P
 1.22 14-Sep-2004  drochner branches: 1.22.4; 1.22.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.21 11-May-2004  wiz Fix typo in comment; from Sergey Svishchev.
 1.20 15-Jan-2003  bouyer branches: 1.20.2;
Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN
sc->write_mbuf now return len of buffer, including padding.
Tested with a PCI ne2000.
 1.19 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.18 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.17 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.16 07-Jan-2002  thorpej branches: 1.16.10;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.15 13-Nov-2001  lukem add RCSID
 1.14 08-Jul-2001  thorpej branches: 1.14.2;
Remove unnecessary include files. From Onno van der Linden.
 1.13 11-Jun-2001  wiz transceiver, not transciever.
 1.12 12-Feb-2001  thorpej branches: 1.12.2;
Adjust the way that media is initialized on DP8390-compatible
chips. The dp8390_softc now has media_init and media_fini
function pointers that do the work.
 1.11 23-Mar-1999  drochner branches: 1.11.8;
Use BUS_SPACE_ALIGNED_POINTER() instead of ALIGNED_POINTER() where the pointer
in not just used to access memory but is bassed to bus_space_xxx_n()
methods. For debugging purposes, bus_space can have additional constraints
which will be properly met by BUS_SPACE_ALIGNED_POINTER().
 1.10 27-Oct-1998  thorpej branches: 1.10.4;
Holy smokes, batman! Actually fill in the "init_card" entry point!
 1.9 05-Jul-1998  jonathan defopt NS, NSIP.
 1.8 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.7 25-Jun-1998  thorpej When writing packets to transmit buffers, do unaligned buffer fixups,
more-or-less lifted from the Shark CS8900 driver.
 1.6 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.5 26-Jan-1998  thorpej Update copyright.
 1.4 26-Jan-1998  thorpej If we're using these devices on a big-endian CPU, byte swap the "count"
field in the dp8390's packet header (because the dp8390 runs in little-endian
mode in these cases). Inspired by an e-mail from Kazuki Sakamoto.
 1.3 12-Jan-1998  thorpej Update for config changes.
 1.2 02-Nov-1997  thorpej branches: 1.2.2;
Fix a slight brain lapse.
 1.1 02-Nov-1997  thorpej Front-end to the dp8390 chip driver for the 3Com 3c503 Ethernet interface.
Supports changing media with ifconfig's "media" directive.

This splits the 3c503 functionality out of the ISA "ed" driver, much the
same way NE2000 support was split out.
 1.2.2.3 29-Oct-1998  cgd pull up rev 1.10 from trunk (thorpej)
 1.2.2.2 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.2.2.1 02-Nov-1997  thorpej file if_ec.c was added on branch netbsd-1-3 on 1997-11-05 19:10:15 +0000
 1.10.4.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.11.8.1 12-Mar-2001  bouyer Sync with HEAD.
 1.12.2.7 17-Jan-2003  thorpej Sync with HEAD.
 1.12.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.12.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.12.2.4 11-Jan-2002  nathanw More catchup.
 1.12.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.12.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.12.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.14.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.10.1 27-Jan-2003  jmc Pullup revisions 1.19-1.20 (requested by bouyer in ticket #1096)
Zero out the NIC memory when padding packet to
ETHER_MIN_LEN-ETHER_CRC_LEN sc->write_mbuf now return len of
buffer, including padding.
 1.20.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.20.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1 03-Aug-2004  skrll Sync with HEAD
 1.22.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.22.6.1 12-Feb-2005  yamt sync with head.
 1.22.4.1 29-Apr-2005  kent sync with -current
 1.24.4.5 17-Mar-2008  yamt sync with head.
 1.24.4.4 27-Oct-2007  yamt sync with head.
 1.24.4.3 03-Sep-2007  yamt sync with head.
 1.24.4.2 30-Dec-2006  yamt sync with head.
 1.24.4.1 21-Jun-2006  yamt sync with head.
 1.26.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.26.10.1 19-Apr-2006  elad sync with head.
 1.26.8.1 01-Apr-2006  yamt sync with head.
 1.26.6.1 22-Apr-2006  simonb Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.27.10.2 10-Dec-2006  yamt sync with head.
 1.27.10.1 22-Oct-2006  yamt sync with head
 1.27.8.1 18-Nov-2006  ad Sync with head.
 1.29.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.30.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.30.16.2 23-Mar-2008  matt sync with HEAD
 1.30.16.1 06-Nov-2007  matt sync with HEAD
 1.30.14.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.30.2.1 23-Oct-2007  ad Sync with head.
 1.31.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.31.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.31.12.1 24-Mar-2008  keiichi sync with head.
 1.32.4.1 16-May-2008  yamt sync with head.
 1.32.2.1 18-May-2008  yamt sync with head.
 1.33.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.22.1 31-May-2011  rmind sync with head
 1.35.4.1 10-Jun-2019  christos Sync with HEAD
 1.2 27-Dec-2019  msaitoh s/transfered/transferred/
 1.1 02-Nov-1997  thorpej branches: 1.1.2; 1.1.238;
Front-end to the dp8390 chip driver for the 3Com 3c503 Ethernet interface.
Supports changing media with ifconfig's "media" directive.

This splits the 3c503 functionality out of the ISA "ed" driver, much the
same way NE2000 support was split out.
 1.1.238.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.1.2.2 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.1.2.1 02-Nov-1997  thorpej file if_ecreg.h was added on branch netbsd-1-3 on 1997-11-05 19:10:16 +0000
 1.119 03-Nov-1997  thorpej This driver is now obsolete.
 1.118 02-Nov-1997  thorpej Garbage-collect the 3Com 3c503 support from the "ed" driver. The ISA "ec"
driver now handles the 3c503.
 1.117 19-Oct-1997  thorpej branches: 1.117.2;
Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.116 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.115 14-Oct-1997  thorpej Correct a comment.
 1.114 14-Oct-1997  thorpej Pulldown from marc-pcmcia branch: garbage-collect NE2000 support from
this file. The "ne" driver is now used, instead.
 1.113 13-Oct-1997  explorer o Make usage of /dev/random dependant on
pseudo-device rnd # /dev/random and in-kernel generator
in config files.

o Add declaration to all architectures.

o Clean up copyright message in rnd.c, rnd.h, and rndpool.c to include
that this code is derived in part from Ted Tyso's linux code.
 1.112 10-Oct-1997  explorer Add hooks to insert timing info into the random system
 1.111 04-Jun-1997  cgd branches: 1.111.4;
4th arg to bus_space_{read,write}_multi_2() is a u_int16_t *, and should be
cast if it isn't. (These casts aren't necessarily safe, because of
alignment issues, but they allow the code to compile with prototyped versions
of bus_space_{read,write}_multi_2().)
 1.110 28-Apr-1997  mycroft Oops; forgot to GC the last mbuf allocated when out of clusters.
 1.109 24-Apr-1997  mycroft Fix typo in previous.
 1.108 24-Apr-1997  mycroft If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
 1.107 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.106 17-Nov-1996  mikel branches: 1.106.4;
Add missing arguments to NIC_GET in debug code. Fixes kern/2875.
 1.105 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.104 13-Oct-1996  christos backout kprintf changes
 1.103 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.102 04-Oct-1996  explorer Better error message when the card is found but shared memory isn't enabled
 1.101 25-Jun-1996  thorpej In the 3c503 probe, map the correct number of ports. (Unmap already
unmapped the correct number of ports, thus causing the ISA io port
extent map to get corrupted.)
 1.100 12-May-1996  mycroft Use intr.h.
 1.99 08-May-1996  thorpej If accessing shared memory on a 16-bit card, be careful not to do any
8-bit memory access; some cards, notably some WD/SMC cards, can't handle
8-bit access if 16-bit access has been enabled.
 1.98 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.97 05-May-1996  thorpej Fix a bug I introduced when converting the driver to <machine/bus.h>.
Use the i/o handle for the `delay port' exported from the parent
ISA bus, rather than the totally bogus combination of [ioh, 0x84].
Also, fix a bug apparently introduced when the -Wall changes were checked
in which, under most circumstances, would cause a 16-bit WD8013EP to
be mis-identified as an 8-bit WD8003EP.
 1.96 03-May-1996  christos Remove unused err label; simplify the code in ed_probe_Novell
 1.95 03-May-1996  christos cleanup the memh mess:
- remove it from the Novell probe.
- cleanup the 3com probe.
 1.94 29-Apr-1996  christos - prototype fixes
 1.93 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.92 09-Apr-1996  thorpej Convert to use <machine/bus.h>.
 1.91 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.90 16-Mar-1996  cgd rename asic_addr and nic_addr to asic_base and nic_base, in softc, as
they're base I/O ports, not really addresses. rather than using those
softc fields directly, assign local variables (asicbase, nicbase) to have
their values, and use those. (consistency, plus better optimization
potential in some cases.)
 1.89 16-Mar-1996  cgd Move contents of edprobe() into ed_find() -- they'll be used by edattach()
eventually. rename the probe functions for the various boards to 'find' for
consistency/correctness (but the generic8390 check is still a 'probe').
Add protos for ed_find(), ed_probe_generic8390(), ed_find_WD80x3(),
ed_find_3Com(), and ed_find_Novell(). Fix one minor space nit.
 1.88 16-Mar-1996  cgd convert NIC_GET and NIC_PUT to take NIC base port address, rather than softc.
 1.87 10-Jan-1996  chuck Imported from OpenBSD/FreeBSD:
Add support for the SMC8416 (EtherEZ) ISA ethernet card.
The 8416 has an 8K shared mem (the old driver assumed 16K
and failed at attach time).
 1.86 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.85 25-Jul-1995  mycroft Fix typos.
 1.84 24-Jul-1995  mycroft Add missing `break;'.
 1.83 24-Jul-1995  mycroft Fix typo.
 1.82 24-Jul-1995  mycroft Various cleanup:
* Use standard function naming conventions.
* Only increment if_ipackets when a packet was actually received.
* Check for excessively large or small packets before trying to read them.
 1.81 23-Jul-1995  mycroft Rename new xmit_busy back to txb_inuse.
 1.80 23-Jul-1995  mycroft Remove txb_inuse. Other stylistic changes.
 1.79 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.78 23-Jul-1995  mycroft Always use m_pkthdr.len on output. Panic if M_PKTHDR is not set.
 1.77 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.76 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.75 28-May-1995  mycroft Fix multicast filter calculation.
 1.74 01-May-1995  mycroft Tweak the output routine for slightly better performance.
 1.73 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.72 11-Apr-1995  mycroft Move NIC register definitions to a global location.
 1.71 11-Apr-1995  mycroft Update for if.h. Define helper macros for accessing NIC registers. Optimize
edrint() a little more.
 1.70 10-Apr-1995  mycroft Change start and watchdog return values to void.
 1.69 27-Feb-1995  glass fix some typos. from frank@fwi.uva.nl (Frank van der Linden)
 1.68 19-Feb-1995  mycroft Display more information when we get bogus data off the card.
 1.67 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.66 03-Jan-1995  mycroft Add interrupt sharing types.
 1.65 02-Jan-1995  mycroft Use soft configuration where possible.
 1.64 18-Nov-1994  mycroft Stylistic changes.
 1.63 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.62 04-Nov-1994  mycroft Remove outdated comment.
 1.61 04-Nov-1994  mycroft No longer needs icu.h.
 1.60 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.59 03-Nov-1994  mycroft Update to match autoconfig code.
 1.58 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.57 27-Oct-1994  cgd new RCS ID format.
 1.56 23-Oct-1994  mycroft Rearrange ed_init() slightly, to better correspond to the National manual.
Optimize ed_rint() slightly in the case of multiple packets. (Avoid an outb
and an inb for each packet).
 1.55 23-Oct-1994  mycroft Slight optimization.
 1.54 23-Oct-1994  mycroft Fix the packet length correction for buggy chips so that it actually works,
and always use it (otherwise short packets could still be corrupted). Also
produce a diagnostic message if DIAGNOSTIC, since it *is* a hardware bug.
Add an ED_PAGE_SHIFT constant, and use it, to avoid GCC doing horrendous
things with divides and multiplies.
 1.53 14-Oct-1994  mycroft Fix bugs in dealing with odd-length mbufs in ed_pio_write_mbufs(). From
John Hood.
 1.52 12-Oct-1994  mycroft Changes from DG to deal with some old chips that corrupt the packet length.
 1.51 01-Oct-1994  mycroft Make some comments more clear.
 1.50 01-Oct-1994  mycroft Various minor changes to sync better with DG's version.
 1.49 24-May-1994  cgd branches: 1.49.2;
MIN -> min, MAX -> max
 1.48 19-May-1994  mycroft Reverse the order of disabling shared memory and turning off 16-bit mode
where necessary, per Steve Wallace.
 1.47 13-May-1994  mycroft Use ether_ifattach() rather than doing the same thing in each driver.
 1.46 11-May-1994  mycroft Fill in some more struct ifnet fields.
 1.45 05-May-1994  mycroft Don't frob the connector type if the card doesn't grok soft config.
 1.44 28-Apr-1994  mycroft Enable/disable shared memory access on all WD/SMC boards. Add support for
software selection of AUI or BNC connectors using LINK0.
 1.43 24-Apr-1994  mycroft Don't need isa.h.
 1.42 14-Apr-1994  mycroft Patches from David Greenman to eliminate magic constants and add delays when
switching to and fro 16-bit access for 790s.
 1.41 08-Apr-1994  mycroft Return correct values from edintr().
 1.40 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.39 29-Mar-1994  mycroft Updates for new autoconfig.
 1.38 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.37 06-Mar-1994  ws Don't let uninitialized variable slip by
 1.36 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.35 02-Mar-1994  mycroft Add 8003W and 8003EB, per David Greenman.
 1.34 02-Mar-1994  mycroft Fix the 790 interrupt table, per Christoph Robitschko.
 1.33 25-Feb-1994  hpeyerl Remove backwoods compatibility.
 1.32 20-Feb-1994  mycroft Forgot to enable the interrupt on Ultras.
 1.31 17-Feb-1994  mycroft Simplify a couple of bits, since IFF_MULTICAST is always set.
 1.30 16-Feb-1994  mycroft Fix typo.
 1.29 16-Feb-1994  mycroft Use IFF_ALLMULTI correctly.
 1.28 16-Feb-1994  mycroft Remove some dead code.
 1.27 15-Feb-1994  mycroft Hack to make this closer to new config.
 1.26 14-Feb-1994  mycroft Make the multicast filter calculation identical to what will be in if_is.c.
 1.25 13-Feb-1994  mycroft Don't save runt or errored packets. These are almost always `normal', and we
really can't deal with them anyway.
 1.24 13-Feb-1994  mycroft Correct spelling errors.
 1.23 12-Feb-1994  mycroft Support for several new cards pulled from magnum branch.
Format police.
 1.22 10-Feb-1994  mycroft Nuke if_init.
 1.21 08-Feb-1994  mycroft Clean up multicast code; part from magnum branch, and part from Brad Parker
<brad@fcr.com>. A couple of other nits.
 1.20 02-Feb-1994  hpeyerl Multicast is no longer optional.
 1.19 01-Feb-1994  ws Better (explicitly) return something from probe when nothing found
 1.18 24-Jan-1994  deraadt ether_input() takes a network byte order ether_type now
 1.17 12-Jan-1994  mycroft We are simply not ready to use pkthdr.len yet.
 1.16 12-Jan-1994  mycroft Use the pkthdr.len field rather than traversing the mbuf chain. Also put some
sanity checking code in, #ifdef DEBUG, just in case.
 1.15 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.14 15-Dec-1993  mycroft Rearrange some tests to improve efficiency a little when using BPF and
multicast at the same time.
 1.13 12-Dec-1993  hpeyerl ie. also pass up any packet with the multicast bit set in the ethernet
>From: Havard Eidnes <Havard.Eidnes@runit.sintef.no>
 1.12 10-Dec-1993  cgd IF_LLC0 -> IF_LINK0
 1.11 10-Dec-1993  hpeyerl More multicast stuff
>From cmaeda@cs.washington.edu
These patches are derived from the IP Multicast patches for BSDI.
 1.10 23-Oct-1993  davidg * Revision 2.11 1993/10/23 04:21:03 davidg
* Novell probe changed to be invasive because of too many complaints
* about some clone boards not being reset properly and thus not
* found on a warmboot. Yuck.
*
* Revision 2.10 1993/10/23 04:07:12 davidg
* increment output errors if the device times out (done via watchdog)
*
* Revision 2.9 1993/10/23 04:01:45 davidg
* increment input error counter if a packet with a bad length is
* detected.
*
* Revision 2.8 1993/10/15 10:59:56 davidg
* increase maximum time to wait for transmit DMA to complete to 120us.
* call ed_reset() if the time limit is reached instead of trying
* to abort the remote DMA.
*
* Revision 2.7 1993/10/15 10:49:10 davidg
* minor change to way the mbuf pointer temp variable is assigned in
* ed_start (slightly improves code readability)
*
* Revision 2.6 93/10/02 01:12:20 davidg
* use ETHER_ADDR_LEN in NE probe rather than '6'.
 1.9 01-Oct-1993  davidg * Revision 2.5 93/09/30 17:44:14 davidg
* patch from vak@zebub.msk.su (Serge V.Vakulenko) to work around
* a hardware bug in cheap WD clone boards where the PROM checksum
* byte is always zero
*
* Revision 2.4 93/09/29 21:24:30 davidg
* Added software NIC reset in NE probe to work around a problem
* with some NE boards where the 8390 doesn't reset properly on
* power-up. Remove initialization of IMR/ISR in the NE probe
* because this is inherent in the reset.
*
* Revision 2.3 93/09/29 15:10:16 davidg
* credit Charles Hannum
*
* Revision 2.2 93/09/29 13:23:25 davidg
* added no multi-buffer override for 3c503
*
* Revision 2.1 93/09/29 12:32:12 davidg
* changed multi-buffer count for 16bit 3c503's from 5 to 2 after
* noticing that the transmitter becomes idle because of so many
* packets to load.
*
* Revision 2.0 93/09/29 00:00:19 davidg
* many changes, rewrites, additions, etc. Now supports the
* NE1000, NE2000, WD8003, WD8013, 3C503, 16bit 3C503, and
* a variety of similar clones. 16bit 3c503 now does multi
* transmit buffers. Nearly every part of the driver has
* changed in some way since rev 1.30.
 1.8 09-Sep-1993  davidg branches: 1.8.2;
As of this revision, all known bugs have been fixed. Some of the fixes include:

1) fixed 3c503 lock-up if the thinwire cable was disconnected at boot time
2) 8013EBT boards now work (quite well!) in 16bit/16k mode
3) ED_NO_DOUBLE_BUFFERING flag now works
4) slightly higer performance (about 3%) with 16bit WD/SMC boards
5) support for WD8013WC (10BaseT) boards

Additionally, the probe code has been reorganized to be much cleaner. This
revision of the driver is 1.25. The release notes have been updated as well.
 1.7 04-Sep-1993  jtc Include systm.h to get prototypes (and possibly inlines) of *max functions.
 1.6 26-Aug-1993  cgd 0.9 "official" patch 001:
(1) added support for ed1 in both generic kernels at:
device ed1 at isa? port 0x250 net irq 9 iomem 0xd8000 vector edintr
(2) brought if_ed.c up to DG's 1.19 rev.
 1.5 03-Aug-1993  glass with -Wall would bomb, on incomplete type 'selinfo'. bpfilter.h include
moved down, and select.h included.
 1.4 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.3 28-Jul-1993  cgd incorporate changes from 0-9-base to 0-9-ALPHA
 1.2 12-Jul-1993  deraadt branches: 1.2.2;
moved bfdttach point to same place as other drivers, from greenman
 1.1 03-Jul-1993  cgd add support for David Greenman's "ed" driver.
 1.2.2.6 25-Aug-1993  cgd PATCH 1:
add device ed1 so people with 3c503's can use them:
> device ed1 at isa? port 0x250 net irq 9 iomem 0xd8000 vector edintr
also, bring if_ed to DG's 1.19 rev.
 1.2.2.5 27-Jul-1993  cgd oops; forgot select.h
 1.2.2.4 27-Jul-1993  cgd most recent if_ed, with some important bug fixes
 1.2.2.3 26-Jul-1993  cgd Fixed logic problem which caused a bogus value to be written to the 3c503
asic register even if the board isn't a 3c503. This caused old 8003E's not
to work because they ignore IO address bits >10bits and the 3c503 asic is
located at +0x400....the offset was ignored by the 8003E and so the
value was written to one of the NIC registers. The bug was discovered by
Wolfgang Solfrank.
 1.2.2.2 21-Jul-1993  cgd from davidg:
Added config file override for memory size and added flags to force
8bit or 16bit operation, and a flag to disable transmitter double buffering.
See the updated "ed.relnotes" file for information about how to set
the flags.
This should be considered the first "production" release. It still
needs a manual page, though.
 1.2.2.1 20-Jul-1993  cgd Fixed to allow iosiz config parameter to override what was (for jkh,
incorrectly) probed. This allows you more flexibility in getting weird
WD 80x3 clones to work.
 1.8.2.21 10-Feb-1994  mycroft Forgot to convert a couple of bits in the multicast code.
 1.8.2.20 10-Feb-1994  mycroft Typod a constant name in the last change.
 1.8.2.19 10-Feb-1994  mycroft Format police.
 1.8.2.18 10-Feb-1994  mycroft Avoid lots of unneeded ifs.
 1.8.2.17 08-Feb-1994  mycroft Changes to some flags were not being picked up. Part of a patch but Brad
Parker <brad@fcr.com>.
 1.8.2.16 02-Feb-1994  mycroft Add support for more cards, from Andreas Schulz, Thomas Sandford, and Glen
Lowe.
 1.8.2.15 02-Feb-1994  mycroft Change second arg of probe to self, and undo kluges to work around this stupid
deficiency in autoconfig. Also, make the multicast code that nobody ever
compiled actually compile.
 1.8.2.14 02-Feb-1994  mycroft A few nits.
 1.8.2.13 02-Feb-1994  mycroft Clean up cruft in multicast code.
 1.8.2.12 01-Feb-1994  mycroft Fix a couple of bogons.
 1.8.2.11 01-Feb-1994  mycroft Add multicast stuff.
 1.8.2.10 10-Dec-1993  cgd LLC -> LINK
 1.8.2.9 03-Dec-1993  mycroft Implement SIOCGIFADDR.
 1.8.2.8 03-Dec-1993  mycroft Implement SIOCGIFADDR.
 1.8.2.7 02-Dec-1993  mycroft Various minor cleanup.
 1.8.2.6 03-Nov-1993  mycroft Update to reflect global changes, and some other cleanup.
 1.8.2.5 29-Oct-1993  mycroft Prototype everything.
 1.8.2.4 29-Oct-1993  mycroft Fix typo in last change.
 1.8.2.3 29-Oct-1993  mycroft Return a proper value from edintr(). Remove some debugging code.
 1.8.2.2 29-Oct-1993  mycroft Initial version for new config. Could use some cleanup.
 1.8.2.1 14-Sep-1993  mycroft New i386 code.
 1.49.2.3 14-Oct-1994  mycroft Update from trunk.
 1.49.2.2 12-Oct-1994  mycroft Update from trunk.
 1.49.2.1 06-Oct-1994  mycroft Update from trunk.
 1.106.4.5 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.106.4.4 28-Feb-1997  is Don't use sc_enaddr after initialization.
 1.106.4.3 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.106.4.2 21-Feb-1997  is One forgotten detail in the #ifdef NS code.
 1.106.4.1 20-Feb-1997  is Adapt this to the new world order.
 1.111.4.4 14-Oct-1997  thorpej Sync w/ trunk.
 1.111.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.111.4.2 14-Oct-1997  thorpej Split off NE2000 support from the ISA "ed" driver, and create a new "ne"
driver that deals with NE2000s and compatibles on ISA, PCI, and PCMCIA
busses.

This driver uses the generic DP8390 core chipset back-end.
 1.111.4.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.117.2.1 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.1 30-Jul-1997  marc branches: 1.1.2;
file if_ed_isa.c was initially added on branch marc-pcmcia.
 1.1.2.3 14-Oct-1997  thorpej This file is no longer needed, now that the NE2000 support is properly split
into its own driver.
 1.1.2.2 14-Oct-1997  thorpej Split off NE2000 support from the ISA "ed" driver, and create a new "ne"
driver that deals with NE2000s and compatibles on ISA, PCI, and PCMCIA
busses.

This driver uses the generic DP8390 core chipset back-end.
 1.1.2.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.18 03-Nov-1997  thorpej This driver is now obsolete.
 1.17 02-Nov-1997  thorpej Garbage-collect the 3Com 3c503 support from the "ed" driver. The ISA "ec"
driver now handles the 3c503.
 1.16 14-Oct-1997  thorpej branches: 1.16.2;
Pulldown from marc-pcmcia branch: garbage-collect NE2000 support from
this file. The "ne" driver is now used, instead.
 1.15 10-Jan-1996  chuck branches: 1.15.12;
Imported from OpenBSD/FreeBSD:
Add support for the SMC8416 (EtherEZ) ISA ethernet card.
The 8416 has an 8K shared mem (the old driver assumed 16K
and failed at attach time).
 1.14 11-Apr-1995  mycroft Move NIC register definitions to a global location.
 1.13 02-Jan-1995  mycroft Use soft configuration where possible.
 1.12 27-Oct-1994  cgd new RCS ID format.
 1.11 23-Oct-1994  mycroft Fix the packet length correction for buggy chips so that it actually works,
and always use it (otherwise short packets could still be corrupted). Also
produce a diagnostic message if DIAGNOSTIC, since it *is* a hardware bug.
Add an ED_PAGE_SHIFT constant, and use it, to avoid GCC doing horrendous
things with divides and multiplies.
 1.10 01-Oct-1994  mycroft Various minor changes to sync better with DG's version.
 1.9 14-Apr-1994  mycroft branches: 1.9.2;
Patches from David Greenman to eliminate magic constants and add delays when
switching to and fro 16-bit access for 790s.
 1.8 02-Mar-1994  mycroft Add 8003W and 8003EB, per David Greenman.
 1.7 13-Feb-1994  mycroft Format police.
 1.6 12-Feb-1994  mycroft Support for several new cards pulled from magnum branch.
Format police.
 1.5 01-Oct-1993  davidg * Revision 2.5 93/09/30 17:44:14 davidg
* patch from vak@zebub.msk.su (Serge V.Vakulenko) to work around
* a hardware bug in cheap WD clone boards where the PROM checksum
* byte is always zero
*
* Revision 2.4 93/09/29 21:24:30 davidg
* Added software NIC reset in NE probe to work around a problem
* with some NE boards where the 8390 doesn't reset properly on
* power-up. Remove initialization of IMR/ISR in the NE probe
* because this is inherent in the reset.
*
* Revision 2.3 93/09/29 15:10:16 davidg
* credit Charles Hannum
*
* Revision 2.2 93/09/29 13:23:25 davidg
* added no multi-buffer override for 3c503
*
* Revision 2.1 93/09/29 12:32:12 davidg
* changed multi-buffer count for 16bit 3c503's from 5 to 2 after
* noticing that the transmitter becomes idle because of so many
* packets to load.
*
* Revision 2.0 93/09/29 00:00:19 davidg
* many changes, rewrites, additions, etc. Now supports the
* NE1000, NE2000, WD8003, WD8013, 3C503, 16bit 3C503, and
* a variety of similar clones. 16bit 3c503 now does multi
* transmit buffers. Nearly every part of the driver has
* changed in some way since rev 1.30.
 1.4 09-Sep-1993  davidg branches: 1.4.2;
As of this revision, all known bugs have been fixed. Some of the fixes include:

1) fixed 3c503 lock-up if the thinwire cable was disconnected at boot time
2) 8013EBT boards now work (quite well!) in 16bit/16k mode
3) ED_NO_DOUBLE_BUFFERING flag now works
4) slightly higer performance (about 3%) with 16bit WD/SMC boards
5) support for WD8013WC (10BaseT) boards

Additionally, the probe code has been reorganized to be much cleaner. This
revision of the driver is 1.25. The release notes have been updated as well.
 1.3 01-Aug-1993  mycroft Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.2 28-Jul-1993  cgd incorporate changes from 0-9-base to 0-9-ALPHA
 1.1 03-Jul-1993  cgd branches: 1.1.2;
add support for David Greenman "ed" driver
 1.1.2.1 21-Jul-1993  cgd from davidg:
Added config file override for memory size and added flags to force
8bit or 16bit operation, and a flag to disable transmitter double buffering.
See the updated "ed.relnotes" file for information about how to set
the flags.
This should be considered the first "production" release. It still
needs a manual page, though.
 1.4.2.3 02-Feb-1994  mycroft Add support for more cards, from Andreas Schulz, Thomas Sandford, and Glen
Lowe.
 1.4.2.2 29-Oct-1993  mycroft Initial version for new config. Could use some cleanup.
 1.4.2.1 14-Sep-1993  mycroft New i386 code.
 1.9.2.1 06-Oct-1994  mycroft Update from trunk.
 1.15.12.3 14-Oct-1997  thorpej Garbage-collect some NE2000 stuff.
 1.15.12.2 14-Oct-1997  thorpej Split off NE2000 support from the ISA "ed" driver, and create a new "ne"
driver that deals with NE2000s and compatibles on ISA, PCI, and PCMCIA
busses.

This driver uses the generic DP8390 core chipset back-end.
 1.15.12.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.16.2.1 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.1 30-Jul-1997  marc branches: 1.1.2;
file if_edvar.h was initially added on branch marc-pcmcia.
 1.1.2.3 14-Oct-1997  thorpej This file is no longer needed, now that the NE2000 support is properly split
into its own driver.
 1.1.2.2 14-Oct-1997  thorpej Split off NE2000 support from the ISA "ed" driver, and create a new "ne"
driver that deals with NE2000s and compatibles on ISA, PCI, and PCMCIA
busses.

This driver uses the generic DP8390 core chipset back-end.
 1.1.2.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.36 12-Jul-2022  thorpej Remove unneeded bus_space_barrier() calls.
 1.35 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.34 25-Apr-2019  msaitoh No functional change:
- Use __arraycount().
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.33 09-Apr-2019  msaitoh Make it compilable with EF_DEBUG.
 1.32 09-Apr-2019  msaitoh - Use the correct function name for the panic message.
- KNF.
 1.31 03-Jun-2011  tsutsui branches: 1.31.54;
Split device_t/softc of i82586. No crash on TME emulating sun2.
 1.30 12-May-2009  cegger branches: 1.30.4; 1.30.6; 1.30.10;
struct device * -> device_t, no functional changes intended.
 1.29 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.28 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.27 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.26 28-Apr-2008  martin branches: 1.26.8; 1.26.14;
Remove clause 3 and 4 from TNF licenses
 1.25 08-Apr-2008  cegger branches: 1.25.2; 1.25.4;
use aprint_*_dev and device_xname
 1.24 19-Oct-2007  ad branches: 1.24.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 16-Nov-2006  christos branches: 1.23.8; 1.23.22; 1.23.24; 1.23.28;
__unused removal on arguments; approved by core.
 1.22 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.21 28-Mar-2006  thorpej branches: 1.21.8; 1.21.10;
Use device_unit().
 1.20 11-Dec-2005  christos branches: 1.20.4; 1.20.6; 1.20.8; 1.20.10; 1.20.12;
merge ktrace-lwp.
 1.19 30-May-2005  christos branches: 1.19.2;
- add const
- avoid variable shadowing.
 1.18 04-Feb-2005  perry de-__P
 1.17 14-Sep-2004  drochner branches: 1.17.4; 1.17.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.16 22-Apr-2004  itojun sprintf -> snprintf
 1.15 02-Oct-2002  thorpej branches: 1.15.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.11 26-Nov-2001  fredette Added macros for the bits in the SYSBUS byte, and macros
for the i82596 PORT access interface, from the documentation
for that chip. These help clarify writes to the SYSBUS
part of the SCP, and PORT usage by i82596-aware drivers.
 1.10 13-Nov-2001  lukem add RCSID
 1.9 10-Mar-2001  jdolecek branches: 1.9.2;
add 'why' argument to the channel attention hook function; this argument
is similar to the one passed to hwreset hook function
 1.8 22-Jan-2001  bjh21 branches: 1.8.2;
Patch from PR kern/8001, submitted by Rafal Boni.

This adds support for EtherExpress/16 cards with 16k of RAM, and in the
process adds general support for PIO mode on these cards. This entails
changing the way the i82586 driver handles bus barriers, since it doesn't
allow for strange cases like this.

This has been tested on the i386 port with the 'ix' driver in both
16KB (which was the source of the problem) and 32KB modes, as well
as with the 'ef' driver. I've tested it (briefly) with 'ei' on arm26
as well. In theory, drivers other than 'ix' should follow precisely the
same code paths as before.
 1.7 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 08-Jan-1999  augustss branches: 1.6.8;
Fix more `void *' arithmetic.
 1.5 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.4 15-Apr-1998  thorpej Fixup RCS IDs.
 1.3 02-Mar-1998  pk drop `ef_softc' from ef_match function.
 1.2 28-Feb-1998  pk * Remove `_NEW_I82586'.
* KNF.
* erase ghost spaces and tabs.
 1.1 27-Feb-1998  pk 3Com/3C507 i82586 front-end driver from Rafal Boni.
 1.6.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.6.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.6.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.8.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.4 11-Jan-2002  nathanw More catchup.
 1.8.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.9.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.17.6.1 12-Feb-2005  yamt sync with head.
 1.17.4.1 29-Apr-2005  kent sync with -current
 1.19.2.3 27-Oct-2007  yamt sync with head.
 1.19.2.2 30-Dec-2006  yamt sync with head.
 1.19.2.1 21-Jun-2006  yamt sync with head.
 1.20.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.20.10.1 19-Apr-2006  elad sync with head.
 1.20.8.1 01-Apr-2006  yamt sync with head.
 1.20.6.1 22-Apr-2006  simonb Sync with head.
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.21.10.2 10-Dec-2006  yamt sync with head.
 1.21.10.1 22-Oct-2006  yamt sync with head
 1.21.8.1 18-Nov-2006  ad Sync with head.
 1.23.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.24.1 06-Nov-2007  matt sync with HEAD
 1.23.22.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.23.8.1 23-Oct-2007  ad Sync with head.
 1.24.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.4.3 16-May-2009  yamt sync with head
 1.25.4.2 04-May-2009  yamt sync with head.
 1.25.4.1 16-May-2008  yamt sync with head.
 1.25.2.1 18-May-2008  yamt sync with head.
 1.26.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.30.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.30.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.30.4.1 12-Jun-2011  rmind sync with head
 1.31.54.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.31.54.1 10-Jun-2019  christos Sync with HEAD
 1.4 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.3 28-Feb-1998  pk branches: 1.3.146; 1.3.148; 1.3.150;
Remove extraneous `$Id$' lines.
 1.2 28-Feb-1998  pk * Remove `_NEW_I82586'.
* KNF.
* erase ghost spaces and tabs.
 1.1 27-Feb-1998  pk 3Com/3C507 i82586 front-end driver from Rafal Boni.
 1.3.150.1 16-May-2008  yamt sync with head.
 1.3.148.1 18-May-2008  yamt sync with head.
 1.3.146.1 02-Jun-2008  mjf Sync with HEAD.
 1.103 17-Sep-2022  thorpej egstart(): Use m_copydata() rather than open-coding it.
 1.102 17-Sep-2022  thorpej Convert an open-coded check for M_PKTHDR + panic into a KASSERT().
 1.101 17-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.100 17-Sep-2022  thorpej u_int*_t -> uint*_t
 1.99 17-Sep-2022  thorpej Liberally apply "static".
 1.98 17-Sep-2022  thorpej malloc() -> kmem_alloc()
 1.97 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.96 05-Feb-2019  msaitoh branches: 1.96.6;
Remove very old IFF_NOTRAILERS flag.
 1.95 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.94 26-Jun-2018  msaitoh branches: 1.94.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.93 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.92 15-Dec-2016  ozaki-r branches: 1.92.8; 1.92.14;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.91 11-Jul-2016  msaitoh branches: 1.91.2;
- Use aprint*() instead of printf() in the attach function.
- KNF.
 1.90 10-Jun-2016  ozaki-r Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.89 09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.88 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.87 10-Aug-2014  tls branches: 1.87.4;
Merge tls-earlyentropy branch into HEAD.
 1.86 18-Oct-2013  apb branches: 1.86.2;
Delete unused function
static inline void egprintstat(u_char);
 1.85 27-Oct-2012  chs branches: 1.85.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.84 02-Feb-2012  tls branches: 1.84.6;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.83 19-Nov-2011  tls branches: 1.83.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.82 05-Apr-2010  joerg branches: 1.82.8;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.81 19-Jan-2010  pooka branches: 1.81.2; 1.81.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.80 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.79 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.78 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.77 07-Nov-2008  dyoung branches: 1.77.4;
*** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.76 08-Apr-2008  cegger branches: 1.76.4; 1.76.10; 1.76.12;
use aprint_*_dev and device_xname
 1.75 30-Mar-2008  ad This driver's probe routine is particularly slow, so disable it if the
system is known to have no ISA expansion slots. XXX
 1.74 29-Mar-2008  ad Waiting 5s for the card to reset during probe is not cool!
 1.73 19-Oct-2007  ad branches: 1.73.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.72 04-Mar-2007  christos branches: 1.72.2; 1.72.14; 1.72.16; 1.72.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.71 16-Nov-2006  christos branches: 1.71.4;
__unused removal on arguments; approved by core.
 1.70 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.69 04-Oct-2006  christos fix empty if
 1.68 07-Sep-2006  dogcow branches: 1.68.2; 1.68.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.67 17-Aug-2006  christos Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
 1.66 11-Dec-2005  christos branches: 1.66.4; 1.66.8;
merge ktrace-lwp.
 1.65 27-Feb-2005  perry branches: 1.65.4;
nuke trailing whitespace
 1.64 04-Feb-2005  perry de-__P
 1.63 14-Sep-2004  drochner branches: 1.63.4; 1.63.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.62 30-Oct-2003  simonb Remove some assigned-to but otherwise unused variables.
 1.61 15-Jan-2003  bouyer branches: 1.61.2;
Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN
 1.60 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.59 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.58 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.57 07-Jan-2002  thorpej branches: 1.57.10;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.56 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.55 13-Nov-2001  lukem add RCSID
 1.54 18-Jul-2001  thorpej bcopy -> memcpy
 1.53 18-Jul-2001  thorpej bzero -> memset
 1.52 14-Dec-2000  thorpej branches: 1.52.2; 1.52.4;
ALTQ'ify.
 1.51 15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.50 01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.49 30-Mar-2000  augustss Remove register declarations.
 1.48 25-Aug-1999  thorpej branches: 1.48.2;
When padding short packets on transmit, don't include the CRC length
in the computation. kern/8194.
 1.47 18-May-1999  thorpej Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.46 25-Mar-1999  thorpej branches: 1.46.4;
Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.45 28-Feb-1999  explorer Update to slightly altered rnd_attach_source() api
 1.44 12-Dec-1998  mycroft Simplify the copy loops a bit.
 1.43 05-Jul-1998  jonathan branches: 1.43.6;
defopt NS, NSIP.
 1.42 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.41 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.40 12-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.39 12-Jan-1998  thorpej Update for config changes.
 1.38 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.37 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.36 28-Apr-1997  mycroft Oops; forgot to GC the last mbuf allocated when out of clusters.
 1.35 24-Apr-1997  mycroft Fix typo in previous.
 1.34 24-Apr-1997  mycroft If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
 1.33 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.32 21-Oct-1996  thorpej branches: 1.32.4;
New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.31 17-Oct-1996  thorpej Add some prototypes, clean up some unused variables, and misc. other
compiler warning cleanup.
 1.30 13-Oct-1996  christos backout kprintf changes
 1.29 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.28 03-Aug-1996  thorpej Oops, missed a couple of inb()s..
 1.27 03-Aug-1996  thorpej Convert to use <machine/bus.h>, plus 2 bug fixes:

- In egstart(), if the Send Packet command fails, m_freem()
the mbuf chain before dequeueing another one (memory leak).

- In egintr(), return 1 if a known interrupt was processed.
Would manifest itself as spurious interrupts.
 1.26 12-May-1996  mycroft Use intr.h.
 1.25 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.24 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.23 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.22 10-Jan-1996  hpeyerl Make it a tad more obvious that this is a 3c505 driver.
 1.21 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.20 24-Jul-1995  mycroft Fix thinko in packet size diagnostic.
 1.19 24-Jul-1995  mycroft Fix typos.
 1.18 24-Jul-1995  mycroft Various cleanup:
* Use standard function naming conventions.
* Only increment if_ipackets when a packet was actually received.
* Check for excessively large or small packets before trying to read them.
 1.17 23-Jul-1995  mycroft Stylistic changes.
 1.16 23-Jul-1995  mycroft Slight rearrangement. Also, force eg_incount to 0 after a reset.
 1.15 23-Jul-1995  mycroft Push the copying of the output buffer further down, with the intent of
eliminating it and outputting the mbufs directly. Make sure the queue drains
even if packets are not failing to transmit.
 1.14 23-Jul-1995  mycroft Kill return values in egstart().
 1.13 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.12 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.11 11-Apr-1995  mycroft Sync with the rest of the world.
 1.10 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.9 03-Jan-1995  mycroft Add interrupt sharing types.
 1.8 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.7 04-Nov-1994  mycroft Trivial stylistic changes.
 1.6 03-Nov-1994  mycroft Update to match autoconfig code.
 1.5 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 25-Aug-1994  deraadt fix debugging stuff, from dean
 1.2 23-Aug-1994  mycroft branches: 1.2.2;
Some cleanup, checked by Dean.
 1.1 23-Aug-1994  deraadt add `eg' driver for the 3c505 by <dean@fsa.ca>
 1.2.2.1 26-Aug-1994  mycroft update from trunk
 1.32.4.3 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.32.4.2 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.32.4.1 25-Feb-1997  is Transform to the new world order.
 1.43.6.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.46.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.48.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.48.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.48.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.52.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.52.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.52.4.1 03-Aug-2001  lukem update to -current
 1.52.2.7 17-Jan-2003  thorpej Sync with HEAD.
 1.52.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.52.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.52.2.4 11-Jan-2002  nathanw More catchup.
 1.52.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.52.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.52.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.57.10.1 27-Jan-2003  jmc Pullup revisions 1.60-1.61 (requested by bouyer in ticket #1089)
Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN
 1.61.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.61.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.61.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.61.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.61.2.1 03-Aug-2004  skrll Sync with HEAD
 1.63.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.63.6.1 12-Feb-2005  yamt sync with head.
 1.63.4.1 29-Apr-2005  kent sync with -current
 1.65.4.3 27-Oct-2007  yamt sync with head.
 1.65.4.2 03-Sep-2007  yamt sync with head.
 1.65.4.1 30-Dec-2006  yamt sync with head.
 1.66.8.2 14-Sep-2006  yamt sync with head.
 1.66.8.1 03-Sep-2006  yamt sync with head.
 1.66.4.1 09-Sep-2006  rpaulo sync with head
 1.68.4.2 10-Dec-2006  yamt sync with head.
 1.68.4.1 22-Oct-2006  yamt sync with head
 1.68.2.1 18-Nov-2006  ad Sync with head.
 1.71.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.72.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.72.16.1 06-Nov-2007  matt sync with HEAD
 1.72.14.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.72.2.1 23-Oct-2007  ad Sync with head.
 1.73.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.73.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.73.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.76.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.76.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.76.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.76.4.4 11-Aug-2010  yamt sync with head.
 1.76.4.3 11-Mar-2010  yamt sync with head
 1.76.4.2 16-May-2009  yamt sync with head
 1.76.4.1 04-May-2009  yamt sync with head.
 1.77.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.81.4.1 30-May-2010  rmind sync with head
 1.81.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.82.8.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.82.8.2 30-Oct-2012  yamt sync with head
 1.82.8.1 17-Apr-2012  yamt sync with head
 1.83.2.1 18-Feb-2012  mrg merge to -current.
 1.84.6.3 03-Dec-2017  jdolecek update from HEAD
 1.84.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.84.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.85.2.1 18-May-2014  rmind sync with head
 1.86.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.87.4.5 05-Feb-2017  skrll Sync with HEAD
 1.87.4.4 05-Oct-2016  skrll Sync with HEAD
 1.87.4.3 09-Jul-2016  skrll Sync with HEAD
 1.87.4.2 19-Mar-2016  skrll Sync with HEAD
 1.87.4.1 06-Jun-2015  skrll Sync with HEAD
 1.91.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.92.14.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.92.14.2 28-Jul-2018  pgoyette Sync with HEAD
 1.92.14.1 25-Jun-2018  pgoyette Sync with HEAD
 1.92.8.1 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #938):
sys/arch/acorn32/podulebus/if_ie.c: revision 1.41
sys/arch/amiga/dev/if_es.c: revision 1.58
sys/arch/amiga/dev/if_qn.c: revision 1.45
sys/arch/arm/at91/at91emac.c: revision 1.20
sys/arch/arm/ep93xx/epe.c: revision 1.37
sys/arch/emips/ebus/if_le_ebus.c: revision 1.14
sys/arch/emips/ebus/if_le_ebus.c: revision 1.15
sys/arch/mac68k/dev/if_mc.c: revision 1.46
sys/arch/macppc/dev/am79c950.c: revision 1.39
sys/arch/newsmips/apbus/if_sn.c: revision 1.40
sys/arch/next68k/dev/mb8795.c: revision 1.59
sys/arch/playstation2/dev/if_smap.c: revision 1.25
sys/arch/playstation2/dev/if_smap.c: revision 1.26
sys/arch/sun2/dev/if_ec.c: revision 1.28
sys/arch/sun3/dev/if_ie.c: revision 1.63
sys/arch/x68k/dev/if_ne_intio.c: revision 1.19
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.75
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.63
sys/dev/bi/if_ni.c: revision 1.45
sys/dev/cadence/if_cemac.c: revision 1.12
sys/dev/ic/am7990.c: revision 1.78
sys/dev/ic/am79900.c: revision 1.27
sys/dev/ic/an.c: revision 1.67
sys/dev/ic/cs89x0.c: revision 1.40
sys/dev/ic/dm9000.c: revision 1.13
sys/dev/ic/dm9000.c: revision 1.14
sys/dev/ic/dp8390.c: revision 1.88
sys/dev/ic/elink3.c: revision 1.141
sys/dev/ic/elinkxl.c: revision 1.122
sys/dev/ic/hme.c: revision 1.98
sys/dev/ic/i82586.c: revision 1.77
sys/dev/ic/lance.c: revision 1.53
sys/dev/ic/mb86950.c: revision 1.27
sys/dev/ic/mb86960.c: revision 1.86
sys/dev/ic/mtd803.c: revision 1.34
sys/dev/ic/pdq_ifsubr.c: revision 1.59
sys/dev/ic/rrunner.c: revision 1.86
sys/dev/ic/seeq8005.c: revision 1.58
sys/dev/ic/sgec.c: revision 1.47
sys/dev/ic/smc90cx6.c: revision 1.72
sys/dev/ic/smc91cxx.c: revision 1.96
sys/dev/ic/tropic.c: revision 1.49
sys/dev/ic/wi.c: revision 1.245
sys/dev/isa/if_eg.c: revision 1.93
sys/dev/isa/if_el.c: revision 1.95
sys/dev/isa/if_iy.c: revision 1.101
sys/dev/ofw/ofnet.c: revision 1.58
sys/dev/pci/if_alc.c: revision 1.27
sys/dev/pci/if_de.c: revision 1.152
sys/dev/pci/if_fpa.c: revision 1.61
sys/dev/pci/if_jme.c: revision 1.34
sys/dev/pci/if_tl.c: revision 1.108
sys/dev/pci/if_vte.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe.h: revision 1.50
sys/dev/pcmcia/if_cnw.c: revision 1.62
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.17
sys/dev/pcmcia/if_ray.c: revision 1.89
sys/dev/pcmcia/if_xi.c: revision 1.81
sys/dev/pcmcia/mhzc.c: revision 1.51
sys/dev/pcmcia/xirc.c: revision 1.34
sys/dev/qbus/if_de.c: revision 1.33
sys/dev/qbus/if_qe.c: revision 1.78
sys/dev/qbus/if_qt.c: revision 1.22
sys/dev/sbus/be.c: revision 1.87
sys/dev/sbus/qe.c: revision 1.68
sys/dev/scsipi/if_se.c: revision 1.96
sys/dev/usb/if_atu.c: revision 1.59
sys/net/if_l2tp.c: revision 1.28 via patch
sys/net/if_ppp.c: revision 1.160
It's not required to include net/bpfdesc.h. Remove it.
--
Simplify like other drivers. NULL check of ifp->if_bpf is done in
bpf_mtap(), so it's not required to do it here.
--
Remove duplicated inclusion of net/bpf.h.
--
Remove duplicated inclusion of net/bpf.h.
--
Simplify bpf_mtap() call. No functional change.
 1.94.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.94.2.1 10-Jun-2019  christos Sync with HEAD
 1.96.6.1 29-Feb-2020  ad Sync with head.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 27-Feb-2005  perry nuke trailing whitespace
 1.3 23-Jul-1995  mycroft branches: 1.3.66; 1.3.74; 1.3.76;
Stylistic changes.
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 23-Aug-1994  deraadt add `eg' driver for the 3c505 by <dean@fsa.ca>
 1.3.76.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.74.1 29-Apr-2005  kent sync with -current
 1.3.66.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.102 17-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.101 17-Sep-2022  thorpej u_int*_t -> uint*_t
 1.100 17-Sep-2022  thorpej Liberally apply static.
 1.99 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.98 05-Feb-2019  msaitoh branches: 1.98.6;
Remove very old IFF_NOTRAILERS flag.
 1.97 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.96 26-Jun-2018  msaitoh branches: 1.96.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.95 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.94 15-Dec-2016  ozaki-r branches: 1.94.8; 1.94.14;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.93 10-Jun-2016  ozaki-r branches: 1.93.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.92 09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.91 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.90 10-Aug-2014  tls branches: 1.90.4;
Merge tls-earlyentropy branch into HEAD.
 1.89 27-Oct-2012  chs branches: 1.89.10;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.88 02-Feb-2012  tls branches: 1.88.6;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.87 19-Nov-2011  tls branches: 1.87.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.86 05-Apr-2010  joerg branches: 1.86.8;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.85 19-Jan-2010  pooka branches: 1.85.2; 1.85.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.84 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.83 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.82 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.81 07-Nov-2008  dyoung branches: 1.81.4;
*** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.80 08-Apr-2008  cegger branches: 1.80.4; 1.80.10; 1.80.12;
use aprint_*_dev and device_xname
 1.79 19-Oct-2007  ad branches: 1.79.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.78 26-Aug-2007  dyoung branches: 1.78.2; 1.78.6;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).
 1.77 04-Mar-2007  christos branches: 1.77.2; 1.77.10; 1.77.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.76 16-Nov-2006  christos branches: 1.76.4;
__unused removal on arguments; approved by core.
 1.75 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.74 07-Sep-2006  dogcow branches: 1.74.2; 1.74.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.73 11-Dec-2005  christos branches: 1.73.4; 1.73.8;
merge ktrace-lwp.
 1.72 04-Feb-2005  perry branches: 1.72.6;
de-__P
 1.71 14-Sep-2004  drochner branches: 1.71.4; 1.71.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.70 15-Jan-2003  bouyer branches: 1.70.2;
Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN
 1.69 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.68 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.67 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.66 07-Jan-2002  thorpej branches: 1.66.10;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.65 13-Nov-2001  lukem add RCSID
 1.64 18-Jul-2001  thorpej bcopy -> memcpy
 1.63 14-Dec-2000  thorpej branches: 1.63.2; 1.63.4;
ALTQ'ify.
 1.62 15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.61 01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.60 30-Mar-2000  augustss Remove register declarations.
 1.59 25-Aug-1999  thorpej branches: 1.59.2;
When padding short packets on transmit, don't include the CRC length
in the computation. kern/8194.
 1.58 18-May-1999  thorpej Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.57 25-Mar-1999  thorpej branches: 1.57.4;
Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.56 28-Feb-1999  explorer Update to slightly altered rnd_attach_source() api
 1.55 12-Dec-1998  mycroft Simplify the copy loops a bit.
 1.54 05-Jul-1998  jonathan branches: 1.54.6;
defopt NS, NSIP.
 1.53 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.52 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.51 12-Jan-1998  thorpej Update for config changes.
 1.50 30-Nov-1997  drochner make it compile without "__BROKEN_INDIRECT_CONFIG"
 1.49 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.48 10-Sep-1997  mycroft The 501 uses 16 ports, and has a wider range of possible I/O address.
 1.47 28-Apr-1997  mycroft branches: 1.47.4;
Oops; forgot to GC the last mbuf allocated when out of clusters.
 1.46 24-Apr-1997  mycroft Fix typo in previous.
 1.45 24-Apr-1997  mycroft If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
 1.44 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.43 21-Oct-1996  thorpej branches: 1.43.4;
New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.42 13-Oct-1996  christos backout kprintf changes
 1.41 10-Oct-1996  christos - printf to kprintf, sprintf -> ksprintf
 1.40 03-Aug-1996  thorpej Two changes:

- Convert to use <machine/bus.h>.

- Also read station address in egattach(). The softc is no
longer required in the probe function.
 1.39 12-May-1996  mycroft Use intr.h.
 1.38 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.37 29-Apr-1996  christos - prototype fixes
 1.36 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.35 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.34 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.33 05-Aug-1995  mycroft Count collisions and errors better.
 1.32 24-Jul-1995  mycroft Fix thinko in packet size diagnostic.
 1.31 24-Jul-1995  mycroft Fix typos.
 1.30 24-Jul-1995  mycroft Various cleanup:
* Use standard function naming conventions.
* Only increment if_ipackets when a packet was actually received.
* Check for excessively large or small packets before trying to read them.
 1.29 23-Jul-1995  mycroft Remove extra spls in el_init().
 1.28 23-Jul-1995  mycroft Update prototypes.
 1.27 23-Jul-1995  mycroft Various:
* Fix ugly looping constructs.
* Add a missing splx().
* Eliminate sc_pktbuf.
 1.26 23-Jul-1995  mycroft Recode elread() and elget() like other drivers.
 1.25 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.24 09-Jun-1995  mycroft Add missing `break;'s.
 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 11-Apr-1995  mycroft Sync with the rest of the world.
 1.21 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.20 03-Jan-1995  mycroft Add interrupt sharing types.
 1.19 10-Dec-1994  mycroft Fix format of attach message.
 1.18 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.17 04-Nov-1994  mycroft No longer needs icu.h.
 1.16 03-Nov-1994  mycroft Update to match autoconfig code.
 1.15 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.14 27-Oct-1994  cgd new RCS ID format.
 1.13 13-May-1994  mycroft Use ether_ifattach() rather than doing the same thing in each driver.
 1.12 11-May-1994  mycroft Fill in some more struct ifnet fields.
 1.11 24-Apr-1994  mycroft Don't need isa.h.
 1.10 08-Apr-1994  mycroft Fix return values from some interrupt routines.
 1.9 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.8 29-Mar-1994  mycroft Updates for new autoconfig.
 1.7 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.6 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.5 03-Mar-1994  mycroft Upload the ether address to the card after a reset, per Matt Kimmel.
 1.4 02-Mar-1994  mycroft Increment outbound packet count, per Matt Kimmel.
 1.3 01-Mar-1994  mycroft Clean up a bit more; make it look like other drivers. Remove SIOCGIFADDR.
 1.2 01-Mar-1994  cgd format cop, plus fix up ether_type byte order difference.
things that i think look bogus are marked "XXX" with "cgd" in the
same line; some enet-savvy person should look through them.
 1.1 01-Mar-1994  hpeyerl Driver for 3Com Etherlink (3c501)
>From Matthew E. Kimmel (kimmel@cs.umass.edu)
 1.43.4.3 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.43.4.2 26-Feb-1997  is Fix edito pointed out by Charles Hannum.
 1.43.4.1 25-Feb-1997  is Convert to the new world order.
 1.47.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.54.6.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.57.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.59.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.59.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.59.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.63.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.63.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.63.4.1 03-Aug-2001  lukem update to -current
 1.63.2.6 17-Jan-2003  thorpej Sync with HEAD.
 1.63.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.63.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.63.2.3 11-Jan-2002  nathanw More catchup.
 1.63.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.63.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.66.10.1 27-Jan-2003  jmc Pullup revisions 1.69-1.70 (requested by bouyer in ticket #1090)
Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN.
 1.70.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.70.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.70.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.71.6.1 12-Feb-2005  yamt sync with head.
 1.71.4.1 29-Apr-2005  kent sync with -current
 1.72.6.3 27-Oct-2007  yamt sync with head.
 1.72.6.2 03-Sep-2007  yamt sync with head.
 1.72.6.1 30-Dec-2006  yamt sync with head.
 1.73.8.1 14-Sep-2006  yamt sync with head.
 1.73.4.1 09-Sep-2006  rpaulo sync with head
 1.74.4.2 10-Dec-2006  yamt sync with head.
 1.74.4.1 22-Oct-2006  yamt sync with head
 1.74.2.1 18-Nov-2006  ad Sync with head.
 1.76.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.77.14.2 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.77.14.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.77.10.1 03-Sep-2007  skrll Sync with HEAD.
 1.77.2.2 23-Oct-2007  ad Sync with head.
 1.77.2.1 09-Oct-2007  ad Sync with head.
 1.78.6.1 25-Oct-2007  bouyer Sync with HEAD.
 1.78.2.1 06-Nov-2007  matt sync with HEAD
 1.79.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.79.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.80.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.80.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.80.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.80.4.4 11-Aug-2010  yamt sync with head.
 1.80.4.3 11-Mar-2010  yamt sync with head
 1.80.4.2 16-May-2009  yamt sync with head
 1.80.4.1 04-May-2009  yamt sync with head.
 1.81.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.85.4.1 30-May-2010  rmind sync with head
 1.85.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.86.8.2 30-Oct-2012  yamt sync with head
 1.86.8.1 17-Apr-2012  yamt sync with head
 1.87.2.1 18-Feb-2012  mrg merge to -current.
 1.88.6.3 03-Dec-2017  jdolecek update from HEAD
 1.88.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.88.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.89.10.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.90.4.4 05-Feb-2017  skrll Sync with HEAD
 1.90.4.3 09-Jul-2016  skrll Sync with HEAD
 1.90.4.2 19-Mar-2016  skrll Sync with HEAD
 1.90.4.1 06-Jun-2015  skrll Sync with HEAD
 1.93.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.94.14.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.94.14.2 28-Jul-2018  pgoyette Sync with HEAD
 1.94.14.1 25-Jun-2018  pgoyette Sync with HEAD
 1.94.8.1 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #938):
sys/arch/acorn32/podulebus/if_ie.c: revision 1.41
sys/arch/amiga/dev/if_es.c: revision 1.58
sys/arch/amiga/dev/if_qn.c: revision 1.45
sys/arch/arm/at91/at91emac.c: revision 1.20
sys/arch/arm/ep93xx/epe.c: revision 1.37
sys/arch/emips/ebus/if_le_ebus.c: revision 1.14
sys/arch/emips/ebus/if_le_ebus.c: revision 1.15
sys/arch/mac68k/dev/if_mc.c: revision 1.46
sys/arch/macppc/dev/am79c950.c: revision 1.39
sys/arch/newsmips/apbus/if_sn.c: revision 1.40
sys/arch/next68k/dev/mb8795.c: revision 1.59
sys/arch/playstation2/dev/if_smap.c: revision 1.25
sys/arch/playstation2/dev/if_smap.c: revision 1.26
sys/arch/sun2/dev/if_ec.c: revision 1.28
sys/arch/sun3/dev/if_ie.c: revision 1.63
sys/arch/x68k/dev/if_ne_intio.c: revision 1.19
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.75
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.63
sys/dev/bi/if_ni.c: revision 1.45
sys/dev/cadence/if_cemac.c: revision 1.12
sys/dev/ic/am7990.c: revision 1.78
sys/dev/ic/am79900.c: revision 1.27
sys/dev/ic/an.c: revision 1.67
sys/dev/ic/cs89x0.c: revision 1.40
sys/dev/ic/dm9000.c: revision 1.13
sys/dev/ic/dm9000.c: revision 1.14
sys/dev/ic/dp8390.c: revision 1.88
sys/dev/ic/elink3.c: revision 1.141
sys/dev/ic/elinkxl.c: revision 1.122
sys/dev/ic/hme.c: revision 1.98
sys/dev/ic/i82586.c: revision 1.77
sys/dev/ic/lance.c: revision 1.53
sys/dev/ic/mb86950.c: revision 1.27
sys/dev/ic/mb86960.c: revision 1.86
sys/dev/ic/mtd803.c: revision 1.34
sys/dev/ic/pdq_ifsubr.c: revision 1.59
sys/dev/ic/rrunner.c: revision 1.86
sys/dev/ic/seeq8005.c: revision 1.58
sys/dev/ic/sgec.c: revision 1.47
sys/dev/ic/smc90cx6.c: revision 1.72
sys/dev/ic/smc91cxx.c: revision 1.96
sys/dev/ic/tropic.c: revision 1.49
sys/dev/ic/wi.c: revision 1.245
sys/dev/isa/if_eg.c: revision 1.93
sys/dev/isa/if_el.c: revision 1.95
sys/dev/isa/if_iy.c: revision 1.101
sys/dev/ofw/ofnet.c: revision 1.58
sys/dev/pci/if_alc.c: revision 1.27
sys/dev/pci/if_de.c: revision 1.152
sys/dev/pci/if_fpa.c: revision 1.61
sys/dev/pci/if_jme.c: revision 1.34
sys/dev/pci/if_tl.c: revision 1.108
sys/dev/pci/if_vte.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe.h: revision 1.50
sys/dev/pcmcia/if_cnw.c: revision 1.62
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.17
sys/dev/pcmcia/if_ray.c: revision 1.89
sys/dev/pcmcia/if_xi.c: revision 1.81
sys/dev/pcmcia/mhzc.c: revision 1.51
sys/dev/pcmcia/xirc.c: revision 1.34
sys/dev/qbus/if_de.c: revision 1.33
sys/dev/qbus/if_qe.c: revision 1.78
sys/dev/qbus/if_qt.c: revision 1.22
sys/dev/sbus/be.c: revision 1.87
sys/dev/sbus/qe.c: revision 1.68
sys/dev/scsipi/if_se.c: revision 1.96
sys/dev/usb/if_atu.c: revision 1.59
sys/net/if_l2tp.c: revision 1.28 via patch
sys/net/if_ppp.c: revision 1.160
It's not required to include net/bpfdesc.h. Remove it.
--
Simplify like other drivers. NULL check of ifp->if_bpf is done in
bpf_mtap(), so it's not required to do it here.
--
Remove duplicated inclusion of net/bpf.h.
--
Remove duplicated inclusion of net/bpf.h.
--
Simplify bpf_mtap() call. No functional change.
 1.96.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.96.2.1 10-Jun-2019  christos Sync with HEAD
 1.98.6.1 29-Feb-2020  ad Sync with head.
 1.5 20-May-2022  andvar s/auxillary/auxiliary/ in comments.
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 01-Mar-1994  mycroft Clean up a bit more; make it look like other drivers. Remove SIOCGIFADDR.
 1.2 01-Mar-1994  cgd format cop, plus fix up ether_type byte order difference.
things that i think look bogus are marked "XXX" with "cgd" in the
same line; some enet-savvy person should look through them.
 1.1 01-Mar-1994  hpeyerl Driver for 3Com Etherlink (3c501)
>From Matthew E. Kimmel (kimmel@cs.umass.edu)
 1.92 25-Apr-1996  thorpej Break up the ep driver into isa, eisa, and pci front-ends and a
bus-independent core driver. Tested on all three bus types, including
an isa 3c509 masquerading as an eisa device (use ep* at eisa? slot ? in
your kernel config file to catch this one).
XXX Driver still needs to be converted to <machine/bus.h>
 1.91 19-Apr-1996  christos Fix 3c590 to use the new pci interface; the pci compat code changes were
slightly biffed.
 1.90 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.89 27-Mar-1996  cgd Update these (as minimally as possible) to work with new PCI interfaces:
(1) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
(use of other PCI functions, etc., left unchanged.)
 1.88 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.87 19-Feb-1996  christos if_ep.c: Recognize 3c595
 1.86 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.85 05-Dec-1995  christos Repeating my mistakes twice... I used sc-> in the pci probe routine
again, and it turned NetBSD in ostype[] to N^CtBSD... Thanks Charles (again)
Also call epstop() in the attach routine to make sure that the pci card
gets reset properly.
 1.84 13-Nov-1995  christos My previous changes broke the pcmcia support. For now assume that all non
PCI cards look identical to ISA cards.
 1.83 10-Nov-1995  christos Add support for the 3c59x (pci) cards in the 3c5x9 driver. In addition
add the necessary bits for the 3c589 (pcmcia) card without adding any
of the pcmcia framework.
 1.82 10-Oct-1995  mycroft Make sure we only schedule one timeout to refill the mbuf queue.
 1.81 27-Jul-1995  mycroft Fix an oversight in the previous.
 1.80 24-Jul-1995  mycroft Fix typos.
 1.79 24-Jul-1995  mycroft Various cleanup:
* Use standard function naming conventions.
* Only increment if_ipackets when a packet was actually received.
* Check for excessively large or small packets before trying to read them.
 1.78 23-Jul-1995  mycroft Stylistic changes.
 1.77 23-Jul-1995  mycroft Call epmbufempty() any time the board is stopped.
 1.76 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.75 23-Jul-1995  mycroft Fix pasto.
 1.74 23-Jul-1995  mycroft Always use m_pkthdr.len on output. Panic if M_PKTHDR is not set.
 1.73 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.72 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.71 11-Apr-1995  mycroft Sync with the rest of the world.
 1.70 19-Feb-1995  mycroft Rearrange epintr() to insure proper edge-trigger of the interrupt latch.
 1.69 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.68 22-Jan-1995  mycroft Fix the problem with identifying cards on warm boot. Partly from Greg Hudson.
 1.67 07-Jan-1995  mycroft Actually, do the ID reset in elink_reset().
 1.66 06-Jan-1995  mycroft Do the reset in the individual drivers, not in elink_idseq().
 1.65 03-Jan-1995  mycroft Add interrupt sharing types.
 1.64 28-Dec-1994  hpeyerl temporary warning until I get new docs.
 1.63 10-Dec-1994  christos 3c509 fixes to avoid adapter getting stuck in high traffic conditions.
I don't particularly like the fixes, but at least now the 3c509 never
gets stuck. On the other hand, performance still sucks in some cases.
 1.62 25-Nov-1994  christos fix unary plus typo :-)
 1.61 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.60 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.59 03-Nov-1994  mycroft Update to match autoconfig code.
 1.58 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.57 27-Oct-1994  cgd new RCS ID format.
 1.56 05-Sep-1994  mycroft Missed an iobase that should be u_short.
 1.55 26-Aug-1994  mycroft Minor.
 1.54 26-Aug-1994  deraadt Re-enable EISA reset code -- definately needed now. do RX_DISCARD_TOP_PACK
before leaving splhigh(), to give incoming packets a better chance.
 1.53 23-Aug-1994  mycroft Various code cleanup.
 1.52 17-Aug-1994  deraadt multicast
 1.51 14-Aug-1994  mycroft Re-enable EISA reset.
 1.50 06-Aug-1994  deraadt cleanup
 1.49 05-Aug-1994  deraadt cleanup, working 32 bit IO on the 3c579, and memory alignment of insl/insw
for better performance.
 1.48 28-Jul-1994  mycroft Redux.
 1.47 28-Jul-1994  mycroft port --> iobase
 1.46 28-Jul-1994  mycroft Make the EISA reset code like the other drivers.
 1.45 21-Jul-1994  mycroft Remove something which cannot possibly be correct.
 1.44 21-Jul-1994  mycroft Do the EISA probing a little differently.
 1.43 21-Jul-1994  deraadt check if eisa card exists before tromping on dma
 1.42 01-Jul-1994  deraadt branches: 1.42.2;
modifications to the threshold and nicer error checking from christos
and .. splhigh() around insw/outsw code.. yetch
 1.41 04-Jun-1994  deraadt two fixes from christos
 1.40 25-May-1994  hpeyerl Copyright foo.
 1.39 24-May-1994  mycroft MIN --> min
 1.38 21-May-1994  deraadt 32bit eisa does not work now, do not even try
 1.37 13-May-1994  mycroft Use ether_ifattach() rather than doing the same thing in each driver.
 1.36 11-May-1994  mycroft Fill in some more struct ifnet fields.
 1.35 02-May-1994  deraadt insw takes a word count
 1.34 24-Apr-1994  deraadt bit better now, fixes from me & charles. squishy squishy squishy. HI ADAM!
 1.33 23-Apr-1994  hpeyerl Some changes from Charles, Adam and Christos Zoulas.
 1.32 18-Apr-1994  deraadt queue up 8 mbuf chains once again, perhaps this will help?
read packets of the card before attempting to transmit (should improve speed)
 1.31 16-Apr-1994  deraadt first attempt at EISA 32bit IO support. it still doesn't work so it's
disabled.
 1.30 15-Apr-1994  deraadt support multicast and promiscious mode
correct mbuf queue bugs, cleanup some extra symbols
try to let link0/link1 change while running, will this work?
 1.29 13-Apr-1994  deraadt deallocate mbuf cache on ifconfig down.
 1.28 11-Apr-1994  deraadt support multiple eisa/isa cards.
 1.27 08-Apr-1994  mycroft Fix return fro isa_epprobe().
 1.26 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.25 29-Mar-1994  mycroft Updates for new autoconfig.
 1.24 14-Mar-1994  hpeyerl Fix for trailer support reported by <sommerfeld@orchard.medford.ma.us>
 1.23 09-Mar-1994  mycroft Fix NS handling.
 1.22 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.21 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.20 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.19 04-Mar-1994  hpeyerl New probe for 3c579's (EISA). EISA cards still don't work but I
have no idea when I'll be able to work on this next.
 1.18 16-Feb-1994  mycroft Move elink_reset() into a separate file, and add a generic elink_idseq().
 1.17 16-Feb-1994  hpeyerl Add common reset function so if_ep and if_ie don't reset each-other.
(this is a 3commonality)
 1.16 15-Feb-1994  mycroft Make epsendidseq() look less like it was transliterated from assembler.
 1.15 14-Feb-1994  hpeyerl Pedantism. Should delay after stopping Coax xcvr.
 1.14 14-Feb-1994  deraadt missing spl's
 1.13 10-Feb-1994  mycroft Nuke if_init.
 1.12 04-Feb-1994  hpeyerl Fix UTP enabling/disabling.
 1.11 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.10 28-Jan-1994  deraadt cleanup
 1.9 25-Jan-1994  deraadt can't use m_pkthdr.len yet, *sigh*
 1.8 24-Jan-1994  deraadt ether_input() takes a network byte order ether_type now
 1.7 23-Jan-1994  deraadt protos, cleanup spl's, bpf receive side code, check for large packets,
various other fixes.
 1.6 21-Jan-1994  hpeyerl From the knights that go "nit".(Tom Bishop <bishop@lear.bos.locus.com>)
 1.5 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.4 16-Dec-1993  hpeyerl IFF_LLC0->IFF_LINK0
 1.3 16-Dec-1993  hpeyerl oh my... make NS work.
(mental note to check more thoroughly in future)
 1.2 16-Dec-1993  hpeyerl Octal; Hex... It's all the same... :-)
>From deaven@ishmael.ameslab.gov
 1.1 14-Dec-1993  hpeyerl Driver for 3Com Etherlink-III (3c509) written by me. Kudos to Charles
and Theo for help and optimizations. (without which this driver would
never have achieved speeds of 1010KB/sec)
 1.42.2.7 06-Oct-1994  mycroft Update from trunk.
 1.42.2.6 26-Aug-1994  mycroft update from trunk
 1.42.2.5 23-Aug-1994  mycroft update from trunk
 1.42.2.4 14-Aug-1994  mycroft update from trunk (minor)
 1.42.2.3 05-Aug-1994  mycroft update from trunk
 1.42.2.2 29-Jul-1994  cgd from trunk.
 1.42.2.1 21-Jul-1994  cgd updates from trunk.
 1.47 27-Dec-2019  msaitoh s/like like/like/ in comment.
 1.46 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.45 14-Jul-2016  msaitoh branches: 1.45.18;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.44 14-Mar-2009  dsl branches: 1.44.22; 1.44.40;
ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.43 27-Aug-2008  christos branches: 1.43.2; 1.43.8;
device_t changes, pmf, minor knf.
 1.42 28-Apr-2008  martin branches: 1.42.2; 1.42.6;
Remove clause 3 and 4 from TNF licenses
 1.41 19-Oct-2007  ad branches: 1.41.16; 1.41.18; 1.41.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.40 16-Nov-2006  christos branches: 1.40.8; 1.40.22; 1.40.24; 1.40.28;
__unused removal on arguments; approved by core.
 1.39 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.38 28-Mar-2006  thorpej branches: 1.38.8; 1.38.10;
Use device_unit().
 1.37 11-Dec-2005  christos branches: 1.37.4; 1.37.6; 1.37.8; 1.37.10; 1.37.12;
merge ktrace-lwp.
 1.36 12-May-2005  christos branches: 1.36.2;
PR/22058: Onno van der Linden: duplicate detection of isa ip.
Use some more undocumented bits to find out if the card is in pnp mode or not.
 1.35 04-Feb-2005  perry de-__P
 1.34 14-Sep-2004  drochner branches: 1.34.4; 1.34.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.33 02-Oct-2002  thorpej branches: 1.33.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.32 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.31 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.30 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.29 13-Nov-2001  lukem add RCSID
 1.28 02-Sep-2001  tsutsui Make 3C509[B] in ISA mode probed correctly on big endian machines.
 1.27 08-Jul-2001  thorpej branches: 1.27.2;
Remove unnecessary include files. From Onno van der Linden.
 1.26 28-Apr-1999  jonathan branches: 1.26.14;
Improved 509B-in-PnP mode detection (Christoph Badura, Jonathan Stone):
Verify EEPROM checksum, extract card rev-level, test capabilities
word, then test high-order config bits to verify card is in PnP mode,
and skip if so.
 1.25 20-Apr-1999  jonathan Don't attach an 3bc509B as ep? at isa if the EEPROM is set to to PnP mode.
See PR# port-i386/7428
 1.24 04-Nov-1998  fvdl branches: 1.24.6;
Add the 'ex' driver, a DMA driver for 3Com 90x and 90xB cards. Rename
constants from EP_ to ELINK_ since they're now used in the ex driver as well.
 1.23 12-Aug-1998  thorpej Completely rewrite media selection. Add support for the MII/PHY on
the 3Com 3c905-TX and 3c905-T4. Fix handling of the MII on the
3c595-MII and 3c597-MII (can't talk to the PHYs on these cards; just
use "manual" for the external MII port).

Fixes kern/4782 (Chris Demetriou).
 1.22 05-Jul-1998  jonathan defopt NS, NSIP.
 1.21 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.20 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.19 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.18 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.17 14-Oct-1997  thorpej Pull down from marc-pcmcia branch:

Minor tweaks to deal with PCMCIA differences, and support for power
management.
 1.16 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.15 23-Jun-1997  cjs branches: 1.15.4;
Make this work again; the code to avoid attaching a 3c509 in P&P mode
didn't map in the port properly, and it was only luck that it worked
on anything at all.
 1.14 28-Apr-1997  mjacob On alpha, sizeof (long) != sizeof (int) and sizeof (int) != sizeof (ptr_t)
 1.13 27-Apr-1997  veego - Add a new variable to epaddcard to call epconfig with the right chipset.
- Don't attach a 3c509 in PnP mode.
 1.12 18-Apr-1997  cgd compile when __BROKEN_INDIRECT_CONFIG isn't defined.
 1.11 30-Mar-1997  jonathan Add ifmedia hooks: include <ifmedia.h> and add sc_media to softc.
 1.10 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.9 18-Feb-1997  jonathan Move if_ep media-sense code from front ends to inside back end,
to prepare for if_media, and to support EISA 3c59x cards:

* change epconfig() to take a short that encodes the chipset
type (3c509, or Demon/Vortex/Boomerang).
* add distinct 3c509 and Demon/Vortex/Boomerang media-sense
functions to back end.
* Add EISA match/attach support for the 3c592 and 3c597
(Demon) cards as well as the 3c509-comatibl EISA 3c509/3c579.

* Assume that ISA and ISA PnP cards are 3c509-style, until
proof to the contrary (e.g. large packet support).

Tested on 3c595, 3c590, and 3c509b. Not tested on 3c515 or Demon.
 1.8 21-Oct-1996  thorpej branches: 1.8.4;
New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.7 13-Oct-1996  christos backout kprintf changes
 1.6 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 12-May-1996  mycroft Use intr.h.
 1.4 10-May-1996  thorpej Update Herb's e-mail address; beer.org feels a lot more friendly.
 1.3 03-May-1996  christos - Fix random return value in the probe function.
- Add <sys/systm.h> to get prototypes
 1.2 30-Apr-1996  thorpej Convert the Etherlink III (ep) driver to use <machine/bus.h>.
For the ISA probe, implement a way to keep track of which ISA busses
have been through an ep_isa probe; the static variable that was used
before didn't scale.
 1.1 25-Apr-1996  thorpej Break up the ep driver into isa, eisa, and pci front-ends and a
bus-independent core driver. Tested on all three bus types, including
an isa 3c509 masquerading as an eisa device (use ep* at eisa? slot ? in
your kernel config file to catch this one).
XXX Driver still needs to be converted to <machine/bus.h>
 1.8.4.3 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.8.4.2 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.8.4.1 20-Feb-1997  is Adapt this to the new world order.
 1.15.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.4.2 27-Sep-1997  marc initialize enable/disable hooks to NULL so the bus independent code
dtrt.
 1.15.4.1 30-Jul-1997  marc added pcmcia infrastructure and a few devices
 1.24.6.1 28-Apr-1999  perry branches: 1.24.6.1.2;
pullup 1.24->1.26 (Jonathan Stone)
 1.24.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.26.14.6 18-Oct-2002  nathanw Catch up to -current.
 1.26.14.5 28-Feb-2002  nathanw Catch up to -current.
 1.26.14.4 11-Jan-2002  nathanw More catchup.
 1.26.14.3 14-Nov-2001  nathanw Catch up to -current.
 1.26.14.2 21-Sep-2001  nathanw Catch up to -current.
 1.26.14.1 24-Aug-2001  nathanw Catch up with -current.
 1.27.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.27.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.33.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.33.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.34.6.1 12-Feb-2005  yamt sync with head.
 1.34.4.1 29-Apr-2005  kent sync with -current
 1.36.2.3 27-Oct-2007  yamt sync with head.
 1.36.2.2 30-Dec-2006  yamt sync with head.
 1.36.2.1 21-Jun-2006  yamt sync with head.
 1.37.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.37.10.1 19-Apr-2006  elad sync with head.
 1.37.8.1 01-Apr-2006  yamt sync with head.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.38.10.2 10-Dec-2006  yamt sync with head.
 1.38.10.1 22-Oct-2006  yamt sync with head
 1.38.8.1 18-Nov-2006  ad Sync with head.
 1.40.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.40.24.1 06-Nov-2007  matt sync with HEAD
 1.40.22.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.40.8.1 23-Oct-2007  ad Sync with head.
 1.41.20.2 04-May-2009  yamt sync with head.
 1.41.20.1 16-May-2008  yamt sync with head.
 1.41.18.1 18-May-2008  yamt sync with head.
 1.41.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.41.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.42.6.1 19-Oct-2008  haad Sync with HEAD.
 1.42.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.43.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.43.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.44.40.1 05-Oct-2016  skrll Sync with HEAD
 1.44.22.1 03-Dec-2017  jdolecek update from HEAD
 1.45.18.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.45.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15 25-Apr-1996  thorpej Break up the ep driver into isa, eisa, and pci front-ends and a
bus-independent core driver. Tested on all three bus types, including
an isa 3c509 masquerading as an eisa device (use ep* at eisa? slot ? in
your kernel config file to catch this one).
XXX Driver still needs to be converted to <machine/bus.h>
 1.14 10-Nov-1995  christos Add support for the 3c59x (pci) cards in the 3c5x9 driver. In addition
add the necessary bits for the 3c589 (pcmcia) card without adding any
of the pcmcia framework.
 1.13 27-Apr-1995  hpeyerl copyright foo.
 1.12 22-Jan-1995  mycroft Fix the problem with identifying cards on warm boot. Partly from Greg Hudson.
 1.11 10-Dec-1994  christos 3c509 fixes to avoid adapter getting stuck in high traffic conditions.
I don't particularly like the fixes, but at least now the 3c509 never
gets stuck. On the other hand, performance still sucks in some cases.
 1.10 27-Oct-1994  cgd new RCS ID format.
 1.9 28-Jul-1994  mycroft Make the EISA reset code like the other drivers.
 1.8 21-Jul-1994  mycroft Fix a typo.
 1.7 21-Jul-1994  mycroft Do the EISA probing a little differently.
 1.6 21-Jul-1994  deraadt check if eisa card exists before tromping on dma
 1.5 01-Jul-1994  deraadt branches: 1.5.2;
modifications to the threshold and nicer error checking from christos
and .. splhigh() around insw/outsw code.. yetch
 1.4 15-Apr-1994  deraadt support multicast and promiscious mode
correct mbuf queue bugs, cleanup some extra symbols
try to let link0/link1 change while running, will this work?
 1.3 29-Mar-1994  mycroft Updates for new autoconfig.
 1.2 28-Jan-1994  jtc Fix spelling error in Copyright notice
 1.1 14-Dec-1993  hpeyerl Driver for 3Com Etherlink-III (3c509) written by me. Kudos to Charles
and Theo for help and optimizations. (without which this driver would
never have achieved speeds of 1010KB/sec)
 1.5.2.2 29-Jul-1994  cgd from trunk.
 1.5.2.1 21-Jul-1994  cgd updates from trunk.
 1.23 03-Apr-1998  enami The fe driver is spilt into ate, fmv and mbe, and this file is no longer
necessary.
 1.22 29-Mar-1998  mycroft Use a 4-bit table to speed up the CRC even further, without increasing the
code size too much.
 1.21 22-Mar-1998  drochner Make this file compile without BROKRN_INDIRECT_CONFIG.
(Brute force - device probe always returns 0. The driver is replaced
by if_ate, if_fmc and if_mbe and is here for reference only.)
 1.20 12-Jan-1998  thorpej Update for config changes.
 1.19 05-Jan-1998  perry RCSID Police.
 1.18 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.17 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.16 17-Oct-1996  thorpej branches: 1.16.4;
Appease the compiler: get rid of some unused variables, add some
prototypes, and suppress a bogus "might be used uninitialized" warning.
It's clear from reading the logic of the function that produces the
warning that the variable will not be used uninitialized, but the
compiler just isn't smart enough, I guess. Marked XXX for future reference.
 1.15 13-Oct-1996  christos backout kprintf changes
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 12-May-1996  mycroft Use intr.h.
 1.12 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.11 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.10 08-Apr-1996  mycroft If we dequeue a packet due to excessive collisions, make sure we check
to see if the queue length has dropped to 0.
 1.9 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.8 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.7 07-Aug-1995  mycroft Fix another comment.
 1.6 07-Aug-1995  mycroft Make this interface simplex. It's more efficient, and sidesteps the
problem of receiving our own multicasts in promiscuous mode. Also, fix
some outdated comments.
 1.5 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.4 23-Jul-1995  mycroft Always use m_pkthdr.len on output. Panic if M_PKTHDR is not set.
 1.3 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.2 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.1 01-May-1995  mycroft Add Masahiro SEKIGUCHI's MB8696[05] driver, ported, with some additional
changes by me:
* Make autoconfiguration work correctly for more models of AT1700.
* Make the debugging code more robust and complete.
* Tweak the output routine for better performance, and to eliminate an ugly
kluge.
Various other style cleanup. Needs more work.
 1.16.4.3 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.16.4.2 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.16.4.1 25-Feb-1997  is Convert to the new world order.
 1.6 28-Sep-2002  tsutsui Rename if_fereg.h -> if_fmvreg.h since now it has only
FMV-18x specific definitions.
 1.5 28-Sep-2002  tsutsui Move AT1700/RE2000 EEPROM definitions from isa/if_fereg.h to ic/ate_subr.h.

XXX Maybe all stuff in ate_subr.* should be merged into ic/mb86960*.[ch].
 1.4 28-Sep-2002  tsutsui Remove unused FE_VERSION and FE_REG_VERSION.
 1.3 28-Sep-2002  tsutsui Remove MBH10302 register definitions, which is also defined
in dev/ic/mb86960reg.h.
 1.2 05-Jan-1998  perry branches: 1.2.26; 1.2.28;
RCSID Police.
 1.1 01-May-1995  mycroft Add Masahiro SEKIGUCHI's MB8696[05] driver, ported, with some additional
changes by me:
* Make autoconfiguration work correctly for more models of AT1700.
* Make the debugging code more robust and complete.
* Tweak the output routine for better performance, and to eliminate an ugly
kluge.
Various other style cleanup. Needs more work.
 1.2.28.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.33 05-Oct-2002  tsutsui Overhaul of fmv(4) driver:
- Split if_fmv.c into MI/MD part and add ISA-PnP attachment for FMV-183.
(XXX FMV-184 is not tested. It would require extra media-select functions..)
- Fix probe functions of fmv_isa so that FMV-181A/182A will also match.
Fixes port-i386/9476.
 1.32 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.31 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.30 29-Sep-2002  tsutsui Call mb86960_attach() with MB86960_TYPE_86965 since
all FMV-18x have MB86964 or MB86965A, not MB86960,
 1.29 28-Sep-2002  tsutsui Remove unused code in #if NetBSD <= 199712 part.
 1.28 28-Sep-2002  tsutsui Rename if_fereg.h -> if_fmvreg.h since now it has only
FMV-18x specific definitions.
 1.27 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.26 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.25 13-Nov-2001  lukem add RCSID
 1.24 29-May-2000  jhawk branches: 1.24.4; 1.24.6;
For all network drivers that call ether_ifattach(), and also
have _detach() functions:
Ensure that softc keeps state about whether the attach succeeded,
and make the detach function return immediately if the attach did
not complete.
 1.23 07-Oct-1998  enami branches: 1.23.12; 1.23.20;
Enable early probe stage printf's not by DIAGNOSTIC but more driver
specific macro constants.
 1.22 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.21 22-Mar-1998  enami Split Fujitsu MB9696x based ethernet card driver into bus
dependent/independent code and bus.h'fied.
 1.20 12-Jan-1998  thorpej Update for config changes.
 1.19 05-Jan-1998  perry RCSID Police.
 1.18 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.17 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.16 17-Oct-1996  thorpej branches: 1.16.4;
Appease the compiler: get rid of some unused variables, add some
prototypes, and suppress a bogus "might be used uninitialized" warning.
It's clear from reading the logic of the function that produces the
warning that the variable will not be used uninitialized, but the
compiler just isn't smart enough, I guess. Marked XXX for future reference.
 1.15 13-Oct-1996  christos backout kprintf changes
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 12-May-1996  mycroft Use intr.h.
 1.12 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.11 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.10 08-Apr-1996  mycroft If we dequeue a packet due to excessive collisions, make sure we check
to see if the queue length has dropped to 0.
 1.9 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.8 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.7 07-Aug-1995  mycroft Fix another comment.
 1.6 07-Aug-1995  mycroft Make this interface simplex. It's more efficient, and sidesteps the
problem of receiving our own multicasts in promiscuous mode. Also, fix
some outdated comments.
 1.5 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.4 23-Jul-1995  mycroft Always use m_pkthdr.len on output. Panic if M_PKTHDR is not set.
 1.3 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.2 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.1 01-May-1995  mycroft Add Masahiro SEKIGUCHI's MB8696[05] driver, ported, with some additional
changes by me:
* Make autoconfiguration work correctly for more models of AT1700.
* Make the debugging code more robust and complete.
* Tweak the output routine for better performance, and to eliminate an ugly
kluge.
Various other style cleanup. Needs more work.
 1.16.4.3 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.16.4.2 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.16.4.1 25-Feb-1997  is Convert to the new world order.
 1.23.20.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.23.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.24.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.24.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.24.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.24.4.2 11-Jan-2002  nathanw More catchup.
 1.24.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.13 12-Apr-2008  tsutsui Split device_t/softc for MI mb86960, with misc cosmetics.
 1.12 12-Apr-2008  tsutsui Fix a botch (inverted test) in rev 1.4.
 1.11 08-Apr-2008  cegger use aprint_*_dev and device_xname
 1.10 19-Oct-2007  ad branches: 1.10.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 16-Nov-2006  christos branches: 1.9.2; 1.9.8; 1.9.16; 1.9.22; 1.9.24; 1.9.28;
__unused removal on arguments; approved by core.
 1.8 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.7 30-Aug-2006  christos branches: 1.7.2; 1.7.4;
Fix initializer
 1.6 24-Dec-2005  perry branches: 1.6.4; 1.6.8;
__inline__ -> inline
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 09-Jan-2005  tsutsui branches: 1.4.8; 1.4.10;
Some cosmetics:
- remove __P()
- use ansi decls
- u_int8_t, u_char -> uint8_t
- use macro for debug printfs
- some KNF
 1.3 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.2 05-Oct-2002  tsutsui branches: 1.2.2; 1.2.8;
Slightly modify attach messages.
 1.1 05-Oct-2002  tsutsui Overhaul of fmv(4) driver:
- Split if_fmv.c into MI/MD part and add ISA-PnP attachment for FMV-183.
(XXX FMV-184 is not tested. It would require extra media-select functions..)
- Fix probe functions of fmv_isa so that FMV-181A/182A will also match.
Fixes port-i386/9476.
 1.2.8.3 17-Jan-2005  skrll Sync with HEAD.
 1.2.8.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.8.1 18-Sep-2004  skrll Sync with HEAD.
 1.2.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.1 05-Oct-2002  nathanw file if_fmv_isa.c was added on branch nathanw_sa on 2002-10-18 02:42:18 +0000
 1.4.10.3 27-Oct-2007  yamt sync with head.
 1.4.10.2 30-Dec-2006  yamt sync with head.
 1.4.10.1 21-Jun-2006  yamt sync with head.
 1.4.8.1 08-May-2008  jdc Pull up revision 1.12 (requested by tsutsui in ticket #1924).

Fix a botch (inverted test) in rev 1.4.
 1.6.8.1 03-Sep-2006  yamt sync with head.
 1.6.4.1 09-Sep-2006  rpaulo sync with head
 1.7.4.2 10-Dec-2006  yamt sync with head.
 1.7.4.1 22-Oct-2006  yamt sync with head
 1.7.2.1 18-Nov-2006  ad Sync with head.
 1.9.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.24.1 06-Nov-2007  matt sync with HEAD
 1.9.22.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.9.16.1 03-Jun-2008  skrll Sync with netbsd-4.
 1.9.8.1 23-Oct-2007  ad Sync with head.
 1.9.2.1 08-May-2008  jdc Pull up revision 1.12 (requested by tsutsui in ticket #1131).

Fix a botch (inverted test) in rev 1.4.
 1.10.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.2 05-Oct-2002  tsutsui branches: 1.2.2;
Overhaul of fmv(4) driver:
- Split if_fmv.c into MI/MD part and add ISA-PnP attachment for FMV-183.
(XXX FMV-184 is not tested. It would require extra media-select functions..)
- Fix probe functions of fmv_isa so that FMV-181A/182A will also match.
Fixes port-i386/9476.
 1.1 28-Sep-2002  tsutsui Rename if_fereg.h -> if_fmvreg.h since now it has only
FMV-18x specific definitions.
 1.2.2.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.49 19-Jan-2010  pooka hp@isa was marked non-compiling and broken 14 years ago. I'm sure
the tens of well-tested changes since then have been necessary,
but now i'll just spoil the fun for everyone by sending the driver
to the attic.
 1.48 17-Mar-2009  dsl Add some 'int' into function definitions where the K&R one didn't
specify a type.
 1.47 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.46 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.45 07-Nov-2008  dyoung branches: 1.45.4;
*** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.44 08-Apr-2008  cegger branches: 1.44.4; 1.44.10; 1.44.12;
use aprint_*_dev and device_xname
 1.43 05-Dec-2007  dyoung branches: 1.43.12;
Use IFADDR_EMPTY().

(This driver should go away, comments indicate that it does not
even compile.)
 1.42 19-Oct-2007  ad branches: 1.42.2; 1.42.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.41 04-Mar-2007  christos branches: 1.41.2; 1.41.14; 1.41.16; 1.41.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.40 07-Sep-2006  dogcow branches: 1.40.8;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.39 11-Dec-2005  christos branches: 1.39.4; 1.39.8;
merge ktrace-lwp.
 1.38 27-Feb-2005  perry branches: 1.38.4;
nuke trailing whitespace
 1.37 07-Aug-2003  agc branches: 1.37.8; 1.37.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.36 03-May-2003  wiz branches: 1.36.2;
DMA, not dma nor Dma.
 1.35 15-Jan-2003  bouyer Add a #error message asking to fix frame padding (this driver doesn't
compile anyway).
 1.34 05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.33 13-Nov-2001  lukem add RCSID
 1.32 18-Jul-2001  thorpej bcopy -> memcpy
 1.31 18-Jul-2001  thorpej bcmp -> memcmp
 1.30 30-Mar-2000  augustss branches: 1.30.6; 1.30.8;
Remove register declarations.
 1.29 25-Mar-1999  thorpej branches: 1.29.8;
Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.28 28-Feb-1999  explorer Update to slightly altered rnd_attach_source() api
 1.27 05-Jul-1998  jonathan branches: 1.27.6;
defopt NS, NSIP.
 1.26 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.25 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.24 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.23 13-Oct-1996  christos branches: 1.23.4;
backout kprintf changes
 1.22 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.21 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.20 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.19 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.18 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.17 27-Oct-1994  cgd new RCS ID format.
 1.16 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.15 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.14 10-Feb-1994  mycroft Nuke if_init.
 1.13 24-Jan-1994  deraadt ether_input() takes a network byte order ether_type now
 1.12 12-Jan-1994  mycroft Use pkthdr.len field.
 1.11 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.10 06-Sep-1993  mycroft Avoid clash of struct ns_addr with #define ns_addr.
 1.9 13-Jul-1993  mycroft Use splnet, not splimp.
 1.8 01-Jul-1993  mycroft Fix a bunch of things.
 1.7 22-May-1993  cgd add rcsids to everything and clean up headers
 1.6 01-May-1993  mycroft Fix error in last change. B-P
 1.5 30-Apr-1993  mycroft Move bpfattach() call into hpattach().
 1.4 28-Apr-1993  mycroft HP cards use 32 I/O ports, not 16.
 1.3 18-Apr-1993  mycroft Return correct value for new probe sequence.
 1.2 17-Apr-1993  mycroft Use new format for attach message.
 1.1 17-Apr-1993  mycroft Add driver for HP ISA and EISA ethernet adapters.
 1.23.4.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.23.4.1 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.27.6.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.29.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.30.8.3 16-Mar-2002  jdolecek Catch up with -current.
 1.30.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.8.1 03-Aug-2001  lukem update to -current
 1.30.6.4 17-Jan-2003  thorpej Sync with HEAD.
 1.30.6.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.30.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.30.6.1 24-Aug-2001  nathanw Catch up with -current.
 1.36.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.36.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.36.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.36.2.1 03-Aug-2004  skrll Sync with HEAD
 1.37.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.37.8.1 29-Apr-2005  kent sync with -current
 1.38.4.4 07-Dec-2007  yamt sync with head
 1.38.4.3 27-Oct-2007  yamt sync with head.
 1.38.4.2 03-Sep-2007  yamt sync with head.
 1.38.4.1 30-Dec-2006  yamt sync with head.
 1.39.8.1 14-Sep-2006  yamt sync with head.
 1.39.4.1 09-Sep-2006  rpaulo sync with head
 1.40.8.1 12-Mar-2007  rmind Sync with HEAD.
 1.41.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.41.16.2 09-Jan-2008  matt sync with HEAD
 1.41.16.1 06-Nov-2007  matt sync with HEAD
 1.41.14.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.41.14.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.41.2.1 23-Oct-2007  ad Sync with head.
 1.42.4.1 08-Dec-2007  ad Sync with head.
 1.42.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.43.12.2 17-Jan-2009  mjf Sync with HEAD.
 1.43.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.44.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.44.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.44.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.44.4.2 11-Mar-2010  yamt sync with head
 1.44.4.1 04-May-2009  yamt sync with head.
 1.45.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.64 28-Feb-1998  pk This driver is replaced by three i82586 front-end drivers: `ix', `ef' and `ai'.
 1.63 12-Jan-1998  thorpej Update for config changes.
 1.62 21-Nov-1997  bouyer Bussify the I/O part of this driver, so that the invasive probe will
not clobbers config of already-found boards.
 1.61 15-Oct-1997  explorer branches: 1.61.2;
Add and/or update rnd_*() hooks
 1.60 07-Sep-1997  mycroft Recognize any of the memory configurations allowed by the EE16 setup program,
and a few more that I can't test. Something is still wrong with the mapping of
16k boards, though.
 1.59 24-Apr-1997  mycroft branches: 1.59.4;
Fix typo in previous.
 1.58 24-Apr-1997  mycroft If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
 1.57 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.56 05-Nov-1996  mikel branches: 1.56.4;
Eliminate unsolicited spewage; PR #2108.
 1.55 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.54 13-Oct-1996  christos backout kprintf changes
 1.53 10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
- remove kvtop declaration.
 1.52 06-Oct-1996  chuck fix "control reaches end of non-void function" in check_eh() for -Werror.
 1.51 12-May-1996  mycroft Use intr.h.
 1.50 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.49 30-Apr-1996  thorpej Update the 3c507 probe to the new interfaces used by elink_reset()
and elink_idseq().
XXX This is just a kludge until the entire driver is converted to use
<machine/bus.h>
 1.48 29-Apr-1996  christos - prototype fixes
 1.47 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.46 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.45 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.44 26-Sep-1995  hpeyerl fixes a typo, the case where iomem is specified, but iosize is not, and
moves a couple of ee16 specific calls into a 'if ee16' protected block.
From Andrew Gillham <gillham@Digitron.COM>
 1.43 14-Sep-1995  hpeyerl Etherexpress-16 driver collision by Andrew Gillham <gillham@Digitron.COM>.
 1.42 23-Jul-1995  mycroft Remove a noop clearing of IFF_OACTIVE.
 1.41 23-Jul-1995  mycroft Exchange xmit_free for xmit_busy. Add BPF hook to iestart().
 1.40 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.39 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.38 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.37 07-Apr-1995  mycroft Clean up to match common code, and fix a typo.
 1.36 04-Apr-1995  mycroft Rename a few constants to match the chip documentation.
 1.35 04-Apr-1995  mycroft More debugging printf()s, from Rafal Boni.
 1.34 03-Apr-1995  mycroft Prototype iexmit().
 1.33 03-Apr-1995  mycroft Some pseudo-random cleanup, and try to start transmitting packets quicker.
 1.32 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.31 29-Jan-1995  cgd use chip headers in /dev/ic
 1.30 26-Jan-1995  mycroft Initialize the new xmit state correctly. From Rafal Boni.
 1.29 23-Jan-1995  mycroft Various changes from Rafal Boni to improve performance and reliability. Also,
clean up the formatting a little more.
 1.28 07-Jan-1995  mycroft Actually, do the ID reset in elink_reset().
 1.27 06-Jan-1995  mycroft Do the reset in the individual drivers, not in elink_idseq().
 1.26 03-Jan-1995  mycroft Add interrupt sharing types.
 1.25 02-Jan-1995  mycroft Move setting of sc_maddr so soft config works.
 1.24 02-Jan-1995  mycroft Use soft configuration when possible.
 1.23 02-Jan-1995  mycroft More cleanup.
 1.22 02-Jan-1995  mycroft Various cleanup.
 1.21 02-Jan-1995  mycroft Need isareg.h.
 1.20 02-Jan-1995  mycroft Don't assume ia_maddr is in the hole.
 1.19 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.18 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.17 03-Nov-1994  mycroft Update to match autoconfig code.
 1.16 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.15 27-Oct-1994  cgd new RCS ID format.
 1.14 18-Oct-1994  mycroft Bug fixes from Rafal Boni:
* Set promiscuous mode flag before configuring card, so it actually works.
* Handle failed TDR commands correctly.
* Remove some apparently defunct and bogus code.
(This driver needs more work.)
 1.13 14-Aug-1994  mycroft Clean up a little.
 1.12 16-Jul-1994  mycroft Fix failed probe message.
 1.11 13-May-1994  mycroft branches: 1.11.2;
Use ether_ifattach() rather than doing the same thing in each driver.
 1.10 11-May-1994  mycroft Fill in some more struct ifnet fields.
 1.9 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.8 31-Mar-1994  mycroft Some patches from Rafal Boni to fix egregious 3C507 mistakes.
 1.7 29-Mar-1994  mycroft Updates for new autoconfig.
 1.6 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.5 16-Feb-1994  mycroft Fix the credits.
 1.4 16-Feb-1994  mycroft Finish 507 probe routine.
 1.3 15-Feb-1994  mycroft Pull from magnum branch. The way this driver does multicast is somewhat
bogus.
 1.2 24-Jan-1994  deraadt ether_input() takes a network byte order ether_type now
 1.1 08-Nov-1993  mycroft branches: 1.1.2;
A slightly unfinished i82586 driver, based on Garrett Wollman's.
 1.1.2.3 02-Feb-1994  mycroft Deal with new byte order of ether_type.
 1.1.2.2 02-Feb-1994  mycroft Change second arg of probe to self.
 1.1.2.1 03-Dec-1993  mycroft Implement SIOCGIFADDR.
 1.11.2.2 18-Oct-1994  cgd from trunk.
 1.11.2.1 14-Aug-1994  mycroft update from trunk
 1.56.4.4 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.56.4.3 28-Feb-1997  is Don't use sc_enaddr afterinitialization.
XXX this file still needs its probe code cleaned up a lot
 1.56.4.2 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.56.4.1 25-Feb-1997  is Convert to the new world order.
 1.59.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.61.2.1 22-Nov-1997  mellon Pull rev 1.62 up from trunk (bouyer)
 1.6 28-Feb-1998  pk This driver is replaced by three i82586 front-end drivers: `ix', `ef' and `ai'.
 1.5 23-Jan-1995  mycroft Various changes from Rafal Boni to improve performance and reliability. Also,
clean up the formatting a little more.
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 31-Mar-1994  mycroft Some patches from Rafal Boni to fix egregious 3C507 mistakes.
 1.2 16-Feb-1994  mycroft Finish 507 probe routine.
 1.1 08-Nov-1993  mycroft A slightly unfinished i82586 driver, based on Garrett Wollman's.
 1.3 28-Feb-1998  pk This driver is replaced by three i82586 front-end drivers: `ix', `ef' and `ai'.
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 08-Nov-1993  mycroft A slightly unfinished i82586 driver, based on Garrett Wollman's.
 1.3 28-Feb-1998  pk This driver is replaced by three i82586 front-end drivers: `ix', `ef' and `ai'.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 14-Sep-1995  hpeyerl Etherexpress-16 driver collision by Andrew Gillham <gillham@Digitron.COM>.
 1.40 10-Feb-2024  andvar fix various typos in comments and log messages.
 1.39 12-Jul-2022  thorpej Remove unneeded bus_space_barrier() calls.
 1.38 25-Apr-2019  msaitoh No functional change:
- Use __arraycount().
- u_int_{8,16,32}_t -> uint_{8,16,32}_t
- KNF.
- Tabify.
- Remove extra space.
 1.37 09-Apr-2019  msaitoh Make it compilable with IX_DEBUG.
 1.36 09-Apr-2019  msaitoh KNF. No functional change.
 1.35 14-Jul-2016  msaitoh branches: 1.35.18;
KNF. No functional change.
 1.34 03-Jun-2011  tsutsui branches: 1.34.12; 1.34.30;
Split device_t/softc of i82586. No crash on TME emulating sun2.
 1.33 12-May-2009  cegger branches: 1.33.4; 1.33.6; 1.33.10;
struct device * -> device_t, no functional changes intended.
 1.32 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.31 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.30 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.29 28-Apr-2008  martin branches: 1.29.8; 1.29.14;
Remove clause 3 and 4 from TNF licenses
 1.28 08-Apr-2008  cegger branches: 1.28.2; 1.28.4;
use aprint_*_dev and device_xname
 1.27 19-Oct-2007  ad branches: 1.27.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.26 16-Nov-2006  christos branches: 1.26.8; 1.26.22; 1.26.24; 1.26.28;
__unused removal on arguments; approved by core.
 1.25 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.24 30-Aug-2006  christos branches: 1.24.2; 1.24.4;
avoid empty if body.
 1.23 11-Dec-2005  christos branches: 1.23.4; 1.23.8;
merge ktrace-lwp.
 1.22 30-May-2005  christos branches: 1.22.2;
- add const
- avoid variable shadowing.
 1.21 27-Feb-2005  perry nuke trailing whitespace
 1.20 04-Feb-2005  perry de-__P
 1.19 14-Sep-2004  drochner branches: 1.19.4; 1.19.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.18 08-Jul-2004  mycroft Allow a board with no memory window configured to be attach. Fixes PR 20436.
 1.17 02-Oct-2002  thorpej branches: 1.17.6; 1.17.8;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.16 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 08-Jan-2002  christos Deal with lossage caused by recent isa changes [/briq potr]
 1.13 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.12 06-Dec-2001  rafal Fix PR 13465 by Krister Walfridsson: memory initialization used uninitialized
variable to start off the write pattern (how ironic! 8-).
 1.11 26-Nov-2001  fredette Added macros for the bits in the SYSBUS byte, and macros
for the i82596 PORT access interface, from the documentation
for that chip. These help clarify writes to the SYSBUS
part of the SCP, and PORT usage by i82596-aware drivers.
 1.10 13-Nov-2001  lukem add RCSID
 1.9 10-Mar-2001  jdolecek branches: 1.9.2;
add 'why' argument to the channel attention hook function; this argument
is similar to the one passed to hwreset hook function
 1.8 22-Jan-2001  bjh21 branches: 1.8.2;
Patch from PR kern/8001, submitted by Rafal Boni.

This adds support for EtherExpress/16 cards with 16k of RAM, and in the
process adds general support for PIO mode on these cards. This entails
changing the way the i82586 driver handles bus barriers, since it doesn't
allow for strange cases like this.

This has been tested on the i386 port with the 'ix' driver in both
16KB (which was the source of the problem) and 32KB modes, as well
as with the 'ef' driver. I've tested it (briefly) with 'ei' on arm26
as well. In theory, drivers other than 'ix' should follow precisely the
same code paths as before.
 1.7 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 08-Jan-1999  augustss branches: 1.6.8;
Fix more `void *' arithmetic.
 1.5 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.4 15-Apr-1998  thorpej Fixup RCS IDs.
 1.3 03-Mar-1998  pk Re-arrange several functions so we no longer need __BROKEN_INDIRECT_CONFIG
semantics.
 1.2 28-Feb-1998  pk * Remove `_NEW_I82586'.
* KNF.
* erase ghost spaces and tabs.
 1.1 27-Feb-1998  pk EtherExpress/16 i82586 front-end driver from Rafal Boni.
 1.6.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.6.8.2 11-Feb-2001  bouyer Sync with HEAD.
 1.6.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.8.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.8.2.4 11-Jan-2002  nathanw More catchup.
 1.8.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.8.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.8.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.9.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.8.1 23-Jul-2004  he Pull up revision 1.18 (requested by mycroft in ticket #696):
Allow a board with no memory window configured to be
attached. Fixes PR#20436.
 1.17.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.6.1 12-Feb-2005  yamt sync with head.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.22.2.2 27-Oct-2007  yamt sync with head.
 1.22.2.1 30-Dec-2006  yamt sync with head.
 1.23.8.1 03-Sep-2006  yamt sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.24.4.2 10-Dec-2006  yamt sync with head.
 1.24.4.1 22-Oct-2006  yamt sync with head
 1.24.2.1 18-Nov-2006  ad Sync with head.
 1.26.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.26.24.1 06-Nov-2007  matt sync with HEAD
 1.26.22.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.26.8.1 23-Oct-2007  ad Sync with head.
 1.27.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.4.3 16-May-2009  yamt sync with head
 1.28.4.2 04-May-2009  yamt sync with head.
 1.28.4.1 16-May-2008  yamt sync with head.
 1.28.2.1 18-May-2008  yamt sync with head.
 1.29.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.33.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.33.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.33.4.1 12-Jun-2011  rmind sync with head
 1.34.30.1 05-Oct-2016  skrll Sync with HEAD
 1.34.12.1 03-Dec-2017  jdolecek update from HEAD
 1.35.18.1 10-Jun-2019  christos Sync with HEAD
 1.3 22-Jan-2001  bjh21 Patch from PR kern/8001, submitted by Rafal Boni.

This adds support for EtherExpress/16 cards with 16k of RAM, and in the
process adds general support for PIO mode on these cards. This entails
changing the way the i82586 driver handles bus barriers, since it doesn't
allow for strange cases like this.

This has been tested on the i386 port with the 'ix' driver in both
16KB (which was the source of the problem) and 32KB modes, as well
as with the 'ef' driver. I've tested it (briefly) with 'ei' on arm26
as well. In theory, drivers other than 'ix' should follow precisely the
same code paths as before.
 1.2 28-Feb-1998  pk branches: 1.2.14;
Remove extraneous `$Id$' lines.
 1.1 27-Feb-1998  pk EtherExpress/16 i82586 front-end driver from Rafal Boni.
 1.2.14.1 11-Feb-2001  bouyer Sync with HEAD.
 1.114 17-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.113 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.112 06-Jan-2020  msaitoh branches: 1.112.2;
Protect ec_multicnt.
 1.111 12-Nov-2019  msaitoh Add missing initialization of sc_dev.
 1.110 13-Sep-2019  msaitoh if_flags is neither int nor short. It's unsigned short.
 1.109 29-May-2019  msaitoh branches: 1.109.2;
Even if we don't use MII(4), use the common path of SIOC[GS]IFMEDIA in
sys/net/if_ethersubr.c if we can.
- Add ec_ifmedia into struct ethercom.
- ec_mii in struct ethercom is kept and used as it is. It might be used in
future. Note that some Ethernet drivers which _DOESN'T_ use mii(4) use
ec_mii for keeping the if_media. Those should be changed in future.
 1.108 28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.107 23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.106 23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.105 24-Apr-2019  msaitoh Remove extra test for SIOCSIFMEDIA.
 1.104 05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.103 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.102 26-Jun-2018  msaitoh branches: 1.102.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.101 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.100 31-Mar-2017  msaitoh branches: 1.100.6; 1.100.12;
Remove extra 0x. This bug was added when replacing bitmask_snprintf(9) with
snprintb(3) (in between NetBSD 5 and 6). Old bitmask_snprint(9) didn't add
0x" automatically for hexadecimal value, so old code used it with "0x%s".
 1.99 15-Dec-2016  ozaki-r branches: 1.99.2;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.98 02-Oct-2016  christos MFREE -> m_free
 1.97 14-Jul-2016  msaitoh branches: 1.97.2;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.96 10-Jun-2016  ozaki-r Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.95 09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.94 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.93 10-Aug-2014  tls branches: 1.93.4;
Merge tls-earlyentropy branch into HEAD.
 1.92 08-Nov-2013  christos branches: 1.92.2;
fix unused variable warnings
 1.91 27-Oct-2012  chs branches: 1.91.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.90 02-Feb-2012  tls branches: 1.90.6;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.89 19-Nov-2011  tls branches: 1.89.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.88 05-Apr-2010  joerg branches: 1.88.8;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.87 19-Jan-2010  pooka branches: 1.87.2; 1.87.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.86 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.85 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.84 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.83 17-Dec-2008  cegger branches: 1.83.2;
make this compile with IYDEBUG
 1.82 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.81 07-Nov-2008  dyoung *** Summary ***

When a link-layer address changes (e.g., ifconfig ex0 link
02:de:ad:be:ef:02 active), send a gratuitous ARP and/or a Neighbor
Advertisement to update the network-/link-layer address bindings
on our LAN peers.

Refuse a change of ethernet address to the address 00:00:00:00:00:00
or to any multicast/broadcast address. (Thanks matt@.)

Reorder ifnet ioctl operations so that driver ioctls may inherit
the functions of their "class"---ether_ioctl(), fddi_ioctl(), et
cetera---and the class ioctls may inherit from the generic ioctl,
ifioctl_common(), but both driver- and class-ioctls may override
the generic behavior. Make network drivers share more code.

Distinguish a "factory" link-layer address from others for the
purposes of both protecting that address from deletion and computing
EUI64.

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

In if_attach(), always initialize the interface ioctl routine,
ifnet->if_ioctl, if the driver has not already initialized it.
Delete if_ioctl == NULL tests everywhere else, because it cannot
happen.

In the ioctl routines of network interfaces, inherit common ioctl
behaviors by calling either ifioctl_common() or whichever ioctl
routine is appropriate for the class of interface---e.g., ether_ioctl()
for ethernets.

Stop (ab)using SIOCSIFADDR and start to use SIOCINITIFADDR. In
the user->kernel interface, SIOCSIFADDR's argument was an ifreq,
but on the protocol->ifnet interface, SIOCSIFADDR's argument was
an ifaddr. That was confusing, and it would work against me as I
make it possible for a network interface to overload most ioctls.
On the protocol->ifnet interface, replace SIOCSIFADDR with
SIOCINITIFADDR. In ifioctl(), return EPERM if userland tries to
invoke SIOCINITIFADDR.

In ifioctl(), give the interface the first shot at handling most
interface ioctls, and give the protocol the second shot, instead
of the other way around. Finally, let compatibility code (COMPAT_OSOCK)
take a shot.

Pull device initialization out of switch statements under
SIOCINITIFADDR. For example, pull ..._init() out of any switch
statement that looks like this:

switch (...->sa_family) {
case ...:
..._init();
...
break;
...
default:
..._init();
...
break;
}

Rewrite many if-else clauses that handle all permutations of IFF_UP
and IFF_RUNNING to use a switch statement,

switch (x & (IFF_UP|IFF_RUNNING)) {
case 0:
...
break;
case IFF_RUNNING:
...
break;
case IFF_UP:
...
break;
case IFF_UP|IFF_RUNNING:
...
break;
}

unifdef lots of code containing #ifdef FreeBSD, #ifdef NetBSD, and
#ifdef SIOCSIFMTU, especially in fwip(4) and in ndis(4).

In ipw(4), remove an if_set_sadl() call that is out of place.

In nfe(4), reuse the jumbo MTU logic in ether_ioctl().

Let ethernets register a callback for setting h/w state such as
promiscuous mode and the multicast filter in accord with a change
in the if_flags: ether_set_ifflags_cb() registers a callback that
returns ENETRESET if the caller should reset the ethernet by calling
if_init(), 0 on success, != 0 on failure. Pull common code from
ex(4), gem(4), nfe(4), sip(4), tlp(4), vge(4) into ether_ioctl(),
and register if_flags callbacks for those drivers.

Return ENOTTY instead of EINVAL for inappropriate ioctls. In
zyd(4), use ENXIO instead of ENOTTY to indicate that the device is
not any longer attached.

Add to if_set_sadl() a boolean 'factory' argument that indicates
whether a link-layer address was assigned by the factory or some
other source. In a comment, recommend using the factory address
for generating an EUI64, and update in6_get_hw_ifid() to prefer a
factory address to any other link-layer address.

Add a routing message, RTM_LLINFO_UPD, that tells protocols to
update the binding of network-layer addresses to link-layer addresses.
Implement this message in IPv4 and IPv6 by sending a gratuitous
ARP or a neighbor advertisement, respectively. Generate RTM_LLINFO_UPD
messages on a change of an interface's link-layer address.

In ether_ioctl(), do not let SIOCALIFADDR set a link-layer address
that is broadcast/multicast or equal to 00:00:00:00:00:00.

Make ether_ioctl() call ifioctl_common() to handle ioctls that it
does not understand.

In gif(4), initialize if_softc and use it, instead of assuming that
the gif_softc and ifp overlap.

Let ifioctl_common() handle SIOCGIFADDR.

Sprinkle rtcache_invariants(), which checks on DIAGNOSTIC kernels
that certain invariants on a struct route are satisfied.

In agr(4), rewrite agr_ioctl_filter() to be a bit more explicit
about the ioctls that we do not allow on an agr(4) member interface.

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.80 28-Apr-2008  martin branches: 1.80.6; 1.80.8;
Remove clause 3 and 4 from TNF licenses
 1.79 08-Apr-2008  cegger branches: 1.79.2; 1.79.4;
use aprint_*_dev and device_xname
 1.78 19-Oct-2007  ad branches: 1.78.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.77 01-Sep-2007  dyoung branches: 1.77.4;
Change a bazillion occurrences of code resembling this,

error = (cmd == SIOCADDMULTI) ?
ether_addmulti(ifr, &sc->sc_ec) :
ether_delmulti(ifr, &sc->sc_ec);

if (error == ENETRESET) {

to this,

if ((error = ether_ioctl(ifp, cmd, data)) == ENETRESET) {

which does the same thing.

(A bazillion is a very large number. This seems to make the i386
ALL kernel smaller by 3kB to 4kB.)

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.76 26-Aug-2007  dyoung branches: 1.76.2;
Constify: LLADDR -> CLLADDR. I'm aiming here to make it easier to
identify sockaddr_dl abuse that remains in the kernel, especially
the potential for overwriting memory past the end of a sockaddr_dl
with, e.g., memcpy(LLADDR(), ...).
 1.75 04-Mar-2007  christos branches: 1.75.2; 1.75.10; 1.75.14;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.74 16-Nov-2006  christos branches: 1.74.4;
__unused removal on arguments; approved by core.
 1.73 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.72 07-Sep-2006  dogcow branches: 1.72.2; 1.72.4;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.71 14-Apr-2006  christos Coverity CID 1104: Return early if no mbuf.
 1.70 24-Dec-2005  perry branches: 1.70.4; 1.70.6; 1.70.8; 1.70.10; 1.70.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.69 11-Dec-2005  christos merge ktrace-lwp.
 1.68 22-May-2005  christos branches: 1.68.2;
No 0x in front of %p...
 1.67 27-Feb-2005  perry nuke trailing whitespace
 1.66 04-Feb-2005  perry de-__P
 1.65 30-Oct-2004  thorpej branches: 1.65.4; 1.65.6;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.64 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.63 30-Oct-2003  simonb branches: 1.63.4;
Remove some assigned-to but otherwise unused variables.
 1.62 06-Jan-2003  wiz branches: 1.62.2;
interrupt with two rs.
 1.61 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.60 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.59 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.58 05-Mar-2002  itojun bring in latest ALTQ from kjc. ALTQify some of the drivers.
 1.57 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.56 13-Nov-2001  lukem add RCSID
 1.55 18-Jul-2001  thorpej bcopy -> memcpy
 1.54 18-Jul-2001  thorpej bcmp -> memcmp
 1.53 15-May-2001  lukem branches: 1.53.2;
delint: need ; between case label and }
 1.52 23-Mar-2001  is Move tx chain result handling into iystart(). This way, ww normally only
need an interupt when the hardware hits tx chain end. We switch on one
int per packet sent when we fill up and go into OACTIVE mode.
Measured total interupt savings on large NFS writes: 20%.
 1.51 22-Mar-2001  is Oops. We _do_ need to receive broadcasts. At least as long as we want ARP.
 1.50 16-Mar-2001  is Don't need to use the hash filter for a single individual address; make
sure concurrent receive processing is disabled.
 1.49 16-Mar-2001  is Don't abort chain processing on error.
 1.48 16-Mar-2001  is Full documentation helps. Among other bugs, remove off-by-one-error when
initializing tx upper limit register.
 1.47 15-Mar-2001  is It's one more if the max. coll. bit is set.
 1.46 15-Mar-2001  is Thats collisions, not errors!
 1.45 14-Dec-2000  thorpej branches: 1.45.2;
ALTQ'ify.
 1.44 15-Nov-2000  thorpej Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.43 01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.42 09-Aug-2000  tv %b -> bitmask_snprintf()
 1.41 21-Jul-2000  is - Big endianness cleanup:

a) use stream methods when transferring data via the MEMPORT into/out of
the chips buffer memory
b) use htole16/le16toh when interpreting 16bit values in the chips memory

Both where NOPs on i386 machines, which is why this worked before on the
test machine(s), but would break when on a big-endian machine.
 1.40 14-Jul-2000  is Do a dummy read after writing through the memory access pipeline, to flush
it, before starting the command to install the multicast list.
(We did it right for writing data packets, but failed here.)
Without this, the last multicast address installed won't be made active.
 1.39 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.38 23-Jun-2000  is s/sc->sc_ethercom.ec_if./ifp->/ where appropriate and formerly forgotten,
for better readability.
 1.37 23-Jun-2000  is Only "complain" about successful multicast setup if IFF_DEBUG was set.
 1.36 30-Mar-2000  augustss branches: 1.36.4;
Remove register declarations.
 1.35 25-Aug-1999  thorpej branches: 1.35.2;
When padding short packets on transmit, don't include the CRC length
in the computation. kern/8194.
 1.34 18-May-1999  thorpej Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.33 25-Mar-1999  thorpej branches: 1.33.2; 1.33.4;
Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.32 28-Feb-1999  explorer Update to slightly altered rnd_attach_source() api
 1.31 16-Feb-1999  is Fix Copyright dates
 1.30 16-Feb-1999  is Assign my files to The NetBSD Foundation, Inc.
 1.29 08-Aug-1998  mycroft branches: 1.29.4;
Use splnet, not splimp.
 1.28 31-Jul-1998  rvb Flush spurious #endif after ADDMULTI
 1.27 30-Jul-1998  is Document supported boards near the top of the driver source code.
 1.26 30-Jul-1998  is Multicast support.
 1.25 28-Jul-1998  is branches: 1.25.2;
ic/i82595reg.h
 1.24 28-Jul-1998  is Remove dead code.
 1.23 05-Jul-1998  jonathan defopt NS, NSIP.
 1.22 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.21 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.20 03-Feb-1998  is Put a debugging printf inside #ifdef IYDEBUG ... #endif.
 1.19 12-Jan-1998  thorpej Update for config changes.
 1.18 02-Dec-1997  bouyer The iy driver now uses if_media (it was the last one, at last for i386, to use
the historical link? flags for media select)
XXX No pullup request for this. But if sysinst supports explicit media
XXX selection in 1.3, this should be in 1.3 as well.
 1.17 30-Nov-1997  drochner make it compile without "__BROKEN_INDIRECT_CONFIG"
 1.16 20-Oct-1997  thorpej branches: 1.16.2;
Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.15 18-Oct-1997  drochner This driver can't handle wildcarded iobase.
(This is really a config file error.)
 1.14 15-Oct-1997  explorer Add and/or update rnd_*() hooks
 1.13 28-Apr-1997  mycroft Oops; forgot to GC the last mbuf allocated when out of clusters.
Also, remove the internal mbuf queue, which is not needed by this driver.
 1.12 24-Apr-1997  mycroft Fix typo in previous.
 1.11 24-Apr-1997  mycroft If we fail to allocate a cluster to hold a large packet, simply
drop it rather than using a chain of tiny mbufs.
 1.10 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.9 21-Oct-1996  thorpej branches: 1.9.4;
New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.8 13-Oct-1996  christos backout kprintf changes
 1.7 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 25-Jul-1996  is Changed the driver to use bus_xxx().
 1.5 22-May-1996  is Added flags to the iy driver to override the media autodetect mechanism, if
necessary. Added a manpage to document the flags.
 1.4 12-May-1996  mycroft Use intr.h.
 1.3 08-May-1996  is Fix a typo.
 1.2 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.1 06-May-1996  is Add "iy" driver for Ethernet ISA boards using the Intel i82595 chip, e.g.
(and only tested on) Intel Etherexpress PRO. Should work on any i82595 ISA
board which uses an EEPROM for config information; NETBLKID not yet supported.
TODO: change to BUS interface, add multicast support.
 1.9.4.7 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.9.4.6 27-Feb-1997  is Removed #include <route.h> and #include <netisr.h>. They're not needed, and
the latter will go away soon.
 1.9.4.5 26-Feb-1997  is Warn operator when we use the configured IRQ, rather than the one from the
EEPROM.
 1.9.4.4 26-Feb-1997  is Eliminate use of softc in iyprobe().
 1.9.4.3 26-Feb-1997  is Fix an edito. While we're here, small cleanup.
 1.9.4.2 17-Feb-1997  is Prevent lota compiler warnings introduced with the -1.2C Makefile.
 1.9.4.1 07-Feb-1997  is Snapshot of new ARP code.

Our old ARP code was hardwired for 6-byte length medium
addresses, while the protocol is designed for any size.

This snapshot contains a first hack at getting rid of
Ethernet specific data structures. The ep driver is updated
(and tested on the PCI bus), the iy and fpa drivers have been
updated, but not real life tested yet.

If you want to test this with other drivers, you have to update
them first yourself, and probably tag the relevant directories.
Better contact me if you want to do this.
 1.16.2.1 03-Feb-1998  is Put a debugging printf (which was missed on earlier cleanup actions) into
a #ifdef IYDEBUG ... #endif bracket.
 1.25.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.29.4.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.33.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.33.2.1 23-Jul-2000  he Pull up revision 1.40 (requested by is):
Flush memory pipeline before installing the multicast list.
Fixes a problem causing a random address to be installed as
the last one in the multicast filter list.
 1.35.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.35.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.35.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.35.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.36.4.5 16-Mar-2001  he Pull up revisions 1.46-1.48 (requested by is):
Fix bug which causes freezes in the Intel Etherexpress PRO (ISA)
driver. Fixes PR#8263.
 1.36.4.4 21-Jul-2000  is Pullup from trunk:
big-endian-machine support for if_iy.c (would only work on little endian
machines before).
 1.36.4.3 14-Jul-2000  is Pullup from trunk:
Do a dummy read after writing through the memory access pipeline, to flush
it, before starting the command to install the multicast list.
Without this, the last multicast address installed won't be made active.
 1.36.4.2 27-Jun-2000  thorpej Pull up rev. 1.38:
s/sc->sc_ethercom.ec_if./ifp->/ where appropriate and formerly forgotten,
for better readability.
 1.36.4.1 27-Jun-2000  thorpej Pull up rev. 1.37:
Only "complain" about successful multicast setup if IFF_DEBUG was set.
 1.45.2.9 07-Jan-2003  thorpej Sync with HEAD.
 1.45.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.45.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.45.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.45.2.5 11-Jan-2002  nathanw More catchup.
 1.45.2.4 14-Nov-2001  nathanw Catch up to -current.
 1.45.2.3 24-Aug-2001  nathanw Catch up with -current.
 1.45.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.45.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.53.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.53.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.53.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.53.2.1 03-Aug-2001  lukem update to -current
 1.62.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.62.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.62.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.62.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.62.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.62.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.62.2.1 03-Aug-2004  skrll Sync with HEAD
 1.63.4.1 30-Jan-2005  he Pull up revision 1.65 (requested by thorpej in ticket #941):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#37678.
 1.65.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.65.6.1 12-Feb-2005  yamt sync with head.
 1.65.4.1 29-Apr-2005  kent sync with -current
 1.68.2.4 27-Oct-2007  yamt sync with head.
 1.68.2.3 03-Sep-2007  yamt sync with head.
 1.68.2.2 30-Dec-2006  yamt sync with head.
 1.68.2.1 21-Jun-2006  yamt sync with head.
 1.70.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.70.10.1 19-Apr-2006  elad sync with head.
 1.70.8.2 14-Sep-2006  yamt sync with head.
 1.70.8.1 24-May-2006  yamt sync with head.
 1.70.6.1 22-Apr-2006  simonb Sync with head.
 1.70.4.1 09-Sep-2006  rpaulo sync with head
 1.72.4.2 10-Dec-2006  yamt sync with head.
 1.72.4.1 22-Oct-2006  yamt sync with head
 1.72.2.1 18-Nov-2006  ad Sync with head.
 1.74.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.75.14.2 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.75.14.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.75.10.1 03-Sep-2007  skrll Sync with HEAD.
 1.75.2.2 23-Oct-2007  ad Sync with head.
 1.75.2.1 09-Oct-2007  ad Sync with head.
 1.76.2.1 06-Nov-2007  matt sync with HEAD
 1.77.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.78.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.78.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.79.4.5 11-Aug-2010  yamt sync with head.
 1.79.4.4 11-Mar-2010  yamt sync with head
 1.79.4.3 16-May-2009  yamt sync with head
 1.79.4.2 04-May-2009  yamt sync with head.
 1.79.4.1 16-May-2008  yamt sync with head.
 1.79.2.1 18-May-2008  yamt sync with head.
 1.80.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.80.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.80.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.83.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.87.4.1 30-May-2010  rmind sync with head
 1.87.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.88.8.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.88.8.2 30-Oct-2012  yamt sync with head
 1.88.8.1 17-Apr-2012  yamt sync with head
 1.89.2.1 18-Feb-2012  mrg merge to -current.
 1.90.6.3 03-Dec-2017  jdolecek update from HEAD
 1.90.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.90.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.91.2.1 18-May-2014  rmind sync with head
 1.92.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.93.4.6 28-Aug-2017  skrll Sync with HEAD
 1.93.4.5 05-Feb-2017  skrll Sync with HEAD
 1.93.4.4 05-Oct-2016  skrll Sync with HEAD
 1.93.4.3 09-Jul-2016  skrll Sync with HEAD
 1.93.4.2 19-Mar-2016  skrll Sync with HEAD
 1.93.4.1 06-Jun-2015  skrll Sync with HEAD
 1.97.2.3 26-Apr-2017  pgoyette Sync with HEAD
 1.97.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.97.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.99.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.100.12.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.100.12.2 28-Jul-2018  pgoyette Sync with HEAD
 1.100.12.1 25-Jun-2018  pgoyette Sync with HEAD
 1.100.6.2 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.


Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


Add missing initialization of sc_dev.
 1.100.6.1 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #938):
sys/arch/acorn32/podulebus/if_ie.c: revision 1.41
sys/arch/amiga/dev/if_es.c: revision 1.58
sys/arch/amiga/dev/if_qn.c: revision 1.45
sys/arch/arm/at91/at91emac.c: revision 1.20
sys/arch/arm/ep93xx/epe.c: revision 1.37
sys/arch/emips/ebus/if_le_ebus.c: revision 1.14
sys/arch/emips/ebus/if_le_ebus.c: revision 1.15
sys/arch/mac68k/dev/if_mc.c: revision 1.46
sys/arch/macppc/dev/am79c950.c: revision 1.39
sys/arch/newsmips/apbus/if_sn.c: revision 1.40
sys/arch/next68k/dev/mb8795.c: revision 1.59
sys/arch/playstation2/dev/if_smap.c: revision 1.25
sys/arch/playstation2/dev/if_smap.c: revision 1.26
sys/arch/sun2/dev/if_ec.c: revision 1.28
sys/arch/sun3/dev/if_ie.c: revision 1.63
sys/arch/x68k/dev/if_ne_intio.c: revision 1.19
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.75
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.63
sys/dev/bi/if_ni.c: revision 1.45
sys/dev/cadence/if_cemac.c: revision 1.12
sys/dev/ic/am7990.c: revision 1.78
sys/dev/ic/am79900.c: revision 1.27
sys/dev/ic/an.c: revision 1.67
sys/dev/ic/cs89x0.c: revision 1.40
sys/dev/ic/dm9000.c: revision 1.13
sys/dev/ic/dm9000.c: revision 1.14
sys/dev/ic/dp8390.c: revision 1.88
sys/dev/ic/elink3.c: revision 1.141
sys/dev/ic/elinkxl.c: revision 1.122
sys/dev/ic/hme.c: revision 1.98
sys/dev/ic/i82586.c: revision 1.77
sys/dev/ic/lance.c: revision 1.53
sys/dev/ic/mb86950.c: revision 1.27
sys/dev/ic/mb86960.c: revision 1.86
sys/dev/ic/mtd803.c: revision 1.34
sys/dev/ic/pdq_ifsubr.c: revision 1.59
sys/dev/ic/rrunner.c: revision 1.86
sys/dev/ic/seeq8005.c: revision 1.58
sys/dev/ic/sgec.c: revision 1.47
sys/dev/ic/smc90cx6.c: revision 1.72
sys/dev/ic/smc91cxx.c: revision 1.96
sys/dev/ic/tropic.c: revision 1.49
sys/dev/ic/wi.c: revision 1.245
sys/dev/isa/if_eg.c: revision 1.93
sys/dev/isa/if_el.c: revision 1.95
sys/dev/isa/if_iy.c: revision 1.101
sys/dev/ofw/ofnet.c: revision 1.58
sys/dev/pci/if_alc.c: revision 1.27
sys/dev/pci/if_de.c: revision 1.152
sys/dev/pci/if_fpa.c: revision 1.61
sys/dev/pci/if_jme.c: revision 1.34
sys/dev/pci/if_tl.c: revision 1.108
sys/dev/pci/if_vte.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe.h: revision 1.50
sys/dev/pcmcia/if_cnw.c: revision 1.62
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.17
sys/dev/pcmcia/if_ray.c: revision 1.89
sys/dev/pcmcia/if_xi.c: revision 1.81
sys/dev/pcmcia/mhzc.c: revision 1.51
sys/dev/pcmcia/xirc.c: revision 1.34
sys/dev/qbus/if_de.c: revision 1.33
sys/dev/qbus/if_qe.c: revision 1.78
sys/dev/qbus/if_qt.c: revision 1.22
sys/dev/sbus/be.c: revision 1.87
sys/dev/sbus/qe.c: revision 1.68
sys/dev/scsipi/if_se.c: revision 1.96
sys/dev/usb/if_atu.c: revision 1.59
sys/net/if_l2tp.c: revision 1.28 via patch
sys/net/if_ppp.c: revision 1.160
It's not required to include net/bpfdesc.h. Remove it.
--
Simplify like other drivers. NULL check of ifp->if_bpf is done in
bpf_mtap(), so it's not required to do it here.
--
Remove duplicated inclusion of net/bpf.h.
--
Remove duplicated inclusion of net/bpf.h.
--
Simplify bpf_mtap() call. No functional change.
 1.102.2.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.102.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.102.2.1 10-Jun-2019  christos Sync with HEAD
 1.109.2.2 28-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #662):

sys/dev/pcmcia/if_xi.c: revision 1.93
sys/arch/x86/pci/if_vmx.c: revision 1.54
sys/dev/pci/if_de.c: revision 1.165
sys/arch/arm/ti/if_cpsw.c: revision 1.10
sys/arch/arm/omap/if_cpsw.c: revision 1.26
sys/dev/isa/if_iy.c: revision 1.112
sys/dev/pcmcia/if_ray.c: revision 1.96

Add ETHER_LOCK() and ETHER_UNLOCK() to protect ec_multiaddrs.

XXX These drivers don't check whether enm_addrlo and enm_addrhi are the same
or not, so it won't work correctly if an multicast address entry has a range.

Protect ec_multicnt.
 1.109.2.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.

Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

Add missing initialization of sc_dev.
 1.112.2.1 29-Feb-2020  ad Sync with head.
 1.35 11-Jul-2016  msaitoh KNF. No functional change.
 1.34 27-Oct-2012  chs branches: 1.34.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.33 12-May-2009  cegger branches: 1.33.12; 1.33.22;
struct device * -> device_t, no functional changes intended.
 1.32 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.31 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.30 13-Feb-2009  bouyer Fix bus_addr_t/bus_size_t confusion
 1.29 08-Apr-2008  cegger branches: 1.29.4; 1.29.12; 1.29.14; 1.29.18; 1.29.22;
use aprint_*_dev and device_xname
 1.28 19-Oct-2007  ad branches: 1.28.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.27 16-Nov-2006  christos branches: 1.27.8; 1.27.22; 1.27.24; 1.27.28;
__unused removal on arguments; approved by core.
 1.26 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.25 14-Apr-2006  christos branches: 1.25.8; 1.25.10;
On second thought, the whole statement is wrong.
 1.24 14-Apr-2006  christos Coverity CID 723: Fix bogus test.
 1.23 11-Dec-2005  christos branches: 1.23.4; 1.23.6; 1.23.8; 1.23.10; 1.23.12;
merge ktrace-lwp.
 1.22 30-May-2005  christos branches: 1.22.2;
- add const
- avoid variable shadowing.
 1.21 27-Feb-2005  perry nuke trailing whitespace
 1.20 04-Feb-2005  perry de-__P
 1.19 14-Sep-2004  drochner branches: 1.19.4; 1.19.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.18 03-Jul-2004  mycroft Only attempt to map the memory window during attach, not match. If msize==0,
print a message and punt. Fixes PR 6167 (from me!).
 1.17 22-Apr-2004  itojun sprintf -> snprintf
 1.16 02-Oct-2002  thorpej branches: 1.16.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.15 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.12 13-Nov-2001  lukem add RCSID
 1.11 08-Jul-2001  thorpej branches: 1.11.2;
Remove unnecessary include files. From Onno van der Linden.
 1.10 13-Jun-2001  wiz withough -> without
 1.9 05-Jul-1998  jonathan branches: 1.9.26;
defopt NS, NSIP.
 1.8 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.7 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.6 30-Nov-1997  christos Make this work again. KNF.
 1.5 17-Nov-1997  thorpej Rewrite lc_isa_probe() to not scan i/o space for LEMAC cards, but rather
to look specifically at the address it was provided *only*, since the
scan isn't safe (it can stomp on cards that will be probed later, like
NE2000 clones).
 1.4 20-Oct-1997  thorpej branches: 1.4.2;
Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.3 20-Oct-1997  fvdl Make sure to unmap bus space when a successful probe is done, to prevent
a panic when the attach code does the map again. PR 4302, from
Anders Hjalmarsson.
 1.2 15-Oct-1997  matt Cleanup ISA probe code. Don't collect info first. Just do the probe.
 1.1 31-Jul-1997  matt branches: 1.1.2;
Add the ISA inteface for the lc (LEMAC, EtherWORKS III) driver.
 1.1.2.2 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.2.1 31-Jul-1997  thorpej file if_lc_isa.c was added on branch marc-pcmcia on 1997-08-23 07:13:21 +0000
 1.4.2.2 22-Dec-1997  perry pull up fix from trunk (christos)
 1.4.2.1 17-Nov-1997  thorpej Sync w/ trunk.
 1.9.26.6 18-Oct-2002  nathanw Catch up to -current.
 1.9.26.5 28-Feb-2002  nathanw Catch up to -current.
 1.9.26.4 11-Jan-2002  nathanw More catchup.
 1.9.26.3 14-Nov-2001  nathanw Catch up to -current.
 1.9.26.2 24-Aug-2001  nathanw Catch up with -current.
 1.9.26.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.6.1 12-Feb-2005  yamt sync with head.
 1.19.4.1 29-Apr-2005  kent sync with -current
 1.22.2.3 27-Oct-2007  yamt sync with head.
 1.22.2.2 30-Dec-2006  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.23.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.23.10.1 19-Apr-2006  elad sync with head.
 1.23.8.1 24-May-2006  yamt sync with head.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.25.10.2 10-Dec-2006  yamt sync with head.
 1.25.10.1 22-Oct-2006  yamt sync with head
 1.25.8.1 18-Nov-2006  ad Sync with head.
 1.27.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.27.24.1 06-Nov-2007  matt sync with HEAD
 1.27.22.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.27.8.1 23-Oct-2007  ad Sync with head.
 1.28.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.22.1 21-Apr-2010  matt sync to netbsd-5
 1.29.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.14.1 30-Sep-2009  snj Pull up following revision(s) (requested by bouyer in ticket #1040):
sys/dev/isa/if_lc_isa.c: revision 1.30
sys/dev/pci/pccbb.c: revision 1.183
Fix bus_addr_t/bus_size_t confusion
 1.29.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.29.12.1 03-Mar-2009  skrll Sync with HEAD.
 1.29.4.2 16-May-2009  yamt sync with head
 1.29.4.1 04-May-2009  yamt sync with head.
 1.33.22.2 03-Dec-2017  jdolecek update from HEAD
 1.33.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.12.1 30-Oct-2012  yamt sync with head
 1.34.14.1 05-Oct-2016  skrll Sync with HEAD
 1.44 07-May-1996  thorpej Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.

Break up ISA LANCE driver into ISA and PCI front-ends.

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
to take a struct ifnet *, rather than a unit number.
 1.43 22-Apr-1996  christos Add a hardware dependent initialization function lehwinit()
 1.42 18-Apr-1996  cgd change LANCE copy & zero functions' names to start with amd7990_, and
remove their 'integrate' (usually defined to be 'static') keywords.
when lance drivers are split up by attachment, more than one file will
reference the copy/zero functions (i.e. not just the file that pulls in
am7990.c... and eventually inclusion of am7990.c should go away entirely).
 1.41 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.40 27-Mar-1996  cgd Update these (as minimally as possible) to work with new PCI interfaces:
(1) make pci functions take as an argument a machine-dependent
cookie, to allow more flexibility in implementation.
(use of other PCI functions, etc., left unchanged.)
 1.39 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.38 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.37 25-Nov-1995  cgd allow bus-specific lance drivers to use machine-independent buffer/descriptor
copy functions, and convert isa and pmax drivers to do so.
 1.36 07-Oct-1995  mycroft Add a shutdown hook.
 1.35 27-Jul-1995  mycroft Add PCI-specific configuration for PCnet-PCI.
 1.34 24-Jul-1995  mycroft Update to use dev/ic/am7990.c.
 1.33 24-Jul-1995  mycroft Fix thinko in packet size diagnostic.
 1.32 24-Jul-1995  mycroft Pass a softc to leget(), not an ifnet.
 1.31 24-Jul-1995  mycroft Various cleanup:
* Use standard function naming conventions.
* Only increment if_ipackets when a packet was actually received.
* Check for excessively large or small packets before trying to read them.
 1.30 23-Jul-1995  mycroft Stylistic changes.
 1.29 23-Jul-1995  mycroft Init functions are always called at splimp().
 1.28 12-Jun-1995  mycroft Remove check for if_addrlist == 0; if_attach() always puts one address on
the list, so this is a noop.
 1.27 10-May-1995  mycroft Update for slightly modified ARP handling.
 1.26 19-Apr-1995  mycroft Watchdog now takes an int, not a short.
 1.25 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.24 10-Apr-1995  mycroft Change start and watchdog return values to void.
 1.23 01-Feb-1995  mycroft Fix path to if_lereg.h.
 1.22 03-Jan-1995  mycroft Add interrupt sharing types.
 1.21 02-Jan-1995  mycroft Need isareg.h.
 1.20 02-Jan-1995  mycroft Don't assume ia_maddr is in the hole.
 1.19 12-Dec-1994  mycroft Make the diagnostics less cryptic.
 1.18 12-Dec-1994  mycroft Patch from Thomas Eberhardt to make PCnet-32 chips work.
 1.17 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.16 04-Nov-1994  mycroft No longer needs icu.h.
 1.15 03-Nov-1994  mycroft Update to match autoconfig code.
 1.14 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.13 27-Oct-1994  cgd new RCS ID format.
 1.12 09-Oct-1994  mycroft Correct multicast filter calculation.
 1.11 07-Aug-1994  mycroft Simplify the DEPCA memory test, and fix a problem with using the alternate
PROM address.
 1.10 25-Jul-1994  mycroft Look for errors in the right place in a transmit descriptor, and count
collisions.
 1.9 15-Jul-1994  mycroft Fix a bogon relating to >16-bit addresses that I introduced. Fix up BPF
support for received packets.
 1.8 10-Jul-1994  mycroft Clean up a bit.
 1.7 05-Jul-1994  mycroft branches: 1.7.2;
Rename flags; clean up a bit.
 1.6 02-Jul-1994  mycroft ISDEBUG --> LEDEBUG, and fix some ugly code.
 1.5 01-Jul-1994  mycroft Make sure we don't leave the interrupt masked after some errors.
 1.4 01-Jul-1994  mycroft Inline le{rd,wr}csr().
 1.3 01-Jul-1994  mycroft Add prototype.
 1.2 01-Jul-1994  mycroft Correct some comments.
 1.1 01-Jul-1994  mycroft Rename is to le, and add support for some models of DEPCA.
 1.7.2.5 09-Oct-1994  mycroft Update from trunk.
 1.7.2.4 07-Aug-1994  mycroft update from trunk
 1.7.2.3 26-Jul-1994  cgd from trunk.
 1.7.2.2 15-Jul-1994  cgd update from trunk.
 1.7.2.1 13-Jul-1994  cgd from trunk, per mycroft
 1.53 29-May-2022  rin Audit unload/unmap v.s. free against DMA buffer for sys/dev;
make sure that bus_dmamap_unload(9) [or bus_dmamap_destroy(9)] or
bus_dmamem_unmap(9) are preceding to freeing DMA buffer, if it is
loaded or mapped, respectively.

This is mandatory for some archs. See, e.g.:

http://www.nerv.org/netbsd/?q=id:20210511T013030Z.013443cc790088147e4beed43f53dedabeaf9312
http://www.nerv.org/netbsd/?q=id:20220511T172220Z.561179f0b6fcc5b9cd73e274f69d74e2ce9e4c93

For some drivers, resource leaks for error paths are fixed at
the same time.

XXX XXX XXX
Compile test only (at least one arch per driver).
 1.52 08-Dec-2021  andvar fix various typos in comments and log messages.
 1.51 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.50 24-Apr-2021  thorpej branches: 1.50.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.49 13-Nov-2010  uebayasi branches: 1.49.76;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.48 12-May-2009  cegger branches: 1.48.4;
struct device * -> device_t, no functional changes intended.
 1.47 28-Apr-2008  martin branches: 1.47.14;
Remove clause 3 and 4 from TNF licenses
 1.46 04-Apr-2008  tsutsui branches: 1.46.2; 1.46.4;
Split device_t/softc for le(4) and variants and misc cosmetic changes.
 1.45 19-Oct-2007  ad branches: 1.45.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.44 04-Mar-2007  christos branches: 1.44.2; 1.44.14; 1.44.16; 1.44.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.43 16-Nov-2006  christos branches: 1.43.4;
__unused removal on arguments; approved by core.
 1.42 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.41 24-Dec-2005  perry branches: 1.41.20; 1.41.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.40 11-Dec-2005  christos merge ktrace-lwp.
 1.39 30-May-2005  christos branches: 1.39.2;
- add const
- avoid variable shadowing.
 1.38 27-Feb-2005  perry nuke trailing whitespace
 1.37 04-Feb-2005  perry de-__P
 1.36 14-Sep-2004  drochner branches: 1.36.4; 1.36.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.35 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.34 02-Oct-2002  thorpej branches: 1.34.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.33 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.32 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.31 29-Jun-2002  rafal Allow this work work without a DRQ for PCNet parts mapped into ISA space
but which are connected to a local bus and do their own bus-mastering.
This has to be turned on via `flags 1' on the nele? device specification.
Gets one of my boxes working again with -current again.
 1.30 29-Jun-2002  rafal Pass bus_space_map() an address then a size, rather than size twice, so this
has a hope of working.
 1.29 07-Jan-2002  thorpej branches: 1.29.8; 1.29.10;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.28 13-Nov-2001  lukem add RCSID
 1.27 08-Jul-2001  thorpej branches: 1.27.2;
Remove unnecessary include files. From Onno van der Linden.
 1.26 30-May-2001  mrg use _KERNEL_OPT
 1.25 14-Nov-2000  thorpej branches: 1.25.2;
NBPG -> PAGE_SIZE
 1.24 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.23 15-Aug-1998  mycroft branches: 1.23.12;
Assign my copyrights to TNF.
 1.22 21-Jul-1998  drochner adapt to LANCE driver split
 1.21 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.20 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.19 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.18 18-Apr-1998  drochner Fix botched DMA tag initialization.
 1.17 16-Apr-1998  drochner Make the ISA LANCE drivers work without BROKEN_INDIRECT_CONFIG.
DEPCA is now split out into a separate driver.
Because there can be only one attachment of a device to a bus, for
each card type a separate pseudo-bus was introduced which attaches to "isa"
and where "le" attaches to.
 1.16 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.15 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.14 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.13 10-Sep-1997  mycroft Oops. Fix a teensy error in the previous.
 1.12 10-Sep-1997  mycroft If we select a 32k window on the DEPCA, make sure to switch to the lower 32k
chunk.
 1.11 06-Jun-1997  thorpej branches: 1.11.4;
Pull thorpej-bus-dma branch into mainline.
 1.10 17-Mar-1997  thorpej branches: 1.10.2;
#include <net/if_media.h>
 1.9 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.8 12-Feb-1997  thorpej Oops, pass the memory handle, not bus PA, to bus_space_unmap().
From Matthias Drochner <drochner@zelz28.zel.kfa-juelich.de>, in
PR #3216.
 1.7 05-Dec-1996  thorpej branches: 1.7.4;
Duh, make sure i/o tags and handles are initialized before actually
probing for the LANCE chip.
 1.6 02-Dec-1996  thorpej Convert to use <machine/bus.h>
 1.5 13-Oct-1996  christos backout kprintf changes
 1.4 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 30-Aug-1996  thorpej Add a missing "int" in a function declaration.
 1.2 12-May-1996  mycroft Use intr.h.
 1.1 07-May-1996  thorpej Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.

Break up ISA LANCE driver into ISA and PCI front-ends.

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
to take a struct ifnet *, rather than a unit number.
 1.7.4.3 12-Mar-1997  is Merge in changes from The Trunk
 1.7.4.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.7.4.1 21-Feb-1997  is Transform to the new world order.
 1.10.2.3 25-May-1997  thorpej Use bus_space_set_region_1() as appropriate.
 1.10.2.2 17-May-1997  thorpej Update for bus_dmamem_alloc() changes.
 1.10.2.1 13-May-1997  thorpej Convert to use bus dma.
 1.11.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.12.2 22-Nov-2000  bouyer Sync with HEAD.
 1.23.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.25.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.25.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.25.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.25.2.4 11-Jan-2002  nathanw More catchup.
 1.25.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.25.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.25.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.27.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.27.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.27.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.10.2 29-Jun-2002  lukem Pull up revision 1.31 (requested by rafal in ticket #397):
Allow this work work without a DRQ for PCNet parts mapped into ISA space
but which are connected to a local bus and do their own bus-mastering.
This has to be turned on via `flags 1' on the nele? device specification.
Gets one of my boxes working again with -current again.
 1.29.10.1 29-Jun-2002  lukem Pull up revision 1.30 (requested by rafal in ticket #396):
Pass bus_space_map() an address then a size, rather than size twice, so this
has a hope of working.
 1.29.8.1 15-Jul-2002  gehenna catch up with -current.
 1.34.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.34.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.34.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.34.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.6.1 03-Aug-2004  skrll Sync with HEAD
 1.36.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.36.6.1 12-Feb-2005  yamt sync with head.
 1.36.4.1 29-Apr-2005  kent sync with -current
 1.39.2.4 27-Oct-2007  yamt sync with head.
 1.39.2.3 03-Sep-2007  yamt sync with head.
 1.39.2.2 30-Dec-2006  yamt sync with head.
 1.39.2.1 21-Jun-2006  yamt sync with head.
 1.41.22.2 10-Dec-2006  yamt sync with head.
 1.41.22.1 22-Oct-2006  yamt sync with head
 1.41.20.1 18-Nov-2006  ad Sync with head.
 1.43.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.44.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.44.16.1 06-Nov-2007  matt sync with HEAD
 1.44.14.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.44.2.1 23-Oct-2007  ad Sync with head.
 1.45.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.46.4.2 16-May-2009  yamt sync with head
 1.46.4.1 16-May-2008  yamt sync with head.
 1.46.2.1 18-May-2008  yamt sync with head.
 1.47.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.48.4.1 05-Mar-2011  rmind sync with head
 1.49.76.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.50.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 24-Jul-1995  mycroft Update to use dev/ic/am7990.c.
 1.3 27-Oct-1994  cgd new RCS ID format.
 1.2 05-Jul-1994  mycroft Rename flags; clean up a bit.
 1.1 01-Jul-1994  mycroft Rename is to le, and add support for some models of DEPCA.
 1.14 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.13 29-Jun-2002  rafal branches: 1.13.104; 1.13.106; 1.13.108;
Allow this work work without a DRQ for PCNet parts mapped into ISA space
but which are connected to a local bus and do their own bus-mastering.
This has to be turned on via `flags 1' on the nele? device specification.
Gets one of my boxes working again with -current again.
 1.12 15-Aug-1998  mycroft branches: 1.12.24; 1.12.26; 1.12.38; 1.12.40;
Assign my copyrights to TNF.
 1.11 16-Apr-1998  drochner Make the ISA LANCE drivers work without BROKEN_INDIRECT_CONFIG.
DEPCA is now split out into a separate driver.
Because there can be only one attachment of a device to a bus, for
each card type a separate pseudo-bus was introduced which attaches to "isa"
and where "le" attaches to.
 1.10 10-Sep-1997  mycroft If we select a 32k window on the DEPCA, make sure to switch to the lower 32k
chunk.
 1.9 06-Jun-1997  thorpej branches: 1.9.4;
Pull thorpej-bus-dma branch into mainline.
 1.8 15-Mar-1997  is branches: 1.8.2;
New ARP system, supports IPv4 over any hardware link.

Some of the stuff (e.g., rarpd, bootpd, dhcpd etc., libsa) still will
only support Ethernet. Tcpdump itself should be ok, but libpcap needs
lot of work.

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.7 02-Dec-1996  thorpej branches: 1.7.4;
Convert to use <machine/bus.h>
 1.6 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.5 07-May-1996  thorpej Make the MI LANCE driver standalone, and use cfattach to resolve
naming conflicts between bus attachments on ports that can have
multiple instances of the LANCE.

Break up ISA LANCE driver into ISA and PCI front-ends.

Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_start)()
to take a struct ifnet *, rather than a unit number.
 1.4 29-Apr-1996  christos - prototype fixes
 1.3 07-Oct-1995  mycroft Add a shutdown hook.
 1.2 27-Jul-1995  mycroft Add PCI-specific configuration for PCnet-PCI.
 1.1 24-Jul-1995  mycroft Update to use dev/ic/am7990.c.
 1.7.4.1 25-Feb-1997  is Fix typo in comment.
 1.8.2.1 13-May-1997  thorpej Convert to use bus dma.
 1.9.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.40.1 29-Jun-2002  lukem Pull up revision 1.13 (requested by rafal in ticket #397):
Allow this work work without a DRQ for PCNet parts mapped into ISA space
but which are connected to a local bus and do their own bus-mastering.
This has to be turned on via `flags 1' on the nele? device specification.
Gets one of my boxes working again with -current again.
 1.12.38.1 15-Jul-2002  gehenna catch up with -current.
 1.12.26.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.12.24.1 01-Aug-2002  nathanw Catch up to -current.
 1.13.108.1 16-May-2008  yamt sync with head.
 1.13.106.1 18-May-2008  yamt sync with head.
 1.13.104.1 02-Jun-2008  mjf Sync with HEAD.
 1.27 03-Mar-2010  tsutsui Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.

* move RTL8019 probe and attach code from each bus attachment
to MI ne2000_detect() and ne2000_attach()
* change a method for backend and attachment to specify 8 bit mode
to use a new sc->sc_quirk member, instead of sc->sc_dmawidth
* handle more NE2000 8 bit mode specific settings, including
bus_space(9) access width and available size of buffer memory
* add a function to detect NE2000 8 bit mode
(disabled by default, but enalbed by options NE2000_DETECT_8BIT
to avoid possible regression on various ISA clones)
* fix ipkdb attachment accordingly (untested)

Tested on two NE2000 ISA variants (RTL8019AS and another clone named UL0001)
in both 8 bit and 16 bit mode on i386. "Looks good" from nonaka@.

See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
 1.26 28-Apr-2008  martin branches: 1.26.10; 1.26.20;
Remove clause 3 and 4 from TNF licenses
 1.25 12-Mar-2008  cube branches: 1.25.2; 1.25.4;
Split device_t and softc for the NE2000 Ethernet chip and all its variants
and attachments. Use device_t accessors, correct types, and ANSIfy when
appropriate.
 1.24 19-Oct-2007  ad branches: 1.24.12; 1.24.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 16-Nov-2006  christos branches: 1.23.8; 1.23.22; 1.23.24; 1.23.28;
__unused removal on arguments; approved by core.
 1.22 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.21 11-Dec-2005  christos branches: 1.21.20; 1.21.22;
merge ktrace-lwp.
 1.20 27-Feb-2005  perry branches: 1.20.4;
nuke trailing whitespace
 1.19 04-Feb-2005  perry de-__P
 1.18 14-Sep-2004  drochner branches: 1.18.4; 1.18.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.17 13-Feb-2004  wiz RealTek -> Realtek.
 1.16 02-Oct-2002  thorpej branches: 1.16.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.15 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.12 13-Nov-2001  lukem add RCSID
 1.11 08-Jul-2001  thorpej branches: 1.11.2;
Remove unnecessary include files. From Onno van der Linden.
 1.10 12-Feb-2001  thorpej branches: 1.10.2;
Adjust the way that media is initialized on DP8390-compatible
chips. The dp8390_softc now has media_init and media_fini
function pointers that do the work.
 1.9 01-Nov-1998  christos branches: 1.9.12;
make this compile again (missing semi-colon)
 1.8 31-Oct-1998  thorpej Add code to detect a RealTek 8019 chip, and use the media selection
support if present.
 1.7 28-Oct-1998  thorpej Add media list, media list count, and default media arguments to
ne2000_attach().
 1.6 05-Jul-1998  jonathan defopt NS, NSIP.
 1.5 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.4 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.3 19-Oct-1997  thorpej Use symbolic names for default locator values.
 1.2 14-Oct-1997  thorpej Pulldown from marc-pcmcia branch: ISA front-end for "ne" driver.
 1.1 14-Oct-1997  thorpej branches: 1.1.2;
file if_ne_isa.c was initially added on branch marc-pcmcia.
 1.1.2.2 14-Oct-1997  thorpej Mark this interface as enabled right from the get-go.
 1.1.2.1 14-Oct-1997  thorpej Split off NE2000 support from the ISA "ed" driver, and create a new "ne"
driver that deals with NE2000s and compatibles on ISA, PCI, and PCMCIA
busses.

This driver uses the generic DP8390 core chipset back-end.
 1.9.12.1 12-Mar-2001  bouyer Sync with HEAD.
 1.10.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.10.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.10.2.3 11-Jan-2002  nathanw More catchup.
 1.10.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.10.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.11.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.16.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.18.6.1 12-Feb-2005  yamt sync with head.
 1.18.4.1 29-Apr-2005  kent sync with -current
 1.20.4.3 17-Mar-2008  yamt sync with head.
 1.20.4.2 27-Oct-2007  yamt sync with head.
 1.20.4.1 30-Dec-2006  yamt sync with head.
 1.21.22.2 10-Dec-2006  yamt sync with head.
 1.21.22.1 22-Oct-2006  yamt sync with head
 1.21.20.1 18-Nov-2006  ad Sync with head.
 1.23.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.24.2 23-Mar-2008  matt sync with HEAD
 1.23.24.1 06-Nov-2007  matt sync with HEAD
 1.23.22.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.23.8.1 23-Oct-2007  ad Sync with head.
 1.24.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.24.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.24.12.1 24-Mar-2008  keiichi sync with head.
 1.25.4.2 11-Mar-2010  yamt sync with head
 1.25.4.1 16-May-2008  yamt sync with head.
 1.25.2.1 18-May-2008  yamt sync with head.
 1.26.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.26.10.1 20-Nov-2010  riz Pull up following revision(s) (requested by tsutsui in ticket #1367):
sys/dev/ic/ne2000var.h: revision 1.25
sys/arch/atari/conf/MILAN.in: revision 1.24
sys/arch/atari/conf/MILAN.in: revision 1.25
sys/dev/ic/ne2000.c: revision 1.71
sys/dev/ic/ne2000.c: revision 1.72
sys/arch/atari/dev/if_ne_mb.c: revision 1.1
sys/arch/atari/dev/if_ne_mb.c: revision 1.2
sys/arch/atari/conf/MILAN-PCIIDE: revision 1.69
sys/arch/atari/conf/HADES.in: revision 1.10
sys/arch/atari/conf/HADES.in: revision 1.11
sys/arch/x68k/dev/if_ne_neptune.c: revision 1.20
sys/dev/isa/if_ne_isa.c: revision 1.27
sys/arch/atari/atari/autoconf.c: revision 1.57
sys/dev/ic/ne2000.c: revision 1.62
sys/dev/isapnp/if_ne_isapnp.c: revision 1.27
sys/arch/atari/conf/files.atari: revision 1.117
sys/arch/atari/conf/HADES: revision 1.88
sys/arch/atari/conf/GENERIC.in: revision 1.85
sys/dev/ic/ne2000.c: revision 1.65
sys/dev/ic/ne2000.c: revision 1.66
sys/dev/ic/ne2000.c: revision 1.68
sys/arch/atari/conf/MILAN-ISAIDE: revision 1.65
distrib/notes/atari/hardware: revision 1.24
sys/conf/files: revision 1.980
sys/dev/ic/ne2000var.h: revision 1.21
sys/arch/x68k/dev/if_ne_intio.c: revision 1.16
sys/dev/ic/dp8390.c: revision 1.74
sys/dev/ic/dp8390.c: revision 1.75
Added NE2000 with 8bit bus width support.
reviewd by tsutsui@ at tech-kern ML.
Fix a wrong calculation bug around RX ring buffer memory address
slipped in about sixteen years ago. Fortunately, it had been working
for ages because some devices used address zero and other devices
ignored wrong higher bits.
Tested on we(4) (SMC Elite Ultra) and ne(4) (NE2000 compatible
named UL0001) on ISA.
Note FreeBSD also uses the same correct value in their ed(4) driver.
Now dp8390_config() calculates mem_ring correctly so
no longer need to override it in ne2000_attach().
Use roundup2() in <sys/param.h> rather than a conditional.
Also fix a wrong mem_ring calculation in dp8390_ipkdb_attach().
Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.
* move RTL8019 probe and attach code from each bus attachment
to MI ne2000_detect() and ne2000_attach()
* change a method for backend and attachment to specify 8 bit mode
to use a new sc->sc_quirk member, instead of sc->sc_dmawidth
* handle more NE2000 8 bit mode specific settings, including
bus_space(9) access width and available size of buffer memory
* add a function to detect NE2000 8 bit mode
(disabled by default, but enalbed by options NE2000_DETECT_8BIT
to avoid possible regression on various ISA clones)
* fix ipkdb attachment accordingly (untested)
Tested on two NE2000 ISA variants (RTL8019AS and another clone named UL0001)
in both 8 bit and 16 bit mode on i386. "Looks good" from nonaka@.
See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
No need to override mem_ring value in ne2000_ipkdb_attach()
since a wrong calculation in dp8390_ipkdb_attach() was fixed.
Don't warn about DMA timeout during probe.
Add support for the EtherNEC.
The EtherNEC is yet another user designed device for Atari machines,
an NE2000 based ISA board connected to Atari's ROM cartridge slot with
simple but ingenious interface and cartridge port adapter, and
it's the most available network solution for the old Atari machines.
See following pages for more details about EtherNEC:
http://hardware.atari.org/ether/
http://home.arcor.de/thomas.redelberger/prj/atari/etherne/
http://www.freemint.org/ethernec/ethernec.html
Also note EtherNEC.
Use callout_schedule(9) rather than callout_reset(9) on polling
as callout(9) man says.
Remove EtherNEC from HADES and MILAN.
They have ISA so no one will bother to connect ISA NE2000 via EtherNEC.
Regen from HADES.in rev 1.11 and MILAN.in rev 1.25:
Remove EtherNEC from HADES and MILAN.
They have ISA so no one will bother to connect ISA NE2000 via EtherNEC.
 1.27 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.26 11-Jul-2016  msaitoh KNF. No functional change.
 1.25 23-Mar-2014  christos branches: 1.25.6;
remove unused
 1.24 27-Oct-2012  chs branches: 1.24.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.23 03-Aug-2010  jakllsch branches: 1.23.8; 1.23.18;
Cast bus_addr_t to void * via uintptr_t to avoid
'cast to pointer from integer of different size' warnings.
Unbreaks i386 ALL kernel.

Oh, I'm sure I mentioned this before:
THIS DRIVER SHOULD NOT BE DOING THIS!
 1.22 27-Nov-2009  dsl branches: 1.22.2; 1.22.4;
Add patch from PR/11805
 1.21 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.20 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.19 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.18 13-Feb-2009  bouyer More printf format fixes.
 1.17 08-Apr-2008  cegger branches: 1.17.4; 1.17.12; 1.17.14; 1.17.18; 1.17.20;
use aprint_*_dev and device_xname
 1.16 19-Oct-2007  ad branches: 1.16.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 16-Nov-2006  christos branches: 1.15.8; 1.15.22; 1.15.24; 1.15.28;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 22-Apr-2006  christos branches: 1.13.8; 1.13.10;
Make this compile again. We really need an ALL kernel.
 1.12 29-Mar-2006  thorpej Use device_cfdata().
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.6; 1.11.8; 1.11.10; 1.11.12;
merge ktrace-lwp.
 1.10 27-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 04-Feb-2005  perry de-__P
 1.8 14-Sep-2004  drochner branches: 1.8.4; 1.8.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.7 03-May-2003  wiz branches: 1.7.2;
DMA, not dma nor Dma.
 1.6 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 04-Jan-2000  chopps branches: 1.1.6; 1.1.8; 1.1.10;
Add Riscom/N2 isa driver, most of the probe code was adapted from the
freebsd if_sr.c driver.
 1.1.10.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.10.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.8.2 11-Jan-2002  nathanw More catchup.
 1.1.8.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 04-Jan-2000  bouyer file if_ntwoc_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:17 +0000
 1.7.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.7.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.6.1 12-Feb-2005  yamt sync with head.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.10.4.2 27-Oct-2007  yamt sync with head.
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.11.12.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.11.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.11.10.2 11-May-2006  elad sync with head
 1.11.10.1 19-Apr-2006  elad sync with head.
 1.11.8.2 24-May-2006  yamt sync with head.
 1.11.8.1 01-Apr-2006  yamt sync with head.
 1.11.6.2 01-Jun-2006  kardel Sync with head.
 1.11.6.1 22-Apr-2006  simonb Sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.13.10.2 10-Dec-2006  yamt sync with head.
 1.13.10.1 22-Oct-2006  yamt sync with head
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.15.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.24.1 06-Nov-2007  matt sync with HEAD
 1.15.22.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.15.8.1 23-Oct-2007  ad Sync with head.
 1.16.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.20.1 26-Jul-2009  snj branches: 1.17.20.1.2;
Pull up following revision(s) (requested by dholland in ticket #874):
sys/dev/ic/ciss.c: revision 1.15
sys/dev/isa/isadma.c: revision 1.59
sys/dev/usb/ulpt.c: revision 1.82
sys/dev/ic/tcic2.c: revision 1.31
sys/dev/isa/if_ntwoc_isa.c: revision 1.18
sys/dev/pci/if_sk.c: revision 1.57
sys/dev/pcmcia/if_cnw.c: revision 1.46
More printf format fixes.
 1.17.20.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.17.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.14.1 26-Jul-2009  snj Pull up following revision(s) (requested by dholland in ticket #874):
sys/dev/ic/ciss.c: revision 1.15
sys/dev/isa/isadma.c: revision 1.59
sys/dev/usb/ulpt.c: revision 1.82
sys/dev/ic/tcic2.c: revision 1.31
sys/dev/isa/if_ntwoc_isa.c: revision 1.18
sys/dev/pci/if_sk.c: revision 1.57
sys/dev/pcmcia/if_cnw.c: revision 1.46
More printf format fixes.
 1.17.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.17.12.1 03-Mar-2009  skrll Sync with HEAD.
 1.17.4.4 11-Aug-2010  yamt sync with head.
 1.17.4.3 11-Mar-2010  yamt sync with head
 1.17.4.2 16-May-2009  yamt sync with head
 1.17.4.1 04-May-2009  yamt sync with head.
 1.22.4.1 05-Mar-2011  rmind sync with head
 1.22.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.23.18.3 03-Dec-2017  jdolecek update from HEAD
 1.23.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.23.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.23.8.1 30-Oct-2012  yamt sync with head
 1.24.2.1 18-May-2014  rmind sync with head
 1.25.6.1 05-Oct-2016  skrll Sync with HEAD
 1.1 04-Jan-2000  chopps branches: 1.1.6;
Add Riscom/N2 isa driver, most of the probe code was adapted from the
freebsd if_sr.c driver.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 04-Jan-2000  bouyer file if_ntwoc_isareg.h was added on branch thorpej_scsipi on 2000-11-20 11:41:17 +0000
 1.24 08-Feb-2018  dholland Typos.
 1.23 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.22 12-May-2009  cegger branches: 1.22.12; 1.22.22;
struct device * -> device_t, no functional changes intended.
 1.21 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.20 28-Apr-2008  martin branches: 1.20.14;
Remove clause 3 and 4 from TNF licenses
 1.19 08-Apr-2008  cegger branches: 1.19.2; 1.19.4;
use aprint_*_dev and device_xname
 1.18 19-Oct-2007  ad branches: 1.18.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 16-Nov-2006  christos branches: 1.17.8; 1.17.22; 1.17.24; 1.17.28;
__unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 11-Dec-2005  christos branches: 1.15.20; 1.15.22;
merge ktrace-lwp.
 1.14 04-Feb-2005  perry branches: 1.14.6;
de-__P
 1.13 14-Sep-2004  drochner branches: 1.13.4; 1.13.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.12 02-Oct-2002  thorpej branches: 1.12.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.11 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.8 13-Nov-2001  lukem add RCSID
 1.7 08-Jul-2001  thorpej branches: 1.7.2;
Remove unnecessary include files. From Onno van der Linden.
 1.6 30-Jul-2000  briggs branches: 1.6.2;
Add MII support to smc91cxx driver. This is supported for the 91c100
and 91c100FD (FEAST) controllers. Existing controllers should continue
to work as they have. Added the card's memory to the probe message.
 1.5 29-May-2000  jhawk branches: 1.5.2;
For all network drivers that call ether_ifattach(), and also
have _detach() functions:
Ensure that softc keeps state about whether the attach succeeded,
and make the detach function return immediately if the attach did
not complete.
 1.4 05-Jul-1998  jonathan branches: 1.4.14; 1.4.22;
defopt NS, NSIP.
 1.3 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.2 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.1 05-Nov-1997  thorpej branches: 1.1.2;
Add an ISA front-end to the SMC91cxx Ethernet driver ("sm"). This
supports generic SMC91cxx-based ISA cards and the built-in SMC
Ethernet found in some laptop docking stations.

Thanks much to Andrew Gillham <gillhaa@ghost.whirlpool.com> for
making this work!
 1.1.2.2 05-Nov-1997  thorpej Pull up from trunk: ISA front-end to the SMC91Cxx driver.
 1.1.2.1 05-Nov-1997  thorpej file if_sm_isa.c was added on branch netbsd-1-3 on 1997-11-05 06:12:07 +0000
 1.4.22.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 06-Aug-2000  briggs Pullups approved by thorpej --
Add MII support to smc91cxx driver. This is supported for the 91c100
and 91c100FD (FEAST) controllers. Existing controllers should continue
to work as they have. Added the card's memory to the probe message.

Make sure that we do not call bus_space_*_multi_* with zero count.
Use bus_space_read/write_multi_stream_2 for FIFO instead of bsr/w_multi_2.
 1.6.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.6.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.2.3 11-Jan-2002  nathanw More catchup.
 1.6.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.6.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.7.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.12.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.13.6.1 12-Feb-2005  yamt sync with head.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.14.6.2 27-Oct-2007  yamt sync with head.
 1.14.6.1 30-Dec-2006  yamt sync with head.
 1.15.22.2 10-Dec-2006  yamt sync with head.
 1.15.22.1 22-Oct-2006  yamt sync with head
 1.15.20.1 18-Nov-2006  ad Sync with head.
 1.17.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.17.24.1 06-Nov-2007  matt sync with HEAD
 1.17.22.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.17.8.1 23-Oct-2007  ad Sync with head.
 1.18.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.19.4.2 16-May-2009  yamt sync with head
 1.19.4.1 16-May-2008  yamt sync with head.
 1.19.2.1 18-May-2008  yamt sync with head.
 1.20.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.22.12.1 30-Oct-2012  yamt sync with head
 1.27 19-Jan-2020  thorpej Remove Token Ring support.
 1.26 14-Jul-2016  msaitoh branches: 1.26.18; 1.26.26;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.25 11-Jul-2016  msaitoh KNF. No functional change.
 1.24 27-Oct-2012  chs branches: 1.24.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.23 12-May-2009  cegger branches: 1.23.12; 1.23.22;
struct device * -> device_t, no functional changes intended.
 1.22 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.21 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.20 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 13-Feb-2009  bouyer Fix printf format after bus_size_t change
 1.18 28-Apr-2008  martin branches: 1.18.8; 1.18.10; 1.18.14; 1.18.18;
Remove clause 3 and 4 from TNF licenses
 1.17 19-Oct-2007  ad branches: 1.17.16; 1.17.18; 1.17.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.16 16-Nov-2006  christos branches: 1.16.8; 1.16.22; 1.16.24; 1.16.28;
__unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 11-Dec-2005  christos branches: 1.14.20; 1.14.22;
merge ktrace-lwp.
 1.13 27-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 04-Feb-2005  perry de-__P
 1.11 02-Oct-2002  thorpej branches: 1.11.6; 1.11.14; 1.11.16;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.10 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.7 13-Nov-2001  lukem add RCSID
 1.6 06-Jun-2000  soren branches: 1.6.4; 1.6.6;
Fix braino in previous, pointed out by Jaromir.
 1.5 06-Jun-2000  soren Make the frontend print a newline.
 1.4 30-Apr-1999  bad branches: 1.4.2; 1.4.10;
Convert some bogus panic()s into printf()s.
 1.3 29-Apr-1999  bad From Onno van der Linden:
Reorganise the driver some what.
Rename tr_reset() to the more appropriate tr_stop().
Create a common tropic reset routine and use it in the frontends.
Move the code in tr_config() which is only used in the card attachment
routines into a new tr_attach() function.
Take adapter off the ring through tr_shutdown() in a shutdown hook.
This simplifies the bus-specific frontend.
 1.2 22-Mar-1999  bad branches: 1.2.2;
Oops. RcsID police.
 1.1 22-Mar-1999  bad Chipset driver for TROPIC based Token-Ring cards.
Frontends for IBM and 3COM ISA cards.

By Onno van der Linden <onno@simplex.nl>.
 1.2.2.2 30-Apr-1999  perry branches: 1.2.2.2.2;
pullup 1.3->1.4 (bad)
 1.2.2.1 29-Apr-1999  perry pullup 1.2->1.3 (bad)
 1.2.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.10.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.6.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.6.4.2 11-Jan-2002  nathanw More catchup.
 1.6.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.11.16.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.16.1 12-Feb-2005  yamt sync with head.
 1.11.14.1 29-Apr-2005  kent sync with -current
 1.11.6.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.6.1 04-Feb-2005  skrll Sync with HEAD.
 1.13.4.2 27-Oct-2007  yamt sync with head.
 1.13.4.1 30-Dec-2006  yamt sync with head.
 1.14.22.2 10-Dec-2006  yamt sync with head.
 1.14.22.1 22-Oct-2006  yamt sync with head
 1.14.20.1 18-Nov-2006  ad Sync with head.
 1.16.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.16.24.1 06-Nov-2007  matt sync with HEAD
 1.16.22.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.16.8.1 23-Oct-2007  ad Sync with head.
 1.17.20.3 16-May-2009  yamt sync with head
 1.17.20.2 04-May-2009  yamt sync with head.
 1.17.20.1 16-May-2008  yamt sync with head.
 1.17.18.1 18-May-2008  yamt sync with head.
 1.17.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.18.18.1 21-Apr-2010  matt sync to netbsd-5
 1.18.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.10.1 29-Sep-2009  snj Pull up following revision(s) (requested by bouyer in ticket #1040):
sys/dev/isa/if_tr_isa.c: revision 1.19
Fix printf format after bus_size_t change
 1.18.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.18.8.1 03-Mar-2009  skrll Sync with HEAD.
 1.23.22.2 03-Dec-2017  jdolecek update from HEAD
 1.23.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.23.12.1 30-Oct-2012  yamt sync with head
 1.24.14.1 05-Oct-2016  skrll Sync with HEAD
 1.26.26.1 25-Jan-2020  ad Sync with head.
 1.26.18.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.15 19-Jan-2020  thorpej Remove Token Ring support.
 1.14 12-May-2009  cegger branches: 1.14.64; 1.14.72;
struct device * -> device_t, no functional changes intended.
 1.13 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.12 28-Apr-2008  martin branches: 1.12.14;
Remove clause 3 and 4 from TNF licenses
 1.11 19-Oct-2007  ad branches: 1.11.16; 1.11.18; 1.11.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.10 16-Nov-2006  christos branches: 1.10.8; 1.10.22; 1.10.24; 1.10.28;
__unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 11-Dec-2005  christos branches: 1.8.20; 1.8.22;
merge ktrace-lwp.
 1.7 27-Feb-2005  perry branches: 1.7.4;
nuke trailing whitespace
 1.6 04-Feb-2005  perry de-__P
 1.5 14-Sep-2004  drochner branches: 1.5.4; 1.5.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.4 07-Jan-2002  thorpej branches: 1.4.16;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 22-Mar-1999  bad branches: 1.2.20; 1.2.22;
Oops. RcsID police.
 1.1 22-Mar-1999  bad Chipset driver for TROPIC based Token-Ring cards.
Frontends for IBM and 3COM ISA cards.

By Onno van der Linden <onno@simplex.nl>.
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.20.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.20.2 11-Jan-2002  nathanw More catchup.
 1.2.20.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.16.3 04-Feb-2005  skrll Sync with HEAD.
 1.4.16.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.16.1 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.6.1 12-Feb-2005  yamt sync with head.
 1.5.4.1 29-Apr-2005  kent sync with -current
 1.7.4.2 27-Oct-2007  yamt sync with head.
 1.7.4.1 30-Dec-2006  yamt sync with head.
 1.8.22.2 10-Dec-2006  yamt sync with head.
 1.8.22.1 22-Oct-2006  yamt sync with head
 1.8.20.1 18-Nov-2006  ad Sync with head.
 1.10.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.24.1 06-Nov-2007  matt sync with HEAD
 1.10.22.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.10.8.1 23-Oct-2007  ad Sync with head.
 1.11.20.2 16-May-2009  yamt sync with head
 1.11.20.1 16-May-2008  yamt sync with head.
 1.11.18.1 18-May-2008  yamt sync with head.
 1.11.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.12.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.14.72.1 25-Jan-2020  ad Sync with head.
 1.14.64.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.21 19-Jan-2020  thorpej Remove Token Ring support.
 1.20 10-Nov-2019  chs branches: 1.20.2;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.19 12-May-2009  cegger branches: 1.19.64;
struct device * -> device_t, no functional changes intended.
 1.18 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.16 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.15 28-Apr-2008  martin branches: 1.15.8; 1.15.14;
Remove clause 3 and 4 from TNF licenses
 1.14 19-Oct-2007  ad branches: 1.14.16; 1.14.18; 1.14.20;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 16-Nov-2006  christos branches: 1.13.8; 1.13.22; 1.13.24; 1.13.28;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 28-Mar-2006  thorpej branches: 1.11.8; 1.11.10;
Use device_unit().
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
merge ktrace-lwp.
 1.9 30-May-2005  christos branches: 1.9.2;
- add const
- avoid variable shadowing.
 1.8 27-Feb-2005  perry nuke trailing whitespace
 1.7 04-Feb-2005  perry de-__P
 1.6 14-Sep-2004  drochner branches: 1.6.4; 1.6.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.5 07-Jan-2002  thorpej branches: 1.5.16;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.4 13-Nov-2001  lukem add RCSID
 1.3 30-Apr-1999  bad branches: 1.3.14; 1.3.16;
Convert some bogus panic()s into printf()s.
 1.2 22-Mar-1999  bad branches: 1.2.2;
Oops. RcsID police.
 1.1 22-Mar-1999  bad Chipset driver for TROPIC based Token-Ring cards.
Frontends for IBM and 3COM ISA cards.

By Onno van der Linden <onno@simplex.nl>.
 1.2.2.1 30-Apr-1999  perry branches: 1.2.2.1.2;
pullup 1.2->1.3 (bad)
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.14.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.14.2 11-Jan-2002  nathanw More catchup.
 1.3.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.5.16.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.16.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.16.3 04-Feb-2005  skrll Sync with HEAD.
 1.5.16.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.16.1 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.6.1 12-Feb-2005  yamt sync with head.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.9.2.3 27-Oct-2007  yamt sync with head.
 1.9.2.2 30-Dec-2006  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.10.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.10.10.1 19-Apr-2006  elad sync with head.
 1.10.8.1 01-Apr-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.10.2 10-Dec-2006  yamt sync with head.
 1.11.10.1 22-Oct-2006  yamt sync with head
 1.11.8.1 18-Nov-2006  ad Sync with head.
 1.13.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.24.1 06-Nov-2007  matt sync with HEAD
 1.13.22.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.13.8.1 23-Oct-2007  ad Sync with head.
 1.14.20.3 16-May-2009  yamt sync with head
 1.14.20.2 04-May-2009  yamt sync with head.
 1.14.20.1 16-May-2008  yamt sync with head.
 1.14.18.1 18-May-2008  yamt sync with head.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.15.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.64.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.20.2.1 25-Jan-2020  ad Sync with head.
 1.16 13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.15 02-Feb-2012  tls branches: 1.15.6; 1.15.24;
Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.14 22-Sep-2009  tsutsui branches: 1.14.12; 1.14.16;
Make local functions static.
 1.13 22-Sep-2009  tsutsui Split device_t/softc. Tested only on cs at ofisa on shark.
 1.12 22-Sep-2009  tsutsui Fix wrong softc size in CFATTACH_DECL(). (not cs_softc but cs_softc_isa)
 1.11 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.10 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.9 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.8 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.7 28-Apr-2008  martin branches: 1.7.8; 1.7.14;
Remove clause 3 and 4 from TNF licenses
 1.6 08-Apr-2008  cegger branches: 1.6.2; 1.6.4;
use aprint_*_dev and device_xname
 1.5 19-Oct-2007  ad branches: 1.5.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.4 11-Dec-2005  christos branches: 1.4.30; 1.4.44; 1.4.46; 1.4.50;
merge ktrace-lwp.
 1.3 27-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 04-Feb-2005  perry de-__P
 1.1 08-Jan-2005  joff branches: 1.1.2; 1.1.4; 1.1.6;
Support for TS-ETH10 PC/104 enet isa card based on CS8900
 1.1.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.6.1 12-Feb-2005  yamt sync with head.
 1.1.4.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.3 04-Feb-2005  skrll Sync with HEAD.
 1.1.4.2 17-Jan-2005  skrll Sync with HEAD.
 1.1.4.1 08-Jan-2005  skrll file if_tscs_isa.c was added on branch ktrace-lwp on 2005-01-17 19:31:11 +0000
 1.1.2.1 29-Apr-2005  kent sync with -current
 1.3.4.1 27-Oct-2007  yamt sync with head.
 1.4.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.46.1 06-Nov-2007  matt sync with HEAD
 1.4.44.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.4.30.1 23-Oct-2007  ad Sync with head.
 1.5.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.4.4 11-Mar-2010  yamt sync with head
 1.6.4.3 16-May-2009  yamt sync with head
 1.6.4.2 04-May-2009  yamt sync with head.
 1.6.4.1 16-May-2008  yamt sync with head.
 1.6.2.1 18-May-2008  yamt sync with head.
 1.7.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.14.16.1 18-Feb-2012  mrg merge to -current.
 1.14.12.1 17-Apr-2012  yamt sync with head
 1.15.24.1 06-Jun-2015  skrll Sync with HEAD
 1.15.6.1 03-Dec-2017  jdolecek update from HEAD
 1.17 23-Mar-2001  jdolecek Split we(4) driver to bus independant and ISA-specific parts, in preparation
for MCA attachment.
 1.16 12-Feb-2001  thorpej branches: 1.16.2;
Adjust the way that media is initialized on DP8390-compatible
chips. The dp8390_softc now has media_init and media_fini
function pointers that do the work.
 1.15 28-Mar-1999  tron branches: 1.15.8;
Make it possible to force 16 mode via "flags 4" in kernel configuration.
Patch supplied by Martin Husemann on "current-users", fixes PR kern/5673.
 1.14 23-Mar-1999  drochner Use BUS_SPACE_ALIGNED_POINTER() instead of ALIGNED_POINTER() where the pointer
in not just used to access memory but is bassed to bus_space_xxx_n()
methods. For debugging purposes, bus_space can have additional constraints
which will be properly met by BUS_SPACE_ALIGNED_POINTER().
 1.13 15-Mar-1999  thomas Include machine/bswap.h, needed on big endian machines.
 1.12 27-Oct-1998  thorpej branches: 1.12.4;
Holy smokes, batman! Actually fill in the "init_card" entry point!
 1.11 05-Jul-1998  jonathan defopt NS, NSIP.
 1.10 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.9 25-Jun-1998  thorpej When writing packets to transmit buffers, do unaligned buffer fixups,
more-or-less lifted from the Shark CS8900 driver.
 1.8 25-May-1998  leo Use stream methods (when available) to read/write the card memory.
 1.7 07-Apr-1998  drochner We can't trust the "delay port" anymore - it doesn't work as expected on
newer chipsets. Use delay() instead.
Being here, remove BROKEN_INDIRECT_CONFIG.
 1.6 26-Jan-1998  thorpej Update copyright.
 1.5 26-Jan-1998  thorpej If we're using these devices on a big-endian CPU, byte swap the "count"
field in the dp8390's packet header (because the dp8390 runs in little-endian
mode in these cases). Inspired by an e-mail from Kazuki Sakamoto.
 1.4 13-Jan-1998  thorpej Fix a typo in previous.
 1.3 12-Jan-1998  thorpej Update for config changes.
 1.2 08-Nov-1997  thorpej Properly determine the default media on '790-based cards.
 1.1 03-Nov-1997  thorpej branches: 1.1.2;
Add a front-end to the MI dp8390 driver for the Western Digital/SMC 80x3
family, SMC Elite Ultra family, and SMC EtherEZ family of Ethernet cards.

This front-end completes the split of the ISA "ed" driver.
 1.1.2.4 29-Oct-1998  cgd pull up rev 1.12 from trunk (thorpej)
 1.1.2.3 08-Nov-1997  thorpej Pull up from trunk: properly detect default media on '790-based cards.
 1.1.2.2 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.1.2.1 03-Nov-1997  thorpej file if_we.c was added on branch netbsd-1-3 on 1997-11-05 19:10:18 +0000
 1.12.4.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.15.8.2 27-Mar-2001  bouyer Sync with HEAD.
 1.15.8.1 12-Mar-2001  bouyer Sync with HEAD.
 1.16.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.23 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.22 13-Mar-2010  tsutsui branches: 1.22.20;
Some KNF.
 1.21 13-Mar-2010  tsutsui - include "ioconf.h" for struct cfdriver we_cd
- remove unused macro
 1.20 28-Apr-2008  martin branches: 1.20.20;
Remove clause 3 and 4 from TNF licenses
 1.19 12-Mar-2008  cube branches: 1.19.2; 1.19.4;
Split device_t and softc for the NE2000 Ethernet chip and all its variants
and attachments. Use device_t accessors, correct types, and ANSIfy when
appropriate.
 1.18 19-Oct-2007  ad branches: 1.18.12; 1.18.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 16-Nov-2006  christos branches: 1.17.8; 1.17.22; 1.17.24; 1.17.28;
__unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 17-Aug-2006  christos branches: 1.15.2; 1.15.4;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
 1.14 29-Jan-2006  dsl branches: 1.14.2; 1.14.6;
Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
 1.13 11-Dec-2005  christos branches: 1.13.2;
merge ktrace-lwp.
 1.12 03-Apr-2005  jdolecek branches: 1.12.2;
Make it possible for attachment to specify that the 16bit access shouldn't
be toggled in WE_MEM_{ENABLE|DISABLE} when receiving or transmitting packets.
Use this to switch the toggle off for MCA cards, since it causes NIC resets
there.

Fixes PR kern/26895 by Dave Barnes.
 1.11 27-Feb-2005  perry nuke trailing whitespace
 1.10 04-Feb-2005  perry de-__P
 1.9 14-Sep-2004  drochner branches: 1.9.4; 1.9.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.4 13-Nov-2001  lukem add RCSID
 1.3 08-Jul-2001  thorpej branches: 1.3.2;
Remove unnecessary include files. From Onno van der Linden.
 1.2 01-Jul-2001  gmcgarry Garbage-collect unneeded rnd.h include.
 1.1 23-Mar-2001  jdolecek branches: 1.1.2; 1.1.4;
Split we(4) driver to bus independant and ISA-specific parts, in preparation
for MCA attachment.
 1.1.4.7 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.6 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.5 11-Jan-2002  nathanw More catchup.
 1.1.4.4 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.3 24-Aug-2001  nathanw Catch up with -current.
 1.1.4.2 09-Apr-2001  nathanw Catch up with -current.
 1.1.4.1 23-Mar-2001  nathanw file if_we_isa.c was added on branch nathanw_sa on 2001-04-09 01:56:42 +0000
 1.1.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.1.2.1 23-Mar-2001  bouyer file if_we_isa.c was added on branch thorpej_scsipi on 2001-03-27 15:32:04 +0000
 1.3.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.8.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.6.1 12-Feb-2005  yamt sync with head.
 1.9.4.1 29-Apr-2005  kent sync with -current
 1.12.2.4 17-Mar-2008  yamt sync with head.
 1.12.2.3 27-Oct-2007  yamt sync with head.
 1.12.2.2 30-Dec-2006  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.13.2.1 01-Feb-2006  yamt sync with head.
 1.14.6.1 03-Sep-2006  yamt sync with head.
 1.14.2.1 09-Sep-2006  rpaulo sync with head
 1.15.4.2 10-Dec-2006  yamt sync with head.
 1.15.4.1 22-Oct-2006  yamt sync with head
 1.15.2.1 18-Nov-2006  ad Sync with head.
 1.17.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.17.24.2 23-Mar-2008  matt sync with HEAD
 1.17.24.1 06-Nov-2007  matt sync with HEAD
 1.17.22.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.17.8.1 23-Oct-2007  ad Sync with head.
 1.18.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.18.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.12.1 24-Mar-2008  keiichi sync with head.
 1.19.4.2 11-Aug-2010  yamt sync with head.
 1.19.4.1 16-May-2008  yamt sync with head.
 1.19.2.1 18-May-2008  yamt sync with head.
 1.20.20.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.22.20.1 03-Dec-2017  jdolecek update from HEAD
 1.2 23-Mar-2001  jdolecek Split we(4) driver to bus independant and ISA-specific parts, in preparation
for MCA attachment.
 1.1 03-Nov-1997  thorpej branches: 1.1.2; 1.1.16; 1.1.28;
Add a front-end to the MI dp8390 driver for the Western Digital/SMC 80x3
family, SMC Elite Ultra family, and SMC EtherEZ family of Ethernet cards.

This front-end completes the split of the ISA "ed" driver.
 1.1.28.1 09-Apr-2001  nathanw Catch up with -current.
 1.1.16.1 27-Mar-2001  bouyer Sync with HEAD.
 1.1.2.2 05-Nov-1997  thorpej Update from trunk: split 3Com 3c503 support and WD/SMC Ethernet support
into "ec" and "we" drivers, respectively, and obsolete the "ed" driver.
 1.1.2.1 03-Nov-1997  thorpej file if_wereg.h was added on branch netbsd-1-3 on 1997-11-05 19:10:19 +0000
 1.24 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.23 24-Apr-2021  thorpej branches: 1.23.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.22 14-Jul-2016  msaitoh branches: 1.22.34;
KNF. No functional change.
 1.21 27-Oct-2012  chs branches: 1.21.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.20 12-May-2009  cegger branches: 1.20.12; 1.20.22;
struct device * -> device_t, no functional changes intended.
 1.19 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.18 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 08-Apr-2008  cegger branches: 1.17.4; 1.17.12; 1.17.18;
use aprint_*_dev and device_xname
 1.16 19-Oct-2007  ad branches: 1.16.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 16-Nov-2006  christos branches: 1.15.8; 1.15.22; 1.15.24; 1.15.28;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 23-Apr-2006  christos branches: 1.13.8; 1.13.10;
Make this compile again.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 27-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 04-Feb-2005  perry de-__P
 1.9 14-Sep-2004  drochner branches: 1.9.4; 1.9.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.8 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.7 06-Jan-2003  wiz branches: 1.7.2;
interrupt with two rs.
 1.6 01-Jan-2003  thorpej Use aprint_normal() in cfprint routines.
 1.5 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.4 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 15-Nov-1999  mcr branches: 1.1.2; 1.1.4; 1.1.10; 1.1.12; 1.1.14;
added support for BOCA 6port ISA adapter. 3x16552 with an
interrupt status register at yet-another-address.
ioat0 at isa? port 0x220 irq 5 flags 1# BOCA 'ioat66' 6-port cards
com* at ioat? slave ?
 1.1.14.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.14.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.12.4 07-Jan-2003  thorpej Sync with HEAD.
 1.1.12.3 03-Jan-2003  thorpej Sync with HEAD.
 1.1.12.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.12.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.10.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.10.1 15-Nov-1999  bouyer file ioat66.c was added on branch thorpej_scsipi on 2000-11-20 11:41:17 +0000
 1.1.4.2 21-Jan-2000  he Pull up revision 1.1 (new, requested by mcr):
Add a driver for BOCA 6-port ISA serial adapter.
 1.1.4.1 15-Nov-1999  he file ioat66.c was added on branch netbsd-1-4 on 2000-01-21 00:39:05 +0000
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.7.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.6.1 12-Feb-2005  yamt sync with head.
 1.9.4.1 29-Apr-2005  kent sync with -current
 1.11.4.3 27-Oct-2007  yamt sync with head.
 1.11.4.2 30-Dec-2006  yamt sync with head.
 1.11.4.1 21-Jun-2006  yamt sync with head.
 1.12.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.12.10.1 11-May-2006  elad sync with head
 1.12.8.1 24-May-2006  yamt sync with head.
 1.12.6.1 01-Jun-2006  kardel Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.10.2 10-Dec-2006  yamt sync with head.
 1.13.10.1 22-Oct-2006  yamt sync with head
 1.13.8.1 18-Nov-2006  ad Sync with head.
 1.15.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.24.1 06-Nov-2007  matt sync with HEAD
 1.15.22.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.15.8.1 23-Oct-2007  ad Sync with head.
 1.16.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.17.4.2 16-May-2009  yamt sync with head
 1.17.4.1 04-May-2009  yamt sync with head.
 1.20.22.2 03-Dec-2017  jdolecek update from HEAD
 1.20.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.20.12.1 30-Oct-2012  yamt sync with head
 1.21.14.1 05-Oct-2016  skrll Sync with HEAD
 1.22.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.23.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.142 17-Oct-2025  thorpej Garbage-collect the "isa_knowndev" stuff; nothing used it.
 1.141 03-Oct-2025  thorpej Use device_{get,set}prop_bool() for "no-legacy-devices".
 1.140 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.139 24-Apr-2021  thorpej branches: 1.139.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.138 21-Aug-2010  jmcneill branches: 1.138.18; 1.138.76;
If the 'no-legacy-devices' property is present and true, skip device
enumeration.
 1.137 19-Aug-2009  cegger branches: 1.137.2; 1.137.4;
build fix: isa_detach_hook() needs isa_chipset_tag_t as first argument.
 1.136 18-Aug-2009  dyoung Let us safely detach the ISA bus and devices attaching to the ISA
bus:

1 Add isadetach() for detaching the ISA bus, and add some helper
routines that release resources held for ISA DMA.

2 In isachilddetached(), forget references to child devices.

While I am here, change ISA_DMA_DRQ_ISFREE(...) == 0 to the simpler
expression, !ISA_DMA_DRQ_ISFREE(...).
 1.135 07-Apr-2009  dyoung Fix spelling: indrect -> indirect.
 1.134 28-Apr-2008  martin branches: 1.134.8; 1.134.14;
Remove clause 3 and 4 from TNF licenses
 1.133 30-Mar-2008  ad branches: 1.133.2; 1.133.4;
Add isa_get_slotcount/isa_set_slotcount to get/set the number of ISA
compatible expansion slots in a system.
 1.132 15-Mar-2008  cube Split device_t and softc for isa(4).
 1.131 09-Dec-2007  jmcneill branches: 1.131.6; 1.131.10;
Merge jmcneill-pm branch.
 1.130 01-Dec-2007  jmcneill branches: 1.130.2; 1.130.4;
aprint-ify isaattach, removes a hard-to-find newline on a boot -z
 1.129 19-Oct-2007  ad branches: 1.129.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.128 02-Jan-2007  isaki branches: 1.128.6; 1.128.18; 1.128.20; 1.128.24;
Correct indent.
 1.127 24-Nov-2006  wiz s/independant/independent/, from Zafer.
 1.126 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.125 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.124 11-Dec-2005  christos branches: 1.124.20; 1.124.22;
merge ktrace-lwp.
 1.123 26-Aug-2005  drochner s/locdesc_t/int/g
 1.122 25-Aug-2005  drochner oops, too much mechanical renaming -- clearly separate searched and
found locators
 1.121 25-Aug-2005  drochner replace the "locdesc_t" structure carrying the number of locators
explicitely by a plain integer array
the length in now known to all relevant parties, so this avoids
duplication of information, and we can allocate that thing in
drivers without hacks
 1.120 29-May-2005  christos branches: 1.120.2;
sprinkle const.
 1.119 14-Sep-2004  drochner include "locators.h" explicitely where it is needed, so that
it can be removed in the isavar.h header eventually
 1.118 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.117 18-Aug-2004  drochner allow to detach child devices and (optional selectively) bus rescans,
using the new autoconf functions
 1.116 01-Jan-2003  thorpej branches: 1.116.2;
Use aprint_normal() in cfprint routines.
 1.115 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.114 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.113 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.112 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.111 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.110 07-Jan-2002  thorpej branches: 1.110.6;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.109 13-Nov-2001  lukem add RCSID
 1.108 19-Jun-2001  fvdl branches: 1.108.2;
ifdef NISAPNP -> if NISAPNP > 0
 1.107 29-Mar-2000  simonb branches: 1.107.6;
Don't need to include <sys/conf.h> here.
 1.106 19-Feb-1999  mycroft branches: 1.106.8;
Kill vestiges of isa_establish().
 1.105 15-Aug-1998  mycroft Assign copyrights to TNF.
 1.104 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.103 30-Jul-1998  christos Use the previously committed pnp hook.
 1.102 11-Jun-1998  leo branches: 1.102.2;
Don't call isa_dmainit() when NISADMA == 0.
 1.101 09-Jun-1998  thorpej Change the ISA DMA API to take an isa_chipset_tag_t rather than
a struct device * corresponding to the ISA bus device. The ISA DMA
controller driver functions have been renamed and now take a struct
isa_dma_state *, and are called indirectly by machine-dependent code
which provides the DMA state.

These changes allow e.g. `ofisa' (the OpenFirmware configuration
mechanism for the ISA bus, used by e.g. Sharks) to use the MI ISA
DMA controller code.
 1.100 05-May-1998  drochner Remove BROKEN_INDIRECT_CONFIG relicts.
 1.99 15-Apr-1998  thorpej Remove the `delay port' stuff since nothing uses it anymore (can't reliably
use it on modern chipsets).
 1.98 12-Jan-1998  thorpej Update for config changes.
 1.97 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.96 17-Jul-1997  jtk branches: 1.96.2;
use locator defines in "locators.h" to index cf_loc[]

still to be done and/or decided not to be done: replace all *UNK uses in
isa code with the native names from locators.h
 1.95 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.94 26-Jan-1997  cgd branches: 1.94.6;
split isasearch (!__BROKEN_INDIRECT_CONFIG) completely off of
isascan (__BROKEN_INDIRECT_CONFIG), and attempt multiple match/attach
of cloning devices in isasearch(). (If a match/attach succeeds for
a cloning device, try it again.)
 1.93 08-Dec-1996  cgd The last change fixed a last-minute goof in the __BROKEN_INDIRECT_CONFIG
case, but added a typo (extra parenthesis) in the !__BROKEN_INDIRECT_CONFIG
case. fix it.
 1.92 05-Dec-1996  cgd fix a (fatal) bug in the __BROKEN_INDIRECT_CONFIG changes checked
in yesterday. (got a little bit careless with #ifdef'd variables.)
 1.91 05-Dec-1996  cgd update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.90 23-Nov-1996  cgd restrict the FSTATE_STAR prohibition (and panic) to the i386 only. Cloning
devices actually do make sense on indirect-config busses, because you
might be able to have more than one of the busses! In addition, they're
useful because they don't require unit numbers to be wired down, so you
could e.g. have vga* at indirect? and vga* at direct?, and have the first
one found be unit number zero. Finally, devices which can divine their
own ports numbers, etc., actually should be cloning, even if you know you'll
only have one bus that they can live on.
 1.89 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.88 13-Oct-1996  christos backout kprintf changes
 1.87 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.86 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.85 14-May-1996  thorpej #include <machine/intr.h> to get IST_* definitions.
 1.84 12-May-1996  mycroft Use intr.h.
 1.83 08-May-1996  thorpej Correct a couple of comments ... port 0x84 produces a 1.25us delay when
read, not 2.5us. (I must have been confused; thanks Charles, for
correcting me.)
 1.82 05-May-1996  thorpej Map port 0x84 (which is used to generate a 2.6us delay) in isaattach().
Since this port is needed by at least a few drivers, export its i/o handle
via isa_attach_args.
 1.81 29-Apr-1996  christos - prototype fixes
 1.80 11-Apr-1996  cgd on non-i386 systems, include <machine/intr.h> (per charles's proposal on
tech-kern (?)), to get the IPL_* and IST_* types. pass the machine-dependent
cookie given at attach time on to sub-devices, so they can use it to access
the interrupt functions properly.
 1.79 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.78 08-Mar-1996  cgd remember the bus_chipset_tag_t given by our parent, and pass it on to
children.
 1.77 28-Feb-1996  cgd make ISA bus match/attach, and sub-device configuration machine-independent.
 1.76 16-Jan-1996  mycroft Make the panic message for ISA clone devices more informative.
 1.75 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.74 07-Jun-1995  cgd make match/attach routines and cfdriver struct mi
 1.73 17-May-1995  cgd isa softc structs are larger than 'struct device'
 1.72 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.71 16-Jan-1995  mycroft Remove outdated comment.
 1.70 02-Jan-1995  mycroft Don't assume ia_maddr is in the hole.
 1.69 18-Nov-1994  mycroft Stylistic changes.
 1.68 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.67 14-Nov-1994  mycroft Map IRQ 2 to IRQ 9.
 1.66 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.65 04-Nov-1994  mycroft Use kvtop() rather than address arithmetic in a couple of places.
 1.64 04-Nov-1994  mycroft Add a new function config_scan(), which just calls a particular function
with each plausibly cfdata, ignoring the priority mechanism completely.
 1.63 04-Nov-1994  mycroft Commit incest with the config system for this one specific case.
 1.62 04-Nov-1994  mycroft Set ia_irq correctly.
 1.61 04-Nov-1994  mycroft Correct an oversight.
 1.60 04-Nov-1994  mycroft Oops; forgot isacd.
 1.59 03-Nov-1994  mycroft New version using standard config_*() functions.
 1.58 27-Oct-1994  cgd new RCS ID format.
 1.57 09-Oct-1994  mycroft Remove unneeded #includes.
 1.56 07-Oct-1994  mycroft Fix initial allocation of dev array, and simplify the code
slightly.
 1.55 05-May-1994  cgd branches: 1.55.2;
lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.54 03-May-1994  mycroft Forgot to munge the #includes in last commit.
 1.53 03-May-1994  mycroft Move beep junk to clock.c.
 1.52 24-Apr-1994  mycroft Rename two files.
 1.51 22-Apr-1994  mycroft Separate DMA functions.
 1.50 21-Apr-1994  mycroft Fix typo.
 1.49 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.48 03-Apr-1994  mycroft Clean up #includes.
 1.47 31-Mar-1994  mycroft Remove an old hack that now just causes a small memory leak during autoconfig.
 1.46 29-Mar-1994  mycroft New autoconfig mechanism. Hacked at the moment to use old config(8), but
look mostly like config.new to drivers.
 1.45 12-Mar-1994  mycroft Rearrange top-level configuration to be more consistent.
 1.44 10-Mar-1994  mycroft Update for new config; handles subdevices differently.
 1.43 10-Mar-1994  mycroft Add isa_dmaabort().
 1.42 09-Mar-1994  mycroft Back out previous change for now.
 1.41 08-Mar-1994  mycroft Inline spl*() calls.
 1.40 06-Mar-1994  mycroft Better delay() from magnum branch.
 1.39 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.38 01-Mar-1994  mycroft Remove some dead code.
 1.37 01-Mar-1994  mycroft Clean up DMA code. Mask and unmask channels. Warn if terminal count not
reached.
 1.36 22-Feb-1994  mycroft Add clockmask.
 1.35 22-Feb-1994  mycroft Add clockmask.
 1.34 16-Feb-1994  mycroft Move elink_reset() into a separate file, and add a generic elink_idseq().
 1.33 16-Feb-1994  hpeyerl Add common reset function so if_ep and if_ie don't reset each-other.
(this is a 3commonality)
 1.32 20-Dec-1993  mycroft Use cpufunc.h only where (currently) needed.
 1.31 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.30 17-Dec-1993  mycroft From magnum branch:
Remove Jolitz's netisr kluge. Make sure cpl == 0 really means base priority.
Other minor cleanup.
 1.29 05-Nov-1993  cgd note that use of splnone() is prolly bogus; splnone() itself is bogus,
so it's use is. 8-)
 1.28 28-Aug-1993  brezak branches: 1.28.2;
Add find_isadev() and have sysbeep() use common defines.
 1.27 08-Aug-1993  cgd there are some devices out there which use... NO I/O PORTS!
 1.26 11-Jul-1993  mycroft Make splimp = splnet | spltty, and get rid of SLIP kluge for splnet and
spltty.
 1.25 07-Jul-1993  cgd delete inclusion of rlist.h again. grr.
 1.24 06-Jul-1993  deraadt clean up code for timeout/untimeout/wakeup prototypes.
 1.23 06-Jul-1993  cgd get rid of extraneous inclusion of rlist.h
 1.22 30-Jun-1993  andrew Updated comments.
 1.21 27-Jun-1993  andrew ANSIfications.
 1.20 20-Jun-1993  deraadt print "maddr 0xd0000 msize 65536" as "maddr 0xd0000-0xdffff" instead.
 1.19 16-Jun-1993  mycroft Fix typo.
 1.18 16-Jun-1993  mycroft Make sysbeep() take a frequency, not a timer count, and add constants
BEEP_FREQ and BEEP_TIME which can be overridden in the config file.
 1.17 15-Jun-1993  mycroft Move definitions of TIMER_FREQ to timerreg.h, and fix value of CF for DELAY().
 1.16 15-Jun-1993  mycroft Clean up beep code a miniscule amount, add interrupt protection, and
make multiple beeps generate a continuous tone.
 1.15 06-Jun-1993  cgd incorporate Bruce Evans' interrupt changes, as hacked by Rod grimes,
for patchkit patch 158. it appears to work well.
 1.14 28-May-1993  deraadt 1. It is now possible to build a kernel that does not have a pc0 device driver.
2. "press any key to reboot" reads the key from the console.
3. wddump() still needs a non-blocking getc() routine (or flush)
 1.13 22-May-1993  cgd add rcsids to everything and clean up headers
 1.12 11-May-1993  deraadt Whoops. One more 0x0ffff to expunge..
 1.11 11-May-1993  deraadt 1. id_irq is a u_short
2. "irq ?" sets it to (u_short)-1
3. "irq #" sets it to (1<<#)
4. not specifying an interrupt sets it to 0.

Until someone else comes up with a better scheme, that's the way it is.
If you have a driver that turns the interrupt off, set it to ZERO.

If, after calling XXprobe(), id_irq is still (u_short)-1, that is the same
as if probe() failed.
 1.10 08-May-1993  deraadt multiple master controllers would probe tthe first one N times instead of
once each. never mind not worth worrying about what i;m talking about.
 1.9 07-May-1993  cgd no irq == -1, or, actually, 0x0ffff (f*ing unsigned short...).
this would break devices w/o interrupts (like lpa).
 1.8 04-May-1993  deraadt support for making dev->id_alive be set, this is for iostat to
find disk devices. wee bit of a kludge. sub-device attach()
routines must now return 1 for successful attach(), 0 otherwise.
Other bsd's do this too..
 1.7 04-May-1993  cgd fixed loopback == nuke problem.
This fix is probably not optimal, but it works.
 1.6 15-Apr-1993  deraadt ioconf changes, see previous cvs's that dumped core
 1.5 09-Apr-1993  cgd make printing of i/o addresses a bit prettier, and fix off-by-one error.
 1.4 09-Apr-1993  cgd from Rodney W. Grimes (rgrimes@agora.rain.com) (patchkit patch 117):

This patch adds the symbol names to icu.s that vmstat expects
the interrupt counters to be called. It also adds code to config
so that the names of the interrupts are written at the end of vectors.s
so vmstat can report real device names. It also cleans up and enables
the logging of stray interrupts. The counters for false interrupts
are added but the fix for them is not (the fix I have is not done
very good.) A false interrupt is when a device asserts it's interrupt
signal, then removes it before the 8259 can latch it. This is the number
one cause of stray IRQ7's and IRQ15's.

Additional device probe information is now printed. This includes
ending I/O address (many drivers do not return the correct value from a
probe this still needs to be fixed), memory address and size, driver
flags passed in by config.
 1.3 08-Apr-1993  deraadt dmesg output at boottime now tries to print out information as
soon as it is available. The output looks much more like Sunos.
 1.2 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.28.2.22 01-Dec-1993  mycroft Remove silly hack to force a delay between beeps.
 1.28.2.21 08-Nov-1993  mycroft Minor cleanup.
 1.28.2.20 31-Oct-1993  mycroft IRQ_SLAVE should not be enabled here.
 1.28.2.19 27-Oct-1993  mycroft Arrange that IF is on but we are at splhigh() during autoconfig. Clear
ipending in isa_flushintrs().
 1.28.2.18 22-Oct-1993  mycroft Remove isa_nmi().
 1.28.2.17 22-Oct-1993  mycroft Remove interrupt handling code.
 1.28.2.16 18-Oct-1993  mycroft Preserve the order in which interrupt handlers on a particular are registered.
 1.28.2.15 17-Oct-1993  mycroft Minor cleanup.
 1.28.2.14 16-Oct-1993  mycroft Add isa_establish(), for all it's worth (which is to say, nothing).
 1.28.2.13 16-Oct-1993  mycroft Don't forget to enable the interrupt line when registering a handler.
Change the first argument to isa_mem{check,alloc}() to a caddr_t.
 1.28.2.12 16-Oct-1993  mycroft Add intr_establish(), and isa_intrmaskwickedness() to set up interrupt masks
after device configuration.
 1.28.2.11 15-Oct-1993  mycroft Rename some functions to match BSDI.
 1.28.2.10 15-Oct-1993  mycroft isa_discoverintr(): Ignore IRQ_SLAVE bit in ICU1.
 1.28.2.9 15-Oct-1993  mycroft Flush any pending interrupts at the end of autoconfig. Make isa_defaultirq
static.
 1.28.2.8 15-Oct-1993  mycroft Add isa_discoverintr().
 1.28.2.7 14-Oct-1993  mycroft Remove DMA gunk. Rewrite IDT initialization to use a table from locore.
Remove some defunct configuration code. Don't splhigh() in sysbeep() and
sysbeepstop().
 1.28.2.6 11-Oct-1993  mycroft #include pio.h where needed, and remove cpufunc.h.
 1.28.2.5 09-Oct-1993  mycroft Remove netmask kluge.
 1.28.2.4 06-Oct-1993  mycroft Announce quite clearly if ia_irq is still IRQUNK in isaprint() (if DIAGNOSTIC).
 1.28.2.3 30-Sep-1993  mycroft Print a warning if probe function leaves irq as IRQUNK with option DIAGNOSTIC.
 1.28.2.2 24-Sep-1993  mycroft clock.c: Finish conversion. Make rtcput() work if VRT bit not set. Speed up
time conversion in delay().
fd.c: Minor changes to autoconfig. Use dv_parent rather than storing another
pointer to the fdc_softc in each fd_softc. Change disk label stuff for our
kernel.
icu.s: Make splx() and splnone() return previous cpl for now.
isa.c: Minor autoconfig changes.
isa.h: rtcin() is now nvram() and is declare in nvram.h. Make isaphysmem a
caddr_t.
pccons.c: XXXX: Maybe we should insist they open /dev/io now.
timerreg.h: #define TIMER_NPORTS.
wd.c: Delete unused wdnoreloc() and wddospart(), and use remaining two bits in
unit number. struct disk --> struct wd_softc. struct board --> struct
wdc_softc. Still needs much work.
 1.28.2.1 14-Sep-1993  mycroft New i386 code.
 1.55.2.2 11-Oct-1994  mycroft Update from trunk.
 1.55.2.1 07-Oct-1994  mycroft Update from trunk.
 1.94.6.1 13-May-1997  thorpej - Pass the bus dma tag to children.
- Map the on-board ISA DMA controller registers and the DMA page registers.
The "delay port" lives in this range, so subregion it.
 1.96.2.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.102.2.1 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.106.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.107.6.6 03-Jan-2003  thorpej Sync with HEAD.
 1.107.6.5 18-Oct-2002  nathanw Catch up to -current.
 1.107.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.107.6.3 11-Jan-2002  nathanw More catchup.
 1.107.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.107.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.108.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.108.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.110.6.1 06-Apr-2002  eeh Convert to support attachment through devprops as well.
 1.116.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.116.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.116.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.116.2.2 03-Sep-2004  skrll Sync with HEAD
 1.116.2.1 25-Aug-2004  skrll Sync with HEAD.
 1.120.2.7 17-Mar-2008  yamt sync with head.
 1.120.2.6 21-Jan-2008  yamt sync with head
 1.120.2.5 07-Dec-2007  yamt sync with head
 1.120.2.4 27-Oct-2007  yamt sync with head.
 1.120.2.3 26-Feb-2007  yamt sync with head.
 1.120.2.2 30-Dec-2006  yamt sync with head.
 1.120.2.1 21-Jun-2006  yamt sync with head.
 1.124.22.2 10-Dec-2006  yamt sync with head.
 1.124.22.1 22-Oct-2006  yamt sync with head
 1.124.20.2 12-Jan-2007  ad Sync with head.
 1.124.20.1 18-Nov-2006  ad Sync with head.
 1.128.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.128.20.3 23-Mar-2008  matt sync with HEAD
 1.128.20.2 09-Jan-2008  matt sync with HEAD
 1.128.20.1 06-Nov-2007  matt sync with HEAD
 1.128.18.6 08-Dec-2007  jmcneill Rename pnp(9) -> pmf(9), as requested by many.
 1.128.18.5 01-Dec-2007  jmcneill Sync with HEAD.
 1.128.18.4 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.128.18.3 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.128.18.2 05-Oct-2007  joerg Add generic ISA power handler.
 1.128.18.1 07-Aug-2007  jmcneill Use pnp_generic_power
 1.128.6.1 23-Oct-2007  ad Sync with head.
 1.129.2.2 27-Dec-2007  mjf Sync with HEAD.
 1.129.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.130.4.1 11-Dec-2007  yamt sync with head.
 1.130.2.1 26-Dec-2007  ad Sync with head.
 1.131.10.2 02-Jun-2008  mjf Sync with HEAD.
 1.131.10.1 03-Apr-2008  mjf Sync with HEAD.
 1.131.6.1 24-Mar-2008  keiichi sync with head.
 1.133.4.5 09-Oct-2010  yamt sync with head
 1.133.4.4 16-Sep-2009  yamt sync with head
 1.133.4.3 19-Aug-2009  yamt sync with head.
 1.133.4.2 04-May-2009  yamt sync with head.
 1.133.4.1 16-May-2008  yamt sync with head.
 1.133.2.1 18-May-2008  yamt sync with head.
 1.134.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.134.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.137.4.1 05-Mar-2011  rmind sync with head
 1.137.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.138.76.8 05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.138.76.7 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.138.76.6 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.138.76.5 03-Apr-2021  thorpej config_attach_loc() -> config_attach() with CFARG_LOCATORS argument.
 1.138.76.4 28-Mar-2021  thorpej - Use designated initializers for the wildcard[] array in isaattach().
- No need to be explicit about interface attribute.
 1.138.76.3 22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.138.76.2 22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.138.76.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.138.18.1 12-Sep-2012  tls Initial snapshot of work to eliminate 64K MAXPHYS. Basically works for
physio (I/O to raw devices); needs more doing to get it going with the
filesystems, but it shouldn't damage data.

All work's been done on amd64 so far. Not hard to add support to other
ports. If others want to pitch in, one very helpful thing would be to
sort out when and how IDE disks can do 128K or larger transfers, and
adjust the various PCI IDE (or at least ahcisata) drivers and wd.c
accordingly -- it would make testing much easier. Another very helpful
thing would be to implement a smart minphys() for RAIDframe along the
lines detailed in the MAXPHYS-NOTES file.
 1.139.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 17-Feb-2001  martin Rename isa_isic.c to i4b_isic_isa.c and isadaic.c to i4b_daic_isa.c
to improve naming consistency.
 1.2 09-Jan-2001  martin Fix some oversights from fixing option names.
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.4 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file isa_isic.c was added on branch thorpej_scsipi on 2001-01-05 17:35:52 +0000
 1.4 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.3 18-Oct-2016  jdolecek branches: 1.3.2; 1.3.4; 1.3.18;
add isa_intr_establish_xname() to MD isa headers so that it can be used
by MI drivers
 1.2 18-Oct-2016  martin Make this compile again.
 1.1 17-Oct-2016  jdolecek provide stub intr xname establish for xen
 1.3.18.2 03-Dec-2017  jdolecek update from HEAD
 1.3.18.1 18-Oct-2016  jdolecek file isa_stub.c was added on branch tls-maxphys on 2017-12-03 11:37:05 +0000
 1.3.4.2 05-Dec-2016  skrll Sync with HEAD
 1.3.4.1 18-Oct-2016  skrll file isa_stub.c was added on branch nick-nhusb on 2016-12-05 10:55:02 +0000
 1.3.2.2 04-Nov-2016  pgoyette Sync with HEAD
 1.3.2.1 18-Oct-2016  pgoyette file isa_stub.c was added on branch pgoyette-localcount on 2016-11-04 14:49:09 +0000
 1.5 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.4 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.3 11-Dec-2005  christos branches: 1.3.20; 1.3.22;
merge ktrace-lwp.
 1.2 24-May-2005  lukem branches: 1.2.2;
add __KERNEL_RCSID
 1.1 30-Aug-2004  drochner branches: 1.1.2;
add centralized {eisa,isa,pci,agp,mca}busprint() functions which do
what tens of the bus' parents foo{...}bridge_print()s scattered around do
 1.1.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Sep-2004  skrll Sync with HEAD
 1.1.2.1 30-Aug-2004  skrll file isabusprint.c was added on branch ktrace-lwp on 2004-09-03 12:45:18 +0000
 1.2.2.2 30-Dec-2006  yamt sync with head.
 1.2.2.1 21-Jun-2006  yamt sync with head.
 1.3.22.2 10-Dec-2006  yamt sync with head.
 1.3.22.1 22-Oct-2006  yamt sync with head
 1.3.20.1 18-Nov-2006  ad Sync with head.
 1.2 17-Feb-2001  martin Rename isa_isic.c to i4b_isic_isa.c and isadaic.c to i4b_daic_isa.c
to improve naming consistency.
 1.1 05-Jan-2001  martin branches: 1.1.1;
Initial revision
 1.1.1.1 05-Jan-2001  martin branches: 1.1.1.1.2;
Initial import of ISDN4BSD release 0.96
 1.1.1.1.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.1.1.1.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.1.1.1.2.1 05-Jan-2001  bouyer file isadaic.c was added on branch thorpej_scsipi on 2001-01-05 17:35:52 +0000
 1.68 27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.67 29-May-2018  jdolecek branches: 1.67.40;
fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly

patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c
 1.66 13-Nov-2010  uebayasi branches: 1.66.52; 1.66.58;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.65 26-Jul-2010  jym Add PAE to ALL kernel, so that most paddr_t format string errors get caught
during compilation.

While here, fix the compilation for ALL.
 1.64 19-Apr-2010  dyoung Add default implementations for bus_space_is_equal(9),
bus_space_tag_create(9), and bus_space_tag_destroy(9). Use
bus_space_is_equal(9) throughout the kernel to compare
bus_space_tag_t's. Tested on i386 and on sparc64.
 1.63 22-Mar-2010  dyoung isadma.c: #if 0 some diagnostic code that compares two bus_space_tag_t's.

pcdisplay.c: #if 0 some code that compares two bus_space_tag_t's
in order to see if pcdisplay0 is console. It does not seem to
be helpful to compare the tags; maybe the author intended to
compare some other bus property?

MI code should not compare an opaque type such as bus_space_tag_t!
 1.62 18-Aug-2009  dyoung branches: 1.62.2; 1.62.4;
Let us safely detach the ISA bus and devices attaching to the ISA
bus:

1 Add isadetach() for detaching the ISA bus, and add some helper
routines that release resources held for ISA DMA.

2 In isachilddetached(), forget references to child devices.

While I am here, change ISA_DMA_DRQ_ISFREE(...) == 0 to the simpler
expression, !ISA_DMA_DRQ_ISFREE(...).
 1.61 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.60 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.59 13-Feb-2009  bouyer More printf format fixes.
 1.58 28-Apr-2008  martin branches: 1.58.8; 1.58.10; 1.58.14; 1.58.16;
Remove clause 3 and 4 from TNF licenses
 1.57 08-Apr-2008  cegger branches: 1.57.2; 1.57.4;
use aprint_*_dev and device_xname
 1.56 19-Oct-2007  ad branches: 1.56.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.55 04-Mar-2007  christos branches: 1.55.2; 1.55.14; 1.55.16; 1.55.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.54 11-Dec-2005  christos branches: 1.54.26;
merge ktrace-lwp.
 1.53 04-Feb-2005  perry branches: 1.53.6;
de-__P
 1.52 09-May-2003  fvdl branches: 1.52.2; 1.52.10; 1.52.12;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.51 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.50 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.49 13-Nov-2001  lukem add RCSID
 1.48 19-Jul-2001  thorpej Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.
 1.47 12-Feb-2001  briggs branches: 1.47.2; 1.47.4;
Clean up a couple of printf-format warnings.
 1.46 14-Nov-2000  thorpej NBPG -> PAGE_SIZE
 1.45 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.44 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.43 07-Feb-2000  thorpej branches: 1.43.4;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.42 22-Mar-1999  mycroft branches: 1.42.8;
If bus_dmamap_create() fails, free the DMA channel.
 1.41 22-Feb-1999  mycroft Oops; remove obsolete code.
 1.40 22-Feb-1999  mycroft Add support for demand mode with auto-init.
 1.39 19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.38 08-Jul-1998  thorpej DRQ 4 is used to chain the two 8237s together. Make sure it's always
cascaded and that it will be unmasked when DMA is thawed after being
frozen. (This also has the effect of making sure that no device ever
erroneously gets DRQ 4.)
 1.37 28-Jun-1998  thorpej Add an additional ISA DMA mode: LOOPDEMAND. This is for devices, such
as the Shark's CS8900 Ethernet, which want to use the DMA controller in
this mode (as opposed to single mode).

[Editor's note: committed from a Shark using a new bus_dma back-end
and a CS8900 driver converted to use the MI code :-]
 1.36 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.35 09-Jun-1998  thorpej Add isa_dma{freeze,thaw}(), used to temporarily stop and then restart
all ISA DMA. Needed by e.g. the SmartCard reader for Sharks.
 1.34 09-Jun-1998  thorpej Change the ISA DMA API to take an isa_chipset_tag_t rather than
a struct device * corresponding to the ISA bus device. The ISA DMA
controller driver functions have been renamed and now take a struct
isa_dma_state *, and are called indirectly by machine-dependent code
which provides the DMA state.

These changes allow e.g. `ofisa' (the OpenFirmware configuration
mechanism for the ISA bus, used by e.g. Sharks) to use the MI ISA
DMA controller code.
 1.33 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.32 05-Sep-1997  thorpej branches: 1.32.4;
Enable use of bus_dmamem_mmap().
 1.31 30-Aug-1997  augustss Insert a sanity check so we get a panic instead of a kernel page
fault if the DMA map is missing.
 1.30 04-Aug-1997  augustss Implement a function to test if a drq is taken and use it
in two drivers. There are still many drivers left to fix...
 1.29 31-Jul-1997  augustss Don't panic when creating a bus dma map for a taken dma channel,
it can happen during probing.
 1.28 28-Jul-1997  augustss branches: 1.28.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.27 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.26 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.25 29-May-1997  mycroft Use single mode, not demand mode, for auto-initialize transfers.
 1.24 28-May-1997  mycroft Don't use the TC bit to check for wraparound in isa_dmacount(); remember the
transfer length and use that.
 1.23 21-Mar-1997  mycroft branches: 1.23.2;
Clean up a bit, and export isa_dmamask() and isa_dmaunmask() interfaces.
 1.22 21-Mar-1997  mycroft Add an isa_dmacount() function, to get the current residual count on a channel.
 1.21 13-Oct-1996  christos backout kprintf changes
 1.20 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.19 29-Apr-1996  christos - prototype fixes
 1.18 31-Mar-1996  mycroft Fix a slight biff with 16-bit DMA in last change.
 1.17 01-Mar-1996  mycroft Oops; switched two bits.
 1.16 01-Mar-1996  mycroft Remove two unneeded `if's.
 1.15 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.14 22-Feb-1996  mycroft Keep the terminal count information around, as it's self-clearing.
 1.13 20-Feb-1996  mycroft Move the terminal count check into a separate function.
 1.12 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.11 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.10 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.9 04-Nov-1994  mycroft Rearrange slightly.
 1.8 27-Oct-1994  cgd new RCS ID format.
 1.7 23-May-1994  cgd quiet compiler warnings
 1.6 24-Apr-1994  mycroft Rename two files.
 1.5 22-Apr-1994  mycroft Separate DMA functions.
 1.4 22-Oct-1993  mycroft Add at_setup_dmachan(). Minor cleanup.
 1.3 17-Oct-1993  mycroft Minor cleanup.
 1.2 16-Oct-1993  mycroft Panic if DMA with odd length attempted on a 16-bit channel.
 1.1 14-Oct-1993  mycroft New file with DMA code from isa.c, modified to check for some errors.
 1.23.2.4 29-May-1997  mycroft Use single mode, not demand mode, for auto-initialize transfers.
 1.23.2.3 28-May-1997  mycroft Don't use the TC bit to check for wraparound in isa_dmacount(); remember the
transfer length and use that.
 1.23.2.2 17-May-1997  thorpej Add isa_dmamem_*() functions, which are wrappers around bus_dmamem_*()
functions, but encapsulate the peculiar memory contraints of the
on-board ISA DMA controller. Devices which use the isa_dma*() functions
should use these for DMA-safe memory manipulation.
 1.23.2.1 13-May-1997  thorpej Mostly-rewrite, converting the ISA DMA controller driver to be a user
of the bus dma API. A new isa_dma*() function call interface is exported
to drivers that need to use this controller.
 1.28.2.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.2 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.4.1 23-Nov-1998  cgd Fix many real and potential security problems with character device
driver mmap routines that did not properly bounds check offsets.
See NetBSD security advisory NetBSD-SA1998-005 for details. Done
as a patch because it's large, and a fair number of bits are different
in -current. (mrg)
 1.42.8.3 12-Mar-2001  bouyer Sync with HEAD.
 1.42.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.42.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.43.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.47.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.47.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.47.4.1 03-Aug-2001  lukem update to -current
 1.47.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.47.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.47.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.52.12.1 12-Feb-2005  yamt sync with head.
 1.52.10.1 29-Apr-2005  kent sync with -current
 1.52.2.1 04-Feb-2005  skrll Sync with HEAD.
 1.53.6.2 27-Oct-2007  yamt sync with head.
 1.53.6.1 03-Sep-2007  yamt sync with head.
 1.54.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.55.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.55.16.1 06-Nov-2007  matt sync with HEAD
 1.55.14.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.55.2.1 23-Oct-2007  ad Sync with head.
 1.56.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.57.4.5 11-Aug-2010  yamt sync with head.
 1.57.4.4 19-Aug-2009  yamt sync with head.
 1.57.4.3 16-May-2009  yamt sync with head
 1.57.4.2 04-May-2009  yamt sync with head.
 1.57.4.1 16-May-2008  yamt sync with head.
 1.57.2.1 18-May-2008  yamt sync with head.
 1.58.16.1 26-Jul-2009  snj branches: 1.58.16.1.2;
Pull up following revision(s) (requested by dholland in ticket #874):
sys/dev/ic/ciss.c: revision 1.15
sys/dev/isa/isadma.c: revision 1.59
sys/dev/usb/ulpt.c: revision 1.82
sys/dev/ic/tcic2.c: revision 1.31
sys/dev/isa/if_ntwoc_isa.c: revision 1.18
sys/dev/pci/if_sk.c: revision 1.57
sys/dev/pcmcia/if_cnw.c: revision 1.46
More printf format fixes.
 1.58.16.1.2.1 21-Apr-2010  matt sync to netbsd-5
 1.58.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.58.10.1 26-Jul-2009  snj Pull up following revision(s) (requested by dholland in ticket #874):
sys/dev/ic/ciss.c: revision 1.15
sys/dev/isa/isadma.c: revision 1.59
sys/dev/usb/ulpt.c: revision 1.82
sys/dev/ic/tcic2.c: revision 1.31
sys/dev/isa/if_ntwoc_isa.c: revision 1.18
sys/dev/pci/if_sk.c: revision 1.57
sys/dev/pcmcia/if_cnw.c: revision 1.46
More printf format fixes.
 1.58.8.2 28-Apr-2009  skrll Sync with HEAD.
 1.58.8.1 03-Mar-2009  skrll Sync with HEAD.
 1.62.4.2 05-Mar-2011  rmind sync with head
 1.62.4.1 30-May-2010  rmind sync with head
 1.62.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.62.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.66.58.1 25-Jun-2018  pgoyette Sync with HEAD
 1.66.52.1 07-Jun-2018  martin Pull up following revision(s) (requested by jdolecek in ticket #841):

sys/dev/isa/isadmareg.h: revision 1.9
sys/dev/isa/isareg.h: revision 1.10
sys/dev/isa/isadma.c: revision 1.67

fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly
patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c
 1.67.40.1 02-Aug-2025  perseant Sync with HEAD
 1.9 29-May-2018  jdolecek fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly

patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c
 1.8 28-Apr-2008  martin branches: 1.8.80; 1.8.86;
Remove clause 3 and 4 from TNF licenses
 1.7 07-Feb-2000  thorpej branches: 1.7.126; 1.7.128; 1.7.130;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.6 22-Jan-1998  cgd branches: 1.6.14;
add definitions for the mask registers. fix I/O size definitions.
 1.5 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.4 28-Jun-1995  cgd branches: 1.4.12;
note that most of dev/ic's contents have changed names
 1.3 29-Jan-1995  cgd use chip headers in /dev/ic
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 22-Apr-1994  mycroft Separate DMA functions.
 1.4.12.1 13-May-1997  thorpej Mostly-rewrite, converting the ISA DMA controller driver to be a user
of the bus dma API. A new isa_dma*() function call interface is exported
to drivers that need to use this controller.
 1.6.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.130.1 16-May-2008  yamt sync with head.
 1.7.128.1 18-May-2008  yamt sync with head.
 1.7.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.86.1 25-Jun-2018  pgoyette Sync with HEAD
 1.8.80.1 07-Jun-2018  martin Pull up following revision(s) (requested by jdolecek in ticket #841):

sys/dev/isa/isadmareg.h: revision 1.9
sys/dev/isa/isareg.h: revision 1.10
sys/dev/isa/isadma.c: revision 1.67

fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly
patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c
 1.26 29-Apr-2012  dsl Patch out the 'struct malloc_type' from the isa_dma alloc routines.
All the i386 kernels now build
 1.25 18-Aug-2009  dyoung branches: 1.25.12; 1.25.16;
Let us safely detach the ISA bus and devices attaching to the ISA
bus:

1 Add isadetach() for detaching the ISA bus, and add some helper
routines that release resources held for ISA DMA.

2 In isachilddetached(), forget references to child devices.

While I am here, change ISA_DMA_DRQ_ISFREE(...) == 0 to the simpler
expression, !ISA_DMA_DRQ_ISFREE(...).
 1.24 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.23 28-Apr-2008  martin branches: 1.23.14;
Remove clause 3 and 4 from TNF licenses
 1.22 04-Mar-2007  christos branches: 1.22.36; 1.22.38; 1.22.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.21 11-Dec-2005  christos branches: 1.21.26;
merge ktrace-lwp.
 1.20 04-Feb-2005  perry branches: 1.20.6;
de-__P
 1.19 09-May-2003  fvdl branches: 1.19.2; 1.19.10; 1.19.12;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.18 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.17 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.16 07-Feb-2000  thorpej branches: 1.16.4;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.15 22-Feb-1999  mycroft branches: 1.15.8;
Add support for demand mode with auto-init.
 1.14 28-Jun-1998  thorpej Add an additional ISA DMA mode: LOOPDEMAND. This is for devices, such
as the Shark's CS8900 Ethernet, which want to use the DMA controller in
this mode (as opposed to single mode).

[Editor's note: committed from a Shark using a new bus_dma back-end
and a CS8900 driver converted to use the MI code :-]
 1.13 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.12 09-Jun-1998  thorpej Add isa_dma{freeze,thaw}(), used to temporarily stop and then restart
all ISA DMA. Needed by e.g. the SmartCard reader for Sharks.
 1.11 09-Jun-1998  thorpej Change the ISA DMA API to take an isa_chipset_tag_t rather than
a struct device * corresponding to the ISA bus device. The ISA DMA
controller driver functions have been renamed and now take a struct
isa_dma_state *, and are called indirectly by machine-dependent code
which provides the DMA state.

These changes allow e.g. `ofisa' (the OpenFirmware configuration
mechanism for the ISA bus, used by e.g. Sharks) to use the MI ISA
DMA controller code.
 1.10 04-Aug-1997  augustss Implement a function to test if a drq is taken and use it
in two drivers. There are still many drivers left to fix...
 1.9 28-Jul-1997  augustss branches: 1.9.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.8 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.7 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.6 21-Mar-1997  mycroft branches: 1.6.2;
Clean up a bit, and export isa_dmamask() and isa_dmaunmask() interfaces.
 1.5 21-Mar-1997  mycroft Add an isa_dmacount() function, to get the current residual count on a channel.
 1.4 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.3 20-Feb-1996  mycroft Move the terminal count check into a separate function.
 1.2 27-Oct-1994  cgd new RCS ID format.
 1.1 22-Apr-1994  mycroft Separate DMA functions.
 1.6.2.2 17-May-1997  thorpej Add isa_dmamem_*() functions, which are wrappers around bus_dmamem_*()
functions, but encapsulate the peculiar memory contraints of the
on-board ISA DMA controller. Devices which use the isa_dma*() functions
should use these for DMA-safe memory manipulation.
 1.6.2.1 13-May-1997  thorpej Mostly-rewrite, converting the ISA DMA controller driver to be a user
of the bus dma API. A new isa_dma*() function call interface is exported
to drivers that need to use this controller.
 1.9.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.19.12.1 12-Feb-2005  yamt sync with head.
 1.19.10.1 29-Apr-2005  kent sync with -current
 1.19.2.1 04-Feb-2005  skrll Sync with HEAD.
 1.20.6.1 03-Sep-2007  yamt sync with head.
 1.21.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.22.40.3 19-Aug-2009  yamt sync with head.
 1.22.40.2 16-May-2009  yamt sync with head
 1.22.40.1 16-May-2008  yamt sync with head.
 1.22.38.1 18-May-2008  yamt sync with head.
 1.22.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.16.1 02-Jun-2012  mrg sync to latest -current.
 1.25.12.1 23-May-2012  yamt sync with head.
 1.11 27-Dec-2019  msaitoh s/reister/register/ in comment.
 1.10 29-May-2018  jdolecek branches: 1.10.2;
fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly

patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c
 1.9 11-Dec-2005  christos branches: 1.9.156; 1.9.162;
merge ktrace-lwp.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 05-May-2003  fvdl branches: 1.7.2;
Move definition of ISA_DMA_BOUNCE_THRESHOLD to dev/isa/isareg.h.
 1.6 22-Mar-1998  drochner The keyboard controller's address range is 5 bytes long - reflect this
here.
 1.5 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.4 27-Oct-1994  cgd new RCS ID format.
 1.3 01-Oct-1994  mycroft Add IO_PPI.
 1.2 01-Oct-1994  mycroft Add IO_PMP[12] and IO_PMPSIZE.
 1.1 24-Apr-1994  mycroft branches: 1.1.2;
Rename two files.
 1.1.2.1 06-Oct-1994  mycroft Update from trunk.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.162.1 25-Jun-2018  pgoyette Sync with HEAD
 1.9.156.1 07-Jun-2018  martin Pull up following revision(s) (requested by jdolecek in ticket #841):

sys/dev/isa/isadmareg.h: revision 1.9
sys/dev/isa/isareg.h: revision 1.10
sys/dev/isa/isadma.c: revision 1.67

fix off-by-one in the mapping of the ISA DMA page registers, they actually
start at 0x81; the code used bus_space_map() starting from 0x80 but
used +1 offset for actual I/O, now it maps starting 0x81 and does I/O
without offset

the reads and writes work exactly the same as before, but this frees
0x80 for being mapped independantly
patch provided in PR kern/52468 by Jonathan Chapman; checked against the spec
and also FreeBSD sys/x86/isa/isa_dma.c
 1.10.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.57 20-Oct-2025  thorpej Fix a paste-o that was previously fixed in one source tree (but, critcally,
not the important one).
 1.56 20-Oct-2025  martin Add the includes required for config_found(). Should unbreak the build.
 1.55 19-Oct-2025  thorpej Encapsulate attaching EISA / ISA busses into eisabus_attach() and
isabus_attach(), respectively. Consistently uses the correct interface
attribute.
 1.54 17-Oct-2025  thorpej Garbage-collect the "isa_knowndev" stuff; nothing used it.
 1.53 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.52 28-Apr-2008  martin branches: 1.52.14;
Remove clause 3 and 4 from TNF licenses
 1.51 30-Mar-2008  ad branches: 1.51.2; 1.51.4;
Add isa_get_slotcount/isa_set_slotcount to get/set the number of ISA
compatible expansion slots in a system.
 1.50 15-Mar-2008  cube Split device_t and softc for isa(4).
 1.49 19-Oct-2007  ad branches: 1.49.12; 1.49.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.48 11-Dec-2005  christos branches: 1.48.30; 1.48.44; 1.48.46; 1.48.50;
merge ktrace-lwp.
 1.47 29-May-2005  christos branches: 1.47.2;
sprinkle const.
 1.46 27-Feb-2005  perry nuke trailing whitespace
 1.45 04-Feb-2005  perry de-__P
 1.44 14-Sep-2004  drochner branches: 1.44.4; 1.44.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.43 30-Aug-2004  drochner Phase out the use of a string as first "attach args" member to control
which bustype should be attached with a specific call to config_found()
(from a "mainbus" or a bus bridge).
Do it for isa/eisa/mca and pci/agp for now. These buses all attach to
an mi interface attribute "isabus", "eisabus" etc., and the autoconf
framework now allows to specify an interface attribute on config_found()
and config_search(), which limits the search of matching config data
to these which attach to that specific attribute.
So we basically have to call config_found_ia(..., "foobus", ...) where
such a bus is attached.
As a consequence, where a "mainbus" or alike also attaches other
devices (eg CPUs) which do not attach to a specific attribute yet,
we need at least pass an attribute name (different from "foobus") so
that the foo bus is not found at these places. This made some minor
changes necessary which are not obviously related to the mentioned buses.
 1.42 30-Aug-2004  drochner add centralized {eisa,isa,pci,agp,mca}busprint() functions which do
what tens of the bus' parents foo{...}bridge_print()s scattered around do
 1.41 08-Jul-2003  itojun function prototype must not have variable name
 1.40 09-May-2003  fvdl branches: 1.40.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.39 07-Jan-2002  thorpej branches: 1.39.6;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.38 04-Jun-2000  cgd branches: 1.38.4; 1.38.6;
Implement the more flexiable `evcnt' interface as discussed (briefly) on
tech-kern and now documented in evcnt(9).
 1.37 19-Mar-1999  cgd branches: 1.37.8; 1.37.16;
pull isa_machdep.h in from machine/ instead of from $(MACHINE)/isa/
 1.36 19-Feb-1999  mycroft Kill vestiges of isa_establish().
 1.35 30-Nov-1998  leo Change comment about isa_intr_establish() as discussed on tech-kern.
 1.34 11-Sep-1998  jonathan Add arc as a target platform.
 1.33 09-Jun-1998  thorpej Change the ISA DMA API to take an isa_chipset_tag_t rather than
a struct device * corresponding to the ISA bus device. The ISA DMA
controller driver functions have been renamed and now take a struct
isa_dma_state *, and are called indirectly by machine-dependent code
which provides the DMA state.

These changes allow e.g. `ofisa' (the OpenFirmware configuration
mechanism for the ISA bus, used by e.g. Sharks) to use the MI ISA
DMA controller code.
 1.32 15-Apr-1998  thorpej Remove the `delay port' stuff since nothing uses it anymore (can't reliably
use it on modern chipsets).
 1.31 17-Feb-1998  cgd include an MD header if arm32. (No header yet, but there will be
one eventually.)
 1.30 14-Oct-1997  sakamoto add bebox
 1.29 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.28 17-Jul-1997  jtk branches: 1.28.2;
use locator defines in "locators.h" to index cf_loc[]

still to be done and/or decided not to be done: replace all *UNK uses in
isa code with the native names from locators.h
 1.27 15-Jul-1997  leo Add atari.
 1.26 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.25 05-Dec-1996  cgd branches: 1.25.8;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.24 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.23 08-May-1996  thorpej Correct a couple of comments ... port 0x84 produces a 1.25us delay when
read, not 2.5us. (I must have been confused; thanks Charles, for
correcting me.)
 1.22 05-May-1996  thorpej Map port 0x84 (which is used to generate a 2.6us delay) in isaattach().
Since this port is needed by at least a few drivers, export its i/o handle
via isa_attach_args.
 1.21 11-Apr-1996  cgd include a machine-specific header from ARCH/isa/isa_machdep.h, to define
the isa_chipset_tag_t type, and to define or prototype:
isa_attach_hook()
isa_intr_establish()
isa_intr_disestablish()
i.e. the machine-dependent functions to be used my MI ISA code.
Remove prototypes for the latter two functions from this file.
 1.20 16-Mar-1996  cgd delete unused cruft (the 'software conventions' chunk).
 1.19 08-Mar-1996  cgd pass a bus_chipset_tag_t (defined in <machine/bus.h>) to the bus when
attaching, and to the devices when attaching them. #include <machine/bus.h>
to make this backward compatible with old #include requirements.
Also, clean up idempotency so that isa/eisa/pci "var.h" headers are
consistent (make them all idempotent).
 1.18 28-Feb-1996  cgd make ISA bus match/attach, and sub-device configuration machine-independent.
 1.17 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.16 07-Jun-1995  cgd prototype isascan, spacing
 1.15 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.14 03-Jan-1995  mycroft Update intr_establish() prototype.
 1.13 02-Jan-1995  mycroft Don't assume ia_maddr is in the hole.
 1.12 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.11 27-Oct-1994  cgd new RCS ID format.
 1.10 27-Jul-1994  mycroft Add IRQUNK.
 1.9 07-Apr-1994  mycroft branches: 1.9.2;
Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.8 30-Mar-1994  mycroft Minor changes.
 1.7 29-Mar-1994  mycroft New autoconfig mechanism. Hacked at the moment to use old config(8), but
look mostly like config.new to drivers.
 1.6 21-Jan-1994  cgd delete contents; can't appear in trunk until copyright is fixed.
 1.5 26-Oct-1993  mycroft branches: 1.5.2;
Add MADDRUNK.
 1.4 17-Oct-1993  mycroft Make atdevbase an int.
 1.3 16-Oct-1993  mycroft Add isa_establish(), for all it's worth (which is to say, nothing).
 1.2 06-Oct-1993  mycroft Add DRQUNK and IOBASEUNK.
 1.1 14-Sep-1993  mycroft New i386 code.
 1.5.2.1 11-Feb-1994  cgd new copyright, per Mike Karels
 1.9.2.1 27-Jul-1994  cgd from trunk, per mycroft
 1.25.8.2 28-May-1997  mycroft Don't use the TC bit to check for wraparound in isa_dmacount(); remember the
transfer length and use that.
 1.25.8.1 13-May-1997  thorpej - Provide the bus dma tag to children.
- Add DMA maps and requisite state information for the on-board ISA DMA
controller.
 1.28.2.2 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.37.16.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.37.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.38.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.38.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.38.4.1 11-Jan-2002  nathanw More catchup.
 1.39.6.1 06-Apr-2002  eeh Convert to support attachment through devprops as well.
 1.40.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.40.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.40.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.40.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.40.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.40.2.2 03-Sep-2004  skrll Sync with HEAD
 1.40.2.1 03-Aug-2004  skrll Sync with HEAD
 1.44.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.44.6.1 12-Feb-2005  yamt sync with head.
 1.44.4.1 29-Apr-2005  kent sync with -current
 1.47.2.2 17-Mar-2008  yamt sync with head.
 1.47.2.1 27-Oct-2007  yamt sync with head.
 1.48.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.48.46.2 23-Mar-2008  matt sync with HEAD
 1.48.46.1 06-Nov-2007  matt sync with HEAD
 1.48.44.3 06-Nov-2007  joerg Refactor PNP API:
- Make suspend/resume directly a device functionality. It consists of
three layers (class logic, device logic, bus logic), all of them being
optional. This replaces D0/D3 transitions.
- device_is_active returns true if the device was not disabled and was
not suspended (even partially), device_is_enabled returns true if the
device was enabled.
- Change pnp_global_transition into pnp_system_suspend and
pnp_system_resume. Before running any suspend/resume handlers, check
that all currently attached devices support power management and bail
out otherwise. The latter is not done for the shutdown/panic case.
- Make the former bus-specific generic network handlers a class handler.
- Make PNP message like volume up/down/toogle PNP events. Each device
can register what events they are interested in and whether the handler
should be global or not.
- Introduce device_active API for devices to mark themselve in use from
either the system or the device. Use this to implement the idle handling
for audio and input devices. This is intended to replace most ad-hoc
watchdogs as well.
- Fix somes situations in which audio resume would lose mixer settings.
- Make USB host controllers better deal with suspend in the light of
shared interrupts.
- Flush filesystem cache on suspend.
- Flush disk caches on suspend. Put ATA disks into standby on suspend as
well.
- Adopt drivers to use the new PNP API.
- Fix a critical bug in the generic cardbus layer that made D0->D3
break.
- Fix ral(4) to set if_stop.
- Convert cbb(4) to the new PNP API.
- Apply the PCI Express SCI fix on resume again.
 1.48.44.2 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.48.44.1 05-Oct-2007  joerg Add generic ISA power handler.
 1.48.30.1 23-Oct-2007  ad Sync with head.
 1.49.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.49.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.49.12.1 24-Mar-2008  keiichi sync with head.
 1.51.4.2 16-May-2009  yamt sync with head
 1.51.4.1 16-May-2008  yamt sync with head.
 1.51.2.1 18-May-2008  yamt sync with head.
 1.52.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.38 14-Jul-2016  msaitoh branches: 1.38.16; 1.38.18;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.37 23-Mar-2014  christos branches: 1.37.6;
remove unused
 1.36 27-Oct-2012  chs branches: 1.36.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.35 12-May-2009  cegger branches: 1.35.12; 1.35.22;
struct device * -> device_t, no functional changes intended.
 1.34 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.33 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.32 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.31 28-Apr-2008  martin branches: 1.31.8; 1.31.14;
Remove clause 3 and 4 from TNF licenses
 1.30 08-Apr-2008  cegger branches: 1.30.2; 1.30.4;
use aprint_*_dev and device_xname
 1.29 19-Oct-2007  ad branches: 1.29.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.28 09-Jul-2007  ad branches: 1.28.6; 1.28.8; 1.28.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.27 16-Nov-2006  christos branches: 1.27.8; 1.27.10;
__unused removal on arguments; approved by core.
 1.26 16-Oct-2006  pooka make compile by using __unused & other necessary tricks

and remove <0 comparisons for bus_size_t. if a port wants signed
bus_size_t, it just might have to accept it can't use this driver. *snif*
 1.25 29-Mar-2006  thorpej branches: 1.25.8; 1.25.10;
Use device_cfdata().
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10; 1.24.12;
merge ktrace-lwp.
 1.23 09-Jul-2005  christos make the isdn drivers compile again with -Wconst, -Wshadow
 1.22 27-Feb-2005  perry branches: 1.22.4;
nuke trailing whitespace
 1.21 04-Feb-2005  perry de-__P
 1.20 14-Sep-2004  drochner branches: 1.20.4; 1.20.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.19 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.18 03-Oct-2003  pooka Ready the kernel side of i4b for primary rate interface support by
removing assumptions that there are only two B channels and by
adding support for a varying number of channels.

Due to this, rename previously used isdn identified "bri" to "isdnif",
which better describes the current situation.
 1.17 20-Oct-2002  martin branches: 1.17.6;
Make it compile again (the softc struct is named inconsistently,
so Jasons script did break this, but thats a bigger fish to fry than I'm
willing to handle now.)
 1.16 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.15 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 14-Apr-2002  martin Fix copyright notice.
 1.12 13-Apr-2002  martin Defer initialization of the ISAC chip until we enable interrupts - it gets
into a strange failure mode if we do it with disabled interrupt. When
(re-)enabling interrupts reset transmitter and receiver and clear any
pending state.
 1.11 10-Apr-2002  martin Remove some redundant tries to disable interupts. We already avoided enabling
them.
Fix a stupid typo when enabling/disabling interrupts: we clear pending
interrupts when enabling, not disbling isac interrupts.
 1.10 30-Mar-2002  martin Be a nice citizen, enable interrupts only when we are ready to talk
to the ISDN (i.e. when userland has /dev/isdn open).
 1.9 24-Mar-2002  martin Minor nit in the attach message: don't print empty io or iomem.
 1.8 24-Mar-2002  martin Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.7 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.6 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.5 13-Nov-2001  lukem add RCSID
 1.4 18-Jul-2001  thorpej bzero -> memset
 1.3 24-Mar-2001  martin branches: 1.3.2;
First step to cleanup the hardware driver <-> upper layers interface.
This now provides slightly more functionality than the FreeBSD layer1-newbus
interface. It was meant to be a simple change to one header and a few
c files, but the change rippled all through various stuff.

To prevent a change to the kernel<->userland interface right now the kernel
is now lying about card types to userland (but who cares). This will be fixed
when the userland interface changes, after layer 3 <-> layer 4 has been
fixed.

Functional changes:

Provide a clean interface for hardware drivers to attach to the upper
layers. This will need another small change in the B-channel handling
when a similar change to the layer 3 <-> layer 4 interface happens.

Avoid passing indices into global arrays of pointers around, instead pass
the pointers itself. Don't code hardware driver types by predefined magic
numbers (think LKM). Prepare for detachable drivers (think pcmcia).

While there remove some sets of function pointers always pointing to the
same function (meant to be the configurable set of D channel protocol
handlers). It is unlikely another supported D-channel protocol will fit into
that (maximal layer interface) abstraction. When we get support for another
protocol, we will need to come up with a workable interface. Besides, the
old implementation was, uhm, strange.
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.4.3 27-Mar-2001  bouyer Sync with HEAD.
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa.c was added on branch thorpej_scsipi on 2001-03-12 13:30:38 +0000
 1.2.2.10 11-Nov-2002  nathanw Catch up to -current
 1.2.2.9 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.8 17-Apr-2002  nathanw Catch up to -current.
 1.2.2.7 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.2.2.5 11-Jan-2002  nathanw More catchup.
 1.2.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.2.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.3.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1 03-Aug-2001  lukem update to -current
 1.17.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.17.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.17.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.20.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.6.1 12-Feb-2005  yamt sync with head.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.22.4.4 27-Oct-2007  yamt sync with head.
 1.22.4.3 03-Sep-2007  yamt sync with head.
 1.22.4.2 30-Dec-2006  yamt sync with head.
 1.22.4.1 21-Jun-2006  yamt sync with head.
 1.24.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.24.10.1 19-Apr-2006  elad sync with head.
 1.24.8.1 01-Apr-2006  yamt sync with head.
 1.24.6.1 22-Apr-2006  simonb Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.25.10.2 10-Dec-2006  yamt sync with head.
 1.25.10.1 22-Oct-2006  yamt sync with head
 1.25.8.1 18-Nov-2006  ad Sync with head.
 1.27.10.1 11-Jul-2007  mjf Sync with head.
 1.27.8.2 23-Oct-2007  ad Sync with head.
 1.27.8.1 01-Jul-2007  ad Adapt to callout API change.
 1.28.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.28.8.1 06-Nov-2007  matt sync with HEAD
 1.28.6.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.29.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.30.4.3 16-May-2009  yamt sync with head
 1.30.4.2 04-May-2009  yamt sync with head.
 1.30.4.1 16-May-2008  yamt sync with head.
 1.30.2.1 18-May-2008  yamt sync with head.
 1.31.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.31.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.35.22.3 03-Dec-2017  jdolecek update from HEAD
 1.35.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.35.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.35.12.1 30-Oct-2012  yamt sync with head
 1.36.2.1 18-May-2014  rmind sync with head
 1.37.6.1 05-Oct-2016  skrll Sync with HEAD
 1.38.18.1 10-Jun-2019  christos Sync with HEAD
 1.38.16.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.11 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.10 19-Oct-2007  ad branches: 1.10.106; 1.10.108;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 04-Mar-2007  christos branches: 1.9.2; 1.9.14; 1.9.16; 1.9.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 11-Dec-2005  christos branches: 1.8.26;
merge ktrace-lwp.
 1.7 09-Jul-2005  christos make the isdn drivers compile again with -Wconst, -Wshadow
 1.6 27-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 04-Feb-2005  perry de-__P
 1.4 24-Mar-2002  martin branches: 1.4.10; 1.4.18; 1.4.20;
Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4; 1.2.6;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa_avm_a1.c was added on branch thorpej_scsipi on 2001-03-12 13:30:38 +0000
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.20.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.20.1 12-Feb-2005  yamt sync with head.
 1.4.18.1 29-Apr-2005  kent sync with -current
 1.4.10.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.10.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.10.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.4.3 27-Oct-2007  yamt sync with head.
 1.6.4.2 03-Sep-2007  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.8.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.16.1 06-Nov-2007  matt sync with HEAD
 1.9.14.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.9.2.1 23-Oct-2007  ad Sync with head.
 1.10.108.1 10-Jun-2019  christos Sync with HEAD
 1.10.106.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.19 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.18 27-Oct-2012  chs branches: 1.18.36; 1.18.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.17 28-Apr-2008  martin branches: 1.17.34; 1.17.44;
Remove clause 3 and 4 from TNF licenses
 1.16 08-Apr-2008  cegger branches: 1.16.2; 1.16.4;
use aprint_*_dev and device_xname
 1.15 19-Oct-2007  ad branches: 1.15.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 04-Mar-2007  christos branches: 1.14.2; 1.14.14; 1.14.16; 1.14.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 24-Nov-2006  wiz branches: 1.13.4;
Correct spelling of "immediate(ly)". From Zafer.
 1.12 11-Dec-2005  christos branches: 1.12.20; 1.12.22;
merge ktrace-lwp.
 1.11 09-Jul-2005  christos make the isdn drivers compile again with -Wconst, -Wshadow
 1.10 27-Feb-2005  perry branches: 1.10.4;
nuke trailing whitespace
 1.9 04-Dec-2003  keihan branches: 1.9.8; 1.9.10;
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.8 14-Apr-2002  martin branches: 1.8.10;
Fix copyright notice.
 1.7 24-Mar-2002  martin Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.6 13-Nov-2001  lukem add RCSID
 1.5 30-Sep-2001  martin Fix a very stupid pasto - the card has two B channels, so better not
query the HSCX chip version of the third one.
 1.4 19-Jun-2001  wiz branches: 1.4.2; 1.4.4;
`existent', not `existant'
 1.3 13-Jun-2001  wiz withough -> without
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa_itk_ix1.c was added on branch thorpej_scsipi on 2001-03-12 13:30:38 +0000
 1.2.2.5 17-Apr-2002  nathanw Catch up to -current.
 1.2.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.2.2 08-Oct-2001  nathanw Catch up to -current.
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.10.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.10.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.10.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.4.4 27-Oct-2007  yamt sync with head.
 1.10.4.3 03-Sep-2007  yamt sync with head.
 1.10.4.2 30-Dec-2006  yamt sync with head.
 1.10.4.1 21-Jun-2006  yamt sync with head.
 1.12.22.1 10-Dec-2006  yamt sync with head.
 1.12.20.1 12-Jan-2007  ad Sync with head.
 1.13.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.16.1 06-Nov-2007  matt sync with HEAD
 1.14.14.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.14.2.1 23-Oct-2007  ad Sync with head.
 1.15.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.4.1 16-May-2008  yamt sync with head.
 1.16.2.1 18-May-2008  yamt sync with head.
 1.17.44.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.17.34.1 30-Oct-2012  yamt sync with head
 1.18.38.1 10-Jun-2019  christos Sync with HEAD
 1.18.36.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.10 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.9 19-Oct-2007  ad branches: 1.9.106; 1.9.108;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 04-Mar-2007  christos branches: 1.8.2; 1.8.14; 1.8.16; 1.8.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 11-Dec-2005  christos branches: 1.7.26;
merge ktrace-lwp.
 1.6 27-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 04-Feb-2005  perry de-__P
 1.4 24-Mar-2002  martin branches: 1.4.10; 1.4.18; 1.4.20;
Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4; 1.2.6;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa_tel_s016.c was added on branch thorpej_scsipi on 2001-03-12 13:30:38 +0000
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.20.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.20.1 12-Feb-2005  yamt sync with head.
 1.4.18.1 29-Apr-2005  kent sync with -current
 1.4.10.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.10.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.4.2 27-Oct-2007  yamt sync with head.
 1.6.4.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.16.1 06-Nov-2007  matt sync with HEAD
 1.8.14.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.8.2.1 23-Oct-2007  ad Sync with head.
 1.9.108.1 10-Jun-2019  christos Sync with HEAD
 1.9.106.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.14 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.13 27-Oct-2012  chs branches: 1.13.36; 1.13.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.12 12-May-2009  cegger branches: 1.12.12; 1.12.22;
struct device * -> device_t, no functional changes intended.
 1.11 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.10 19-Oct-2007  ad branches: 1.10.20; 1.10.34;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9 04-Mar-2007  christos branches: 1.9.2; 1.9.14; 1.9.16; 1.9.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 11-Dec-2005  christos branches: 1.8.26;
merge ktrace-lwp.
 1.7 09-Jul-2005  christos make the isdn drivers compile again with -Wconst, -Wshadow
 1.6 27-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 04-Feb-2005  perry de-__P
 1.4 24-Mar-2002  martin branches: 1.4.10; 1.4.18; 1.4.20;
Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4; 1.2.6;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa_tel_s0163.c was added on branch thorpej_scsipi on 2001-03-12 13:30:38 +0000
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.20.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.20.1 12-Feb-2005  yamt sync with head.
 1.4.18.1 29-Apr-2005  kent sync with -current
 1.4.10.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.10.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.10.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.4.3 27-Oct-2007  yamt sync with head.
 1.6.4.2 03-Sep-2007  yamt sync with head.
 1.6.4.1 21-Jun-2006  yamt sync with head.
 1.8.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.9.16.1 06-Nov-2007  matt sync with HEAD
 1.9.14.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.9.2.1 23-Oct-2007  ad Sync with head.
 1.10.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.10.20.1 16-May-2009  yamt sync with head
 1.12.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.12.12.1 30-Oct-2012  yamt sync with head
 1.13.38.1 10-Jun-2019  christos Sync with HEAD
 1.13.36.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.10 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.9 19-Oct-2007  ad branches: 1.9.106; 1.9.108;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.8 04-Mar-2007  christos branches: 1.8.2; 1.8.14; 1.8.16; 1.8.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 11-Dec-2005  christos branches: 1.7.26;
merge ktrace-lwp.
 1.6 27-Feb-2005  perry branches: 1.6.4;
nuke trailing whitespace
 1.5 04-Feb-2005  perry de-__P
 1.4 24-Mar-2002  martin branches: 1.4.10; 1.4.18; 1.4.20;
Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4; 1.2.6;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa_tel_s08.c was added on branch thorpej_scsipi on 2001-03-12 13:30:38 +0000
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.20.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.20.1 12-Feb-2005  yamt sync with head.
 1.4.18.1 29-Apr-2005  kent sync with -current
 1.4.10.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.4.10.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.4.2 27-Oct-2007  yamt sync with head.
 1.6.4.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.8.16.1 06-Nov-2007  matt sync with HEAD
 1.8.14.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.8.2.1 23-Oct-2007  ad Sync with head.
 1.9.108.1 10-Jun-2019  christos Sync with HEAD
 1.9.106.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.9 22-Sep-2018  maxv Remove isic(4). It is part of ISDN, which we are now retiring.
 1.8 19-Oct-2007  ad branches: 1.8.106; 1.8.108;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.7 04-Mar-2007  christos branches: 1.7.2; 1.7.14; 1.7.16; 1.7.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 27-Feb-2005  perry branches: 1.5.4;
nuke trailing whitespace
 1.4 24-Mar-2002  martin branches: 1.4.10; 1.4.18; 1.4.20;
Now that we have all the pieces of the puzzle available start to unriddle
and move them in their proper places.

Move the BRI registry from layer 2 (duh!) to layer 4, so active cards
(which don't have layer 3 or layer 2 in their driver). Remove all remaining
hard coded controller and driver types. Remove any arbitrary hard coded
limits, at least those that show up in the internal API.

This fixes PR 15950.
 1.3 13-Nov-2001  lukem add RCSID
 1.2 20-Feb-2001  martin branches: 1.2.2; 1.2.4; 1.2.6;
Filename cleanup: remove i4b_ prefixes outside sys/netisdn, last round.

Renamed in sys/dev/ic:
i4b_hscx.c -> hscx.c
i4b_hscx.h -> hscx.h
i4b_ipac.h -> ipac.h
i4b_isac.c -> isac.c
i4b_isac.h -> isac.h
i4b_isic.c -> isic.c
i4b_isicbchan.c -> isic_bchan.c
i4b_isicl1.c -> isic_l1.c
i4b_isicl1.h -> isic_l1.h
i4b_isicl1fsm.c -> isic_l1fsm.c
 1.1 18-Feb-2001  martin Filename cleanup police (per discussion with Soren S. Jorvang):
remove all (legacy) "i4b_" prefixes outside of sys/netisdn.
Prefix all card specific driver support files with the basename
of the driver bus attachement file.

Renamed here:
i4b_isic_isa.c -> isic_isa.c
i4b_avm_a1.c -> isic_isa_avm_a1.c
i4b_daic_isa.c -> daic_isa.c
i4b_itk_ix1.c -> isic_isa_itk_ix1.c
i4b_tel_s08.c -> isic_isa_tel_s08.c
i4b_tel_s016.c -> isic_isa_tel_s016.c
i4b_tel_s0163.c -> isic_isa_tel_s0163.c
i4b_usr_sti.c -> isic_isa_usr_sti.c
 1.2.6.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.2 12-Mar-2001  bouyer Sync with HEAD.
 1.2.4.1 20-Feb-2001  bouyer file isic_isa_usr_sti.c was added on branch thorpej_scsipi on 2001-03-12 13:30:39 +0000
 1.2.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.4.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.4.18.1 29-Apr-2005  kent sync with -current
 1.4.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.4.2 27-Oct-2007  yamt sync with head.
 1.5.4.1 03-Sep-2007  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.7.16.1 06-Nov-2007  matt sync with HEAD
 1.7.14.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.7.2.1 23-Oct-2007  ad Sync with head.
 1.8.108.1 10-Jun-2019  christos Sync with HEAD
 1.8.106.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.7 25-Jul-2014  dholland branches: 1.7.8; 1.7.18;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.6 23-Mar-2014  christos branches: 1.6.2;
remove unused
 1.5 16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.4 06-Nov-2010  uebayasi branches: 1.4.8; 1.4.18; 1.4.22;
Include uvm/uvm_external.h to access UVM external API (uvm_km_*(9)).
 1.3 27-Feb-2009  dyoung branches: 1.3.2; 1.3.4;
Use the right format specifiers to print the new struct timeval.
 1.2 28-Apr-2008  martin branches: 1.2.8; 1.2.14;
Remove clause 3 and 4 from TNF licenses
 1.1 02-Apr-2008  dyoung branches: 1.1.2; 1.1.4; 1.1.6;
Certain misguided people have complained, NetBSD only runs rare or
"retro" computers, but NetBSD also runs a growing number of rare
and retro add-on cards. With this patch, NetBSD supports the IDEC
Supervision/16, a black&white image capture board for the 16-bit
ISA bus. Approximate date of manufacture: 1991. Total instances
known to be in use throughout the world: one.

Coming soon; isvctl(8), the utility program for capturing 8-bit,
512x480 images at speeds of up to 6 frames per second.
 1.1.6.2 04-May-2009  yamt sync with head.
 1.1.6.1 16-May-2008  yamt sync with head.
 1.1.4.1 18-May-2008  yamt sync with head.
 1.1.2.3 02-Jun-2008  mjf Sync with HEAD.
 1.1.2.2 03-Apr-2008  mjf Sync with HEAD.
 1.1.2.1 02-Apr-2008  mjf file isv.c was added on branch mjf-devfs2 on 2008-04-03 12:42:44 +0000
 1.2.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.8.1 03-Mar-2009  skrll Sync with HEAD.
 1.3.4.1 05-Mar-2011  rmind sync with head
 1.3.2.1 23-Oct-2010  uebayasi Include uvm_extern.h, not uvm.h.
 1.4.22.1 18-May-2014  rmind sync with head
 1.4.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.8.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.6.2.1 10-Aug-2014  tls Rebase.
 1.7.18.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.7.8.2 25-Jul-2016  pgoyette Redo previous
 1.7.8.1 25-Jul-2016  pgoyette Update a few drivers for localcount(9)
 1.1 02-Apr-2008  dyoung branches: 1.1.2;
Certain misguided people have complained, NetBSD only runs rare or
"retro" computers, but NetBSD also runs a growing number of rare
and retro add-on cards. With this patch, NetBSD supports the IDEC
Supervision/16, a black&white image capture board for the 16-bit
ISA bus. Approximate date of manufacture: 1991. Total instances
known to be in use throughout the world: one.

Coming soon; isvctl(8), the utility program for capturing 8-bit,
512x480 images at speeds of up to 6 frames per second.
 1.1.2.2 03-Apr-2008  mjf Sync with HEAD.
 1.1.2.1 02-Apr-2008  mjf file isvio.h was added on branch mjf-devfs2 on 2008-04-03 12:42:44 +0000
 1.16 15-Nov-2007  xtraeme Rename it(4) to itesio(4) to accomodate for the following changes:

- The driver now uses the Super I/O address port as port argument in
the configuration file. The Environmental Controller base address is
fetched by the Super I/O EC LDN configuration registers.

- Invalidate voltage sensors if data returned is 0xff.

- Use the Super I/O Global Configuration Registers Chip ID[12] and Device
Revision to store/print the correct information.

- Use only the Fan Extended Tachometer registers on IT871[68]F for now;
this gives us correct data for IT8705/IT8712F again.

Inspired by the smsc(4) driver. The UPDATING file has been updated to
reflect the rename.
 1.15 19-Oct-2007  ad branches: 1.15.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 09-Sep-2007  xtraeme branches: 1.14.4;
Add the detach method, will be used by the LKM.
 1.13 20-Jul-2007  xtraeme branches: 1.13.4; 1.13.6; 1.13.8;
Fix typo that wasn't allowing to change the rfact.
 1.12 07-Jul-2007  xtraeme branches: 1.12.2;
Set the ENVSYS_FCHANGERFACT flag in it_setup_sensors rather than
in the refresh function.
 1.11 05-Jul-2007  xtraeme Some changes:

- Add support for the IT8716F chip, patch from FUKUMOTO Atsushi via
PR port-i386/35796.
- Enable the flag ENVSYS_FCHANGERFACT in voltage sensors, to be able to
increment the value returned by the driver via envstat(8).
- Update VBAT sensor reading every time we read it, otherwise it will
always report the power on value.
- Enable all sensors that were missing before: 3 Temp + 3 Fan + 9 Voltage.
- Add new registers to set high/low limits in temperature/voltage sensors
(still unused).
- Disable some sensors if they are reporting bogus data or simply they are
not connected.

Tested by wiz.
 1.10 01-Jul-2007  xtraeme In the gtredata function, use the edata pointer rather than using
directly the edata array index in the softc.
 1.9 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.8 07-May-2007  xtraeme Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.
 1.7 07-Jan-2007  xtraeme branches: 1.7.2; 1.7.6; 1.7.8;
* Remove unused sensors, anyway we are showing just the sensors of what
the BIOS is reporting (and speedfan for windows).
* Simplify the code.
* Remove unused functions and unnecessary variables.
* Provide more rfact values for the voltage sensors (from OpenBSD).
* Remove the limit of 1.5 seconds for refreshing the sensors, it's
unnecessary... we can read it every time we want.

Now I'm happy with the driver (code and envstat output):

[juan@nocturno][~]> envstat -r
CPU Temp: 38.000 degC
System Temp: 36.000 degC
VCORE_A: 1.664 V
+3.3V: 3.312 V
+5V: 4.919 V
+12V: 12.480 V
VBAT: 3.248 V
CPU Fan: 3096 RPM
System Fan: 0 RPM
[juan@nocturno][~]>
 1.6 16-Nov-2006  christos branches: 1.6.2;
__unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 11-Jun-2006  xtraeme branches: 1.4.4; 1.4.8; 1.4.10; 1.4.12;
* Improve description for all sensors.
* Fix some voltage values.
* Do not print rfact+data values for sensors without any returned data.
 1.3 08-Jun-2006  xtraeme Adapt to timecounters.
 1.2 05-Jun-2006  xtraeme it_check(): check values from IT_RES48 and IT_RES52, if both are default
values specified by the chip, continue attaching the driver (previously
only checking IT_RES48 was enough and IT_RES52 was ignored).
 1.1 13-May-2006  xtraeme branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Driver for iTE IT87xxF and compatibles hardware monitor. Add
commented out entries on GENERIC and GENERIC_LAPTOP.

Adapted from OpenBSD.
 1.1.8.3 07-Jun-2006  kardel Sync with head.
 1.1.8.2 01-Jun-2006  kardel Sync with head.
 1.1.8.1 13-May-2006  kardel file it.c was added on branch simonb-timecounters on 2006-06-01 22:36:42 +0000
 1.1.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.6.1 13-May-2006  tron file it.c was added on branch peter-altq on 2006-05-24 15:50:26 +0000
 1.1.4.3 26-Jun-2006  yamt sync with head.
 1.1.4.2 24-May-2006  yamt sync with head.
 1.1.4.1 13-May-2006  yamt file it.c was added on branch yamt-pdpolicy on 2006-05-24 10:57:52 +0000
 1.1.2.1 19-Jun-2006  chap Sync with head.
 1.4.12.2 10-Dec-2006  yamt sync with head.
 1.4.12.1 22-Oct-2006  yamt sync with head
 1.4.10.2 09-Sep-2006  rpaulo sync with head
 1.4.10.1 11-Jun-2006  rpaulo file it.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:51:26 +0000
 1.4.8.2 12-Jan-2007  ad Sync with head.
 1.4.8.1 18-Nov-2006  ad Sync with head.
 1.4.4.7 07-Dec-2007  yamt sync with head
 1.4.4.6 27-Oct-2007  yamt sync with head.
 1.4.4.5 03-Sep-2007  yamt sync with head.
 1.4.4.4 26-Feb-2007  yamt sync with head.
 1.4.4.3 30-Dec-2006  yamt sync with head.
 1.4.4.2 21-Jun-2006  yamt sync with head.
 1.4.4.1 11-Jun-2006  yamt file it.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.6.2.2 12-May-2007  snj Pull up following revision(s) (requested by xtraeme in ticket #622):
sys/dev/isa/it.c: revision 1.8
Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.
 1.6.2.1 09-Jan-2007  tron Pull up following revision(s) (requested by xtraeme in ticket #340):
sys/dev/isa/itvar.h: revision 1.3
sys/dev/isa/it.c: revision 1.7
* Remove unused sensors, anyway we are showing just the sensors of what
the BIOS is reporting (and speedfan for windows).
* Simplify the code.
* Remove unused functions and unnecessary variables.
* Provide more rfact values for the voltage sensors (from OpenBSD).
* Remove the limit of 1.5 seconds for refreshing the sensors, it's
unnecessary... we can read it every time we want.
Now I'm happy with the driver (code and envstat output):
[juan@nocturno][~]> envstat -r
CPU Temp: 38.000 degC
System Temp: 36.000 degC
VCORE_A: 1.664 V
+3.3V: 3.312 V
+5V: 4.919 V
+12V: 12.480 V
VBAT: 3.248 V
CPU Fan: 3096 RPM
System Fan: 0 RPM
[juan@nocturno][~]>
 1.7.8.1 11-Jul-2007  mjf Sync with head.
 1.7.6.5 23-Oct-2007  ad Sync with head.
 1.7.6.4 09-Oct-2007  ad Sync with head.
 1.7.6.3 20-Aug-2007  ad Sync with HEAD.
 1.7.6.2 15-Jul-2007  ad Sync with head.
 1.7.6.1 27-May-2007  ad Sync with head.
 1.7.2.1 17-May-2007  yamt sync with head.
 1.12.2.2 10-Sep-2007  skrll Sync with HEAD.
 1.12.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.13.8.2 20-Jul-2007  xtraeme Fix typo that wasn't allowing to change the rfact.
 1.13.8.1 20-Jul-2007  xtraeme file it.c was added on branch matt-mips64 on 2007-07-20 07:23:48 +0000
 1.13.6.2 23-Mar-2008  matt sync with HEAD
 1.13.6.1 06-Nov-2007  matt sync with HEAD
 1.13.4.3 21-Nov-2007  joerg Sync with HEAD.
 1.13.4.2 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.13.4.1 02-Oct-2007  joerg Sync with HEAD.
 1.14.4.2 18-Nov-2007  bouyer Sync with HEAD
 1.14.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.30 29-Jun-2022  mlelstv unregister sensors only when registered.
 1.29 03-Jul-2021  nonaka itesio(4): Added IT8625E support.
 1.28 23-Jul-2019  msaitoh branches: 1.28.14;
Add IT8655 support.
 1.27 12-Sep-2017  msaitoh branches: 1.27.4;
Add IT8728F and IT877[12]E.
 1.26 14-Aug-2017  hauke Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board.

XXX These IT suoer IO chips appear to be all fairly alike. Maybe add a
comprehensive list of IDs to recognize them, then deal with the
fallout?
 1.25 23-Apr-2015  pgoyette branches: 1.25.10;
Update module dependencies for all the existing modules that depend on sysmon components.
 1.24 15-Nov-2012  msaitoh branches: 1.24.14;
Add support for ITE8720F by Nat Sloss. PR#47169.
 1.23 29-Jul-2011  jmcneill branches: 1.23.2; 1.23.8; 1.23.12;
add module support
 1.22 20-Jun-2011  pgoyette Initialize sensors states before registering.
 1.21 13-Aug-2010  jakllsch branches: 1.21.6;
Implement user-settable rfact in itesio.
Additionally, match on IT8721.
 1.20 17-Jul-2010  pgoyette Put the original NULL pmf handler establishment back where it started, so
as not to call it in some error paths.

Instead, if there is a watchdog present, deregister the NULL handler before
establishing the one for the watchdog.
 1.19 17-Jul-2010  pgoyette If this itesio(4) has a watchdog, then set up a real suspend handler to
make sure we don't suspend when the wdog time is active.
 1.18 02-May-2010  jakllsch This only needs one bus_space_tag_t.
While here, rename one of the bus_space_handle_ts
to be be descriptive of its function.

Fixes crash caused by uninitialized bus_space_tag_t
discovered by Paul Goyette.
 1.17 26-Apr-2008  xtraeme branches: 1.17.2; 1.17.22; 1.17.24;
Also attach in the IT8726F Super I/O.
 1.16 26-Apr-2008  xtraeme Fixup the negative VINs, they were inverted and conversion was wrong.
 1.15 04-Apr-2008  xtraeme branches: 1.15.2;
Don't forget to unmap the I/O space in the error paths.
 1.14 05-Mar-2008  xtraeme struct cfdata * -> cfdata_t (for consistency).
 1.13 04-Mar-2008  xtraeme Change my email address to the netbsd one.
 1.12 31-Dec-2007  wiz branches: 1.12.2; 1.12.4; 1.12.8;
Proxy-commit for xtraeme:
Use sysmon_wdog_unregister(), not sysmon_wdog_register(), in
itesio_detach().
 1.11 29-Dec-2007  xtraeme Erm, update another comment that was outdated with latest changes.
 1.10 29-Dec-2007  xtraeme Update a comment that I wanted to correct for long time now...
 1.9 29-Dec-2007  xtraeme Added support for the Watchdog Timer built in the IT871[268] Super I/Os.

The WDT supports any value between 1 and 65535 seconds (or minutes, but
but the driver only uses seconds).
 1.8 13-Dec-2007  xtraeme Check return value of pmf_device_register(), pointed out by joerg.

Looks like the pmf(9) manpage declared it as void and not bool...
 1.7 09-Dec-2007  xtraeme branches: 1.7.2;
Register to pmf(9).
 1.6 01-Dec-2007  jmcneill branches: 1.6.2; 1.6.4; 1.6.6;
aprintify, on behalf of xtraeme
 1.5 22-Nov-2007  xtraeme Print the error if sysmon_envsys_register() fails and add a missing
return in that case.
 1.4 16-Nov-2007  xtraeme branches: 1.4.2; 1.4.4; 1.4.6;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.3 15-Nov-2007  xtraeme Remove a debug printf.
 1.2 15-Nov-2007  xtraeme - Remove an extra RCS ID line.
- Update the ifdef on itesio_isavar.h to reflect the rename.
 1.1 15-Nov-2007  xtraeme Rename it(4) to itesio(4) to accomodate for the following changes:

- The driver now uses the Super I/O address port as port argument in
the configuration file. The Environmental Controller base address is
fetched by the Super I/O EC LDN configuration registers.

- Invalidate voltage sensors if data returned is 0xff.

- Use the Super I/O Global Configuration Registers Chip ID[12] and Device
Revision to store/print the correct information.

- Use only the Fan Extended Tachometer registers on IT871[68]F for now;
this gives us correct data for IT8705/IT8712F again.

Inspired by the smsc(4) driver. The UPDATING file has been updated to
reflect the rename.
 1.4.6.4 03-Dec-2007  joerg Sync with HEAD.
 1.4.6.3 27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.4.6.2 21-Nov-2007  joerg Sync with HEAD.
 1.4.6.1 16-Nov-2007  joerg file itesio_isa.c was added on branch jmcneill-pm on 2007-11-21 21:55:16 +0000
 1.4.4.5 18-Feb-2008  mjf Sync with HEAD.
 1.4.4.4 27-Dec-2007  mjf Sync with HEAD.
 1.4.4.3 08-Dec-2007  mjf Sync with HEAD.
 1.4.4.2 19-Nov-2007  mjf Sync with HEAD.
 1.4.4.1 16-Nov-2007  mjf file itesio_isa.c was added on branch mjf-devfs on 2007-11-19 00:48:02 +0000
 1.4.2.3 22-Nov-2007  bouyer Sync with HEAD
 1.4.2.2 18-Nov-2007  bouyer Sync with HEAD
 1.4.2.1 16-Nov-2007  bouyer file itesio_isa.c was added on branch bouyer-xenamd64 on 2007-11-18 19:35:30 +0000
 1.6.6.1 11-Dec-2007  yamt sync with head.
 1.6.4.4 17-Mar-2008  yamt sync with head.
 1.6.4.3 21-Jan-2008  yamt sync with head
 1.6.4.2 07-Dec-2007  yamt sync with head
 1.6.4.1 01-Dec-2007  yamt file itesio_isa.c was added on branch yamt-lazymbuf on 2007-12-07 17:30:17 +0000
 1.6.2.1 26-Dec-2007  ad Sync with head.
 1.7.2.2 02-Jan-2008  bouyer Sync with HEAD
 1.7.2.1 13-Dec-2007  bouyer Sync with HEAD
 1.12.8.2 02-Jun-2008  mjf Sync with HEAD.
 1.12.8.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.4.1 24-Mar-2008  keiichi sync with head.
 1.12.2.3 23-Mar-2008  matt sync with HEAD
 1.12.2.2 09-Jan-2008  matt sync with HEAD
 1.12.2.1 31-Dec-2007  matt file itesio_isa.c was added on branch matt-armv6 on 2008-01-09 01:53:13 +0000
 1.15.2.1 18-May-2008  yamt sync with head.
 1.17.24.2 05-Mar-2011  rmind sync with head
 1.17.24.1 30-May-2010  rmind sync with head
 1.17.22.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.17.2.2 09-Oct-2010  yamt sync with head
 1.17.2.1 11-Aug-2010  yamt sync with head.
 1.21.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.23.12.2 03-Dec-2017  jdolecek update from HEAD
 1.23.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.23.8.1 23-Nov-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #699):
sys/dev/isa/itesio_isavar.h: revision 1.9
sys/dev/isa/itesio_isa.c: revision 1.24
Add support for ITE8720F by Nat Sloss. PR#47169.
 1.23.2.1 16-Jan-2013  yamt sync with (a bit old) head
 1.24.14.2 28-Aug-2017  skrll Sync with HEAD
 1.24.14.1 06-Jun-2015  skrll Sync with HEAD
 1.25.10.2 01-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1348):

sys/dev/isa/itesio_isavar.h: revision 1.12
sys/dev/isa/itesio_isa.c: revision 1.28

Add IT8655 support.
 1.25.10.1 23-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #373):
sys/dev/isa/itesio_isavar.h: revision 1.10
sys/dev/isa/itesio_isavar.h: revision 1.11
sys/dev/isa/itesio_isa.c: revision 1.26
sys/dev/isa/itesio_isa.c: revision 1.27
Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board.
XXX These IT suoer IO chips appear to be all fairly alike. Maybe add a
comprehensive list of IDs to recognize them, then deal with the
fallout?
Add IT8728F and IT877[12]E.
 1.27.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.28.14.1 01-Aug-2021  thorpej Sync with HEAD.
 1.14 03-Jul-2021  nonaka itesio(4): Added IT8625E support.
 1.13 05-Jun-2021  nonaka Add IT8625 chip id.
 1.12 23-Jul-2019  msaitoh branches: 1.12.14; 1.12.18;
Add IT8655 support.
 1.11 12-Sep-2017  msaitoh branches: 1.11.4;
Add IT8728F and IT877[12]E.
 1.10 14-Aug-2017  hauke Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board.

XXX These IT suoer IO chips appear to be all fairly alike. Maybe add a
comprehensive list of IDs to recognize them, then deal with the
fallout?
 1.9 15-Nov-2012  msaitoh branches: 1.9.14; 1.9.30;
Add support for ITE8720F by Nat Sloss. PR#47169.
 1.8 13-Aug-2010  jakllsch branches: 1.8.8; 1.8.14; 1.8.18;
Implement user-settable rfact in itesio.
Additionally, match on IT8721.
 1.7 02-May-2010  jakllsch This only needs one bus_space_tag_t.
While here, rename one of the bus_space_handle_ts
to be be descriptive of its function.

Fixes crash caused by uninitialized bus_space_tag_t
discovered by Paul Goyette.
 1.6 26-Apr-2008  xtraeme branches: 1.6.2; 1.6.22; 1.6.24;
Also attach in the IT8726F Super I/O.
 1.5 04-Mar-2008  xtraeme branches: 1.5.2;
Change my email address to the netbsd one.
 1.4 29-Dec-2007  xtraeme branches: 1.4.2; 1.4.4; 1.4.8;
Added support for the Watchdog Timer built in the IT871[268] Super I/Os.

The WDT supports any value between 1 and 65535 seconds (or minutes, but
but the driver only uses seconds).
 1.3 16-Nov-2007  xtraeme branches: 1.3.2; 1.3.4; 1.3.6; 1.3.10; 1.3.14;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.2 15-Nov-2007  xtraeme - Remove an extra RCS ID line.
- Update the ifdef on itesio_isavar.h to reflect the rename.
 1.1 15-Nov-2007  xtraeme Rename it(4) to itesio(4) to accomodate for the following changes:

- The driver now uses the Super I/O address port as port argument in
the configuration file. The Environmental Controller base address is
fetched by the Super I/O EC LDN configuration registers.

- Invalidate voltage sensors if data returned is 0xff.

- Use the Super I/O Global Configuration Registers Chip ID[12] and Device
Revision to store/print the correct information.

- Use only the Fan Extended Tachometer registers on IT871[68]F for now;
this gives us correct data for IT8705/IT8712F again.

Inspired by the smsc(4) driver. The UPDATING file has been updated to
reflect the rename.
 1.3.14.1 02-Jan-2008  bouyer Sync with HEAD
 1.3.10.4 17-Mar-2008  yamt sync with head.
 1.3.10.3 21-Jan-2008  yamt sync with head
 1.3.10.2 07-Dec-2007  yamt sync with head
 1.3.10.1 16-Nov-2007  yamt file itesio_isavar.h was added on branch yamt-lazymbuf on 2007-12-07 17:30:18 +0000
 1.3.6.2 21-Nov-2007  joerg Sync with HEAD.
 1.3.6.1 16-Nov-2007  joerg file itesio_isavar.h was added on branch jmcneill-pm on 2007-11-21 21:55:23 +0000
 1.3.4.3 18-Feb-2008  mjf Sync with HEAD.
 1.3.4.2 19-Nov-2007  mjf Sync with HEAD.
 1.3.4.1 16-Nov-2007  mjf file itesio_isavar.h was added on branch mjf-devfs on 2007-11-19 00:48:02 +0000
 1.3.2.2 18-Nov-2007  bouyer Sync with HEAD
 1.3.2.1 16-Nov-2007  bouyer file itesio_isavar.h was added on branch bouyer-xenamd64 on 2007-11-18 19:35:31 +0000
 1.4.8.2 02-Jun-2008  mjf Sync with HEAD.
 1.4.8.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.4.1 24-Mar-2008  keiichi sync with head.
 1.4.2.3 23-Mar-2008  matt sync with HEAD
 1.4.2.2 09-Jan-2008  matt sync with HEAD
 1.4.2.1 29-Dec-2007  matt file itesio_isavar.h was added on branch matt-armv6 on 2008-01-09 01:53:13 +0000
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.24.2 05-Mar-2011  rmind sync with head
 1.6.24.1 30-May-2010  rmind sync with head
 1.6.22.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.6.2.2 09-Oct-2010  yamt sync with head
 1.6.2.1 11-Aug-2010  yamt sync with head.
 1.8.18.2 03-Dec-2017  jdolecek update from HEAD
 1.8.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.14.1 23-Nov-2012  riz Pull up following revision(s) (requested by msaitoh in ticket #699):
sys/dev/isa/itesio_isavar.h: revision 1.9
sys/dev/isa/itesio_isa.c: revision 1.24
Add support for ITE8720F by Nat Sloss. PR#47169.
 1.8.8.1 16-Jan-2013  yamt sync with (a bit old) head
 1.9.30.2 01-Sep-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1348):

sys/dev/isa/itesio_isavar.h: revision 1.12
sys/dev/isa/itesio_isa.c: revision 1.28

Add IT8655 support.
 1.9.30.1 23-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #373):
sys/dev/isa/itesio_isavar.h: revision 1.10
sys/dev/isa/itesio_isavar.h: revision 1.11
sys/dev/isa/itesio_isa.c: revision 1.26
sys/dev/isa/itesio_isa.c: revision 1.27
Enable the IT8628E shipped with my gigabyte GA-N3150N-D3V board.
XXX These IT suoer IO chips appear to be all fairly alike. Maybe add a
comprehensive list of IDs to recognize them, then deal with the
fallout?
Add IT8728F and IT877[12]E.
 1.9.14.1 28-Aug-2017  skrll Sync with HEAD
 1.11.4.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.12.18.1 06-Jun-2021  cjep sync with head
 1.12.14.2 01-Aug-2021  thorpej Sync with HEAD.
 1.12.14.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.6 15-Nov-2007  xtraeme Rename it(4) to itesio(4) to accomodate for the following changes:

- The driver now uses the Super I/O address port as port argument in
the configuration file. The Environmental Controller base address is
fetched by the Super I/O EC LDN configuration registers.

- Invalidate voltage sensors if data returned is 0xff.

- Use the Super I/O Global Configuration Registers Chip ID[12] and Device
Revision to store/print the correct information.

- Use only the Fan Extended Tachometer registers on IT871[68]F for now;
this gives us correct data for IT8705/IT8712F again.

Inspired by the smsc(4) driver. The UPDATING file has been updated to
reflect the rename.
 1.5 05-Jul-2007  xtraeme branches: 1.5.6; 1.5.8; 1.5.12; 1.5.14;
Some changes:

- Add support for the IT8716F chip, patch from FUKUMOTO Atsushi via
PR port-i386/35796.
- Enable the flag ENVSYS_FCHANGERFACT in voltage sensors, to be able to
increment the value returned by the driver via envstat(8).
- Update VBAT sensor reading every time we read it, otherwise it will
always report the power on value.
- Enable all sensors that were missing before: 3 Temp + 3 Fan + 9 Voltage.
- Add new registers to set high/low limits in temperature/voltage sensors
(still unused).
- Disable some sensors if they are reporting bogus data or simply they are
not connected.

Tested by wiz.
 1.4 01-Jul-2007  xtraeme Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.3 07-Jan-2007  xtraeme branches: 1.3.6; 1.3.8;
* Remove unused sensors, anyway we are showing just the sensors of what
the BIOS is reporting (and speedfan for windows).
* Simplify the code.
* Remove unused functions and unnecessary variables.
* Provide more rfact values for the voltage sensors (from OpenBSD).
* Remove the limit of 1.5 seconds for refreshing the sensors, it's
unnecessary... we can read it every time we want.

Now I'm happy with the driver (code and envstat output):

[juan@nocturno][~]> envstat -r
CPU Temp: 38.000 degC
System Temp: 36.000 degC
VCORE_A: 1.664 V
+3.3V: 3.312 V
+5V: 4.919 V
+12V: 12.480 V
VBAT: 3.248 V
CPU Fan: 3096 RPM
System Fan: 0 RPM
[juan@nocturno][~]>
 1.2 05-Jun-2006  xtraeme branches: 1.2.4; 1.2.8; 1.2.10; 1.2.14;
it_check(): check values from IT_RES48 and IT_RES52, if both are default
values specified by the chip, continue attaching the driver (previously
only checking IT_RES48 was enough and IT_RES52 was ignored).
 1.1 13-May-2006  xtraeme branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Driver for iTE IT87xxF and compatibles hardware monitor. Add
commented out entries on GENERIC and GENERIC_LAPTOP.

Adapted from OpenBSD.
 1.1.8.3 07-Jun-2006  kardel Sync with head.
 1.1.8.2 01-Jun-2006  kardel Sync with head.
 1.1.8.1 13-May-2006  kardel file itvar.h was added on branch simonb-timecounters on 2006-06-01 22:36:42 +0000
 1.1.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.1.6.1 13-May-2006  tron file itvar.h was added on branch peter-altq on 2006-05-24 15:50:26 +0000
 1.1.4.3 26-Jun-2006  yamt sync with head.
 1.1.4.2 24-May-2006  yamt sync with head.
 1.1.4.1 13-May-2006  yamt file itvar.h was added on branch yamt-pdpolicy on 2006-05-24 10:57:52 +0000
 1.1.2.1 19-Jun-2006  chap Sync with head.
 1.2.14.1 09-Jan-2007  tron Pull up following revision(s) (requested by xtraeme in ticket #340):
sys/dev/isa/itvar.h: revision 1.3
sys/dev/isa/it.c: revision 1.7
* Remove unused sensors, anyway we are showing just the sensors of what
the BIOS is reporting (and speedfan for windows).
* Simplify the code.
* Remove unused functions and unnecessary variables.
* Provide more rfact values for the voltage sensors (from OpenBSD).
* Remove the limit of 1.5 seconds for refreshing the sensors, it's
unnecessary... we can read it every time we want.
Now I'm happy with the driver (code and envstat output):
[juan@nocturno][~]> envstat -r
CPU Temp: 38.000 degC
System Temp: 36.000 degC
VCORE_A: 1.664 V
+3.3V: 3.312 V
+5V: 4.919 V
+12V: 12.480 V
VBAT: 3.248 V
CPU Fan: 3096 RPM
System Fan: 0 RPM
[juan@nocturno][~]>
 1.2.10.2 09-Sep-2006  rpaulo sync with head
 1.2.10.1 05-Jun-2006  rpaulo file itvar.h was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:51:26 +0000
 1.2.8.1 12-Jan-2007  ad Sync with head.
 1.2.4.5 07-Dec-2007  yamt sync with head
 1.2.4.4 03-Sep-2007  yamt sync with head.
 1.2.4.3 26-Feb-2007  yamt sync with head.
 1.2.4.2 21-Jun-2006  yamt sync with head.
 1.2.4.1 05-Jun-2006  yamt file itvar.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.3.8.1 11-Jul-2007  mjf Sync with head.
 1.3.6.1 15-Jul-2007  ad Sync with head.
 1.5.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.5.12.1 18-Nov-2007  bouyer Sync with HEAD
 1.5.8.1 23-Mar-2008  matt sync with HEAD
 1.5.6.1 21-Nov-2007  joerg Sync with HEAD.
 1.7 08-May-2019  isaki 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.6 23-Nov-2011  jmcneill branches: 1.6.50; 1.6.54;
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.5 26-Mar-2008  xtraeme branches: 1.5.16; 1.5.38; 1.5.40;
Split device_t/softc for joy(4) and all its attachments. Also
use device_lookup_private() and related cosmetic changes.

Reviewed by cube@.
 1.4 11-Dec-2007  lukem branches: 1.4.8;
use __KERNEL_RCSID()
 1.3 19-Oct-2007  ad branches: 1.3.4; 1.3.6; 1.3.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.2 11-Dec-2005  christos branches: 1.2.30; 1.2.44; 1.2.46; 1.2.50;
merge ktrace-lwp.
 1.1 04-Aug-2004  drochner branches: 1.1.2; 1.1.14;
This is definitely what the world has been waiting for:-)
Allow to enable the game port on an ES1888, in case the firmware didn't
this. (Otherwise we still rely on the firmware having mapped the sound
related registers.)
Limit this to the "isa" attachment for now because this is the only
one I'm able to test.
Attach the "joy" device directly at "ess" to make sure the port is
enabled before the "joy" probe/attach.
This makes the joystick port usable on a "PWS" alpha (Miata).
 1.1.14.2 21-Jan-2008  yamt sync with head
 1.1.14.1 27-Oct-2007  yamt sync with head.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 12-Aug-2004  skrll Sync with HEAD.
 1.1.2.1 04-Aug-2004  skrll file joy_ess.c was added on branch ktrace-lwp on 2004-08-12 11:41:44 +0000
 1.2.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.2.46.2 09-Jan-2008  matt sync with HEAD
 1.2.46.1 06-Nov-2007  matt sync with HEAD
 1.2.44.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.2.30.1 23-Oct-2007  ad Sync with head.
 1.3.8.2 02-Jan-2008  bouyer Sync with HEAD
 1.3.8.1 13-Dec-2007  bouyer Sync with HEAD
 1.3.6.1 11-Dec-2007  yamt sync with head.
 1.3.4.1 26-Dec-2007  ad Sync with head.
 1.4.8.1 03-Apr-2008  mjf Sync with HEAD.
 1.5.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.5.38.1 17-Apr-2012  yamt sync with head
 1.5.16.1 12-Dec-2008  ad Checkpoint work in progress.
 1.6.54.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.6.50.1 10-Jun-2019  christos Sync with HEAD
 1.14 05-Dec-2011  christos make joy code consistent (avoid games with pointers), and fix the isa softc
declaration
 1.13 23-Nov-2011  jmcneill branches: 1.13.2;
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.12 26-Mar-2008  xtraeme branches: 1.12.16; 1.12.38; 1.12.40;
Split device_t/softc for joy(4) and all its attachments. Also
use device_lookup_private() and related cosmetic changes.

Reviewed by cube@.
 1.11 19-Oct-2007  ad branches: 1.11.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.10 16-Nov-2006  christos branches: 1.10.8; 1.10.22; 1.10.24; 1.10.28;
__unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 11-Dec-2005  christos branches: 1.8.20; 1.8.22;
merge ktrace-lwp.
 1.7 04-Feb-2005  perry branches: 1.7.6;
de-__P
 1.6 14-Sep-2004  drochner branches: 1.6.4; 1.6.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.5 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.4 02-Oct-2002  thorpej branches: 1.4.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.3 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 02-Feb-2002  jdolecek branches: 1.1.2; 1.1.4;
Reduce the massive code duplication regarding joy(4). Split it into
MI and MD parts, and make ISA/ISAPNP/PCI joy(4) attachments MI.
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.1 02-Feb-2002  nathanw file joy_isa.c was added on branch nathanw_sa on 2002-02-28 04:13:44 +0000
 1.1.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.2.1 02-Feb-2002  jdolecek file joy_isa.c was added on branch kqueue on 2002-02-11 20:09:52 +0000
 1.4.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.6.1 12-Feb-2005  yamt sync with head.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.7.6.2 27-Oct-2007  yamt sync with head.
 1.7.6.1 30-Dec-2006  yamt sync with head.
 1.8.22.2 10-Dec-2006  yamt sync with head.
 1.8.22.1 22-Oct-2006  yamt sync with head
 1.8.20.1 18-Nov-2006  ad Sync with head.
 1.10.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.24.1 06-Nov-2007  matt sync with HEAD
 1.10.22.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.10.8.1 23-Oct-2007  ad Sync with head.
 1.11.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.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.12.38.1 17-Apr-2012  yamt sync with head
 1.12.16.1 12-Dec-2008  ad Checkpoint work in progress.
 1.13.2.1 18-Feb-2012  mrg merge to -current.
 1.24 17-Jan-2012  jakllsch Modularize lm_isa and lm_wbsio, splitting the common part out
into a 3rd module. Add wbsio module too.
 1.23 21-Feb-2010  cnst branches: 1.23.10; 1.23.14;
New wbsio(4) driver for Winbond Super I/O attachment of lm(4) on any port.

http://mail-index.netbsd.org/tech-kern/2010/02/17/msg007338.html

Reviewed by <pgoyette>, <tech-kern>.
 1.22 12-Oct-2008  pgoyette branches: 1.22.14;
Consistent use of softc member name - fixes build breakage from previous.
 1.21 12-Oct-2008  pgoyette Add an i2c attachment for the LM78 family of temp sensor/fan control

Tested by Martin Husemann
 1.20 28-Apr-2008  martin branches: 1.20.6;
Remove clause 3 and 4 from TNF licenses
 1.19 05-Mar-2008  xtraeme branches: 1.19.2; 1.19.4;
Split device_t/softc in the lm(4) driver and its attachments, and
other related cosmetic changes.
 1.18 19-Oct-2007  ad branches: 1.18.12; 1.18.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 08-Sep-2007  xtraeme branches: 1.17.4;
Add the detach method that calls driver's lm_detach() function and
unmaps the I/O space used.
 1.16 07-Mar-2007  xtraeme branches: 1.16.2; 1.16.10; 1.16.14; 1.16.16;
* Remove unneeded headers.
* KNF, u_intx_t -> uintx_t
* There's no need to use additional variables for iobase and iot, just
use the members from ia.
 1.15 29-Jan-2007  hubertf branches: 1.15.2;
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.14 24-Nov-2006  wiz branches: 1.14.2;
s/independant/independent/, from Zafer.
 1.13 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 14-Sep-2004  drochner branches: 1.10.12;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.9 15-Nov-2002  ad branches: 1.9.6;
Changes for SMBus/I2C:

- Move lm_readreg/lm_writereg into the front-ends. Add/use function pointers
in the softc.
- Add a bank select function pointer to the softc and provide a generic
version. WinBond chips accessed over serial bus present three addresses,
two of which are used to access bank 1/2 registers.
- Mark TSENS2/3 sensor data as invalid if the the corresponding bank select
fails.
 1.8 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.4 13-Nov-2001  lukem add RCSID
 1.3 24-Jun-2000  thorpej branches: 1.3.2; 1.3.4; 1.3.6;
Add a clearing-house pseudo-device for system monitoring devices
such as the LM78 and VT82C686A (and eventually ACPI). Multiple
sensor devices can be hooked registered with `sysmon', and eventually
sysmon will also handle hardware (and software) watchdog timers.

Convert the `lm' and `viaenv' drivers to the new interface.
 1.2 09-Mar-2000  groo branches: 1.2.4;
use bus independent probe
 1.1 25-Feb-2000  groo Initial import of National Semiconductor LM7[89] Hardware Monitor with isa and
pnpbios attach.

examples:

lm0 at pnpbios0 index?
lm0 at isa? port 0x290


TODO: spinlocks, i2c interface.
 1.2.4.1 30-Jul-2000  bouyer Pull up (requested by thorpej):
lm_pnpbios.c 1.2->1.3
files 1.374->1.375
nslm7x.c 1.3->1.4
nslm7xvar.h 1.2->1.3
lm_isa.c 1.2->1.3
files.pci 1.96->1.97
viaenv.c 1.2->1.3
sysmon.c 1.1
sysmonvar.h 1.1

Add a clearing-house pseudo-device for system monitoring devices
such as the LM78 and VT82C686A (and eventually ACPI). Multiple
sensor devices can be hooked registered with `sysmon', and eventually
sysmon will also handle hardware (and software) watchdog timers.

Convert the `lm' and `viaenv' drivers to the new interface.
 1.3.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.4.5 11-Dec-2002  thorpej Sync with HEAD.
 1.3.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.3.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.3.4.2 11-Jan-2002  nathanw More catchup.
 1.3.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.3.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.2.1 24-Jun-2000  bouyer file lm_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:18 +0000
 1.9.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.10.12.5 17-Mar-2008  yamt sync with head.
 1.10.12.4 27-Oct-2007  yamt sync with head.
 1.10.12.3 03-Sep-2007  yamt sync with head.
 1.10.12.2 26-Feb-2007  yamt sync with head.
 1.10.12.1 30-Dec-2006  yamt sync with head.
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.3 01-Feb-2007  ad Sync with head.
 1.11.20.2 12-Jan-2007  ad Sync with head.
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.14.2.1 20-Apr-2007  bouyer Pull up following revision(s) (requested by xtraeme in ticket #584):
share/man/man4/lm.4: revisions 1.19 - 1.20
sys/dev/isa/lm_isa.c: revision 1.16 via patch
sys/dev/ic/nslm7xvar.h: revision 1.19
sys/dev/ic/nslm7x.c: revision 1.30 - 1.33 via patch
sync lm(4) with OpenBSD.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
 1.15.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.16.2 23-Mar-2008  matt sync with HEAD
 1.16.16.1 06-Nov-2007  matt sync with HEAD
 1.16.14.2 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.16.14.1 02-Oct-2007  joerg Sync with HEAD.
 1.16.10.1 10-Sep-2007  skrll Sync with HEAD.
 1.16.2.2 23-Oct-2007  ad Sync with head.
 1.16.2.1 09-Oct-2007  ad Sync with head.
 1.17.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.18.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.18.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.12.1 24-Mar-2008  keiichi sync with head.
 1.19.4.3 11-Mar-2010  yamt sync with head
 1.19.4.2 04-May-2009  yamt sync with head.
 1.19.4.1 16-May-2008  yamt sync with head.
 1.19.2.1 18-May-2008  yamt sync with head.
 1.20.6.1 19-Oct-2008  haad Sync with HEAD.
 1.22.14.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.23.14.1 18-Feb-2012  mrg merge to -current.
 1.23.10.1 17-Apr-2012  yamt sync with head
 1.7 24-Jun-2020  jdolecek avoid stack usage in match routine
 1.6 18-Aug-2017  msaitoh - WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from otehrs, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
 1.5 17-Aug-2017  msaitoh Use uint8_t instead of int. No functional change.
 1.4 01-Jun-2016  pgoyette branches: 1.4.10;
Add support for Nuvoton NCT6776F from OpenBSD

From PR kern/49747
 1.3 18-Jan-2012  jakllsch branches: 1.3.4; 1.3.6; 1.3.10; 1.3.28;
Improve module dependencies, clean up old #if 0 code.
 1.2 17-Jan-2012  jakllsch No module dependencies are denoted with NULL. Pointed out by jmcneill.
 1.1 17-Jan-2012  jakllsch Modularize lm_isa and lm_wbsio, splitting the common part out
into a 3rd module. Add wbsio module too.
 1.3.28.2 28-Aug-2017  skrll Sync with HEAD
 1.3.28.1 09-Jul-2016  skrll Sync with HEAD
 1.3.10.1 03-Dec-2017  jdolecek update from HEAD
 1.3.6.2 17-Apr-2012  yamt sync with head
 1.3.6.1 18-Jan-2012  yamt file lm_isa_common.c was added on branch yamt-pagecache on 2012-04-17 00:07:39 +0000
 1.3.4.2 18-Feb-2012  mrg merge to -current.
 1.3.4.1 18-Jan-2012  mrg file lm_isa_common.c was added on branch jmcneill-usbmp on 2012-02-18 07:34:29 +0000
 1.4.10.1 22-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #374):
share/man/man4/lm.4: revision 1.33
share/man/man4/lm.4: revision 1.34
sys/dev/ic/nslm7x.c: revision 1.70
sys/dev/isa/lm_isa_common.c: revision 1.5
sys/dev/isa/lm_isa_common.c: revision 1.6
sys/dev/isa/wbsio.c: revision 1.11
sys/dev/i2c/lm_i2c.c: revision 1.3
sys/dev/isa/wbsio.c: revision 1.12
sys/dev/i2c/lm_i2c.c: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.1
sys/dev/isa/wbsio.c: revision 1.13
sys/dev/isa/wbsioreg.h: revision 1.2
sys/dev/isa/wbsio.c: revision 1.14
sys/dev/isa/wbsioreg.h: revision 1.3
sys/dev/isa/wbsio.c: revision 1.15
sys/dev/isa/wbsioreg.h: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.5
share/man/man4/wbsio.4: revision 1.4
share/man/man4/wbsio.4: revision 1.5
sys/dev/ic/nslm7xvar.h: revision 1.30
sys/dev/ic/nslm7x.c: revision 1.65
share/man/man4/wbsio.4: revision 1.6
sys/dev/ic/nslm7xvar.h: revision 1.31
sys/dev/ic/nslm7x.c: revision 1.66
sys/dev/ic/nslm7xvar.h: revision 1.32
sys/dev/ic/nslm7x.c: revision 1.67
sys/dev/ic/nslm7xvar.h: revision 1.33
sys/dev/ic/nslm7x.c: revision 1.68
sys/dev/ic/nslm7x.c: revision 1.69
Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT610[246]D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
Add note about Nuvoton.
- Add new Nuvoton devices.
- Add CAVEATS section from OpenBSD.
Add space before left-paren
Remove superfluous Pp.
Whitespace.
Fix a bug that fan RPM wasn't printed correctly. 0xbX is not RPM but counter.
Use 0xcX.
Fix typo.
- Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
Use uint8_t instead of int. No functional change.
Print chip name correctly.
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from others, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
s/Id/NetBSD/. Pointed out by wiz!
 1.1 17-Jan-2012  jakllsch branches: 1.1.4; 1.1.6;
Modularize lm_isa and lm_wbsio, splitting the common part out
into a 3rd module. Add wbsio module too.
 1.1.6.2 17-Apr-2012  yamt sync with head
 1.1.6.1 17-Jan-2012  yamt file lm_isa_common_var.h was added on branch yamt-pagecache on 2012-04-17 00:07:39 +0000
 1.1.4.2 18-Feb-2012  mrg merge to -current.
 1.1.4.1 17-Jan-2012  mrg file lm_isa_common_var.h was added on branch jmcneill-usbmp on 2012-02-18 07:34:29 +0000
 1.2 18-Jan-2012  jakllsch branches: 1.2.4; 1.2.6;
Improve module dependency list.
 1.1 17-Jan-2012  jakllsch Modularize lm_isa and lm_wbsio, splitting the common part out
into a 3rd module. Add wbsio module too.
 1.2.6.2 17-Apr-2012  yamt sync with head
 1.2.6.1 18-Jan-2012  yamt file lm_wbsio.c was added on branch yamt-pagecache on 2012-04-17 00:07:39 +0000
 1.2.4.2 18-Feb-2012  mrg merge to -current.
 1.2.4.1 18-Jan-2012  mrg file lm_wbsio.c was added on branch jmcneill-usbmp on 2012-02-18 07:34:29 +0000
 1.45 14-Oct-1997  is Finalize the isa/lpt.c split:
The isa attachment code is in isa/lpt_isa.c now, which attaches to the
already created ic/lpt* files.
You don't need to change your config files, but you need to re-"config" if
using lpt at isa.
XXX The "lpt" device definition should be in sys/conf/files instead, but to
my knowledge, there are some ports which have private copies of lpt, and would
choke on that. No need to make people unhappy 7 days before release branching.
 1.44 02-Sep-1997  mikel add missing argument to LPRINTF() declaration; from Geoff Wing in PR 4072.
I also made inclusion of LPRINTF() dependent solely on the symbol
LPTDEBUG, initialized lptdebug variable to 0 instead of 1, and
matched arguments to format strings in LPRINTF() calls.
 1.43 05-Dec-1996  cgd branches: 1.43.10;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.42 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.41 13-Oct-1996  christos backout kprintf changes
 1.40 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.39 12-May-1996  mycroft Use intr.h.
 1.38 29-Apr-1996  christos - Fix gcc -Wall warnings
- BUG: if (error = ...() == EWOULDBLOCK)
 1.37 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.36 10-Apr-1996  mycroft Add explicit return types.
 1.35 18-Mar-1996  cgd since this driver tries to block its interrupt with spltty(), it must
attach that interrupt with IPL_TTY.
 1.34 17-Mar-1996  cgd clean up <machine/bus.h> changes a bit; no real functional change.
prototype lpt_port_test().
 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 08-Mar-1996  cgd convert to use I/O mapping/access macros in <machine/bus.h>.
Mostly mechanical changes, except for probe/attach, which have
to map (and, in the case of probe, unmap) the I/O space that the
chip will use.
 1.31 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.30 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.29 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.28 26-Jan-1995  mycroft Don't check the control port at all; too unreliable.
 1.27 22-Jan-1995  mycroft Rearrange tests so `offline' has higher priority than `out of paper'.
 1.26 03-Jan-1995  mycroft Add interrupt sharing types.
 1.25 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.24 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.23 27-Oct-1994  cgd new RCS ID format.
 1.22 16-Jun-1994  mycroft branches: 1.22.2;
b_un.b_addr -> b_data
 1.21 27-May-1994  mycroft Only print the blasted messages *once* per error.
 1.20 23-May-1994  cgd turn off spontaneous printing of messages when DEBUG turned on
 1.19 05-May-1994  mycroft Remove now-bogus cast.
 1.18 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.17 22-Apr-1994  mycroft Don't need isa.h.
 1.16 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.15 29-Mar-1994  mycroft Updates for new autoconfig.
 1.14 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.13 19-Feb-1994  mycroft Speed it up a little...
 1.12 19-Feb-1994  mycroft Minor tweak of no importance.
 1.11 18-Feb-1994  mycroft Combined version from magnum branch. Somewhat faster and less buggy.
 1.10 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.9 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.8 28-Sep-1993  cgd get rid of stray printfs (turn them into "lprintf"s)
 1.7 17-Jul-1993  mycroft branches: 1.7.4;
Make these files GCC 2 happy.
 1.6 15-Jun-1993  mycroft Ignore interrupts if the device isn't open. This prevents stray interrupts
from hosing the works. What a stupid architecture.
 1.5 05-Jun-1993  cgd patch from rgrimes to add delay to let data port stabilize, also
make "lpflag" unique to each driver
 1.4 22-May-1993  cgd add include of select.h if necessary for protos, or delete if extraneous
 1.3 18-May-1993  cgd make kernel select interface be one-stop shopping & clean it all up.
 1.2 07-May-1993  cgd fix lpt driver and add lpa driver. from 386bsd pk patch 133
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.4.18 16-Feb-1994  mycroft Avoid two minor race conditions; no real differences.
 1.7.4.17 29-Oct-1993  mycroft Force the printer closed even if the final pushbytes() fails.
 1.7.4.16 29-Oct-1993  mycroft Make sure pushbytes() returns 0 on success.
 1.7.4.15 29-Oct-1993  mycroft Ignore the bottom 3 bits when checking for printer ready.
 1.7.4.14 29-Oct-1993  mycroft Make some debugging code in the probe routines #ifdef DEBUG.
 1.7.4.13 27-Oct-1993  mycroft Add lptforceintr(), but disabled for now. Add some debugging code.
 1.7.4.12 18-Oct-1993  mycroft We can't determine lpt interrupts dynamically.
 1.7.4.11 17-Oct-1993  mycroft When an error occurs, at least say what it is before hanging.
 1.7.4.10 16-Oct-1993  mycroft Add missing dv_class entry to cfdrivers, and use dv_xname where appropriate.
 1.7.4.9 12-Oct-1993  mycroft Minor cleanup.
 1.7.4.8 11-Oct-1993  mycroft #include pio.h where needed, and remove cpufunc.h.
 1.7.4.7 07-Oct-1993  mycroft Don't #include isa.h.
 1.7.4.6 06-Oct-1993  mycroft Finish reformatting. Turn interrupt on or off as appropriate in lptopen().
 1.7.4.5 01-Oct-1993  mycroft #include "machine/cpu.h"
 1.7.4.4 30-Sep-1993  mycroft Change some uses of IRQUNK to IRQNONE. #include isa.h and icu.h.
 1.7.4.3 30-Sep-1993  mycroft clock.c: Remove unnecessary casts.
com.c: Update for new config. Add bis() and bic() macros like BSDI's.
Add comspeed() and tiocm_xxx2mcr() from BSDI.
comreg.h: Add COM_FREQ, COM_TOLERANCE, and COM_NPORTS.
fd.c: Remove casts and clean up fdioctl().
[lm]ms.c: Add necessary gunk to [lm]ms_softc and remove casts.
 1.7.4.2 29-Sep-1993  mycroft lms.c: Update for new config.
lpa.c: Defunct.
lpt.c: Update for new config. Fix handling of interrupted writes. Merge code
from lpa driver. Make all operations interruptible. Remove a few other
bogons.
lptreg.h: Add LPT_NPORTS.
pccons.c: Merge changes from trunk.
 1.7.4.1 14-Sep-1993  mycroft New i386 code.
 1.22.2.1 23-Nov-1994  cgd make sure to do an untimeout. for patch_04
 1.43.10.2 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.43.10.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.70 27-Dec-2019  msaitoh s/manaul/manual/ in comment.
 1.69 24-Mar-2018  jdolecek branches: 1.69.2;
use isa_intr_establish_xname()
 1.68 23-Nov-2009  rmind branches: 1.68.62;
Remove some unecessary includes sys/user.h header.
 1.67 31-May-2008  jmcneill lpt(4): register NULL pmf handler.
 1.66 07-Mar-2008  cube branches: 1.66.2; 1.66.4; 1.66.6;
Split the softc from the device_t for all lpt(4) variants and attachments
except the ppbus stuff (which doesn't compile) and ulpt(4) which is
unrelated and can be dealt with separately.

As usual, it comes with related cosmetic changes.
 1.65 22-Feb-2008  dyoung Add methods to detach lpt at isa.
 1.64 19-Oct-2007  ad branches: 1.64.12; 1.64.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.63 16-Nov-2006  christos branches: 1.63.8; 1.63.22; 1.63.24; 1.63.28;
__unused removal on arguments; approved by core.
 1.62 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.61 11-Dec-2005  christos branches: 1.61.20; 1.61.22;
merge ktrace-lwp.
 1.60 27-Feb-2005  perry branches: 1.60.4;
nuke trailing whitespace
 1.59 04-Feb-2005  perry de-__P
 1.58 14-Sep-2004  drochner branches: 1.58.4; 1.58.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.57 03-Apr-2003  christos branches: 1.57.2;
avoid stupid printfs during probe when debugging is on.
 1.56 20-Jan-2003  simonb The Double-Semi-Colon Police.
 1.55 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.54 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.53 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.52 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.51 13-Nov-2001  lukem add RCSID
 1.50 29-Mar-2000  simonb branches: 1.50.6; 1.50.8;
Don't need to include <sys/conf.h> here.
 1.49 15-Aug-1998  mycroft branches: 1.49.12;
Make copyright notices with my name consistent.
 1.48 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.47 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.46 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.45 14-Oct-1997  is branches: 1.45.2;
Finalize the isa/lpt.c split:
The isa attachment code is in isa/lpt_isa.c now, which attaches to the
already created ic/lpt* files.
You don't need to change your config files, but you need to re-"config" if
using lpt at isa.
XXX The "lpt" device definition should be in sys/conf/files instead, but to
my knowledge, there are some ports which have private copies of lpt, and would
choke on that. No need to make people unhappy 7 days before release branching.
 1.44 02-Sep-1997  mikel add missing argument to LPRINTF() declaration; from Geoff Wing in PR 4072.
I also made inclusion of LPRINTF() dependent solely on the symbol
LPTDEBUG, initialized lptdebug variable to 0 instead of 1, and
matched arguments to format strings in LPRINTF() calls.
 1.43 05-Dec-1996  cgd branches: 1.43.10;
update these so they compile whether or not __BROKEN_INDIRECT_CONFIG
is defined.
 1.42 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.41 13-Oct-1996  christos backout kprintf changes
 1.40 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.39 12-May-1996  mycroft Use intr.h.
 1.38 29-Apr-1996  christos - Fix gcc -Wall warnings
- BUG: if (error = ...() == EWOULDBLOCK)
 1.37 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.36 10-Apr-1996  mycroft Add explicit return types.
 1.35 18-Mar-1996  cgd since this driver tries to block its interrupt with spltty(), it must
attach that interrupt with IPL_TTY.
 1.34 17-Mar-1996  cgd clean up <machine/bus.h> changes a bit; no real functional change.
prototype lpt_port_test().
 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 08-Mar-1996  cgd convert to use I/O mapping/access macros in <machine/bus.h>.
Mostly mechanical changes, except for probe/attach, which have
to map (and, in the case of probe, unmap) the I/O space that the
chip will use.
 1.31 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.30 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.29 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.28 26-Jan-1995  mycroft Don't check the control port at all; too unreliable.
 1.27 22-Jan-1995  mycroft Rearrange tests so `offline' has higher priority than `out of paper'.
 1.26 03-Jan-1995  mycroft Add interrupt sharing types.
 1.25 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.24 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.23 27-Oct-1994  cgd new RCS ID format.
 1.22 16-Jun-1994  mycroft branches: 1.22.2;
b_un.b_addr -> b_data
 1.21 27-May-1994  mycroft Only print the blasted messages *once* per error.
 1.20 23-May-1994  cgd turn off spontaneous printing of messages when DEBUG turned on
 1.19 05-May-1994  mycroft Remove now-bogus cast.
 1.18 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.17 22-Apr-1994  mycroft Don't need isa.h.
 1.16 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.15 29-Mar-1994  mycroft Updates for new autoconfig.
 1.14 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.13 19-Feb-1994  mycroft Speed it up a little...
 1.12 19-Feb-1994  mycroft Minor tweak of no importance.
 1.11 18-Feb-1994  mycroft Combined version from magnum branch. Somewhat faster and less buggy.
 1.10 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.9 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.8 28-Sep-1993  cgd get rid of stray printfs (turn them into "lprintf"s)
 1.7 17-Jul-1993  mycroft branches: 1.7.4;
Make these files GCC 2 happy.
 1.6 15-Jun-1993  mycroft Ignore interrupts if the device isn't open. This prevents stray interrupts
from hosing the works. What a stupid architecture.
 1.5 05-Jun-1993  cgd patch from rgrimes to add delay to let data port stabilize, also
make "lpflag" unique to each driver
 1.4 22-May-1993  cgd add include of select.h if necessary for protos, or delete if extraneous
 1.3 18-May-1993  cgd make kernel select interface be one-stop shopping & clean it all up.
 1.2 07-May-1993  cgd fix lpt driver and add lpa driver. from 386bsd pk patch 133
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.4.18 16-Feb-1994  mycroft Avoid two minor race conditions; no real differences.
 1.7.4.17 29-Oct-1993  mycroft Force the printer closed even if the final pushbytes() fails.
 1.7.4.16 29-Oct-1993  mycroft Make sure pushbytes() returns 0 on success.
 1.7.4.15 29-Oct-1993  mycroft Ignore the bottom 3 bits when checking for printer ready.
 1.7.4.14 29-Oct-1993  mycroft Make some debugging code in the probe routines #ifdef DEBUG.
 1.7.4.13 27-Oct-1993  mycroft Add lptforceintr(), but disabled for now. Add some debugging code.
 1.7.4.12 18-Oct-1993  mycroft We can't determine lpt interrupts dynamically.
 1.7.4.11 17-Oct-1993  mycroft When an error occurs, at least say what it is before hanging.
 1.7.4.10 16-Oct-1993  mycroft Add missing dv_class entry to cfdrivers, and use dv_xname where appropriate.
 1.7.4.9 12-Oct-1993  mycroft Minor cleanup.
 1.7.4.8 11-Oct-1993  mycroft #include pio.h where needed, and remove cpufunc.h.
 1.7.4.7 07-Oct-1993  mycroft Don't #include isa.h.
 1.7.4.6 06-Oct-1993  mycroft Finish reformatting. Turn interrupt on or off as appropriate in lptopen().
 1.7.4.5 01-Oct-1993  mycroft #include "machine/cpu.h"
 1.7.4.4 30-Sep-1993  mycroft Change some uses of IRQUNK to IRQNONE. #include isa.h and icu.h.
 1.7.4.3 30-Sep-1993  mycroft clock.c: Remove unnecessary casts.
com.c: Update for new config. Add bis() and bic() macros like BSDI's.
Add comspeed() and tiocm_xxx2mcr() from BSDI.
comreg.h: Add COM_FREQ, COM_TOLERANCE, and COM_NPORTS.
fd.c: Remove casts and clean up fdioctl().
[lm]ms.c: Add necessary gunk to [lm]ms_softc and remove casts.
 1.7.4.2 29-Sep-1993  mycroft lms.c: Update for new config.
lpa.c: Defunct.
lpt.c: Update for new config. Fix handling of interrupted writes. Merge code
from lpa driver. Make all operations interruptible. Remove a few other
bogons.
lptreg.h: Add LPT_NPORTS.
pccons.c: Merge changes from trunk.
 1.7.4.1 14-Sep-1993  mycroft New i386 code.
 1.22.2.1 23-Nov-1994  cgd make sure to do an untimeout. for patch_04
 1.43.10.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.2.2 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.2.1 14-Oct-1997  thorpej file lpt_isa.c was added on branch marc-pcmcia on 1997-10-15 05:36:51 +0000
 1.49.12.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.50.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.50.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.50.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.50.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.50.6.2 11-Jan-2002  nathanw More catchup.
 1.50.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.57.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.57.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.57.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.57.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.58.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.58.6.1 12-Feb-2005  yamt sync with head.
 1.58.4.1 29-Apr-2005  kent sync with -current
 1.60.4.4 17-Mar-2008  yamt sync with head.
 1.60.4.3 27-Feb-2008  yamt sync with head.
 1.60.4.2 27-Oct-2007  yamt sync with head.
 1.60.4.1 30-Dec-2006  yamt sync with head.
 1.61.22.2 10-Dec-2006  yamt sync with head.
 1.61.22.1 22-Oct-2006  yamt sync with head
 1.61.20.1 18-Nov-2006  ad Sync with head.
 1.63.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.63.24.2 23-Mar-2008  matt sync with HEAD
 1.63.24.1 06-Nov-2007  matt sync with HEAD
 1.63.22.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.63.8.1 23-Oct-2007  ad Sync with head.
 1.64.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.64.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.64.12.1 24-Mar-2008  keiichi sync with head.
 1.66.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.66.4.2 11-Mar-2010  yamt sync with head
 1.66.4.1 04-May-2009  yamt sync with head.
 1.66.2.1 04-Jun-2008  yamt sync with head
 1.68.62.1 30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.69.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.6 14-Oct-1997  is Finalize the isa/lpt.c split:
The isa attachment code is in isa/lpt_isa.c now, which attaches to the
already created ic/lpt* files.
You don't need to change your config files, but you need to re-"config" if
using lpt at isa.
XXX The "lpt" device definition should be in sys/conf/files instead, but to
my knowledge, there are some ports which have private copies of lpt, and would
choke on that. No need to make people unhappy 7 days before release branching.
 1.5 23-Nov-1996  cgd branches: 1.5.10;
Drop LPT_NPORTS to 4 from 8. Some lpt units require only 4 I/O ports
(e.g. from 0x3bc to 0x3bf, for example). Others may require more,
but until there's some special handling for them, 4 should be returned
so that on systems with I/O port accounting, the unit at 0x3bf can be
properly mapped, etc. (OK'd by mycroft.)
 1.4 27-Oct-1994  cgd new RCS ID format.
 1.3 18-Feb-1994  mycroft Combined version from magnum branch. Somewhat faster and less buggy.
 1.2 22-May-1993  cgd branches: 1.2.4;
add rcsids to everything and clean up headers
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.2.4.2 06-Oct-1993  mycroft Give #defines more mnemonic names, and fix comment for LPC_IENABLE.
 1.2.4.1 29-Sep-1993  mycroft lms.c: Update for new config.
lpa.c: Defunct.
lpt.c: Update for new config. Fix handling of interrupted writes. Merge code
from lpa driver. Make all operations interruptible. Remove a few other
bogons.
lptreg.h: Add LPT_NPORTS.
pccons.c: Merge changes from trunk.
 1.5.10.1 15-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6 02-Nov-2022  andvar fix various typos in comments and messages.
 1.5 08-Dec-1998  augustss Make the OPL information string more informative.
 1.4 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.3 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.2 06-Apr-1997  augustss branches: 1.2.4;
Add RCS id.
 1.1 06-Apr-1997  augustss Add support for MAD16 based audio cards.
XXX Change the way we determine to probe for it when
multiple I/O ranges are available.
 1.2.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.121 09-Sep-2021  riastradh sys/dev: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.

I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
 1.120 24-Feb-2020  rin 0x%p --> %p for non-external codes.
 1.119 12-Nov-2019  msaitoh branches: 1.119.2;
Add missing initialization of sc_dev.
 1.118 24-Feb-2019  kamil branches: 1.118.4;
Add missing FALLTHROUGH in isa/mcd.c

Requested by GCC in NetBSD/i386 kUBSan KCOV build.

Reviewed by <mgorny>
 1.117 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.116 14-Jul-2016  msaitoh branches: 1.116.2; 1.116.8; 1.116.10; 1.116.16; 1.116.18;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.115 26-Apr-2015  mlelstv Use C99-style initializers for struct dkdriver.
 1.114 31-Dec-2014  christos make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
 1.113 25-Jul-2014  dholland branches: 1.113.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.112 25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.111 16-Mar-2014  dholland branches: 1.111.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.110 27-Oct-2012  chs branches: 1.110.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.109 12-May-2009  cegger branches: 1.109.12; 1.109.22;
struct device * -> device_t, no functional changes intended.
 1.108 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.107 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.106 13-Jan-2009  yamt branches: 1.106.2;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.105 08-Jun-2008  tsutsui branches: 1.105.6;
Replace device_lookup() with device_lookup_private() on getting softc
for future device_t/softc spilt.
 1.104 08-Apr-2008  cegger branches: 1.104.2; 1.104.4; 1.104.6;
use aprint_*_dev and device_xname
 1.103 05-Dec-2007  ad branches: 1.103.12;
lockmgr -> mutex
 1.102 19-Oct-2007  ad branches: 1.102.2; 1.102.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.101 08-Oct-2007  ad branches: 1.101.2;
Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.100 29-Jul-2007  ad branches: 1.100.4; 1.100.6; 1.100.8; 1.100.10;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.99 09-Jul-2007  ad branches: 1.99.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.98 30-Jun-2007  dsl The cd ioctl definitions are not condusive to being called from within
the kernel (eg from withthe linux compat code).
Add CDIOCREADSUBCHANNEL_BUF and CDIOREADTOCENTRIES_BUF which are like the
existing ioctls withoutthe _BUF, except that the data area immediately
follows the control structure (and is fixed length).
Modify scsipi/cd.c so that it only ever has one 'struct cd_formatted_toc'
allocated on the stack (maybe this info ought to be in the softc)
structure since even one 800 byte on-stack buffer isn't overly friendly.
cdplay(1) still seems able to read the track-list of an ATAPI cd.
 1.97 04-Mar-2007  christos branches: 1.97.2; 1.97.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.96 16-Nov-2006  christos branches: 1.96.4;
__unused removal on arguments; approved by core.
 1.95 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.94 02-Sep-2006  christos branches: 1.94.2; 1.94.4;
add missing initializer
 1.93 13-Apr-2006  christos PR/29683: Sergey Svishchev: Make this compile again..
 1.92 11-Dec-2005  christos branches: 1.92.4; 1.92.6; 1.92.8; 1.92.10; 1.92.12;
merge ktrace-lwp.
 1.91 15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.90 12-Mar-2005  christos branches: 1.90.4;
PR/29683: M. B. Buchanan: mcd driver has printf formatting compile issue
and sets the wrong field to the number of ports.
 1.89 27-Feb-2005  perry nuke trailing whitespace
 1.88 04-Feb-2005  perry de-__P
 1.87 28-Oct-2004  yamt branches: 1.87.4; 1.87.6;
move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.86 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.85 07-Nov-2003  mycroft Replace home-grown locks with lockmgr().
 1.84 29-Jun-2003  fvdl branches: 1.84.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.83 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.82 10-May-2003  thorpej Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself. This paves the way for some future changes.
 1.81 01-Nov-2002  mrg implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
when processing hw.diskstats, add the read&write bytes/transfers for
the old combined stats to attempt to keep backwards compatibility.

unfortunately, due to multiple bugs, this will cause new kernels and old
vmstat/iostat/systat programs to fail. however, the next time this is
change it will not fail again.

this is just the kernel portion.
 1.80 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.79 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.78 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.77 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.76 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.75 24-Jul-2002  hannken Convert to new device buffer queue interface.
 1.74 07-Jan-2002  thorpej branches: 1.74.8;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.73 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.72 13-Nov-2001  lukem add RCSID
 1.71 18-Jul-2001  thorpej branches: 1.71.2;
bzero -> memset
 1.70 10-Feb-2001  taca branches: 1.70.2; 1.70.4;
Insert missing '#' for cpp(1). This should close PR/12167.
 1.69 08-Jan-2001  fvdl Return error in the case of using ODIOCGDINFO or ODIOCGDEFLABEL when
the number of partitions is > OLDMAXPARTITIONS. This is better
than silently truncating the label (don't want to silently throw
away partitions when using an old disklabel binary on a label with
> 8 partitions). From Enami Tsugutomo.
 1.68 07-Jan-2001  fvdl Adapt all disk devices in MI directories to handle ODIOC* calls
for ports that have bumped MAXPARTITIONS (and thus define
__HAVE_OLD_DISKLABEL).
 1.67 06-Jul-2000  thorpej Use device_lookup().
 1.66 23-Mar-2000  thorpej branches: 1.66.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.65 07-Feb-2000  thorpej Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle. Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
 1.64 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.63 08-Feb-1999  bouyer branches: 1.63.8;
Change DIOCEJECT to do what's needed to eject a device before the eject
command (unlock for sd and cd) if no other partitions are open, return
EBUSY otherwise. DIOCEJECT will have the old semantic if its argument is not
0. The old ioctl has been renamed to ODIOCEJECT for binary compatibility.
 1.62 23-Jun-1998  jonathan * Add defopt MCD_PROMISC for more conservative probes.
Before, the probe routine (mcd_find() would succeed even if the probe
code thought it had a response, but didn't recognize the ID-code byte.
Now, only do the promiscuous match if MCD_PROMISC is configured.
 1.61 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.60 14-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.59 12-Jan-1998  thorpej Update for config changes.
 1.58 11-Nov-1997  fvdl Add missing ;
 1.57 20-Oct-1997  thorpej branches: 1.57.2;
Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.56 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.55 08-Oct-1997  thorpej Implement DIOCGDEFLABEL.
 1.54 14-Jun-1997  thorpej branches: 1.54.4;
Make this compile again in light of recent changes to cdio.h
 1.53 04-Apr-1997  christos Busify the driver (from perry).
 1.52 05-Nov-1996  mikel Eliminate unsolicited spewage; PR #2108.
 1.51 13-Oct-1996  christos backout kprintf changes
 1.50 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.49 12-May-1996  mycroft Use intr.h.
 1.48 29-Apr-1996  christos Fix gcc -Wall warnings.
 1.47 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.46 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.45 30-Jan-1996  thorpej Accept DIOCEJECT as a synonym for CDIOCEJECT. Implement DIOCLOCK
separately from CDIOCALLOW and CDIOCPREVENT, even though they perform
basically the same function (with a different interface XXX).
 1.44 07-Jan-1996  thorpej New generic disk framework. Highlights:

- New metrics handling. Metrics are now kept in the new
`struct disk'. Busy time is now stored as a timeval, and
transfer count in bytes.

- Storage for disklabels is now dynamically allocated, so that
the size of the disk structure is not machine-dependent.

- Several new functions for attaching and detaching disks, and
handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
 1.43 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.42 05-Aug-1995  mycroft Use an intermediate variable to shorten label initialization code.
 1.41 10-Jul-1995  cgd fix from Onno van der Linden for large-file read timeouts on double-speed
drives. A different read command must be used on double-speed drives.
It boggles my mind that people could design hardware this stupid.
 1.40 05-Jul-1995  mycroft Make each disk and tape driver define its own read and write functions.
Deprecate rawread() and rawwrite() completely. Remove d_strategy from cdevsw to
force the abstraction barrier.
 1.39 26-Jun-1995  cgd make dump stubs consistent
 1.38 27-Apr-1995  mycroft Turn off some debugging code by default.
 1.37 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.36 15-Apr-1995  mycroft Don't boundary check I/O to the `raw' partition.
 1.35 01-Apr-1995  mycroft Insert a missing unlock.
 1.34 01-Apr-1995  mycroft Change the locking protocol to match other drivers.
 1.33 01-Apr-1995  mycroft Always load the TOC. Turn off the TOC bit in the mode register so the busy
light goes off.
 1.32 27-Mar-1995  mycroft Remove unused variable.
 1.31 27-Mar-1995  mycroft Remove a tiny bit of redundant code.
 1.30 27-Mar-1995  mycroft It's not necessary to do a GETSTAT before each read.
 1.29 27-Mar-1995  mycroft Small garbage collection, and turn off debugging info by default.
 1.28 27-Mar-1995  mycroft Largely rewritten by me, with some input from Dave Burgess. Implement most of
the CDIOC* calls correctly, improve performance by 10x when interrupts work,
and implement the same generic disk framework as other drivers.
Needs some more work.
 1.27 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.26 03-Jan-1995  mycroft Add interrupt sharing types.
 1.25 14-Dec-1994  mycroft Remove dkbad.h.
 1.24 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.23 03-Nov-1994  mycroft Use indirect config for subdevices, and add dkdrivers where missing.
 1.22 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.21 28-Oct-1994  mycroft Various:
* Forget all cached info when opening a new disc.
* If the disc is removed, flush the buffer queue rather than stalling it.
* Set the default label after getting the disc size, and fill in the info
for RAW_PART also.
* Change another use of the unit number to a softc pointer.
* Use a dkdevice to hold the label and open partition masks.
* Force the partition offset to 0 for RAW_PART, regardless of the label.
* Nuke MCDPHYS() and MCDREADRAW; they had a silly bug that caused the code
to not work, and they aren't useful anyway.
Some other minor cleanup.
 1.20 27-Oct-1994  cgd new RCS ID format.
 1.19 14-Oct-1994  cgd move arch dependence to archs. clean up a bit. deal with weird MAXPARTITONS.
 1.18 05-Aug-1994  mycroft Fix spelling of `STEREO'.
 1.17 03-Aug-1994  mycroft Add a missing splx() and increase the reset delay during probe, as suggested
by Juergen Keil. Add a diagnostic message if the controller info is not what
we expect.
 1.16 16-Jun-1994  mycroft branches: 1.16.2;
b_un.b_addr -> b_data
 1.15 11-May-1994  mycroft Add dummy *dump() routines.
 1.14 05-May-1994  mycroft Retool the state machine is a sane way.
 1.13 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.12 22-Apr-1994  mycroft Don't need isa.h.
 1.11 08-Apr-1994  mycroft Small fix to attach message.
 1.10 08-Apr-1994  mycroft Fix return values from some interrupt routines.
 1.9 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.8 29-Mar-1994  mycroft Updates for new autoconfig.
 1.7 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.6 21-Feb-1994  mycroft Fixed probe routine from Holger Veit; lots of other cleanup by me.
 1.5 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.4 06-Feb-1994  mycroft Use b_actf, not av_forw.
 1.3 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.2 17-Nov-1993  cgd added two copyright strings at the request of Gary Clark II
<gclarkii@freefall.cdrom.com>, because he hacked and is in the process
of hacking the code significantly.
 1.1 04-Nov-1993  cgd branches: 1.1.2;
add mcd: Mitsumi CD driver by Holger Veit and Brian Moore
 1.1.2.7 06-Feb-1994  mycroft Use b_actf, not av_forw.
 1.1.2.6 02-Feb-1994  mycroft Various cleanup.
 1.1.2.5 02-Feb-1994  mycroft Change second arg of probe to self, in preparation of changing subr_autoconf.
 1.1.2.4 02-Feb-1994  mycroft Updates from Gary Clark II; may need more work.
 1.1.2.3 01-Feb-1994  mycroft Updates from main branch.
 1.1.2.2 29-Nov-1993  mycroft Forgot to #include pio.h and cpu.h.
 1.1.2.1 29-Nov-1993  mycroft Converted. Needs testing.
 1.16.2.2 05-Aug-1994  mycroft update from trunk
 1.16.2.1 03-Aug-1994  cgd from trunk
 1.54.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.1 12-Nov-1997  mellon Pull rev 1.58 up from trunk (fvdl)
 1.63.8.3 11-Feb-2001  bouyer Sync with HEAD.
 1.63.8.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.63.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.66.4.2 26-May-2001  he Apply patch (requested by wiz):
Correct typo related to __HAVE_OLD_DISKLABEL changes.
 1.66.4.1 01-May-2001  he Pull up revisions 1.68-1.69 (requested by fvdl):
Increase the number of BSD disklabel partitions on i386 to 16.
 1.70.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.70.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.70.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.70.4.1 03-Aug-2001  lukem update to -current
 1.70.2.9 11-Nov-2002  nathanw Catch up to -current
 1.70.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.70.2.7 17-Sep-2002  nathanw Catch up to -current.
 1.70.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.70.2.5 28-Feb-2002  nathanw Catch up to -current.
 1.70.2.4 11-Jan-2002  nathanw More catchup.
 1.70.2.3 08-Jan-2002  nathanw Catch up to -current.
 1.70.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.70.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.71.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.74.8.2 29-Aug-2002  gehenna catch up with -current.
 1.74.8.1 16-May-2002  gehenna Add the block/character device switches.
 1.84.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.84.2.8 01-Apr-2005  skrll Sync with HEAD.
 1.84.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.84.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.84.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.84.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.84.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.84.2.2 03-Aug-2004  skrll Sync with HEAD
 1.84.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.87.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.87.6.1 12-Feb-2005  yamt sync with head.
 1.87.4.1 29-Apr-2005  kent sync with -current
 1.90.4.5 07-Dec-2007  yamt sync with head
 1.90.4.4 27-Oct-2007  yamt sync with head.
 1.90.4.3 03-Sep-2007  yamt sync with head.
 1.90.4.2 30-Dec-2006  yamt sync with head.
 1.90.4.1 21-Jun-2006  yamt sync with head.
 1.92.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.92.10.1 19-Apr-2006  elad sync with head.
 1.92.8.2 03-Sep-2006  yamt sync with head.
 1.92.8.1 24-May-2006  yamt sync with head.
 1.92.6.1 22-Apr-2006  simonb Sync with head.
 1.92.4.1 09-Sep-2006  rpaulo sync with head
 1.94.4.2 10-Dec-2006  yamt sync with head.
 1.94.4.1 22-Oct-2006  yamt sync with head
 1.94.2.1 18-Nov-2006  ad Sync with head.
 1.96.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.97.4.1 11-Jul-2007  mjf Sync with head.
 1.97.2.7 23-Oct-2007  ad Sync with head.
 1.97.2.6 20-Aug-2007  ad Sync with head.
 1.97.2.5 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.97.2.4 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.97.2.3 15-Jul-2007  ad Sync with head.
 1.97.2.2 01-Jul-2007  ad Adapt to callout API change.
 1.97.2.1 09-Jun-2007  ad Sync with head.
 1.99.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.100.10.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.100.10.1 29-Jul-2007  ad file mcd.c was added on branch matt-mips64 on 2007-07-29 12:50:22 +0000
 1.100.8.1 14-Oct-2007  yamt sync with head.
 1.100.6.2 09-Jan-2008  matt sync with HEAD
 1.100.6.1 06-Nov-2007  matt sync with HEAD
 1.100.4.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.100.4.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.101.2.1 25-Oct-2007  bouyer Sync with HEAD.
 1.102.4.1 08-Dec-2007  ad Sync with head.
 1.102.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.103.12.4 17-Jan-2009  mjf Sync with HEAD.
 1.103.12.3 29-Jun-2008  mjf Sync with HEAD.
 1.103.12.2 02-Jun-2008  mjf Sync with HEAD.
 1.103.12.1 05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.104.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.104.4.2 16-May-2009  yamt sync with head
 1.104.4.1 04-May-2009  yamt sync with head.
 1.104.2.1 17-Jun-2008  yamt sync with head.
 1.105.6.2 28-Apr-2009  skrll Sync with HEAD.
 1.105.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.106.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.109.22.3 03-Dec-2017  jdolecek update from HEAD
 1.109.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.109.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.109.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.109.12.1 30-Oct-2012  yamt sync with head
 1.110.2.1 18-May-2014  rmind sync with head
 1.111.2.1 10-Aug-2014  tls Rebase.
 1.113.4.3 05-Oct-2016  skrll Sync with HEAD
 1.113.4.2 06-Jun-2015  skrll Sync with HEAD
 1.113.4.1 06-Apr-2015  skrll Sync with HEAD
 1.116.18.3 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.116.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.116.18.1 10-Jun-2019  christos Sync with HEAD
 1.116.16.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.116.10.2 21-Jun-2023  martin Pull up following revision(s) (requested by riastradh in ticket #1835):

sys/dev/pci/if_iwi.c: revision 1.117
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.401
sys/dev/scsipi/ses.c: revision 1.52
sys/dev/isa/mcd.c: revision 1.121
(all via patch)

sys/dev: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.

I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
 1.116.10.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.


Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


Add missing initialization of sc_dev.
 1.116.8.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.116.2.2 25-Jul-2016  pgoyette Redo previous
 1.116.2.1 25-Jul-2016  pgoyette Update a few drivers for localcount(9)
 1.118.4.2 03-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1485):

sys/dev/pci/if_iwi.c: revision 1.117
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.401
sys/dev/scsipi/ses.c: revision 1.52
sys/dev/isa/mcd.c: revision 1.121

sys/dev: Memset zero before copyout.

Just in case of uninitialized padding which would lead to kernel
stack disclosure. If the compiler can prove the memset redundant
then it can optimize it away; otherwise better safe than sorry.

I think the iwi(4), mcd(4), and ses(4) changes actually plug leaks;
the raidframe(4) change probably doesn't (but doesn't hurt).
 1.118.4.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.

Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

Add missing initialization of sc_dev.
 1.119.2.1 29-Feb-2020  ad Sync with head.
 1.9 08-Jun-2000  cgd in allegedly-MI code, if we're gonna use '#pragma pack(N)', #pragma pack()
should be used to reset the packing. (#pragma pack(4) was used here
before. "wrong!")
 1.8 04-Apr-1997  christos branches: 1.8.22; 1.8.30;
Busify the driver (from perry).
 1.7 10-Jul-1995  cgd fix from Onno van der Linden for large-file read timeouts on double-speed
drives. A different read command must be used on double-speed drives.
It boggles my mind that people could design hardware this stupid.
 1.6 27-Mar-1995  mycroft Largely rewritten by me, with some input from Dave Burgess. Implement most of
the CDIOC* calls correctly, improve performance by 10x when interrupts work,
and implement the same generic disk framework as other drivers.
Needs some more work.
 1.5 27-Oct-1994  cgd new RCS ID format.
 1.4 21-Feb-1994  mycroft Fix copyright. No code by G. Clark left.
 1.3 21-Feb-1994  mycroft Fixed probe routine from Holger Veit; lots of other cleanup by me.
 1.2 17-Nov-1993  cgd branches: 1.2.2;
added two copyright strings at the request of Gary Clark II
<gclarkii@freefall.cdrom.com>, because he hacked and is in the process
of hacking the code significantly.
 1.1 04-Nov-1993  cgd add mcd: Mitsumi CD driver by Holger Veit and Brian Moore
 1.2.2.1 02-Feb-1994  mycroft Updates from Gary Clark II; may need more work.
 1.8.30.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.22.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.27 08-May-2019  isaki 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.26 09-Apr-2012  plunky branches: 1.26.40; 1.26.44;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.25 05-Apr-2012  plunky move the pmf_device_register() for midi.c and midi_pcppi.c to midi_attach()
for symmetry, since it is removed in midi detach code

and don't need to call device_pmf_is_registered() before registering it
 1.24 23-Nov-2011  jmcneill branches: 1.24.2;
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.23 10-Apr-2009  mlelstv branches: 1.23.12; 1.23.14;
attach and detach do not mix.
Create a new detach function that calls the parent function after
dealing with the private instance counter.
 1.22 08-Apr-2009  dyoung Decrease midi_pcppi_attached when midi at pcppi detaches.
 1.21 07-Apr-2009  dyoung Detach midi at pcppi during shutdown. Sprinkle static.
 1.20 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.19 28-Apr-2008  martin branches: 1.19.8; 1.19.12; 1.19.14;
Remove clause 3 and 4 from TNF licenses
 1.18 05-Mar-2008  cube branches: 1.18.2; 1.18.4;
Fix fallout from midi(4)'s softc split.
 1.17 16-Dec-2007  christos branches: 1.17.2; 1.17.6;
add null pmf handlers.
 1.16 19-Oct-2007  ad branches: 1.16.4; 1.16.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.15 16-Nov-2006  christos branches: 1.15.8; 1.15.22; 1.15.24; 1.15.28;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 30-Jun-2006  chap branches: 1.13.4; 1.13.6;
Ankh-Morpork, we have a MIDI driver....

Merge from chap-midi branch, after
~month for review
Comments by thorpej@ drochner@ and Alexandre Ratchov

Incorporated: points by thorpej@ drochner@; preliminary support for
a stats-collecting ioctl suggested by martin@ from comments by A.R.

PR kern/32441 kern/32442 kern/32567 kern/32588 kern/32694 kern/33590
kern/33614 and one instance of kern/32651

ok martin@
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.8; 1.12.14; 1.12.16;
merge ktrace-lwp.
 1.11 21-Mar-2005  xtraeme branches: 1.11.2;
This needs <machine/bus.h> now.
 1.10 04-Feb-2005  perry de-__P
 1.9 04-Dec-2003  keihan branches: 1.9.8; 1.9.10;
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.8 02-Oct-2002  thorpej branches: 1.8.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 25-Nov-1998  augustss branches: 1.4.22; 1.4.24;
Make the copyright header conform to the NetBSD template.
 1.3 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.2 12-Aug-1998  augustss Shut up after close().
 1.1 12-Aug-1998  augustss Add a MIDI driver for the PC speaker. This is mostly of hack value,
but, hey, lotsa people got a MIDI device now! (A truly pitiful one. :-)
 1.4.24.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.24.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.22.2 18-Oct-2002  nathanw Catch up to -current.
 1.4.22.1 14-Nov-2001  nathanw Catch up to -current.
 1.8.6.5 01-Apr-2005  skrll Sync with HEAD.
 1.8.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.2 26-Mar-2005  yamt sync with head.
 1.9.10.1 12-Feb-2005  yamt sync with head.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.11.2.4 17-Mar-2008  yamt sync with head.
 1.11.2.3 21-Jan-2008  yamt sync with head
 1.11.2.2 27-Oct-2007  yamt sync with head.
 1.11.2.1 30-Dec-2006  yamt sync with head.
 1.12.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.12.14.4 10-Jun-2006  chap Now with support for the following MIDI controls -

Channel Volume
Expression

- the following heretofore unimplemented message -

Pitch Bend

- and the following registered parameters -

Pitch Bend Range
Channel Fine Tuning
Channel Coarse Tuning

Volume and Expression are handled by all synth chip drivers but pcppi
(which has a fixed volume). All of the pitch controls will be effective
(at least for new notes struck after a change) for all current synth
drivers but cms (that driver discards all the fractional pitch bits and
calculates its own frequency by a table lookup; it should be possible to
do better with knowledge of the formula behind the table, but I have
found no cms docs). If a driver provides repitchv and relevelv methods
for changing the pitch/level of a sounding voice, then changes to these
parameters will take effect in real time and not just for subsequent notes.
The effect can be heard (for repitchv) over pcppi.

Heads up: if you build with libprop earlier than 2006.05.28, you can enjoy
the exhilarating experience of seeing kernel memory stomped. ;)
 1.12.14.3 09-Jun-2006  chap Bit of housecleaning.

"miditune" wasn't a good name for the pitch representation (even if it
did come from the MIDI Tuning Specification) because for too many people
a 'tune' is a little ditty, not a single pitch. Changed the name to
midipitch and added a typedef midipitch_t; renamed the associated macros
consistently.

The type and operations on it are now in <sys/midiio.h> because they could
show up in userland for manipulation of the MIDI Tuning messages that
RP-012 defines. The macro MIDIPITCH_TO_HZ18 expands in userland to
ordinary libm calls, and in-kernel to the no-floating-point version in
midisyn. A few more operations are defined in userland where libm is
available.

At the same time, made midipitch_t signed. It has the bits to spare,
and such manipulations as adding several corrections and clamping the
result will be simpler with it signed.
 1.12.14.2 08-Jun-2006  chap Rototill of midisyn <-> synth driver i/f.

The DOALLOC and FREQXLATE flags are on the way out. Whether a driver wants
allocation service is deducible from whether it provides an allocv method, and
anyway none does. As for freq, they all get a miditune and can convert it
whichever way they want.

Controller handling with midictl is hooked in but few controllers watched yet.

Some macros for manipulating the miditune type are currently in midisynvar.h
but should perhaps be exported in midiio.h.

opl no longer has its own master volume state (there was no setter for it
anyway, it never changed); soon that will be handled centrally in midisyn.

Builds a kernel. Not all functionality tested yet.
 1.12.14.1 07-Jun-2006  chap The midisyn clients now use designated initializers so the method
structure can evolve. Only opl currently provides any methods beyond
open/close/note-on/note-off. Only cms takes a note number; the others
want a frequency. This is good because it is much easier that way to
put a common handler for tuning/pitchbend/portamento in midisyn itself.

Next up, axe most methods nobody implements. Split note-on into two
methods, one with a frequency, one with a note number, of which a driver
provides one or the other. So far all of the clients delegate voice
allocation to midisyn, so clarify that the method is getting an actual
voice number for the device and not a MIDI channel. If a device that can
do its own allocation is later to be supported, let appropriate different
methods be added then.
 1.12.8.1 11-Aug-2006  yamt sync with head
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.6.2 10-Dec-2006  yamt sync with head.
 1.13.6.1 22-Oct-2006  yamt sync with head
 1.13.4.1 18-Nov-2006  ad Sync with head.
 1.15.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.15.24.3 23-Mar-2008  matt sync with HEAD
 1.15.24.2 09-Jan-2008  matt sync with HEAD
 1.15.24.1 06-Nov-2007  matt sync with HEAD
 1.15.22.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.15.8.1 23-Oct-2007  ad Sync with head.
 1.16.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.16.4.1 26-Dec-2007  ad Sync with head.
 1.17.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.17.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.2.1 24-Mar-2008  keiichi sync with head.
 1.18.4.2 04-May-2009  yamt sync with head.
 1.18.4.1 16-May-2008  yamt sync with head.
 1.18.2.1 18-May-2008  yamt sync with head.
 1.19.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.12.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.19.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.23.14.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.23.12.1 17-Apr-2012  yamt sync with head
 1.24.2.2 29-Apr-2012  mrg sync to latest -current.
 1.24.2.1 05-Apr-2012  mrg sync to latest -current.
 1.26.44.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.26.40.1 10-Jun-2019  christos Sync with HEAD
 1.23 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.22 24-Apr-2021  thorpej branches: 1.22.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.21 11-Jul-2016  msaitoh branches: 1.21.34;
KNF. No functional change.
 1.20 27-Oct-2012  chs branches: 1.20.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.19 12-May-2009  cegger branches: 1.19.12; 1.19.22;
struct device * -> device_t, no functional changes intended.
 1.18 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.17 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.16 08-Apr-2008  cegger branches: 1.16.4; 1.16.12; 1.16.18;
use aprint_*_dev and device_xname
 1.15 19-Oct-2007  ad branches: 1.15.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 16-Nov-2006  christos branches: 1.14.8; 1.14.22; 1.14.24; 1.14.28;
__unused removal on arguments; approved by core.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 11-Dec-2005  christos branches: 1.12.20; 1.12.22;
merge ktrace-lwp.
 1.11 04-Feb-2005  perry branches: 1.11.6;
de-__P
 1.10 14-Sep-2004  drochner branches: 1.10.4; 1.10.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.9 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.8 27-Oct-2003  chs uninitialized variables.
 1.7 01-Jan-2003  thorpej branches: 1.7.2;
Use aprint_normal() in cfprint routines.
 1.6 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 20-Nov-2000  jdolecek branches: 1.1.2; 1.1.4; 1.1.6;
Add an attachment for MOXA 168P isa multiport card. This code was
written by Christoph Badura.
This was reported to work by user of this code. It's not tested
by me, but it's probably more useful in tree anyway.
 1.1.6.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.5 03-Jan-2003  thorpej Sync with HEAD.
 1.1.4.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.2 11-Jan-2002  nathanw More catchup.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 20-Nov-2000  bouyer file moxa_isa.c was added on branch thorpej_scsipi on 2000-11-22 16:03:47 +0000
 1.7.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.6.1 12-Feb-2005  yamt sync with head.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.6.2 27-Oct-2007  yamt sync with head.
 1.11.6.1 30-Dec-2006  yamt sync with head.
 1.12.22.2 10-Dec-2006  yamt sync with head.
 1.12.22.1 22-Oct-2006  yamt sync with head
 1.12.20.1 18-Nov-2006  ad Sync with head.
 1.14.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.24.1 06-Nov-2007  matt sync with HEAD
 1.14.22.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.14.8.1 23-Oct-2007  ad Sync with head.
 1.15.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.16.4.2 16-May-2009  yamt sync with head
 1.16.4.1 04-May-2009  yamt sync with head.
 1.19.22.2 03-Dec-2017  jdolecek update from HEAD
 1.19.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.12.1 30-Oct-2012  yamt sync with head
 1.20.14.1 05-Oct-2016  skrll Sync with HEAD
 1.21.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.22.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 01-Aug-1999  augustss Move the MPU driver isa/ to ic/.
(I didn't move it in the repository because the revision history
is very short and uninteresting. :)
 1.3 01-Aug-1999  augustss Make an MPU attachment to ISA. Used for old Roland cards. Written
by me and gson@araneus.fi (Andreas Gustafsson).
 1.2 24-Mar-1999  augustss branches: 1.2.4;
Remove leftover definition of AUDIO_DEBUG.
 1.1 22-Mar-1999  mycroft 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.2.4.1 02-Aug-1999  thorpej Update from trunk.
 1.4 22-Mar-1999  mycroft 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.3 25-Nov-1998  augustss Make the copyright header conform to the NetBSD template.
 1.2 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.1 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.4 22-Mar-1999  mycroft 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.3 25-Nov-1998  augustss Make the copyright header conform to the NetBSD template.
 1.2 20-Aug-1998  augustss Add missing __P
 1.1 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.23 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.22 24-Nov-2011  mrg branches: 1.22.8; 1.22.26;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.21 23-Nov-2011  jmcneill 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.20 28-Apr-2008  martin branches: 1.20.12; 1.20.34; 1.20.36;
Remove clause 3 and 4 from TNF licenses
 1.19 01-Apr-2008  xtraeme branches: 1.19.2; 1.19.4;
Fix fallout from device_t/softc split to mpu(4):
always pass the mpu_softc to mpu_intr(). Found by Takeshi Nakayama.
 1.18 27-Mar-2008  xtraeme Split device_t/softc for mpu(4) and its attachments, plus other
related cosmetic changes.

Reviewed by cube@.
 1.17 19-Oct-2007  ad branches: 1.17.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.16 16-Nov-2006  christos branches: 1.16.8; 1.16.22; 1.16.24; 1.16.28;
__unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 11-Dec-2005  christos branches: 1.14.20; 1.14.22;
merge ktrace-lwp.
 1.13 27-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 04-Feb-2005  perry de-__P
 1.11 02-Dec-2004  xtraeme branches: 1.11.4; 1.11.6;
Add ACPI mpu(4) attachment, based on lpt_acpi.c by jmcneill@,
reviewed by christos@, cube@ and martin@.

While here, remove a printf() in mpu_attach() (ic/mpu.c) to remove
an empty line in some frontends (mpu_isa.c, etc).
 1.10 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.8 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 05-Aug-1999  augustss branches: 1.4.14; 1.4.16;
Make this file compile again.
 1.3 02-Aug-1999  augustss branches: 1.3.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.2 01-Aug-1999  augustss Move the MPU driver isa/ to ic/.
(I didn't move it in the repository because the revision history
is very short and uninteresting. :)
 1.1 01-Aug-1999  augustss Make an MPU attachment to ISA. Used for old Roland cards. Written
by me and gson@araneus.fi (Andreas Gustafsson).
 1.3.2.2 02-Aug-1999  thorpej Update from trunk.
 1.3.2.1 02-Aug-1999  thorpej file mpu_isa.c was added on branch chs-ubc2 on 1999-08-02 21:59:29 +0000
 1.4.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.14.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.14.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.14.2 11-Jan-2002  nathanw More catchup.
 1.4.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.9.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.9.6.3 18-Dec-2004  skrll Sync with HEAD.
 1.9.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.6.1 12-Feb-2005  yamt sync with head.
 1.11.4.1 29-Apr-2005  kent sync with -current
 1.13.4.2 27-Oct-2007  yamt sync with head.
 1.13.4.1 30-Dec-2006  yamt sync with head.
 1.14.22.2 10-Dec-2006  yamt sync with head.
 1.14.22.1 22-Oct-2006  yamt sync with head
 1.14.20.1 18-Nov-2006  ad Sync with head.
 1.16.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.16.24.1 06-Nov-2007  matt sync with HEAD
 1.16.22.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.16.8.1 23-Oct-2007  ad Sync with head.
 1.17.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.17.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.4.1 16-May-2008  yamt sync with head.
 1.19.2.1 18-May-2008  yamt sync with head.
 1.20.36.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.20.34.1 17-Apr-2012  yamt sync with head
 1.20.12.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.22.26.1 05-Oct-2016  skrll Sync with HEAD
 1.22.8.1 03-Dec-2017  jdolecek update from HEAD
 1.17 08-May-2019  isaki 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.16 23-Nov-2011  jmcneill branches: 1.16.50; 1.16.54;
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.15 28-Apr-2008  martin branches: 1.15.12; 1.15.34; 1.15.36;
Remove clause 3 and 4 from TNF licenses
 1.14 27-Mar-2008  xtraeme branches: 1.14.2; 1.14.4;
Split device_t/softc for mpu(4) and its attachments, plus other
related cosmetic changes.

Reviewed by cube@.
 1.13 15-Mar-2008  cube Split device_t and softc for sb(4) and all its attachments.
 1.12 19-Oct-2007  ad branches: 1.12.12; 1.12.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.11 16-Nov-2006  christos branches: 1.11.8; 1.11.22; 1.11.24; 1.11.28;
__unused removal on arguments; approved by core.
 1.10 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.9 11-Dec-2005  christos branches: 1.9.20; 1.9.22;
merge ktrace-lwp.
 1.8 04-Feb-2005  perry branches: 1.8.6;
de-__P
 1.7 02-Dec-2004  xtraeme branches: 1.7.4; 1.7.6;
Add ACPI mpu(4) attachment, based on lpt_acpi.c by jmcneill@,
reviewed by christos@, cube@ and martin@.

While here, remove a printf() in mpu_attach() (ic/mpu.c) to remove
an empty line in some frontends (mpu_isa.c, etc).
 1.6 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.5 02-Oct-2002  thorpej branches: 1.5.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.4 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 04-Aug-1999  augustss branches: 1.1.14; 1.1.16;
Add another file I forgot in my MPU changes.
 1.1.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.14.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.5.6.5 04-Feb-2005  skrll Sync with HEAD.
 1.5.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 12-Feb-2005  yamt sync with head.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.6.3 17-Mar-2008  yamt sync with head.
 1.8.6.2 27-Oct-2007  yamt sync with head.
 1.8.6.1 30-Dec-2006  yamt sync with head.
 1.9.22.2 10-Dec-2006  yamt sync with head.
 1.9.22.1 22-Oct-2006  yamt sync with head
 1.9.20.1 18-Nov-2006  ad Sync with head.
 1.11.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.11.24.2 23-Mar-2008  matt sync with HEAD
 1.11.24.1 06-Nov-2007  matt sync with HEAD
 1.11.22.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.11.8.1 23-Oct-2007  ad Sync with head.
 1.12.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.12.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.12.1 24-Mar-2008  keiichi sync with head.
 1.14.4.1 16-May-2008  yamt sync with head.
 1.14.2.1 18-May-2008  yamt sync with head.
 1.15.36.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.15.34.1 17-Apr-2012  yamt sync with head
 1.15.12.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.16.54.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.16.50.1 10-Jun-2019  christos Sync with HEAD
 1.17 08-May-2019  isaki 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.16 23-Nov-2011  jmcneill branches: 1.16.50; 1.16.54;
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.15 28-Apr-2008  martin branches: 1.15.12; 1.15.34; 1.15.36;
Remove clause 3 and 4 from TNF licenses
 1.14 27-Mar-2008  xtraeme branches: 1.14.2; 1.14.4;
Split device_t/softc for mpu(4) and its attachments, plus other
related cosmetic changes.

Reviewed by cube@.
 1.13 19-Oct-2007  ad branches: 1.13.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.12 16-Nov-2006  christos branches: 1.12.8; 1.12.22; 1.12.24; 1.12.28;
__unused removal on arguments; approved by core.
 1.11 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.22;
merge ktrace-lwp.
 1.9 04-Feb-2005  perry branches: 1.9.6;
de-__P
 1.8 02-Dec-2004  xtraeme branches: 1.8.4; 1.8.6;
Add ACPI mpu(4) attachment, based on lpt_acpi.c by jmcneill@,
reviewed by christos@, cube@ and martin@.

While here, remove a printf() in mpu_attach() (ic/mpu.c) to remove
an empty line in some frontends (mpu_isa.c, etc).
 1.7 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.6 02-Oct-2002  thorpej branches: 1.6.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 10-Mar-2002  itohy Add explicit support of OPL3-SA2 (YMF711).
Not well tested....
 1.2 13-Nov-2001  lukem add RCSID
 1.1 05-Oct-1999  itohy branches: 1.1.12; 1.1.14; 1.1.16;
"mpu at ym" attachment glue for making use of
Roland MPU401 compatible MIDI port on Yamaha OPL3-SA3.
 1.1.16.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.16.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.14.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.14.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.12.1 27-Mar-2002  he Pull up revisions 1.2-1.3 (requested by itohy):
Several changes to wss-compatible audio devices:
o Fix ADPCM playback/recording
o Add explicit support for OPL3-SA2 (YMF711), fixes PR#14819
o Add AD1845 support
o other minor bugfixes and cleanups
 1.6.6.5 04-Feb-2005  skrll Sync with HEAD.
 1.6.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.6.1 12-Feb-2005  yamt sync with head.
 1.8.4.1 29-Apr-2005  kent sync with -current
 1.9.6.2 27-Oct-2007  yamt sync with head.
 1.9.6.1 30-Dec-2006  yamt sync with head.
 1.10.22.2 10-Dec-2006  yamt sync with head.
 1.10.22.1 22-Oct-2006  yamt sync with head
 1.10.20.1 18-Nov-2006  ad Sync with head.
 1.12.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.12.24.1 06-Nov-2007  matt sync with HEAD
 1.12.22.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.12.8.1 23-Oct-2007  ad Sync with head.
 1.13.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.13.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.14.4.1 16-May-2008  yamt sync with head.
 1.14.2.1 18-May-2008  yamt sync with head.
 1.15.36.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.15.34.1 17-Apr-2012  yamt sync with head
 1.15.12.1 12-Dec-2008  ad Checkpoint work in progress.
 1.16.54.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.16.50.1 10-Jun-2019  christos Sync with HEAD
 1.3 01-Aug-1999  augustss Move the MPU driver isa/ to ic/.
(I didn't move it in the repository because the revision history
is very short and uninteresting. :)
 1.2 01-Aug-1999  augustss Make an MPU attachment to ISA. Used for old Roland cards. Written
by me and gson@araneus.fi (Andreas Gustafsson).
 1.1 22-Mar-1999  mycroft branches: 1.1.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.1.4.1 02-Aug-1999  thorpej Update from trunk.
 1.4 18-Mar-2000  mycroft Move some code around in preparation for nca_pcmcia.
 1.3 19-Nov-1998  thorpej branches: 1.3.10;
Adapt to the new scsipi_adapter interface.
 1.2 25-Oct-1998  scottr Replace architecture-dependent tag/handle field names with
architecture-independent versions.
 1.1 25-Oct-1998  christos PR/6274: John Ruschmeyer: Add isa/i386 ncr53c80 driver.
XXX: Needs work. We need to fix the probe/find goo, and add support for the
pas16 cards.
 1.3.10.2 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.3.10.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.22 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.21 28-Apr-2008  martin branches: 1.21.34; 1.21.44;
Remove clause 3 and 4 from TNF licenses
 1.20 04-Apr-2008  tsutsui branches: 1.20.2; 1.20.4;
Split device_t/softc for more ncr5380sbc variants, with related changes.
 1.19 19-Oct-2007  ad branches: 1.19.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.18 16-Nov-2006  christos branches: 1.18.8; 1.18.22; 1.18.24; 1.18.28;
__unused removal on arguments; approved by core.
 1.17 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.16 11-Dec-2005  christos branches: 1.16.20; 1.16.22;
merge ktrace-lwp.
 1.15 27-Feb-2005  perry branches: 1.15.4;
nuke trailing whitespace
 1.14 04-Feb-2005  perry de-__P
 1.13 14-Sep-2004  drochner branches: 1.13.4; 1.13.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.12 02-Oct-2002  thorpej branches: 1.12.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.11 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.8 13-Nov-2001  lukem add RCSID
 1.7 25-Apr-2001  bouyer branches: 1.7.2;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.6 25-Mar-2000  tsutsui branches: 1.6.6; 1.6.8;
Add a "sc_rev" member to ncr5380_softc and handle CXD1180 quirk
in MI ncr5380sbc.
 1.5 18-Mar-2000  mycroft Change footprint of ncr5380_intr() to match normal interrupt handler usage.
 1.4 18-Mar-2000  mycroft GC.
 1.3 18-Mar-2000  mycroft Add a ncr5380_attach() routine which does part of the initialization, attaches
the scsibus, and does the addref/delref dance.
 1.2 18-Mar-2000  mycroft nca -> nca_isa
 1.1 18-Mar-2000  mycroft Move some code around in preparation for nca_pcmcia.
 1.6.8.5 18-Oct-2002  nathanw Catch up to -current.
 1.6.8.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.8.3 11-Jan-2002  nathanw More catchup.
 1.6.8.2 14-Nov-2001  nathanw Catch up to -current.
 1.6.8.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.6.1 25-Mar-2000  bouyer file nca_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:19 +0000
 1.7.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.12.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.13.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.6.1 12-Feb-2005  yamt sync with head.
 1.13.4.1 29-Apr-2005  kent sync with -current
 1.15.4.2 27-Oct-2007  yamt sync with head.
 1.15.4.1 30-Dec-2006  yamt sync with head.
 1.16.22.2 10-Dec-2006  yamt sync with head.
 1.16.22.1 22-Oct-2006  yamt sync with head
 1.16.20.1 18-Nov-2006  ad Sync with head.
 1.18.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.18.24.1 06-Nov-2007  matt sync with HEAD
 1.18.22.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.18.8.1 23-Oct-2007  ad Sync with head.
 1.19.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.4.1 16-May-2008  yamt sync with head.
 1.20.2.1 18-May-2008  yamt sync with head.
 1.21.44.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.21.34.1 30-Oct-2012  yamt sync with head
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file nca_isa.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file nca_isa.c.rej was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3 18-Mar-2000  mycroft GC.
 1.2 18-Mar-2000  mycroft nca -> nca_isa
 1.1 18-Mar-2000  mycroft Move some code around in preparation for nca_pcmcia.
 1.2 18-Mar-2000  mycroft Move some code around in preparation for nca_pcmcia.
 1.1 25-Oct-1998  christos branches: 1.1.12;
PR/6274: John Ruschmeyer: Add isa/i386 ncr53c80 driver.
XXX: Needs work. We need to fix the probe/find goo, and add support for the
pas16 cards.
 1.1.12.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.4 18-Mar-2000  mycroft Move some code around in preparation for nca_pcmcia.
 1.3 19-Feb-1999  mycroft branches: 1.3.8;
Kill vestiges of isa_establish().
 1.2 25-Oct-1998  scottr Remove unused sc_iot/sc_ioh fields.
 1.1 25-Oct-1998  christos PR/6274: John Ruschmeyer: Add isa/i386 ncr53c80 driver.
XXX: Needs work. We need to fix the probe/find goo, and add support for the
pas16 cards.
 1.3.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.5 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.4 24-Apr-2021  thorpej branches: 1.4.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.3 01-Apr-2020  ad branches: 1.3.4; 1.3.8;
Newer PC Engines BIOS versions don't set up the Super I/O for GPIO the
way we want so ignore most of the existing settings and enable banks 0
and 1.
 1.2 16-Nov-2019  martin PR port-i386/54701: deal with missing pmf platform keys.
 1.1 25-Oct-2019  martin Add support for Nuvoton NCT5104D GPIO chips, as found on PC Engines APU
systems. From Andrew Doran in PR kern/54648.
 1.3.8.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.3.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.4.1 01-Apr-2020  martin file nct.c was added on branch phil-wifi on 2020-04-13 08:04:22 +0000
 1.4.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.34 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.33 24-Apr-2021  thorpej branches: 1.33.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.32 29-Mar-2017  msaitoh branches: 1.32.30;
Fix 0x%d and 0x%u.
 1.31 23-Apr-2015  pgoyette branches: 1.31.2; 1.31.4;
Update module dependencies for all the existing modules that depend on sysmon components.
 1.30 15-Jul-2011  jmcneill branches: 1.30.12; 1.30.30;
add module support
 1.29 20-Jun-2011  pgoyette Initialize sensors states before registering.
 1.28 12-Nov-2008  ad branches: 1.28.14;
Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.27 04-Apr-2008  xtraeme branches: 1.27.4; 1.27.10; 1.27.12;
Fix fallout from previous commit.
 1.26 04-Apr-2008  xtraeme Split device_t/softc and other related cosmetic changes.
 1.25 02-Jan-2008  dyoung branches: 1.25.6;
Improve device detach routine. Now I can detach nsclpcsio0 and
its children.

Fix an off-by-one bug in the sensor initialization which stopped
it from completing.

Extract sensor initialization into a new subroutine. If there is
an error while initializing sensors, do not let sc_sme dangle.
 1.24 02-Jan-2008  dyoung Cosmetic: fix indentation.
 1.23 05-Dec-2007  ad branches: 1.23.4;
Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
 1.22 16-Nov-2007  xtraeme branches: 1.22.2;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.21 09-Nov-2007  xtraeme Add support for the VMS logical device on nsclpcsio(4) and clean up
the code. This provides 14 voltage sensors in addition to the previous
3 temperature sensors supported in the TMS logical device.

Adapted from OpenBSD, tested by dyoung.
 1.20 19-Oct-2007  ad branches: 1.20.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.19 09-Sep-2007  xtraeme branches: 1.19.4;
Add the detach method and don't bother with gpio in the LKM for now.
 1.18 02-Sep-2007  xtraeme Do not enable monitoring for the sensors... if somebody wants this,
it may be enabled via userland.
 1.17 01-Jul-2007  xtraeme branches: 1.17.2; 1.17.6; 1.17.8;
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.16 18-Feb-2007  xtraeme branches: 1.16.4; 1.16.6;
Replace simple_locks with mutexes, reviewed by ad@.
 1.15 16-Nov-2006  christos branches: 1.15.4;
__unused removal on arguments; approved by core.
 1.14 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.13 11-Dec-2005  christos branches: 1.13.20; 1.13.22;
merge ktrace-lwp.
 1.12 11-Oct-2005  drochner -put gpio stuff inside #if NGPIO > 0
-kill gba_name in attach arg, specify interface attribute
 1.11 27-Sep-2005  jmcneill Attach to gpiobus. From OpenBSD.
 1.10 29-Jul-2005  drochner complete attachment if the temperature monotor was successfully awoken,
minor whitespace fixes
 1.9 29-Jul-2005  drochner activate the temperature sensors if the device is in standby mode
on attach (as on Soekris boards), from Aaron Hodgen per PR kern/23598
 1.8 27-Feb-2005  perry branches: 1.8.2; 1.8.4;
nuke trailing whitespace
 1.7 04-Feb-2005  perry de-__P
 1.6 14-Sep-2004  drochner branches: 1.6.4; 1.6.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.5 22-Oct-2002  drochner branches: 1.5.6;
-fix script botch from CFATTACH_DECL introduction
-while here, spotted probe error: we shouldn't try other locations if the
base address is nailed down per locator
 1.4 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.3 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 17-Jul-2002  drochner branches: 1.1.2; 1.1.4; 1.1.6;
adda driver to read the temerature sensors on a NSC PC87366 Super IO chip
(the chip provides voltage / fan rpm control too, but we don't care yet)
 1.1.6.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 17-Jul-2002  jdolecek file nsclpcsio_isa.c was added on branch kqueue on 2002-09-06 08:44:51 +0000
 1.1.4.4 11-Nov-2002  nathanw Catch up to -current
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 17-Jul-2002  nathanw file nsclpcsio_isa.c was added on branch nathanw_sa on 2002-08-01 02:44:57 +0000
 1.1.2.2 20-Jul-2002  gehenna catch up with -current.
 1.1.2.1 17-Jul-2002  gehenna file nsclpcsio_isa.c was added on branch gehenna-devsw on 2002-07-20 11:35:08 +0000
 1.5.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.5.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.6.1 12-Feb-2005  yamt sync with head.
 1.6.4.1 29-Apr-2005  kent sync with -current
 1.8.4.8 21-Jan-2008  yamt sync with head
 1.8.4.7 07-Dec-2007  yamt sync with head
 1.8.4.6 15-Nov-2007  yamt sync with head.
 1.8.4.5 27-Oct-2007  yamt sync with head.
 1.8.4.4 03-Sep-2007  yamt sync with head.
 1.8.4.3 26-Feb-2007  yamt sync with head.
 1.8.4.2 30-Dec-2006  yamt sync with head.
 1.8.4.1 21-Jun-2006  yamt sync with head.
 1.8.2.2 04-Aug-2005  tron Pull up revision 1.10 (requested by drochner in ticket #640):
complete attachment if the temperature monotor was successfully awoken,
minor whitespace fixes
 1.8.2.1 04-Aug-2005  tron Pull up revision 1.9 (requested by drochner in ticket #640):
activate the temperature sensors if the device is in standby mode
on attach (as on Soekris boards), from Aaron Hodgen per PR kern/23598
 1.13.22.2 10-Dec-2006  yamt sync with head.
 1.13.22.1 22-Oct-2006  yamt sync with head
 1.13.20.1 18-Nov-2006  ad Sync with head.
 1.15.4.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.16.6.1 11-Jul-2007  mjf Sync with head.
 1.16.4.3 23-Oct-2007  ad Sync with head.
 1.16.4.2 09-Oct-2007  ad Sync with head.
 1.16.4.1 15-Jul-2007  ad Sync with head.
 1.17.8.2 09-Jan-2008  matt sync with HEAD
 1.17.8.1 06-Nov-2007  matt sync with HEAD
 1.17.6.6 09-Dec-2007  jmcneill Sync with HEAD.
 1.17.6.5 21-Nov-2007  joerg Sync with HEAD.
 1.17.6.4 11-Nov-2007  joerg Sync with HEAD.
 1.17.6.3 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.17.6.2 02-Oct-2007  joerg Sync with HEAD.
 1.17.6.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.17.2.2 10-Sep-2007  skrll Sync with HEAD.
 1.17.2.1 03-Sep-2007  skrll Sync with HEAD.
 1.19.4.3 18-Nov-2007  bouyer Sync with HEAD
 1.19.4.2 13-Nov-2007  bouyer Sync with HEAD
 1.19.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.20.2.3 18-Feb-2008  mjf Sync with HEAD.
 1.20.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.20.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.22.2.1 08-Dec-2007  ad Sync with head.
 1.23.4.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.25.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.27.4.1 04-May-2009  yamt sync with head.
 1.28.14.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.30.30.2 28-Aug-2017  skrll Sync with HEAD
 1.30.30.1 06-Jun-2015  skrll Sync with HEAD
 1.30.12.1 03-Dec-2017  jdolecek update from HEAD
 1.31.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.31.2.1 26-Apr-2017  pgoyette Sync with HEAD
 1.32.30.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.33.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20 24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.19 08-May-2019  isaki 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.18 09-Apr-2012  plunky branches: 1.18.40; 1.18.44;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.17 23-Nov-2011  jmcneill branches: 1.17.2;
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.16 28-Apr-2008  martin branches: 1.16.12; 1.16.34; 1.16.36;
Remove clause 3 and 4 from TNF licenses
 1.15 15-Mar-2008  cube branches: 1.15.2; 1.15.4;
Split device_t and softc for opl(4). That should have been done along with
midi(4), because opl_softc embed a midi_softc.
Fixes PR#38242 by Onno van der Linden.
 1.14 19-Oct-2007  ad branches: 1.14.12; 1.14.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 16-Nov-2006  christos branches: 1.13.8; 1.13.22; 1.13.24; 1.13.28;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 09-Jun-2006  christos branches: 1.11.6; 1.11.8;
stack police: Introduce an opl_match function that uses malloc instead of
allocating ~2K of softc on the stack.
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.8; 1.10.14;
merge ktrace-lwp.
 1.9 04-Feb-2005  perry branches: 1.9.6;
de-__P
 1.8 02-Oct-2002  thorpej branches: 1.8.6; 1.8.14; 1.8.16;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 13-Apr-1999  augustss branches: 1.4.14; 1.4.16;
Make copyrights conform.
 1.3 08-Dec-1998  augustss branches: 1.3.4;
Make the OPL information string more informative.
 1.2 26-Aug-1998  augustss Make the OPL driver turn on the sound on sound cards that require it.
That makes it much more likely that we get any sound. DUH!
 1.1 25-Aug-1998  augustss Attach the OPL FM synth to the ESS driver.
It probes, but alas, no sound.
 1.3.4.1 16-Apr-1999  augustss branches: 1.3.4.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.3.4.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.4.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.14.2 18-Oct-2002  nathanw Catch up to -current.
 1.4.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.8.16.1 12-Feb-2005  yamt sync with head.
 1.8.14.1 29-Apr-2005  kent sync with -current
 1.8.6.1 04-Feb-2005  skrll Sync with HEAD.
 1.9.6.4 17-Mar-2008  yamt sync with head.
 1.9.6.3 27-Oct-2007  yamt sync with head.
 1.9.6.2 30-Dec-2006  yamt sync with head.
 1.9.6.1 21-Jun-2006  yamt sync with head.
 1.10.14.1 19-Jun-2006  chap Sync with head.
 1.10.8.1 26-Jun-2006  yamt sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.8.2 10-Dec-2006  yamt sync with head.
 1.11.8.1 22-Oct-2006  yamt sync with head
 1.11.6.1 18-Nov-2006  ad Sync with head.
 1.13.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.24.2 23-Mar-2008  matt sync with HEAD
 1.13.24.1 06-Nov-2007  matt sync with HEAD
 1.13.22.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.13.8.1 23-Oct-2007  ad Sync with head.
 1.14.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.14.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.14.12.1 24-Mar-2008  keiichi sync with head.
 1.15.4.1 16-May-2008  yamt sync with head.
 1.15.2.1 18-May-2008  yamt sync with head.
 1.16.36.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.16.34.1 17-Apr-2012  yamt sync with head
 1.16.12.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.17.2.1 29-Apr-2012  mrg sync to latest -current.
 1.18.44.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.18.40.1 10-Jun-2019  christos Sync with HEAD
 1.23 24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.22 08-May-2019  isaki 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.21 09-Apr-2012  plunky branches: 1.21.40; 1.21.44;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.20 23-Nov-2011  jmcneill branches: 1.20.2;
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.19 28-Apr-2008  martin branches: 1.19.12; 1.19.34; 1.19.36;
Remove clause 3 and 4 from TNF licenses
 1.18 15-Mar-2008  cube branches: 1.18.2; 1.18.4;
Split device_t and softc for opl(4). That should have been done along with
midi(4), because opl_softc embed a midi_softc.
Fixes PR#38242 by Onno van der Linden.
 1.17 19-Oct-2007  ad branches: 1.17.12; 1.17.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.16 16-Nov-2006  christos branches: 1.16.8; 1.16.22; 1.16.24; 1.16.28;
__unused removal on arguments; approved by core.
 1.15 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.14 18-Jun-2006  chap branches: 1.14.4; 1.14.6;
Not related to chap-midi branch; corrects two compilation errors induced
by a stack-police commit to the HEAD. (Is this why so many comments about
catching up with -current say "here we go again"?)
 1.13 09-Jun-2006  christos branches: 1.13.2;
stack police: Introduce an opl_match function that uses malloc instead of
allocating ~2K of softc on the stack.
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.8; 1.12.14;
merge ktrace-lwp.
 1.11 04-Feb-2005  perry branches: 1.11.6;
de-__P
 1.10 14-Sep-2004  drochner branches: 1.10.4; 1.10.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.8 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 26-Feb-2000  thorpej branches: 1.4.6; 1.4.8;
Fill in the softc's bus space tag (OOPS!).
 1.3 14-Aug-1999  drochner branches: 1.3.2;
make it report the correct ISA port range
 1.2 13-Apr-1999  augustss Make copyrights conform.
 1.1 26-Aug-1998  augustss branches: 1.1.6;
Make the OPL driver attach directly to ISA as well.
 1.1.6.1 16-Apr-1999  augustss branches: 1.1.6.1.2;
Make a bunch of copyright headers conform to the standard.
Pullup approved by Perry.
 1.1.6.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.6.2 11-Jan-2002  nathanw More catchup.
 1.4.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.9.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.9.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 12-Feb-2005  yamt sync with head.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.6.4 17-Mar-2008  yamt sync with head.
 1.11.6.3 27-Oct-2007  yamt sync with head.
 1.11.6.2 30-Dec-2006  yamt sync with head.
 1.11.6.1 21-Jun-2006  yamt sync with head.
 1.12.14.1 19-Jun-2006  chap Sync with head.
 1.12.8.1 26-Jun-2006  yamt sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.13.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.14.6.2 10-Dec-2006  yamt sync with head.
 1.14.6.1 22-Oct-2006  yamt sync with head
 1.14.4.1 18-Nov-2006  ad Sync with head.
 1.16.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.16.24.2 23-Mar-2008  matt sync with HEAD
 1.16.24.1 06-Nov-2007  matt sync with HEAD
 1.16.22.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.16.8.1 23-Oct-2007  ad Sync with head.
 1.17.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.17.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.12.1 24-Mar-2008  keiichi sync with head.
 1.18.4.1 16-May-2008  yamt sync with head.
 1.18.2.1 18-May-2008  yamt sync with head.
 1.19.36.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.19.34.1 17-Apr-2012  yamt sync with head
 1.19.12.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.20.2.1 29-Apr-2012  mrg sync to latest -current.
 1.21.44.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.21.40.1 10-Jun-2019  christos Sync with HEAD
 1.22 24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.21 08-May-2019  isaki 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.20 09-Apr-2012  plunky branches: 1.20.40; 1.20.44;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.19 23-Nov-2011  jmcneill branches: 1.19.2;
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.18 28-Apr-2008  martin branches: 1.18.12; 1.18.34; 1.18.36;
Remove clause 3 and 4 from TNF licenses
 1.17 15-Mar-2008  cube branches: 1.17.2; 1.17.4;
Split device_t and softc for opl(4). That should have been done along with
midi(4), because opl_softc embed a midi_softc.
Fixes PR#38242 by Onno van der Linden.
 1.16 15-Mar-2008  cube Split device_t and softc for sb(4) and all its attachments.
 1.15 19-Oct-2007  ad branches: 1.15.12; 1.15.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 16-Nov-2006  christos branches: 1.14.8; 1.14.22; 1.14.24; 1.14.28;
__unused removal on arguments; approved by core.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 09-Jun-2006  christos branches: 1.12.6; 1.12.8;
stack police: Introduce an opl_match function that uses malloc instead of
allocating ~2K of softc on the stack.
 1.11 11-Dec-2005  christos branches: 1.11.4; 1.11.8; 1.11.14;
merge ktrace-lwp.
 1.10 04-Feb-2005  perry branches: 1.10.6;
de-__P
 1.9 04-Dec-2003  keihan branches: 1.9.8; 1.9.10;
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.8 02-Oct-2002  thorpej branches: 1.8.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 08-Dec-1998  augustss branches: 1.4.22; 1.4.24;
Make the OPL information string more informative.
 1.3 25-Nov-1998  augustss Make the copyright header conform to the NetBSD template.
 1.2 26-Aug-1998  augustss Make the OPL driver turn on the sound on sound cards that require it.
That makes it much more likely that we get any sound. DUH!
 1.1 18-Aug-1998  augustss Add forgotten OPL file.
 1.4.24.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.24.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.22.2 18-Oct-2002  nathanw Catch up to -current.
 1.4.22.1 14-Nov-2001  nathanw Catch up to -current.
 1.8.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.1 12-Feb-2005  yamt sync with head.
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.6.4 17-Mar-2008  yamt sync with head.
 1.10.6.3 27-Oct-2007  yamt sync with head.
 1.10.6.2 30-Dec-2006  yamt sync with head.
 1.10.6.1 21-Jun-2006  yamt sync with head.
 1.11.14.1 19-Jun-2006  chap Sync with head.
 1.11.8.1 26-Jun-2006  yamt sync with head.
 1.11.4.1 09-Sep-2006  rpaulo sync with head
 1.12.8.2 10-Dec-2006  yamt sync with head.
 1.12.8.1 22-Oct-2006  yamt sync with head
 1.12.6.1 18-Nov-2006  ad Sync with head.
 1.14.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.24.2 23-Mar-2008  matt sync with HEAD
 1.14.24.1 06-Nov-2007  matt sync with HEAD
 1.14.22.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.14.8.1 23-Oct-2007  ad Sync with head.
 1.15.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.15.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.15.12.1 24-Mar-2008  keiichi sync with head.
 1.17.4.1 16-May-2008  yamt sync with head.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.18.36.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.18.34.1 17-Apr-2012  yamt sync with head
 1.18.12.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.19.2.1 29-Apr-2012  mrg sync to latest -current.
 1.20.44.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.20.40.1 10-Jun-2019  christos Sync with HEAD
 1.17 24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.16 08-May-2019  isaki 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.15 09-Apr-2012  plunky branches: 1.15.40; 1.15.44;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.14 07-Dec-2011  jakllsch Initialize the opl softc lock pointer to the parent's interrupt lock.
Briefly tested only on wss@isapnp.
 1.13 28-Apr-2008  martin branches: 1.13.34; 1.13.38;
Remove clause 3 and 4 from TNF licenses
 1.12 15-Mar-2008  cube branches: 1.12.2; 1.12.4;
Split device_t and softc for opl(4). That should have been done along with
midi(4), because opl_softc embed a midi_softc.
Fixes PR#38242 by Onno van der Linden.
 1.11 19-Oct-2007  ad branches: 1.11.12; 1.11.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.10 16-Nov-2006  christos branches: 1.10.8; 1.10.22; 1.10.24; 1.10.28;
__unused removal on arguments; approved by core.
 1.9 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.8 09-Jun-2006  christos branches: 1.8.6; 1.8.8;
stack police: Introduce an opl_match function that uses malloc instead of
allocating ~2K of softc on the stack.
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.8; 1.7.14;
merge ktrace-lwp.
 1.6 04-Feb-2005  perry branches: 1.6.6;
de-__P
 1.5 02-Oct-2002  thorpej branches: 1.5.6; 1.5.14; 1.5.16;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.4 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 14-Aug-1999  augustss branches: 1.1.14; 1.1.16;
Implement opl at wss.
 1.1.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.14.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.5.16.1 12-Feb-2005  yamt sync with head.
 1.5.14.1 29-Apr-2005  kent sync with -current
 1.5.6.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.6.4 17-Mar-2008  yamt sync with head.
 1.6.6.3 27-Oct-2007  yamt sync with head.
 1.6.6.2 30-Dec-2006  yamt sync with head.
 1.6.6.1 21-Jun-2006  yamt sync with head.
 1.7.14.1 19-Jun-2006  chap Sync with head.
 1.7.8.1 26-Jun-2006  yamt sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.8.2 10-Dec-2006  yamt sync with head.
 1.8.8.1 22-Oct-2006  yamt sync with head
 1.8.6.1 18-Nov-2006  ad Sync with head.
 1.10.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.10.24.2 23-Mar-2008  matt sync with HEAD
 1.10.24.1 06-Nov-2007  matt sync with HEAD
 1.10.22.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.10.8.1 23-Oct-2007  ad Sync with head.
 1.11.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.11.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.12.1 24-Mar-2008  keiichi sync with head.
 1.12.4.1 16-May-2008  yamt sync with head.
 1.12.2.1 18-May-2008  yamt sync with head.
 1.13.38.2 29-Apr-2012  mrg sync to latest -current.
 1.13.38.1 18-Feb-2012  mrg merge to -current.
 1.13.34.1 17-Apr-2012  yamt sync with head
 1.15.44.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.15.40.1 10-Jun-2019  christos Sync with HEAD
 1.20 24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.19 08-May-2019  isaki 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.18 09-Apr-2012  plunky branches: 1.18.40; 1.18.44;
Tidy up a little, the way that midi attachment code works

- change midi_attach() to omit the 'parent' arg (there are
only two callers of this and it is not used)

- change midisyn_attach() to midisyn_init(), so not needing a midi_softc,
and fix the midi_pcppi driver to set hw_if and hw_hdl directly in
its midi_softc before calling midi_attach()

- add a device_t to opl_softc structure, change opl drivers to store
the device 'self' in opl_softc and fix opl_attach() to use this
opl_softc->dev field directly rather than a field in an otherwise
unused midi_softc

- remove unnecessary midi_softc from opl and cms drivers (child device
provides that)

reviewed by mrg
 1.17 07-Dec-2011  jakllsch Initialize the opl softc lock pointer to the parent's interrupt lock.
Briefly tested only on wss@isapnp.
 1.16 28-Apr-2008  martin branches: 1.16.34; 1.16.38;
Remove clause 3 and 4 from TNF licenses
 1.15 15-Mar-2008  cube branches: 1.15.2; 1.15.4;
Split device_t and softc for opl(4). That should have been done along with
midi(4), because opl_softc embed a midi_softc.
Fixes PR#38242 by Onno van der Linden.
 1.14 19-Oct-2007  ad branches: 1.14.12; 1.14.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 16-Nov-2006  christos branches: 1.13.8; 1.13.22; 1.13.24; 1.13.28;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 08-Jul-2006  christos branches: 1.11.4; 1.11.6;
Fix use the proper ioh.
 1.10 09-Jun-2006  christos branches: 1.10.2;
stack police: Introduce an opl_match function that uses malloc instead of
allocating ~2K of softc on the stack.
 1.9 11-Dec-2005  christos branches: 1.9.4; 1.9.8; 1.9.14;
merge ktrace-lwp.
 1.8 04-Feb-2005  perry branches: 1.8.6;
de-__P
 1.7 22-Apr-2004  itojun branches: 1.7.4; 1.7.6;
sprintf -> snprintf
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 10-Mar-2002  itohy Add explicit support of OPL3-SA2 (YMF711).
Not well tested....
 1.2 13-Nov-2001  lukem add RCSID
 1.1 05-Oct-1999  itohy branches: 1.1.12; 1.1.14; 1.1.16;
"opl at ym" attachment glue for making use of
OPL3 FM synthesizer on Yamaha OPL3-SA3.
 1.1.16.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.16.2 16-Mar-2002  jdolecek Catch up with -current.
 1.1.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.14.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.14.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.14.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.12.1 27-Mar-2002  he Pull up revisions 1.2-1.3 (requested by itohy):
Several changes to wss-compatible audio devices:
o Fix ADPCM playback/recording
o Add explicit support for OPL3-SA2 (YMF711), fixes PR#14819
o Add AD1845 support
o other minor bugfixes and cleanups
 1.6.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.6.1 12-Feb-2005  yamt sync with head.
 1.7.4.1 29-Apr-2005  kent sync with -current
 1.8.6.4 17-Mar-2008  yamt sync with head.
 1.8.6.3 27-Oct-2007  yamt sync with head.
 1.8.6.2 30-Dec-2006  yamt sync with head.
 1.8.6.1 21-Jun-2006  yamt sync with head.
 1.9.14.1 19-Jun-2006  chap Sync with head.
 1.9.8.2 11-Aug-2006  yamt sync with head
 1.9.8.1 26-Jun-2006  yamt sync with head.
 1.9.4.1 09-Sep-2006  rpaulo sync with head
 1.10.2.1 13-Jul-2006  gdamore Merge from HEAD.
 1.11.6.2 10-Dec-2006  yamt sync with head.
 1.11.6.1 22-Oct-2006  yamt sync with head
 1.11.4.1 18-Nov-2006  ad Sync with head.
 1.13.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.24.2 23-Mar-2008  matt sync with HEAD
 1.13.24.1 06-Nov-2007  matt sync with HEAD
 1.13.22.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.13.8.1 23-Oct-2007  ad Sync with head.
 1.14.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.14.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.14.12.1 24-Mar-2008  keiichi sync with head.
 1.15.4.1 16-May-2008  yamt sync with head.
 1.15.2.1 18-May-2008  yamt sync with head.
 1.16.38.2 29-Apr-2012  mrg sync to latest -current.
 1.16.38.1 18-Feb-2012  mrg merge to -current.
 1.16.34.1 17-Apr-2012  yamt sync with head
 1.18.44.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.18.40.1 10-Jun-2019  christos Sync with HEAD
 1.73 27-Dec-2019  msaitoh s/suport/support/
 1.72 08-May-2019  isaki 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.71 16-Mar-2019  isaki branches: 1.71.2;
Use C99 style struct initializer to audio_hw_if.
 1.70 24-Nov-2011  mrg branches: 1.70.50;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.69 23-Nov-2011  jmcneill 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.68 24-Mar-2010  dyoung branches: 1.68.8; 1.68.10;
Do not use unitialized bus_space_tag_t's. Use the tag(s) from the
attachment arguments.
 1.67 15-Mar-2008  cube branches: 1.67.4; 1.67.16; 1.67.24; 1.67.26;
Split device_t and softc for sb(4) and all its attachments.
 1.66 19-Oct-2007  ad branches: 1.66.12; 1.66.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.65 16-Nov-2006  christos branches: 1.65.6; 1.65.8; 1.65.22; 1.65.24; 1.65.28;
__unused removal on arguments; approved by core.
 1.64 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.63 03-Sep-2006  christos branches: 1.63.2; 1.63.4;
add missing initializers
 1.62 11-Dec-2005  christos branches: 1.62.4; 1.62.8;
merge ktrace-lwp.
 1.61 14-Jan-2005  kent branches: 1.61.10;
ansify and KNF
 1.60 29-Oct-2004  yamt constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.59 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.58 22-Apr-2004  itojun sprintf -> snprintf
 1.57 03-May-2003  wiz branches: 1.57.2;
DMA, not dma nor Dma.
 1.56 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.55 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.54 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.53 11-Jan-2002  jdolecek Resurrect the 'sc->sc_sbdsp.sc_dev.dv_cfdata = match' in pasprobe(),
it's needed for sbdsp.c:sbdsp_probe().
 1.52 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.51 13-Nov-2001  lukem add RCSID
 1.50 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.49 18-Jul-2001  thorpej branches: 1.49.2;
bzero -> memset
 1.48 15-May-2001  lukem branches: 1.48.2;
delint: () protect some macro args
 1.47 28-Apr-2000  jdolecek branches: 1.47.6;
pasfind(): avoid silly bug - if bus_space_map() of SB I/O space failed,
we used bad label and tried to bus_space_unmap() invalid memory
region

Fixes port-i386/9992 by Jarkko Teppo <jate@uwasa.fi>.
 1.46 18-Feb-1999  mycroft branches: 1.46.2; 1.46.8;
Add separate halt_output and halt_input routines.
 1.45 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.44 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.43 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.42 22-Jun-1998  augustss Make PAS driver work again. From "John F. Woods" <jfw@jfwhome.funhouse.com>.
 1.41 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.40 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.39 23-Mar-1998  augustss Update for __BROKEN_INDIRECT_CONFIG. Still untested since it is so hard
to find testers for these old cards.
 1.38 22-Mar-1998  drochner Make this file compile without BROKRN_INDIRECT_CONFIG.
(Brute force - device probe always returns 0. Should be fixed soon.)
 1.37 12-Jan-1998  thorpej Update for config changes.
 1.36 19-Oct-1997  augustss 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.35 14-Sep-1997  augustss Get rid of `register'.
 1.34 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.33 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.32 28-Jul-1997  augustss branches: 1.32.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.31 28-Jul-1997  augustss audio: Minor cleanup and enable looping DMA for PSS and PAS.
 1.30 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.29 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.28 25-Jul-1997  augustss Make PAS audio work again.
From John F. Woods, PR #3859.
 1.27 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.26 09-May-1997  augustss branches: 1.26.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.25 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.24 06-Apr-1997  augustss Make sure the bus tag is set where we need it.
 1.23 24-Mar-1997  jtk use new name sc_drq8 and initialize sc_drq16 (reflect changes to SB driver)
 1.22 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.21 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.20 12-Nov-1996  mikel Use device struct from sbdsp_softc, eliminate redundant softc members.
Fixes PR kern/2237.
 1.19 13-Oct-1996  christos backout kprintf changes
 1.18 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.17 12-May-1996  mycroft Use intr.h.
 1.16 29-Apr-1996  christos - prototype fixes
 1.15 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.14 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.13 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.12 16-Feb-1996  mycroft Prototype the probe and attach functions.
 1.11 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.10 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.9 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.8 07-Jul-1995  brezak Cleanup
 1.7 08-May-1995  brezak Remove strings
 1.6 17-Apr-1995  cgd update for new locations
 1.5 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.4 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.3 14-Mar-1995  brezak Fixes defect port-i386/864 from John Woods (jfw@jfwhome.funhouse.com) with
supplied patch. pas.c doesn't recognize ProAudio Spectrum 16 Basic card.
 1.2 28-Feb-1995  brezak Use irq directly not as a mask
 1.1 21-Feb-1995  brezak PAS driver; uses SB emulation for now
 1.26.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.32.2.2 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.46.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.46.2.1 30-Apr-2000  he Pull up revision 1.47 (requested by jdolecek):
Fix bug related to allocation / deallocation of bus_space region
if map of SB I/O space failed. Fixes PR#9992.
 1.47.6.7 18-Oct-2002  nathanw Catch up to -current.
 1.47.6.6 28-Feb-2002  nathanw Catch up to -current.
 1.47.6.5 11-Jan-2002  nathanw More catchup.
 1.47.6.4 14-Nov-2001  nathanw Catch up to -current.
 1.47.6.3 08-Oct-2001  nathanw Catch up to -current.
 1.47.6.2 24-Aug-2001  nathanw Catch up with -current.
 1.47.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.48.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.48.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.48.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.48.2.1 03-Aug-2001  lukem update to -current
 1.49.2.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.57.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.57.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.57.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.57.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.57.2.1 03-Aug-2004  skrll Sync with HEAD
 1.61.10.3 17-Mar-2008  yamt sync with head.
 1.61.10.2 27-Oct-2007  yamt sync with head.
 1.61.10.1 30-Dec-2006  yamt sync with head.
 1.62.8.1 03-Sep-2006  yamt sync with head.
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.63.4.2 10-Dec-2006  yamt sync with head.
 1.63.4.1 22-Oct-2006  yamt sync with head
 1.63.2.1 18-Nov-2006  ad Sync with head.
 1.65.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.65.24.2 23-Mar-2008  matt sync with HEAD
 1.65.24.1 06-Nov-2007  matt sync with HEAD
 1.65.22.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.65.8.1 23-Oct-2007  ad Sync with head.
 1.65.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.66.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.66.12.1 24-Mar-2008  keiichi sync with head.
 1.67.26.1 30-May-2010  rmind sync with head
 1.67.24.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.67.16.1 08-Dec-2008  ad Convert some more drivers.
 1.67.4.1 11-Aug-2010  yamt sync with head.
 1.68.10.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.68.10.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.68.8.1 17-Apr-2012  yamt sync with head
 1.70.50.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.70.50.1 10-Jun-2019  christos Sync with HEAD
 1.71.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.71.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.5 08-Mar-2006  lukem Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.4 11-Dec-2005  christos branches: 1.4.4; 1.4.6; 1.4.8; 1.4.10;
merge ktrace-lwp.
 1.3 27-Feb-2005  perry branches: 1.3.4;
nuke trailing whitespace
 1.2 15-Mar-1995  brezak branches: 1.2.66; 1.2.74; 1.2.76;
Add support for PAS 16 basic
 1.1 21-Feb-1995  brezak PAS driver; uses SB emulation for now
 1.2.76.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.74.1 29-Apr-2005  kent sync with -current
 1.2.66.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.3.4.1 21-Jun-2006  yamt sync with head.
 1.4.10.1 19-Apr-2006  elad sync with head.
 1.4.8.1 13-Mar-2006  yamt sync with head.
 1.4.6.1 22-Apr-2006  simonb Sync with head.
 1.4.4.1 09-Sep-2006  rpaulo sync with head
 1.47 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.46 24-Apr-2021  thorpej branches: 1.46.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.45 24-Apr-2020  ad branches: 1.45.4;
BUS_SPACE_MAP_PREFETCHABLE yields a write combining region on x86 and that's
not what I intended.. BUS_SPACE_MAP_CACHEABLE is enough.
 1.44 01-Dec-2019  ad branches: 1.44.6;
Map the video RAM cacheable/prefetchable, it's very slow and this helps a bit.
 1.43 21-Apr-2018  mlelstv branches: 1.43.2;
Fix an ancient typo, instead of setting the base address, the size
value is written leaving the autoconf setting (-1) as the address.
The value is only used for printing an attach message, the actual
pcdisplay_init code uses hard coded base addresses again.
 1.42 14-Jul-2016  msaitoh branches: 1.42.16;
KNF. No functional change.
 1.41 27-Oct-2012  chs branches: 1.41.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.40 19-Apr-2010  dyoung branches: 1.40.8; 1.40.18;
Add default implementations for bus_space_is_equal(9),
bus_space_tag_create(9), and bus_space_tag_destroy(9). Use
bus_space_is_equal(9) throughout the kernel to compare
bus_space_tag_t's. Tested on i386 and on sparc64.
 1.39 22-Mar-2010  dyoung isadma.c: #if 0 some diagnostic code that compares two bus_space_tag_t's.

pcdisplay.c: #if 0 some code that compares two bus_space_tag_t's
in order to see if pcdisplay0 is console. It does not seem to
be helpful to compare the tags; maybe the author intended to
compare some other bus property?

MI code should not compare an opaque type such as bus_space_tag_t!
 1.38 12-May-2009  cegger branches: 1.38.2; 1.38.4;
struct device * -> device_t, no functional changes intended.
 1.37 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.36 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.35 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.34 19-Oct-2007  ad branches: 1.34.20; 1.34.28; 1.34.34;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.33 04-Mar-2007  christos branches: 1.33.2; 1.33.14; 1.33.16; 1.33.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32 16-Nov-2006  christos branches: 1.32.4;
__unused removal on arguments; approved by core.
 1.31 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.30 03-Sep-2006  christos branches: 1.30.2; 1.30.4;
add missing initializers
 1.29 12-Apr-2006  jmmv Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.28 11-Dec-2005  christos branches: 1.28.4; 1.28.6; 1.28.8; 1.28.10; 1.28.12;
merge ktrace-lwp.
 1.27 04-Feb-2005  perry branches: 1.27.6;
de-__P
 1.26 14-Sep-2004  drochner branches: 1.26.4; 1.26.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.25 24-Mar-2004  drochner remove license clauses 3 and 4 from my cpoyright notices
 1.24 29-Jun-2003  fvdl branches: 1.24.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.23 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.22 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.21 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.20 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.19 07-Jul-2002  junyoung Rename vc_ccol and vc_crow in struct pcdisplayscreen to cursorcol
and cursorrow, respectively, to be consistent with other members
in the structure.
 1.18 04-Jul-2002  junyoung alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.17 17-Mar-2002  atatat branches: 1.17.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.16 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.15 16-Dec-2001  thorpej Try again: weasel -> weasel_isa
 1.14 16-Dec-2001  thorpej Oops, revert previous; it included some other changes there weren't
meant to be checked in.
 1.13 16-Dec-2001  thorpej weasel -> weasel_isa
 1.12 13-Nov-2001  lukem add RCSID
 1.11 04-Nov-2000  thorpej branches: 1.11.2; 1.11.4;
Add a device driver for the Middle Digital, Inc. PC-Weasel serial
console board. This glues into the `pcdisplay' driver and provides
support for the watchdog timer function on the PC-Weasel.
 1.10 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.9 25-Jan-2000  ad branches: 1.9.4;
Finish with fixing the SOFTCURSOR stuff.
 1.8 05-Jan-2000  ad Add and use pcdisplay_cursor_init(). Still a couple of nits with this, I
will resolve when I can test properly.
 1.7 06-Dec-1999  drochner update for changed struct wsdisplay_accessops:show_screen signature.
no functional changes
 1.6 11-Jan-1999  drochner branches: 1.6.8; 1.6.14;
remove dummy "load_font" entries
 1.5 13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.4 24-Jul-1998  drochner branches: 1.4.2;
Initialize the new "dispoffset" (but don't use it for anything fancy).
 1.3 26-Jun-1998  drochner adapt to wsdisplay interface change
 1.2 21-Jun-1998  drochner adapt to wscons interface change
 1.1 28-May-1998  drochner Add a graphics device driver for wscons which supports legacy PC display
adapters. (minimal functionality - no virtual screens, no colors)
 1.4.2.2 08-Aug-1998  eeh Revert cdevsw mmap routines to return int.
 1.4.2.1 07-Aug-1998  drochner make it compile in paddr_t world
 1.6.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.6.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.11.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.11.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.2.7 18-Oct-2002  nathanw Catch up to -current.
 1.11.2.6 01-Aug-2002  nathanw Catch up to -current.
 1.11.2.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.11.2.3 11-Jan-2002  nathanw More catchup.
 1.11.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.17.4.1 15-Jul-2002  gehenna catch up with -current.
 1.24.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.24.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.2 03-Aug-2004  skrll Sync with HEAD
 1.24.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.26.6.1 12-Feb-2005  yamt sync with head.
 1.26.4.1 29-Apr-2005  kent sync with -current
 1.27.6.4 27-Oct-2007  yamt sync with head.
 1.27.6.3 03-Sep-2007  yamt sync with head.
 1.27.6.2 30-Dec-2006  yamt sync with head.
 1.27.6.1 21-Jun-2006  yamt sync with head.
 1.28.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.28.10.1 19-Apr-2006  elad sync with head.
 1.28.8.2 03-Sep-2006  yamt sync with head.
 1.28.8.1 24-May-2006  yamt sync with head.
 1.28.6.1 22-Apr-2006  simonb Sync with head.
 1.28.4.1 09-Sep-2006  rpaulo sync with head
 1.30.4.2 10-Dec-2006  yamt sync with head.
 1.30.4.1 22-Oct-2006  yamt sync with head
 1.30.2.1 18-Nov-2006  ad Sync with head.
 1.32.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.33.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.33.16.1 06-Nov-2007  matt sync with HEAD
 1.33.14.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.33.2.1 23-Oct-2007  ad Sync with head.
 1.34.34.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.28.1 28-Apr-2009  skrll Sync with HEAD.
 1.34.20.3 11-Aug-2010  yamt sync with head.
 1.34.20.2 16-May-2009  yamt sync with head
 1.34.20.1 04-May-2009  yamt sync with head.
 1.38.4.1 30-May-2010  rmind sync with head
 1.38.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.40.18.2 03-Dec-2017  jdolecek update from HEAD
 1.40.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.40.8.1 30-Oct-2012  yamt sync with head
 1.41.14.1 05-Oct-2016  skrll Sync with HEAD
 1.42.16.1 22-Apr-2018  pgoyette Sync with HEAD
 1.43.2.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.44.6.1 25-Apr-2020  bouyer Sync with bouyer-xenpvh-base2 (HEAD)
 1.45.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.46.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 04-Feb-2005  perry de-__P
 1.2 24-Mar-2004  drochner branches: 1.2.8; 1.2.10;
remove license clauses 3 and 4 from my cpoyright notices
 1.1 28-May-1998  drochner branches: 1.1.48;
Add a graphics device driver for wscons which supports legacy PC display
adapters. (minimal functionality - no virtual screens, no colors)
 1.1.48.4 04-Feb-2005  skrll Sync with HEAD.
 1.1.48.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.48.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.48.1 03-Aug-2004  skrll Sync with HEAD
 1.2.10.1 12-Feb-2005  yamt sync with head.
 1.2.8.1 29-Apr-2005  kent sync with -current
 1.14 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.13 03-Dec-1999  thorpej Get ready for some needed flexibility; put the IRQs to use for each slot
in the softc.
 1.12 05-Mar-1999  drochner branches: 1.12.8; 1.12.14;
Don't try to selftest the keyboard port. PC keyboard controllers have
shown up which break in 3 different ways, so the test is becoming
pointless.
 1.11 28-Feb-1999  drochner Make "1" an acceptable result in port tests.
This is a workaround for crappy hardware, normal keyboard controllers
return a "0".
Should fix PR port-i386/6636 by Krister Walfridsson and problems
reported by chopps and fvdl.
 1.10 14-Dec-1998  drochner Deal with an unusual response on port selftest commands. This makes at
least John Kohl's crappy Dell box work.
 1.9 16-Nov-1998  thorpej Print out which IRQ is being used for which slot, when the interrupts
are established.
 1.8 24-Jul-1998  sommerfe Deal with new pool code's changed API by rewriting this to not use pools.
Instead, use a manually maintained freelist in a second tailq.
Uses less data space, looks more symmetrical.
 1.7 03-May-1998  drochner Suppress the diagnostic printout if the keyboard controller has no
mouse port.
 1.6 03-May-1998  drochner If the keyboard is console device, use the command byte as set by
the console initialization code.
 1.5 03-May-1998  drochner Make some diagnostic output "#ifdef PCKBCDEBUG".
 1.4 28-Apr-1998  thorpej Add a comment about some future work.
 1.3 18-Apr-1998  drochner Initialize the command byte and its shadow register in early console
setup so that the keykoard driver can deal with scancode translation
in its console initialization function.
 1.2 07-Apr-1998  drochner Clean up diagnostic printouts.
Being here, remove BROKEN_INDIRECT_CONFIG.
 1.1 22-Mar-1998  drochner MI driver for the infamous PC keyboard controller, primarily for use with
the new wscons code (but may be interfaced with other drivers as well).
needs testing
 1.12.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.8.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.27 25-Sep-2022  thorpej malloc(9) -> kmem(9)
 1.26 03-Apr-2014  mrg GCC 4.8 build fixes from John D. Baker
 1.25 25-May-2008  jmcneill branches: 1.25.32; 1.25.42; 1.25.48;
Add pmf support.
 1.24 15-Mar-2008  cube branches: 1.24.2; 1.24.4; 1.24.6;
Split device_t and softc for pckbc(4) and its attachments.
 1.23 04-Jan-2008  ad branches: 1.23.2; 1.23.6;
Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
 1.22 19-Oct-2007  ad branches: 1.22.2; 1.22.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.21 09-Jul-2007  ad branches: 1.21.6; 1.21.8; 1.21.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.20 16-Nov-2006  christos branches: 1.20.8; 1.20.10;
__unused removal on arguments; approved by core.
 1.19 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.18 11-Apr-2006  garbled branches: 1.18.8; 1.18.10;
Add an option PCKBCNOTEST and defopt it. On the prep 7043 and 7248
machines, the keyboard controller will not pass this test, but if you
attach anyway, it works fine. Note that this test is specifically
disabled in ic/pckbc.c, but given that it seems to work fine on other
machines, leave it defaulted to on.
 1.17 11-Dec-2005  christos branches: 1.17.4; 1.17.6; 1.17.8; 1.17.10; 1.17.12;
merge ktrace-lwp.
 1.16 27-Feb-2005  perry branches: 1.16.4;
nuke trailing whitespace
 1.15 04-Feb-2005  perry de-__P
 1.14 14-Sep-2004  drochner branches: 1.14.4; 1.14.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.13 24-Mar-2004  drochner remove license clauses 3 and 4 from my cpoyright notices
 1.12 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.11 04-Oct-2002  soren branches: 1.11.6;
Avoid noise on kbd-less machines.
 1.10 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 12-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of memset() after malloc().
 1.6 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 23-Jul-2001  jdolecek Since ~all pckbc_poll_data1() callers had the appropriate pckbc
tag handy and we are going to need more of it in pckbc_poll_data1() soon,
change pckbc_poll_data1() to accept it as first arg. iot, ioh_d, ioh_c are
no longer passed separately. Use fabricated pckbc tag for calls from
arch/arc/jazz/pckbc_jazzio.c and dev/isa/pckbc_isa.c.
 1.3 18-Jul-2001  thorpej bzero -> memset
 1.2 23-Mar-2000  thorpej branches: 1.2.6; 1.2.8; 1.2.10;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.1 03-Dec-1999  thorpej branches: 1.1.2;
Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.1.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.10.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.10.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.10.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.10.1 03-Aug-2001  lukem update to -current
 1.2.8.5 18-Oct-2002  nathanw Catch up to -current.
 1.2.8.4 28-Feb-2002  nathanw Catch up to -current.
 1.2.8.3 11-Jan-2002  nathanw More catchup.
 1.2.8.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.8.1 24-Aug-2001  nathanw Catch up with -current.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 23-Mar-2000  bouyer file pckbc_isa.c was added on branch thorpej_scsipi on 2000-11-20 11:41:20 +0000
 1.11.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.11.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.11.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.6.1 03-Aug-2004  skrll Sync with HEAD
 1.14.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.14.6.1 12-Feb-2005  yamt sync with head.
 1.14.4.1 29-Apr-2005  kent sync with -current
 1.16.4.6 17-Mar-2008  yamt sync with head.
 1.16.4.5 21-Jan-2008  yamt sync with head
 1.16.4.4 27-Oct-2007  yamt sync with head.
 1.16.4.3 03-Sep-2007  yamt sync with head.
 1.16.4.2 30-Dec-2006  yamt sync with head.
 1.16.4.1 21-Jun-2006  yamt sync with head.
 1.17.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.17.10.1 19-Apr-2006  elad sync with head.
 1.17.8.1 24-May-2006  yamt sync with head.
 1.17.6.1 22-Apr-2006  simonb Sync with head.
 1.17.4.1 09-Sep-2006  rpaulo sync with head
 1.18.10.2 10-Dec-2006  yamt sync with head.
 1.18.10.1 22-Oct-2006  yamt sync with head
 1.18.8.1 18-Nov-2006  ad Sync with head.
 1.20.10.1 11-Jul-2007  mjf Sync with head.
 1.20.8.2 23-Oct-2007  ad Sync with head.
 1.20.8.1 01-Jul-2007  ad Adapt to callout API change.
 1.21.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.21.8.3 23-Mar-2008  matt sync with HEAD
 1.21.8.2 09-Jan-2008  matt sync with HEAD
 1.21.8.1 06-Nov-2007  matt sync with HEAD
 1.21.6.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.22.8.1 08-Jan-2008  bouyer Sync with HEAD
 1.22.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.23.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.23.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.23.2.1 24-Mar-2008  keiichi sync with head.
 1.24.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.24.4.1 04-May-2009  yamt sync with head.
 1.24.2.1 04-Jun-2008  yamt sync with head
 1.25.48.1 18-May-2014  rmind sync with head
 1.25.42.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.32.1 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2 03-Dec-1999  thorpej Split the PC-like keyboard controller driver into chip back-end and
bus front-end.
 1.1 22-Mar-1998  drochner branches: 1.1.14; 1.1.20;
MI driver for the infamous PC keyboard controller, primarily for use with
the new wscons code (but may be interfaced with other drivers as well).
needs testing
 1.1.20.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.1.14.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck, and commit Makefile which
I forgot in the batch of commits.
 1.48 09-Feb-2024  andvar s/anthing/anything/ and s/be to/too/ in comments.
 1.47 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.46 24-Apr-2021  thorpej branches: 1.46.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.45 14-Jun-2017  pgoyette branches: 1.45.22;
Instead of directly referencing a parent device's code (ie, pcppi_bell()
routine), let the parent device pass a pointer to the code (in the aux
config data). This allows us to load the spkr module without requiring
the pcppi parent device to exist. (The spkr device can also have an
audio as parent.)
 1.44 17-May-2015  pgoyette Modularize the spkr(4) driver (i386 and amd64 only). Adapt parent
pcppi(4) driver to be able to handle rescan().
 1.43 08-Dec-2014  msaitoh Add missing newlines...
 1.42 06-Apr-2012  plunky branches: 1.42.2; 1.42.14; 1.42.16;
device_pmf_is_registered() is not required
 1.41 26-Nov-2011  drochner branches: 1.41.2;
stopgap fix to avoid panic due to recursive locking if the keyboard beep
is activated through a tty (which it usually is)
IMO it was no good idea to abuse tty_lock here - it is already
problematic in the tty subsystem
 1.40 25-Nov-2011  riastradh KASSERT(!mutex_owned(...)) is not kosher.
 1.39 25-Nov-2011  jakllsch Make locking in pcppi_pckbd_bell() work. Works around locking problems
triggered when an X server rings the console bell.
 1.38 23-Nov-2011  jmcneill 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.37 24-May-2011  mrg branches: 1.37.4; 1.37.6;
avoid mutex locking botch and introduce an unlocked version of
pcppi_bell_stop(). fixes a problem reported in private email.
 1.36 03-May-2011  mrg convert a lockless + spltty() combo to a IPL_VM mutex and cv.

hopefully this will avoid the beep-didn't-stop problem i had recently
that i was able to fix by calling wakeup() on pcppi's softc from ddb.
 1.35 17-Apr-2009  dyoung branches: 1.35.4; 1.35.6;
Detach pcppi0 at isa0 during shutdown.
 1.34 07-Apr-2009  dyoung Make pcppi(4) detach the "speaker" from attimer(4), so that the
corresponding attimer(4) resource is not perpetually busy: now it
is possible to detach and to reattach pcppi(4). Make attimer(4)'s
device-detachment hook return EBUSY if pcppi(4) is still attached, so
that pcppi(4) cannot end up with a dangling pointer to attimer(4).
 1.33 14-Mar-2009  ad 'boot -z' bogons
 1.32 05-Mar-2008  cube branches: 1.32.4; 1.32.12; 1.32.14; 1.32.16; 1.32.18;
Fix a softc split fallout.
 1.31 04-Mar-2008  dyoung The attimer (sc_timer) is not actually a child of pcppi, and pcppi
does do not hold references to any other device, so provide an
empty child-detachment method.
 1.30 04-Mar-2008  cube - Split device_t and softc for pcppi(4) and attimer(4)
- Change the attimer <-> pcppi communication using device_t so that
pcppi(4) doesn't have to know about the contents of struct attimer_softc.

XXX pcppi's childdet function is completely wrong. This has to be
XXX revisited later.
 1.29 22-Feb-2008  dyoung Use device_t and accessors. Use aprint_*_dev().

Add method to detach child.
 1.28 30-Jan-2008  he branches: 1.28.2; 1.28.6;
Do a dummy pmf_device_register() in pcppi_attach() instead of only
in pcppi_isa_attach(), so that pcppi at acpi doesn't become an obstacle
to suspending.

Looked over by jmcneill.
 1.27 10-Jan-2008  dyoung In pcppi_detach(), s/pmf_device_register/pmf_device_deregister/.
Why that never blew up when I tested, I will never know. Thanks
wiz@ for catching my mistake.
 1.26 10-Jan-2008  dyoung Support pcppi(4) detachment.

Use device_t, device_private(). Get rid of a struct device * cast.
 1.25 16-Dec-2007  christos add null pmf handlers.
 1.24 19-Oct-2007  ad branches: 1.24.2; 1.24.4; 1.24.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 09-Jul-2007  ad branches: 1.23.6; 1.23.8; 1.23.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.22 10-Dec-2006  cube branches: 1.22.6; 1.22.8;
Remove an error message about having FSTAR'd instances attaching at pcppi.
It's actually fine to have them. Somehow I wish there was a way to express
that there can be only one device of that kind attaching on a given pcppi.

All of this is generic for all indirectly configured bus (i.e., specified
by kernel configuration).

Reported by uwe@.
 1.21 10-Dec-2006  uwe When comlaining about child* attachment print "WARNING" and the child
name. Makes it more obvious what the problem is, and easier to spot
in the dmesg output after quiet boot warns about "errors" while
detecting hardware.
 1.20 16-Nov-2006  christos __unused removal on arguments; approved by core.
 1.19 05-Nov-2006  cube config_found() is for direct configuration, not indirect.

Change the code to use config_search/config_attach, and print a warning
when the user has device* at pcppi? in the kernel configuration file.
 1.18 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.17 11-Dec-2005  christos branches: 1.17.20; 1.17.22;
merge ktrace-lwp.
 1.16 25-Mar-2005  cube branches: 1.16.2;
Make pcppi(4) use attimer(4) to set the pitch of the bell.

In case you don't configure an attimer(4) device in your kernel config,
you will simply lose the ability to set the pitch. It will still beep.
 1.15 21-Mar-2005  xtraeme Move the struct pcppi_softc into pcppivar.h, add in this file
pcppi_attach(), which now accepts "struct pcppi_softc";
Split ISA specific bits from pcppi_attach() into pcppi_isa_attach()
(needed by the upcoming pcppi(4) ACPI attachment).

Reviewed by christos@.
 1.14 21-Mar-2005  xtraeme Use ANSI function declarations.
 1.13 27-Feb-2005  perry nuke trailing whitespace
 1.12 04-Feb-2005  perry de-__P
 1.11 14-Sep-2004  drochner branches: 1.11.4; 1.11.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.10 13-Mar-2004  bjh21 Abstract the interface between pckbc(4), and the pckbd(4) and pms(4)
drivers that attach to it. This allows for other host interface chips
that use the same keyboards and mice, such as the ones in the ARM
IOMD20, ARM7500, and SA-1111. The PC-compatible driver is still
called pckbc(4), and the new abstraction layer is "pckbport", so the
child devices have moved from sys/dev/pckbc to sys/dev/pckbport, which
also contains some code shared between all host controllers. To avoid
incompatibility, pckbdreg.h is still installed in
/usr/include/dev/pckbc.

In theory, this shouldn't cause any behavioural changes in the drivers
concerned. Thy just use rather more function pointers than before. Tested
on i386 and (with a new host driver) acorn32. Compiled on several other
affected architectures.
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.8 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.5 13-Nov-2001  lukem add RCSID
 1.4 23-Mar-2000  thorpej branches: 1.4.6; 1.4.8;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.3 10-Mar-2000  thorpej Only poll for bell completion if we're calling in from cnbell(). Fixes
a problem reported by Lennart Augustsson.
 1.2 06-Mar-2000  thorpej - Make the pcppi and pckbd drivers cooperate a little more -- pckbd provides
a call to hook up a bell-ringer (since the keyboard itself has no bell).
This eliminates the need for #ifdefs for the bell-ringer in the pckbd
driver.
- Add cnbell() support to pckbd.
 1.1 15-Apr-1998  drochner branches: 1.1.14;
MI driver for the ISA speaker, and the IBM BASIC playstring interpreter
which has so many fans.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.4.6.2 11-Jan-2002  nathanw More catchup.
 1.4.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.9.6.6 01-Apr-2005  skrll Sync with HEAD.
 1.9.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.6.3 26-Mar-2005  yamt sync with head.
 1.11.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.6.1 12-Feb-2005  yamt sync with head.
 1.11.4.1 29-Apr-2005  kent sync with -current
 1.16.2.7 17-Mar-2008  yamt sync with head.
 1.16.2.6 27-Feb-2008  yamt sync with head.
 1.16.2.5 04-Feb-2008  yamt sync with head.
 1.16.2.4 21-Jan-2008  yamt sync with head
 1.16.2.3 27-Oct-2007  yamt sync with head.
 1.16.2.2 03-Sep-2007  yamt sync with head.
 1.16.2.1 30-Dec-2006  yamt sync with head.
 1.17.22.3 18-Dec-2006  yamt sync with head.
 1.17.22.2 10-Dec-2006  yamt sync with head.
 1.17.22.1 22-Oct-2006  yamt sync with head
 1.17.20.2 12-Jan-2007  ad Sync with head.
 1.17.20.1 18-Nov-2006  ad Sync with head.
 1.22.8.1 11-Jul-2007  mjf Sync with head.
 1.22.6.2 23-Oct-2007  ad Sync with head.
 1.22.6.1 01-Jul-2007  ad Adapt to callout API change.
 1.23.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.8.3 23-Mar-2008  matt sync with HEAD
 1.23.8.2 09-Jan-2008  matt sync with HEAD
 1.23.8.1 06-Nov-2007  matt sync with HEAD
 1.23.6.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.24.8.2 10-Jan-2008  bouyer Sync with HEAD
 1.24.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.24.4.1 26-Dec-2007  ad Sync with head.
 1.24.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.28.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.2.1 24-Mar-2008  keiichi sync with head.
 1.32.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.32.16.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.32.14.3 18-Jun-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1625):
sys/dev/isa/pcppi.c: revision 1.37
avoid mutex locking botch and introduce an unlocked version of
pcppi_bell_stop(). fixes a problem reported in private email.
 1.32.14.2 18-Jun-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1625):
sys/dev/isa/pcppivar.h: revision 1.10
sys/dev/isa/pcppi.c: revision 1.36
convert a lockless + spltty() combo to a IPL_VM mutex and cv.
hopefully this will avoid the beep-didn't-stop problem i had recently
that i was able to fix by calling wakeup() on pcppi's softc from ddb.
 1.32.14.1 20-Nov-2010  riz Pull up following revision(s) (requested by hubertf in ticket #1386):
sys/dev/raidframe/rf_netbsdkintf.c: revision 1.258
sys/dev/pad/pad.c: revision 1.11
sys/dev/scsipi/cd.c: revision 1.288
sys/dev/isa/pcppi.c: revision 1.33
sys/kern/subr_autoconf.c: revision 1.169
'boot -z' bogons
 1.32.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.32.4.1 04-May-2009  yamt sync with head.
 1.35.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.35.4.1 31-May-2011  rmind sync with head
 1.37.6.1 20-Nov-2011  mrg port the changes from ad-audiomp2 branch. this mostly replaces the
changes i'd made to pcppi to achieve a similar result.

XXX: these actually could be pulled down to -current today, i think.
no actual dependancies on audiomp branch itself.
 1.37.4.1 17-Apr-2012  yamt sync with head
 1.41.2.1 29-Apr-2012  mrg sync to latest -current.
 1.42.16.3 28-Aug-2017  skrll Sync with HEAD
 1.42.16.2 06-Jun-2015  skrll Sync with HEAD
 1.42.16.1 06-Apr-2015  skrll Sync with HEAD
 1.42.14.1 08-Jan-2015  martin Pull up following revision(s) (requested by msaitoh in ticket #392):
sys/dev/acpi/acpi_ec.c: revision 1.74
sys/dev/isa/pcppi.c: revision 1.43
Add missing newlines...
 1.42.2.1 03-Dec-2017  jdolecek update from HEAD
 1.45.22.6 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.45.22.5 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.45.22.4 03-Apr-2021  thorpej config_attach_loc() -> config_attach() with CFARG_LOCATORS argument.
 1.45.22.3 28-Mar-2021  thorpej pcppi_scan(): No need to pass interface attribute or locators to
config_search().
 1.45.22.2 21-Mar-2021  thorpej In "rescan" routines, always pass locators and the interface attribute
straight through to config_search(). Also, for devices that carry only
one interface attribute, no need to do an ifattr_match(), because
rescan_with_cfdata() will have already validated that the parent is
eligible, which includes an interface attribute check.
 1.45.22.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.46.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 15-Apr-1998  drochner MI driver for the ISA speaker, and the IBM BASIC playstring interpreter
which has so many fans.
 1.12 14-Jun-2017  pgoyette Instead of directly referencing a parent device's code (ie, pcppi_bell()
routine), let the parent device pass a pointer to the code (in the aux
config data). This allows us to load the spkr module without requiring
the pcppi parent device to exist. (The spkr device can also have an
audio as parent.)
 1.11 23-Nov-2011  jmcneill branches: 1.11.8; 1.11.26;
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.10 03-May-2011  mrg branches: 1.10.4; 1.10.6;
convert a lockless + spltty() combo to a IPL_VM mutex and cv.

hopefully this will avoid the beep-didn't-stop problem i had recently
that i was able to fix by calling wakeup() on pcppi's softc from ddb.
 1.9 04-Mar-2008  cube branches: 1.9.14; 1.9.16; 1.9.26; 1.9.32;
- Split device_t and softc for pcppi(4) and attimer(4)
- Change the attimer <-> pcppi communication using device_t so that
pcppi(4) doesn't have to know about the contents of struct attimer_softc.

XXX pcppi's childdet function is completely wrong. This has to be
XXX revisited later.
 1.8 10-Jan-2008  dyoung branches: 1.8.2; 1.8.6;
Support pcppi(4) detachment.

Use device_t, device_private(). Get rid of a struct device * cast.
 1.7 11-Dec-2005  christos branches: 1.7.46; 1.7.52; 1.7.60;
merge ktrace-lwp.
 1.6 25-Mar-2005  cube branches: 1.6.2;
Make pcppi(4) use attimer(4) to set the pitch of the bell.

In case you don't configure an attimer(4) device in your kernel config,
you will simply lose the ability to set the pitch. It will still beep.
 1.5 21-Mar-2005  xtraeme Move the struct pcppi_softc into pcppivar.h, add in this file
pcppi_attach(), which now accepts "struct pcppi_softc";
Split ISA specific bits from pcppi_attach() into pcppi_isa_attach()
(needed by the upcoming pcppi(4) ACPI attachment).

Reviewed by christos@.
 1.4 27-Feb-2005  perry nuke trailing whitespace
 1.3 04-Feb-2005  perry de-__P
 1.2 06-Mar-2000  thorpej branches: 1.2.28; 1.2.36; 1.2.38;
- Make the pcppi and pckbd drivers cooperate a little more -- pckbd provides
a call to hook up a bell-ringer (since the keyboard itself has no bell).
This eliminates the need for #ifdefs for the bell-ringer in the pckbd
driver.
- Add cnbell() support to pckbd.
 1.1 15-Apr-1998  drochner branches: 1.1.14;
MI driver for the ISA speaker, and the IBM BASIC playstring interpreter
which has so many fans.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.38.3 26-Mar-2005  yamt sync with head.
 1.2.38.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.38.1 12-Feb-2005  yamt sync with head.
 1.2.36.1 29-Apr-2005  kent sync with -current
 1.2.28.3 01-Apr-2005  skrll Sync with HEAD.
 1.2.28.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.28.1 04-Feb-2005  skrll Sync with HEAD.
 1.6.2.2 17-Mar-2008  yamt sync with head.
 1.6.2.1 21-Jan-2008  yamt sync with head
 1.7.60.1 10-Jan-2008  bouyer Sync with HEAD
 1.7.52.1 18-Feb-2008  mjf Sync with HEAD.
 1.7.46.1 23-Mar-2008  matt sync with HEAD
 1.8.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.2.1 24-Mar-2008  keiichi sync with head.
 1.9.32.1 06-Jun-2011  jruoho Sync with HEAD.
 1.9.26.1 31-May-2011  rmind sync with head
 1.9.16.1 09-Dec-2008  ad Checkpoint work on MIDI.
 1.9.14.1 18-Jun-2011  bouyer Pull up following revision(s) (requested by mrg in ticket #1625):
sys/dev/isa/pcppivar.h: revision 1.10
sys/dev/isa/pcppi.c: revision 1.36
convert a lockless + spltty() combo to a IPL_VM mutex and cv.
hopefully this will avoid the beep-didn't-stop problem i had recently
that i was able to fix by calling wakeup() on pcppi's softc from ddb.
 1.10.6.2 20-Nov-2011  mrg port the changes from ad-audiomp2 branch. this mostly replaces the
changes i'd made to pcppi to achieve a similar result.

XXX: these actually could be pulled down to -current today, i think.
no actual dependancies on audiomp branch itself.
 1.10.6.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.10.4.1 17-Apr-2012  yamt sync with head
 1.11.26.1 28-Aug-2017  skrll Sync with HEAD
 1.11.8.1 03-Dec-2017  jdolecek update from HEAD
 1.69 28-Jun-2005  kent remove pss(4) driver. It has never been workable and has not been
compilable for a long time.
 1.68 27-Feb-2005  perry nuke trailing whitespace
 1.67 04-Feb-2005  perry de-__P
 1.66 29-Oct-2004  yamt branches: 1.66.4; 1.66.6;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.65 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.64 03-May-2003  wiz branches: 1.64.2;
DMA, not dma nor Dma.
 1.63 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.62 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.61 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.60 08-Jan-2002  christos Deal with lossage caused by recent isa changes [/briq potr]
 1.59 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.58 13-Nov-2001  lukem add RCSID
 1.57 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.56 18-Jul-2001  thorpej branches: 1.56.2;
bzero -> memset
 1.55 26-Apr-2001  thorpej branches: 1.55.2;
Explictly include <machine/pio.h> (since this driver uses
i386 pio instructions -- XXX BROKEN).
 1.54 19-Feb-1999  mycroft branches: 1.54.20;
Kill vestiges of isa_establish().
 1.53 18-Feb-1999  mycroft Add separate halt_input and halt_output methods in ad1848_isa, which disable
the DMA channel.
 1.52 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.51 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.50 05-Dec-1998  dbj made prototype for debug function wss_dump_regs match its definition.
 1.49 31-Aug-1998  cgd kill the last remnants of __BROKEN_INDIRECT_CONFIG. (only the pica port
used it, and it's non-working and apparently slated for replacement.)
 1.48 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.47 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.46 30-Jun-1998  mycroft Add a monitor mute. The mixer here really needs more work for the
Crystal chips.
 1.45 17-Jun-1998  augustss Remove a bunch of totally unnecessary #include <machine/pio.h>
left over from the olden days.
 1.44 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.43 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.42 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.41 23-Mar-1998  augustss Update for __BROKEN_INDIRECT_CONFIG. Still untested since it is so hard
to find testers for these old cards.
 1.40 22-Mar-1998  drochner Make this file compile without BROKRN_INDIRECT_CONFIG.
(Brute force - device probe always returns 0. Should be fixed soon.)
 1.39 12-Mar-1998  augustss Update probing for GUS a little. From soren@t.dk,
closes PR kern/5148.
 1.38 12-Jan-1998  thorpej Update for config changes.
 1.37 19-Oct-1997  augustss 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.36 11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
 1.35 14-Sep-1997  augustss Get rid of `register'.
 1.34 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.33 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.32 28-Jul-1997  augustss branches: 1.32.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.31 28-Jul-1997  augustss audio: Minor cleanup and enable looping DMA for PSS and PAS.
 1.30 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.29 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.28 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.27 09-May-1997  augustss branches: 1.27.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.26 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.25 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.24 06-Apr-1997  augustss Make sure the bus tag is set where we need it.
 1.23 05-Apr-1997  augustss Busify the WSS driver.
 1.22 25-Mar-1997  mikel some cleanup; still needs a *lot* of work
 1.21 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.20 19-Mar-1997  mikel normalize off-by-four ad1848 register offsets.
 1.19 13-Mar-1997  mikel fix various AD1848/PSS misfeatures; from Jason Baker in PR kern/2045.
also did some misc cleanup of my own.
 1.18 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.17 13-Oct-1996  christos backout kprintf changes
 1.16 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.15 12-May-1996  mycroft Use intr.h.
 1.14 29-Apr-1996  christos - prototype fixes
- BUG: changed:
val &= CD_POL_MASK;
val | CD_POL_BIT; /* XXX if (pol) */
to:
val &= CD_POL_MASK;
val |= CD_POL_BIT; /* XXX if (pol) */
 1.13 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.12 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.11 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.10 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.9 12-Aug-1995  mycroft ia_irq has not been a power of 2 for a long time...
 1.8 07-Jul-1995  brezak Cleanup
 1.7 08-May-1995  brezak Remove strings
 1.6 26-Apr-1995  brezak Fix nits from Mike Long <mike.long@analog.com> PR#996
 1.5 17-Apr-1995  cgd update for new locations
 1.4 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.3 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.2 21-Mar-1995  brezak Fix probing of slave devices and remove unneeded ffs()'s
 1.1 21-Feb-1995  brezak PSS driver; needs testing with config.new
 1.27.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.32.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.2 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.54.20.7 18-Oct-2002  nathanw Catch up to -current.
 1.54.20.6 28-Feb-2002  nathanw Catch up to -current.
 1.54.20.5 11-Jan-2002  nathanw More catchup.
 1.54.20.4 14-Nov-2001  nathanw Catch up to -current.
 1.54.20.3 08-Oct-2001  nathanw Catch up to -current.
 1.54.20.2 24-Aug-2001  nathanw Catch up with -current.
 1.54.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.55.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.55.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.55.2.1 03-Aug-2001  lukem update to -current
 1.56.2.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.64.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.64.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.64.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.64.2.3 02-Nov-2004  skrll Sync with HEAD.
 1.64.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.64.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.66.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.66.6.1 12-Feb-2005  yamt sync with head.
 1.66.4.1 29-Apr-2005  kent sync with -current
 1.3 28-Jun-2005  kent remove pss(4) driver. It has never been workable and has not been
compilable for a long time.
 1.2 08-May-1995  brezak branches: 1.2.66;
Remove strings
 1.1 21-Feb-1995  brezak PSS driver; needs testing with config.new
 1.2.66.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.4 24-Apr-2021  thorpej branches: 1.4.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.3 17-Dec-2012  mbalmer branches: 1.3.2; 1.3.4; 1.3.6; 1.3.22; 1.3.62;
No need to include machine/pio.h now that inb() and outb() are no longer used.
 1.2 17-Dec-2012  mbalmer Fix the CVS Id marker.
 1.1 16-Dec-2012  mbalmer ptcd(4) is a device driver for the cash drawer port found on Protech PS3100
point of sale terminals. It controls the cash drawer using a gpio(4) device
that attaches at ptcd0: Pin 0 controls the drawer, pin 1 reports the current
state. For details read the manual page.
 1.3.62.1 23-Mar-2021  thorpej Convert config_found_ia() call sites where the device only carries
a single interface attribute to bare config_found() calls.
 1.3.22.2 16-Apr-2015  snj Pull up following revision(s) (requested by mbalmer in ticket #891):
distrib/sets/lists/man/mi: revision 1.1411
share/man/man4/Makefile: revision 1.593
share/man/man4/gpio.4: revision 1.24
share/man/man4/ptcd.4: revision 1.1-1.4
sys/arch/i386/conf/ALL: revision 1.348
sys/arch/i386/conf/files.i386: revision 1.369
sys/dev/isa/ptcd.c: revision 1.1
ptcd(4) is a device driver for the cash drawer port found on Protech PS3100
point of sale terminals. It controls the cash drawer using a gpio(4) device
that attaches at ptcd0: Pin 0 controls the drawer, pin 1 reports the current
state. For details read the manual page.
--
Mention ptcd(4) in the synopsis.
--
Add ptcd(4).
--
Mention ibmcd(4).
--
Sort sections.
--
Sort SEE ALSO.
 1.3.22.1 17-Dec-2012  snj file ptcd.c was added on branch netbsd-6 on 2015-04-16 07:01:39 +0000
 1.3.6.2 25-Feb-2013  tls resync with head
 1.3.6.1 17-Dec-2012  tls file ptcd.c was added on branch tls-maxphys on 2013-02-25 00:29:16 +0000
 1.3.4.2 23-Jun-2013  bouyer Pull up following revision(s) (requested by mbalmer in ticket #1863):
distrib/sets/lists/man/mi: revision 1.1411
share/man/man4/gpio.4: revision 1.24
sys/arch/i386/conf/ALL: revision 1.348
sys/arch/i386/conf/files.i386: revision 1.369
sys/dev/isa/ptcd.c: revision 1.1
share/man/man4/Makefile: revision 1.593
share/man/man4/ptcd.4: revision 1.1, 1.3, 1.4
ptcd(4) is a device driver for the cash drawer port found on Protech PS3100
point of sale terminals. It controls the cash drawer using a gpio(4) device
that attaches at ptcd0: Pin 0 controls the drawer, pin 1 reports the current
state. For details read the manual page.
Mention ptcd(4) in the synopsis.
 1.3.4.1 17-Dec-2012  bouyer file ptcd.c was added on branch netbsd-5 on 2013-06-23 11:09:54 +0000
 1.3.2.2 23-Jan-2013  yamt sync with head
 1.3.2.1 17-Dec-2012  yamt file ptcd.c was added on branch yamt-pagecache on 2013-01-23 00:06:07 +0000
 1.4.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20 23-Mar-2014  christos fix unused
 1.19 27-Oct-2012  chs branches: 1.19.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.18 12-May-2009  cegger branches: 1.18.12; 1.18.22;
struct device * -> device_t, no functional changes intended.
 1.17 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.16 08-Apr-2008  cegger branches: 1.16.4; 1.16.18;
use aprint_*_dev and device_xname
 1.15 19-Oct-2007  ad branches: 1.15.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.14 16-Nov-2006  christos branches: 1.14.8; 1.14.22; 1.14.24; 1.14.28;
__unused removal on arguments; approved by core.
 1.13 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.12 11-Dec-2005  christos branches: 1.12.20; 1.12.22;
merge ktrace-lwp.
 1.11 27-Feb-2005  perry branches: 1.11.4;
nuke trailing whitespace
 1.10 29-Oct-2004  yamt branches: 1.10.4; 1.10.6;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.9 14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 07-Jan-2002  thorpej branches: 1.5.2; 1.5.4;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.4 03-Jan-2002  augustss Add \n in attach messages.
 1.3 02-Jan-2002  augustss Change the probe code. You cannot unmap bus space and then use it.
 1.2 02-Jan-2002  augustss Add missing newline.
 1.1 01-Jan-2002  augustss Add support for radio cards. Written by Maxim Tsyplakov and Vladimir Popov
for OpenBSD, from where it was imported.
 1.5.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.4.1 07-Jan-2002  thorpej file radiotrack.c was added on branch kqueue on 2002-01-10 19:55:40 +0000
 1.5.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.5.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.5.2.3 11-Jan-2002  nathanw More catchup.
 1.5.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.1 07-Jan-2002  nathanw file radiotrack.c was added on branch nathanw_sa on 2002-01-08 00:30:30 +0000
 1.8.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.4.1 29-Apr-2005  kent sync with -current
 1.11.4.2 27-Oct-2007  yamt sync with head.
 1.11.4.1 30-Dec-2006  yamt sync with head.
 1.12.22.2 10-Dec-2006  yamt sync with head.
 1.12.22.1 22-Oct-2006  yamt sync with head
 1.12.20.1 18-Nov-2006  ad Sync with head.
 1.14.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.14.24.1 06-Nov-2007  matt sync with HEAD
 1.14.22.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.14.8.1 23-Oct-2007  ad Sync with head.
 1.15.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.4.1 16-May-2009  yamt sync with head
 1.18.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.18.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.12.1 30-Oct-2012  yamt sync with head
 1.19.2.1 18-May-2014  rmind sync with head
 1.16 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.15 12-May-2009  cegger branches: 1.15.12; 1.15.22;
struct device * -> device_t, no functional changes intended.
 1.14 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.13 16-Nov-2006  christos branches: 1.13.52; 1.13.68;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 29-Oct-2004  yamt branches: 1.10.12;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.9 14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 03-Sep-2002  augustss Use a different way to recognize tea5759 chips. From OpenBSD.
 1.4 07-Jan-2002  thorpej branches: 1.4.2; 1.4.4;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 03-Jan-2002  augustss Add \n in attach messages.
 1.2 02-Jan-2002  augustss Change the probe code. You cannot unmap bus space and then use it.
 1.1 01-Jan-2002  augustss Add support for radio cards. Written by Maxim Tsyplakov and Vladimir Popov
for OpenBSD, from where it was imported.
 1.4.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.1 07-Jan-2002  thorpej file radiotrack2.c was added on branch kqueue on 2002-01-10 19:55:41 +0000
 1.4.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.4.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.3 11-Jan-2002  nathanw More catchup.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 07-Jan-2002  nathanw file radiotrack2.c was added on branch nathanw_sa on 2002-01-08 00:30:30 +0000
 1.8.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.12.1 30-Dec-2006  yamt sync with head.
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.13.68.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.52.1 16-May-2009  yamt sync with head
 1.15.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.12.1 30-Oct-2012  yamt sync with head
 1.62 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.61 24-Apr-2021  thorpej branches: 1.61.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.60 14-Jul-2016  msaitoh branches: 1.60.34;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.59 11-Jul-2016  msaitoh KNF. No functional change.
 1.58 27-Oct-2012  chs branches: 1.58.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.57 12-May-2009  cegger branches: 1.57.12; 1.57.22;
struct device * -> device_t, no functional changes intended.
 1.56 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.55 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.54 08-Apr-2008  cegger branches: 1.54.4; 1.54.12; 1.54.18;
use aprint_*_dev and device_xname
 1.53 19-Oct-2007  ad branches: 1.53.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.52 16-Nov-2006  christos branches: 1.52.8; 1.52.22; 1.52.24; 1.52.28;
__unused removal on arguments; approved by core.
 1.51 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.50 11-Dec-2005  christos branches: 1.50.20; 1.50.22;
merge ktrace-lwp.
 1.49 04-Feb-2005  perry branches: 1.49.6;
de-__P
 1.48 14-Sep-2004  drochner branches: 1.48.4; 1.48.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.47 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.46 01-Jan-2003  thorpej branches: 1.46.2;
Use aprint_normal() in cfprint routines.
 1.45 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.44 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.43 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.42 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.41 13-Nov-2001  lukem add RCSID
 1.40 18-Sep-1998  enami branches: 1.40.24; 1.40.26;
Make these files compile again; no longer necessary to pass
iobase to comprobe1.
 1.39 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.38 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.37 14-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.36 12-Jan-1998  thorpej Update for config changes.
 1.35 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.34 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.33 16-Oct-1997  thorpej Adjust for the new "com" driver home.
 1.32 12-Sep-1997  drochner Make console on multiport cards more likely to work (obvious bug,
fix still untested).
Closes PR kern/4095 by enami tsugutomo.
 1.31 23-Aug-1997  drochner Use the new com_is_console() to decide if the port is already initialized.
XXX shouldn't the attach() use the existing handle if present???
 1.30 16-Aug-1997  drochner Bring back the "comconsattached" flag. It is necessary for starred
com devices (on non "__BROKEN_INDIRECT_CONFIG" ISA).
 1.29 13-Aug-1997  jtk fix multi-port serial drivers to reflect recent changes to com driver for console/kgdb
 1.28 09-Apr-1997  mycroft branches: 1.28.4;
Update for new com driver.
 1.27 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.26 13-Oct-1996  christos backout kprintf changes
 1.25 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.24 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.23 12-May-1996  mycroft Use intr.h.
 1.22 05-May-1996  christos Make those compile again; they were missing a declaration for bc.
Also fix prototypes.
 1.21 15-Apr-1996  cgd include <sys/termios.h> to make comvar.h happy
 1.20 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.19 04-Apr-1996  cgd remove tricky open-coded variants of config_found(), by using the
child device pointer now returned by config_found(). (previously,
the code played games to get that pointer; now they are unnecesary.)
 1.18 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.17 10-Mar-1996  cgd convert these to use new <machine/bus.h> interfaces. This involved
substantial reworking of the multi-port drivers, as they need to frob
bits in the io-port spaces of their children. As a result, the
commulti->com attachment interface is substantially more complex.
(This may be fixable in the future by making some of the code common,
but as long as io-port allocation checking is planned, it's necessary.)
 1.16 09-Mar-1996  cgd Include comvar.h, for comprobe1() prototype and for commulti_attach_args.
Remove multiple identical definitions for the arg struct used by multiport
boards' to attach slave com ports.
 1.15 09-Mar-1996  cgd minor cleanup. mostly: use COM_NPORTS and a new (driver-specific) NSLAVES
macro where appropriate. No point in hard-coding numbers in multiple places.
At the very least, this makes the drivers slightly easier to diff/understand.
 1.14 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.13 26-Jun-1995  cgd if subdevices specified with wildcarded unit number, config_attach()
can change the cf_unit, so save it before attach and use saved value.
 1.12 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.11 04-Jan-1995  mycroft Fix oversight in previous.
 1.10 03-Jan-1995  mycroft \
These files have been 99% rewritten from the original ast driver. Add an
appropriate copyright notice.
 1.9 03-Jan-1995  mycroft Add interrupt sharing types.
 1.8 02-Jan-1995  mycroft Use direct config for subdevices.
 1.7 18-Nov-1994  mycroft Stylistic changes.
 1.6 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.5 07-Nov-1994  mycroft Update for new autoconfig.
 1.4 04-Nov-1994  mycroft No longer needs icu.h.
 1.3 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.2 27-Oct-1994  cgd new RCS ID format.
 1.1 07-Aug-1994  mycroft Add multiplexer for RT 4-port serial cards.
 1.28.4.4 16-Oct-1997  thorpej Sync w/ trunk.
 1.28.4.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.40.26.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.40.26.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.24.5 03-Jan-2003  thorpej Sync with HEAD.
 1.40.24.4 18-Oct-2002  nathanw Catch up to -current.
 1.40.24.3 28-Feb-2002  nathanw Catch up to -current.
 1.40.24.2 11-Jan-2002  nathanw More catchup.
 1.40.24.1 14-Nov-2001  nathanw Catch up to -current.
 1.46.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.46.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.46.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.48.6.1 12-Feb-2005  yamt sync with head.
 1.48.4.1 29-Apr-2005  kent sync with -current
 1.49.6.2 27-Oct-2007  yamt sync with head.
 1.49.6.1 30-Dec-2006  yamt sync with head.
 1.50.22.2 10-Dec-2006  yamt sync with head.
 1.50.22.1 22-Oct-2006  yamt sync with head
 1.50.20.1 18-Nov-2006  ad Sync with head.
 1.52.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.52.24.1 06-Nov-2007  matt sync with HEAD
 1.52.22.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.52.8.1 23-Oct-2007  ad Sync with head.
 1.53.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.54.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.54.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.54.4.2 16-May-2009  yamt sync with head
 1.54.4.1 04-May-2009  yamt sync with head.
 1.57.22.2 03-Dec-2017  jdolecek update from HEAD
 1.57.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.57.12.1 30-Oct-2012  yamt sync with head
 1.58.14.1 05-Oct-2016  skrll Sync with HEAD
 1.60.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.61.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.47 27-Jan-2019  maxv Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.46 25-Oct-2017  maya branches: 1.46.4;
Use C99 initializer for filterops

Mostly done with spatch with touchups for indentation

@@
expression a;
identifier b,c,d;
identifier p;
@@
const struct filterops p =
- { a, b, c, d
+ {
+ .f_isfd = a,
+ .f_attach = b,
+ .f_detach = c,
+ .f_event = d,
};
 1.45 25-Jul-2014  dholland Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.44 16-Mar-2014  dholland branches: 1.44.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.43 27-Oct-2012  chs branches: 1.43.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.42 12-May-2009  cegger branches: 1.42.12; 1.42.22;
struct device * -> device_t, no functional changes intended.
 1.41 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.40 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.39 08-Jun-2008  tsutsui branches: 1.39.6; 1.39.12;
Replace device_lookup() with device_lookup_private() on getting softc
for future device_t/softc spilt.
 1.38 28-Apr-2008  martin branches: 1.38.2;
Remove clause 3 and 4 from TNF licenses
 1.37 08-Apr-2008  cegger branches: 1.37.2; 1.37.4;
use aprint_*_dev and device_xname
 1.36 01-Mar-2008  rmind Welcome to 4.99.55:

- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call. It will
indicate which event (POLL_IN, POLL_OUT, etc) happen. If unknown,
zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
 1.35 05-Dec-2007  pooka branches: 1.35.8; 1.35.12;
Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
 1.34 19-Oct-2007  ad branches: 1.34.2; 1.34.4;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.33 10-Jul-2007  tsutsui branches: 1.33.6; 1.33.8; 1.33.12;
Fix more pesudo.
 1.32 09-Jul-2007  ad Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.31 04-Mar-2007  christos branches: 1.31.2; 1.31.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30 16-Nov-2006  christos branches: 1.30.4;
__unused removal on arguments; approved by core.
 1.29 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.28 03-Sep-2006  christos branches: 1.28.2; 1.28.4;
add missing initializer
 1.27 23-Apr-2006  christos Make this compile again.
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.6; 1.26.8; 1.26.10; 1.26.12;
merge ktrace-lwp.
 1.25 27-Feb-2005  perry branches: 1.25.4;
nuke trailing whitespace
 1.24 04-Feb-2005  perry de-__P
 1.23 14-Sep-2004  drochner branches: 1.23.4; 1.23.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.22 09-May-2003  fvdl branches: 1.22.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.21 26-Nov-2002  christos si_ -> sel_
 1.20 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.19 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.18 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.17 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.16 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.15 07-Jan-2002  thorpej branches: 1.15.8;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.14 13-Nov-2001  lukem add RCSID
 1.13 18-Jul-2001  thorpej branches: 1.13.2;
bcopy -> memcpy
 1.12 18-Jul-2001  thorpej bzero -> memset
 1.11 06-Jul-2000  thorpej branches: 1.11.2; 1.11.4;
Use device_lookup().
 1.10 15-May-2000  thorpej Fix a tyop, pointed out by Bill Studenmund.
 1.9 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.8 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.7 09-Jun-1998  thorpej branches: 1.7.14;
Nuke __BROKEN_INDIRECT_CONFIG.
 1.6 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.5 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.4 12-Jan-1998  thorpej Update for config changes.
 1.3 19-Oct-1997  thorpej Use symbolic names for default locator values.
 1.2 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.1 13-Jul-1997  hpeyerl branches: 1.1.2;
Satellite receiver driver for ISA cards from PlanetConnect by Jason and
Herb for Canada Connect Corp.
 1.1.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.11.4.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.4.5 02-Oct-2002  jdolecek do not need the (void *) cast for kn_hook anymore
 1.11.4.4 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.4.3 12-Sep-2001  thorpej Oops, selwakeup -> selnotify
 1.11.4.2 11-Sep-2001  thorpej Add kqueue support.
 1.11.4.1 03-Aug-2001  lukem update to -current
 1.11.2.8 11-Dec-2002  thorpej Sync with HEAD.
 1.11.2.7 11-Nov-2002  nathanw Catch up to -current
 1.11.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.11.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.11.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.11.2.3 11-Jan-2002  nathanw More catchup.
 1.11.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.11.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.13.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.15.8.1 16-May-2002  gehenna Add the character device switch.
 1.22.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.22.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.22.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.23.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.23.6.1 12-Feb-2005  yamt sync with head.
 1.23.4.1 29-Apr-2005  kent sync with -current
 1.25.4.6 17-Mar-2008  yamt sync with head.
 1.25.4.5 07-Dec-2007  yamt sync with head
 1.25.4.4 27-Oct-2007  yamt sync with head.
 1.25.4.3 03-Sep-2007  yamt sync with head.
 1.25.4.2 30-Dec-2006  yamt sync with head.
 1.25.4.1 21-Jun-2006  yamt sync with head.
 1.26.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.26.10.1 11-May-2006  elad sync with head
 1.26.8.2 03-Sep-2006  yamt sync with head.
 1.26.8.1 24-May-2006  yamt sync with head.
 1.26.6.1 01-Jun-2006  kardel Sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.28.4.2 10-Dec-2006  yamt sync with head.
 1.28.4.1 22-Oct-2006  yamt sync with head
 1.28.2.1 18-Nov-2006  ad Sync with head.
 1.30.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.31.4.1 11-Jul-2007  mjf Sync with head.
 1.31.2.3 23-Oct-2007  ad Sync with head.
 1.31.2.2 15-Jul-2007  ad Sync with head.
 1.31.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.33.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.33.8.3 23-Mar-2008  matt sync with HEAD
 1.33.8.2 09-Jan-2008  matt sync with HEAD
 1.33.8.1 06-Nov-2007  matt sync with HEAD
 1.33.6.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.33.6.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.34.4.1 08-Dec-2007  ad Sync with head.
 1.34.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.35.12.4 29-Jun-2008  mjf Sync with HEAD.
 1.35.12.3 02-Jun-2008  mjf Sync with HEAD.
 1.35.12.2 05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.35.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.35.8.1 24-Mar-2008  keiichi sync with head.
 1.37.4.3 16-May-2009  yamt sync with head
 1.37.4.2 04-May-2009  yamt sync with head.
 1.37.4.1 16-May-2008  yamt sync with head.
 1.37.2.2 17-Jun-2008  yamt sync with head.
 1.37.2.1 18-May-2008  yamt sync with head.
 1.38.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.39.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.39.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.42.22.3 03-Dec-2017  jdolecek update from HEAD
 1.42.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.42.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.42.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.42.12.1 30-Oct-2012  yamt sync with head
 1.43.2.1 18-May-2014  rmind sync with head
 1.44.2.1 10-Aug-2014  tls Rebase.
 1.46.4.1 10-Jun-2019  christos Sync with HEAD
 1.5 27-Jan-2019  maxv Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.4 06-Sep-2015  dholland branches: 1.4.18;
More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.3 28-Apr-2008  martin branches: 1.3.44; 1.3.64;
Remove clause 3 and 4 from TNF licenses
 1.2 09-Oct-1997  jtc branches: 1.2.148; 1.2.150; 1.2.152;
Fix tipo inherited from old version of TNF copyright template.
 1.1 13-Jul-1997  hpeyerl branches: 1.1.2;
Satellite receiver driver for ISA cards from PlanetConnect by Jason and
Herb for Canada Connect Corp.
 1.1.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.152.1 16-May-2008  yamt sync with head.
 1.2.150.1 18-May-2008  yamt sync with head.
 1.2.148.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.64.1 22-Sep-2015  skrll Sync with HEAD
 1.3.44.1 03-Dec-2017  jdolecek update from HEAD
 1.4.18.1 10-Jun-2019  christos Sync with HEAD
 1.4 27-Jan-2019  maxv Remove the satlink driver. It was disabled everywhere, had no man page and
no use either. Spotted by thorpej in PR/21345, ok christos.
 1.3 28-Apr-2008  martin branches: 1.3.88;
Remove clause 3 and 4 from TNF licenses
 1.2 09-Oct-1997  jtc branches: 1.2.148; 1.2.150; 1.2.152;
Fix tipo inherited from old version of TNF copyright template.
 1.1 13-Jul-1997  hpeyerl branches: 1.1.2;
Satellite receiver driver for ISA cards from PlanetConnect by Jason and
Herb for Canada Connect Corp.
 1.1.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.152.1 16-May-2008  yamt sync with head.
 1.2.150.1 18-May-2008  yamt sync with head.
 1.2.148.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.88.1 10-Jun-2019  christos Sync with HEAD
 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().
 1.39 08-May-2019  isaki 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.38 24-Nov-2011  mrg branches: 1.38.50; 1.38.54;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.37 23-Nov-2011  jmcneill 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.36 15-Mar-2008  cube branches: 1.36.16; 1.36.38; 1.36.40;
Split device_t and softc for sb(4) and all its attachments.
 1.35 19-Oct-2007  ad branches: 1.35.12; 1.35.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.34 16-Nov-2006  christos branches: 1.34.6; 1.34.8; 1.34.22; 1.34.24; 1.34.28;
__unused removal on arguments; approved by core.
 1.33 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.32 11-Dec-2005  christos branches: 1.32.20; 1.32.22;
merge ktrace-lwp.
 1.31 27-Feb-2005  perry branches: 1.31.4;
nuke trailing whitespace
 1.30 04-Feb-2005  perry de-__P
 1.29 02-Oct-2002  thorpej branches: 1.29.6; 1.29.14; 1.29.16;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.28 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.27 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.26 11-Jan-2002  jdolecek Fix fallout from previous - the 'sc->sc_dev.dv_cfdata = match' needs
to be retained, it's referenced in sbdsp.c:sbdsp_probe().
 1.25 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.24 13-Nov-2001  lukem add RCSID
 1.23 18-Jul-2001  thorpej bzero -> memset
 1.22 07-Sep-1999  soren branches: 1.22.14; 1.22.16;
Do not complain in sbfind() if another driver has mapped the registers.
 1.21 22-Mar-1999  mycroft 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.20 19-Feb-1999  mycroft Move IRQ setup into frontend. Need to move DRQ handling as well.
 1.19 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.18 29-Jun-1998  thorpej Interrupt share type is EDGE.
 1.17 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.16 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.15 30-Nov-1997  drochner fix inconsistent declaration in non-"__BROKEN_INDIRECT_CONFIG" case
 1.14 28-Aug-1997  augustss branches: 1.14.4;
Zap drq2 if unused.
 1.13 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.12 25-Aug-1997  augustss Fix the "non-broken" indirect configuration so it might actually work.
 1.11 24-Aug-1997  augustss Remove indirect brokenness.
 1.10 07-Aug-1997  augustss Add a 'return 1' that got lost in the last commit.
 1.9 04-Aug-1997  augustss Implement a function to test if a drq is taken and use it
in two drivers. There are still many drivers left to fix...
 1.8 27-Jul-1997  augustss branches: 1.8.2;
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.7 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.6 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.5 17-May-1997  augustss Change lowater calculation a little.
Fix mixer setting bug and add some missing splaudio().
Set SB drq16 to 5 and don't pretend to be SB v1.0.
 1.4 13-May-1997  augustss Clean up emulation code, SB, and GUS drivers and add some more encoding
emulation to SB.
 1.3 20-Mar-1997  mycroft branches: 1.3.2;
Add 16-bit DRQ support on PnP, and enable 16-bit output.
 1.2 12-Feb-1997  thorpej Pass the i/o handle, not bus PA, to bus_space_unmap().
From Matthias Drochner <drochner@zelz28.zel.kfa-juelich.de>,
in PR #3216.
 1.1 16-Jan-1997  christos branches: 1.1.2; 1.1.4;
- convert to bus_space_*
- split attachment code to sb_isa.c
 1.1.4.1 12-Mar-1997  is Merge in changes from The Trunk
 1.1.2.2 18-Jan-1997  thorpej Update from trunk.
 1.1.2.1 16-Jan-1997  thorpej file sb_isa.c was added on branch thorpej-setroot on 1997-01-18 04:30:37 +0000
 1.3.2.3 24-May-1997  thorpej Update from trunk.
 1.3.2.2 19-May-1997  thorpej Update from trunk.
 1.3.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.8.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.4.1 17-Dec-1997  mellon Pull rev 1.15 up from trunk (mycroft)
 1.22.16.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.16.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.22.16.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.22.16.1 03-Aug-2001  lukem update to -current
 1.22.14.5 18-Oct-2002  nathanw Catch up to -current.
 1.22.14.4 28-Feb-2002  nathanw Catch up to -current.
 1.22.14.3 11-Jan-2002  nathanw More catchup.
 1.22.14.2 14-Nov-2001  nathanw Catch up to -current.
 1.22.14.1 24-Aug-2001  nathanw Catch up with -current.
 1.29.16.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.29.16.1 12-Feb-2005  yamt sync with head.
 1.29.14.1 29-Apr-2005  kent sync with -current
 1.29.6.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.29.6.1 04-Feb-2005  skrll Sync with HEAD.
 1.31.4.3 17-Mar-2008  yamt sync with head.
 1.31.4.2 27-Oct-2007  yamt sync with head.
 1.31.4.1 30-Dec-2006  yamt sync with head.
 1.32.22.2 10-Dec-2006  yamt sync with head.
 1.32.22.1 22-Oct-2006  yamt sync with head
 1.32.20.1 18-Nov-2006  ad Sync with head.
 1.34.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.34.24.2 23-Mar-2008  matt sync with HEAD
 1.34.24.1 06-Nov-2007  matt sync with HEAD
 1.34.22.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.34.8.1 23-Oct-2007  ad Sync with head.
 1.34.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.35.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.35.12.1 24-Mar-2008  keiichi sync with head.
 1.36.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.36.38.1 17-Apr-2012  yamt sync with head
 1.36.16.1 08-Dec-2008  ad Convert some more drivers.
 1.38.54.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.38.54.1 03-May-2019  isaki Remove dev/auconv.[ch].
Now it is handled in dev/audio/audio.c and dev/audio/linear.c.
Remove dev/mulaw.h.
It already have been just a link to dev/audio/mulaw.h in this
branch.
 1.38.50.1 10-Jun-2019  christos Sync with HEAD
 1.142 24-Jul-2021  andvar Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.141 08-Jun-2019  isaki branches: 1.141.14;
Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.140 08-May-2019  isaki 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.139 03-Feb-2019  mrg branches: 1.139.2;
- add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
this case, and thus can't be marked __dead easily
 1.138 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int. The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER! Some subsystems have

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX. Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.137 04-Nov-2017  nat branches: 1.137.2; 1.137.4;
Add AUDIO_ENCODING_SLINEAR to supported encodings. This allows sb, sbpro
& sb16 to configure with 8-bit precision.

Tested in games/mame with a 486DX emulation.
 1.136 11-Jul-2016  msaitoh branches: 1.136.10;
KNF. No functional change.
 1.135 23-Nov-2011  jmcneill branches: 1.135.8; 1.135.26;
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.134 24-Feb-2010  dyoung branches: 1.134.10; 1.134.12;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.133 08-Jan-2010  dyoung branches: 1.133.2;
Expand PMF_FN_* macros.
 1.132 01-Sep-2009  jmcneill aprint-ify
 1.131 28-Apr-2008  martin branches: 1.131.12;
Remove clause 3 and 4 from TNF licenses
 1.130 11-Apr-2008  cegger branches: 1.130.2; 1.130.4;
convert to pmf(9)
ok jmcneill
 1.129 01-Apr-2008  xtraeme Fix fallout from device_t/softc split to mpu(4):
always pass the mpu_softc to mpu_intr(). Found by Takeshi Nakayama.
 1.128 15-Mar-2008  cube Split device_t and softc for sb(4) and all its attachments.
 1.127 19-Oct-2007  ad branches: 1.127.12; 1.127.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.126 16-Nov-2006  christos branches: 1.126.6; 1.126.8; 1.126.22; 1.126.24; 1.126.28;
__unused removal on arguments; approved by core.
 1.125 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.124 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.123 03-Sep-2006  christos branches: 1.123.2; 1.123.4;
add missing initializers
 1.122 14-May-2006  elad integrate kauth.
 1.121 13-Apr-2006  christos Coverity CID 1320: Don't try to use drq16 as an index in an array if it is -1
 1.120 29-Mar-2006  thorpej Use device_cfdata().
 1.119 08-Mar-2006  lukem branches: 1.119.2;
Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.118 11-Dec-2005  christos branches: 1.118.4; 1.118.6; 1.118.8; 1.118.10;
merge ktrace-lwp.
 1.117 27-Feb-2005  perry branches: 1.117.4;
nuke trailing whitespace
 1.116 01-Feb-2005  gson Update printf format in debug printf to account for sample_rate now
being an unsigned int.
 1.115 13-Jan-2005  kent branches: 1.115.2; 1.115.4;
ansify and KNF
 1.114 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.113 09-Jul-2004  mycroft branches: 1.113.2;
Remove junk code.
 1.112 09-May-2003  fvdl branches: 1.112.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.111 03-May-2003  wiz DMA, not dma nor Dma.
 1.110 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.109 06-Jan-2002  augustss Increase max sampling rate on SB16. It seems almost all models supports it.
 1.108 13-Nov-2001  lukem add RCSID
 1.107 22-Feb-2001  minoura branches: 1.107.2; 1.107.4;
Reset the mixer when resume from suspend.
This is required on some laptops with a buggy APM BIOS.
Code from Inoue Yoshinari <pf5y-inue@asahi-net.or.jp>.
 1.106 28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.105 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.104 07-Feb-2000  thorpej branches: 1.104.4;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.103 20-Jan-2000  thorpej Simplify sbdsp_pause().
 1.102 01-Nov-1999  augustss Make little endian and big endian version of all functions
that deal with 16 bit samples. Let the drivers decide which ones
to use.
 1.101 10-Oct-1999  mycroft branches: 1.101.2; 1.101.4;
Fix one more #ifdef, and now it actually compiles again. *sigh*
 1.100 04-Aug-1999  augustss branches: 1.100.2;
Use NMPU not NMIDI around call to mpu_intr.
 1.99 02-Aug-1999  augustss 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.98 22-Mar-1999  mycroft branches: 1.98.4;
Make sure we clean up any DMA maps if the open fails.
 1.97 22-Mar-1999  mycroft 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.96 22-Feb-1999  mycroft Use DMAMODE_LOOPDEMAND. Tested on a ViBRA16.
 1.95 18-Feb-1999  mycroft spaces -> tabs
 1.94 18-Feb-1999  mycroft Remove some superfluous softc elements.
 1.93 18-Feb-1999  mycroft Add separate halt_output and halt_input routines.
 1.92 17-Feb-1999  mycroft Fix slight ommission in previous.
 1.91 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.90 17-Feb-1999  mycroft If we have an 8-bit DRQ, always pass that to isa_malloc().
 1.89 08-Jan-1999  augustss Avoid arithmetic on `void *' since that's not ANSI C.
 1.88 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.87 10-Aug-1998  augustss Fix typo.
 1.86 10-Aug-1998  mycroft Minor change.
 1.85 10-Aug-1998  mycroft Slow down, Wilbur.
 1.84 10-Aug-1998  mycroft Fix a typo I introduced in the MIDI code.
 1.83 10-Aug-1998  mycroft For models prior to the SB16, there is only one clock divider, so couple the
sample rates. However, only do this if both play and record are being used
simultaneously; otherwise we can't play 22KHz on the SB1.
 1.82 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.81 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.80 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.79 04-Mar-1998  augustss Use lower case "agc" for consistency.
 1.78 30-Jan-1998  bouyer Fix for the vibra16x from Lennart Augusts: saying that the dsp4.16 was
a SB64 was just a guess. The vibra16x is really a sb16.
 1.77 02-Dec-1997  mycroft Set the gain to 1/2 by default; 3/4 is too loud and can damage headphones and
speakers.
 1.76 19-Oct-1997  augustss branches: 1.76.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.75 16-Oct-1997  augustss Make sure the 'input' class is used even for the 1345 mixer.
 1.74 11-Oct-1997  mycroft AudioElinear -> AudioEslinear
 1.73 11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
 1.72 06-Oct-1997  augustss Keep filter when setting source on SB Pro.
Close PR 2593.
 1.71 09-Sep-1997  augustss Change the way we determine what interrupt routine to use to make
it work when drq8 == drq16.
 1.70 29-Aug-1997  augustss Substantial rewrite of the SB driver to make it do full duplex on an SB16.
Because of the braindead design of the SB the input and output have to
use different precisions (8 and 16 bits). It is possible to set the driver
to use 8 bits on both and it will the emulate 8 bits on the output by
expanding it to 16 bits.
 1.69 24-Aug-1997  augustss Add mute and channels swap to the mixer capabilites.
 1.68 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.67 19-Aug-1997  augustss Avoid munging audio_defaults.
 1.66 11-Aug-1997  augustss Round mixer values correctly when setting them.
This is important for the OSS emulation since OSS
uses a different range of values for the mixer.
 1.65 04-Aug-1997  augustss Audio:
* Make it possible to use software assisted encodings that expand the
sample size.
* Use 16 bits per sample when emulating mulaw coding on the SB.
* Prepare for SB16 without CT1745 mixer.
 1.64 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.63 28-Jul-1997  augustss branches: 1.63.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.62 28-Jul-1997  augustss audio: Minor cleanup and enable looping DMA for PSS and PAS.
 1.61 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.60 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.59 15-Jul-1997  augustss In the name of backwards compatibility AUDIO_ENCODING_LINEAR has been
renamed AUDIO_ENCODING_SLINEAR and AUDIO_ENCODING_LINEAR reverts to the
NetBSD 1.2 sematics. A kernel with COMPAT_12 defined will accept
AUDIO_ENCODING_LINEAR and treat it as before, without COMPAT_12 it
will be rejected.
 1.58 13-Jun-1997  augustss Fix a braino in record source selection and a pasto in detecting
16 bit mode recording.
 1.57 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.56 29-May-1997  jtk make Jazz16 16-bit output work properly again. Still hangs somewhere
(not yet diagnosed) on occasion in high-speed mode, but a ^C will exit
immediately--no 30-second drainage timeout.
 1.55 28-May-1997  augustss Add Alaw encoding emulation.
 1.54 27-May-1997  augustss A cosmetic name change.
 1.53 26-May-1997  mycroft Minor corrections to previous. Notably, make recording work on SBPro again.
 1.52 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.51 20-May-1997  augustss Make the audio default parameters into a globally accessible constant.
 1.50 19-May-1997  augustss Redo the SB mixer code. The driver can now distinguish between the
four different mixer options: none, CT1335, CT1345, and CT1745.
It should now be possible to access most of the SB16 functionality.
 1.49 18-May-1997  augustss Mask the level registers as the documentation suggests.
 1.48 17-May-1997  augustss Change lowater calculation a little.
Fix mixer setting bug and add some missing splaudio().
Set SB drq16 to 5 and don't pretend to be SB v1.0.
 1.47 16-May-1997  augustss Back to pretending to be a SB v1.0 again, the mixer code for higher
versions is buggy.
 1.46 13-May-1997  augustss Clean up emulation code, SB, and GUS drivers and add some more encoding
emulation to SB.
 1.45 09-May-1997  augustss branches: 1.45.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.44 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.43 07-May-1997  mikel update sb_printsc() to match current reality.
 1.42 30-Apr-1997  augustss XXX Pretend that all SB cards are of model 1.
XXX This way you can at least use SB cards until the real fixes go in.
 1.41 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.40 29-Mar-1997  jtk partial fix for PR 3385: correctly identify JAZZ-16 when AUDIO_DEBUG is
enabled
 1.39 20-Mar-1997  mycroft Use autoinitialize DMA mode on the SB2 and later. Partly from Torsten Duwe.
 1.38 20-Mar-1997  mycroft Make sure we round the block size to a multiple of the sample size.
 1.37 20-Mar-1997  mycroft Remove bogus block rounding code. If the application sets a
block size explicitly, it had better know what it's doing. From
PR 2587, by Robert Baron.
 1.36 20-Mar-1997  mycroft Turn off a debugging printf().
 1.35 20-Mar-1997  mycroft Add 16-bit DRQ support on PnP, and enable 16-bit output.
 1.34 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.33 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.32 03-Mar-1997  christos Fix bug introduced in the conversion to bus_*(). Don't always say that
we are a JASS16. From enami tsugutomo.
 1.31 16-Jan-1997  christos branches: 1.31.2;
- convert to bus_space_*
- split attachment code to sb_isa.c
 1.30 25-Oct-1996  fvdl branches: 1.30.2;
Move 'not finished' printf within AUDIO_DEBUG ifdefs, it should normally
be silent about this and caused confusion with stray interrupts.
 1.29 16-Oct-1996  jtk fix PR 2851: make it compile under -Wformat
 1.28 13-Oct-1996  christos backout kprintf changes
 1.27 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.26 12-May-1996  mycroft Use intr.h.
 1.25 29-Apr-1996  christos - prototype fixes
 1.24 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.23 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.22 20-Feb-1996  mycroft Do not allow the gain to be changed on an original SoundBlaster.
 1.21 20-Feb-1996  mycroft Fix mono volume adjustment.
 1.20 20-Feb-1996  mycroft XXX This is a kluge.
Check to see if the DMA transfer is finished; if not, don't do interrupt
processing.
 1.19 18-Feb-1996  mycroft Declare a variable...
 1.18 18-Feb-1996  mycroft Clean this up a bit.
 1.17 18-Feb-1996  jtk Add bass/treble input filter adjustment controls to SB (Pro) driver
 1.16 16-Feb-1996  mycroft Various:
* Snap the sample rate when setting it, and remember only the time constant.
* Set the time constant when changing between play/record.
* Always return the actual sample rate with AUDIO_GETINFO.
 1.15 16-Feb-1996  mycroft Various, including:
* Add more delays while writing registers.
* Replace sc_dma{in,out}_inprogress with sc_dmadir.
* Eliminate the need for sc_locked.
* Add more DPRINTF()s.
 1.14 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.13 19-Jul-1995  brezak GUS audio driver from John Kohl.
 1.12 07-Jul-1995  brezak Cleanup
 1.11 08-May-1995  brezak Remove strings
 1.10 08-May-1995  brezak Fix holes in device index space. PR#1028
 1.9 26-Apr-1995  brezak Fix nits from Mike Long <mike.long@analog.com> PR#996
 1.8 17-Apr-1995  mycroft Fix obvious bug in reading from SB_MIC_PORT.
 1.7 17-Apr-1995  cgd update for new locations
 1.6 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.5 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.4 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.3 13-Mar-1995  brezak Fix SB8 playback. From David Gluss <david@pure.com>
 1.2 08-Mar-1995  brezak Cleanup for SB16 (From Jan Sparud)
 1.1 21-Feb-1995  brezak SoundBlaster driver for SB, SB16 and SBPRO
 1.30.2.1 18-Jan-1997  thorpej Update from trunk.
 1.31.2.1 12-Mar-1997  is Merge in changes from The Trunk
 1.45.2.4 01-Jun-1997  thorpej Update from trunk.
 1.45.2.3 24-May-1997  thorpej Update from trunk.
 1.45.2.2 19-May-1997  thorpej Update from trunk.
 1.45.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.63.2.5 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.63.2.4 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.63.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.63.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.63.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.76.2.2 07-Feb-1998  mellon Pull up 1.78 (manuel)
 1.76.2.1 09-Dec-1997  thorpej Sync w/ trunk (mycroft)
 1.98.4.1 02-Aug-1999  thorpej Update from trunk.
 1.100.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.101.4.1 15-Nov-1999  fvdl Sync with -current
 1.101.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.101.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.104.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.107.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.107.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.107.2.2 11-Jan-2002  nathanw More catchup.
 1.107.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.112.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.112.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.112.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.112.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.112.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.112.2.1 03-Aug-2004  skrll Sync with HEAD
 1.113.2.3 09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.113.2.2 03-Jan-2005  kent * remove stream_filter_list_append and stream_filter_list_prepend
* add stream_filter_list_t::{append(), prepend(), set()}
 1.113.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.115.4.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.115.4.1 12-Feb-2005  yamt sync with head.
 1.115.2.1 29-Apr-2005  kent sync with -current
 1.117.4.4 17-Mar-2008  yamt sync with head.
 1.117.4.3 27-Oct-2007  yamt sync with head.
 1.117.4.2 30-Dec-2006  yamt sync with head.
 1.117.4.1 21-Jun-2006  yamt sync with head.
 1.118.10.1 19-Apr-2006  elad sync with head.
 1.118.8.4 03-Sep-2006  yamt sync with head.
 1.118.8.3 24-May-2006  yamt sync with head.
 1.118.8.2 01-Apr-2006  yamt sync with head.
 1.118.8.1 13-Mar-2006  yamt sync with head.
 1.118.6.1 22-Apr-2006  simonb Sync with head.
 1.118.4.1 09-Sep-2006  rpaulo sync with head
 1.119.2.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.119.2.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.123.4.2 10-Dec-2006  yamt sync with head.
 1.123.4.1 22-Oct-2006  yamt sync with head
 1.123.2.1 18-Nov-2006  ad Sync with head.
 1.126.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.126.24.2 23-Mar-2008  matt sync with HEAD
 1.126.24.1 06-Nov-2007  matt sync with HEAD
 1.126.22.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.126.8.1 23-Oct-2007  ad Sync with head.
 1.126.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.127.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.127.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.127.12.1 24-Mar-2008  keiichi sync with head.
 1.130.4.3 11-Mar-2010  yamt sync with head
 1.130.4.2 16-Sep-2009  yamt sync with head
 1.130.4.1 16-May-2008  yamt sync with head.
 1.130.2.1 18-May-2008  yamt sync with head.
 1.131.12.3 11-Dec-2008  ad Checkpoint work in progress.
 1.131.12.2 09-Dec-2008  ad Checkpoint work on MIDI.
 1.131.12.1 08-Dec-2008  ad Convert some more drivers.
 1.133.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.134.12.3 20-Nov-2011  jmcneill improve the last change, after discussing it with rmind
 1.134.12.2 20-Nov-2011  jmcneill don't kpause with intr_lock held
 1.134.12.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.134.10.1 17-Apr-2012  yamt sync with head
 1.135.26.1 05-Oct-2016  skrll Sync with HEAD
 1.135.8.1 03-Dec-2017  jdolecek update from HEAD
 1.136.10.1 16-Apr-2018  martin Pull up following revision(s) (requested by nat in ticket #761):

sys/dev/isa/sbdsp.c: revision 1.137

Add AUDIO_ENCODING_SLINEAR to supported encodings. This allows sb, sbpro
& sb16 to configure with 8-bit precision.

Tested in games/mame with a 486DX emulation.
 1.137.4.1 10-Jun-2019  christos Sync with HEAD
 1.137.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.139.2.4 05-May-2019  isaki Fix typos (made in this branch).
 1.139.2.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.139.2.2 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.139.2.1 21-Apr-2019  isaki Not yet fully adapted to audio2 but make it compilable.
- Drop FULLDUPLEX property. It is done in a tricky way.
 1.141.14.1 01-Aug-2021  thorpej Sync with HEAD.
 1.62 08-May-2019  isaki 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.61 23-Nov-2011  jmcneill branches: 1.61.50; 1.61.54;
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.60 12-May-2009  cegger branches: 1.60.12; 1.60.14;
struct device * -> device_t, no functional changes intended.
 1.59 15-Mar-2008  cube branches: 1.59.4; 1.59.16; 1.59.18;
Split device_t and softc for sb(4) and all its attachments.
 1.58 13-Apr-2006  cube branches: 1.58.16; 1.58.34; 1.58.54; 1.58.58;
Fix grammar in a comment, and use named constants for better readability.
 1.57 11-Dec-2005  christos branches: 1.57.4; 1.57.6; 1.57.8; 1.57.10; 1.57.12;
merge ktrace-lwp.
 1.56 13-Jan-2005  kent branches: 1.56.10;
ansify and KNF
 1.55 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.54 09-Jul-2004  mycroft branches: 1.54.2;
Forgot to commit this.
 1.53 08-Jul-2003  itojun function prototype must not have variable name
 1.52 03-May-2003  wiz branches: 1.52.2;
DMA, not dma nor Dma.
 1.51 01-Feb-2003  thorpej Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.50 19-Dec-2000  mjl Add quirk for Avance Logic ALS100+, which doesn't like it's irq/drq
being set in pnp mode.
 1.49 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.48 07-Feb-2000  thorpej branches: 1.48.4;
Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.47 10-Oct-1999  mycroft branches: 1.47.2;
Oops; this should get mpu.h, not midi.h.
 1.46 09-Oct-1999  mycroft NMIDI -> NMPU, to be consistent with sbdsp.c.
 1.45 09-Oct-1999  mycroft NMIDI -> NMPU, to be consistent with sbdsp.c.
 1.44 02-Aug-1999  augustss branches: 1.44.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.43 01-Aug-1999  augustss Move the MPU driver isa/ to ic/.
(I didn't move it in the repository because the revision history
is very short and uninteresting. :)
 1.42 22-Mar-1999  mycroft branches: 1.42.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.41 19-Feb-1999  mycroft Move IRQ setup into frontend. Need to move DRQ handling as well.
 1.40 18-Feb-1999  mycroft Remove some superfluous softc elements.
 1.39 18-Feb-1999  mycroft Add separate halt_output and halt_input routines.
 1.38 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.37 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.36 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.35 29-Jun-1998  thorpej When hooking up the interrupt handler, use an interrupt share type
specified by the front-end.
 1.34 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.33 19-Oct-1997  augustss 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.32 16-Oct-1997  augustss Make sure the 'input' class is used even for the 1345 mixer.
 1.31 30-Aug-1997  augustss Make SB full duplex. Ooops, I forgot this in the last commit.
 1.30 24-Aug-1997  augustss Add mute and channels swap to the mixer capabilites.
 1.29 24-Aug-1997  augustss - Change audio_hw_if a little: set_param now sets the play and record modes
at the same time instead by using two different calls. This enables
it to check more easily if the combined mode is all right.
- Improve the error checking in audio.c.
- Add a new audio property, AUDIO_PROP_INDEPENDENT, show if the
play and record settings are independent.
- Fix some buglets in audio.c.
 1.28 04-Aug-1997  augustss Audio:
* Make it possible to use software assisted encodings that expand the
sample size.
* Use 16 bits per sample when emulating mulaw coding on the SB.
* Prepare for SB16 without CT1745 mixer.
 1.27 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.26 28-Jul-1997  augustss branches: 1.26.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.25 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.24 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.23 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.22 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.21 19-May-1997  augustss Redo the SB mixer code. The driver can now distinguish between the
four different mixer options: none, CT1335, CT1345, and CT1745.
It should now be possible to access most of the SB16 functionality.
 1.20 09-May-1997  augustss branches: 1.20.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.19 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.18 20-Mar-1997  mycroft Use autoinitialize DMA mode on the SB2 and later. Partly from Torsten Duwe.
 1.17 20-Mar-1997  mycroft Add 16-bit DRQ support on PnP, and enable 16-bit output.
 1.16 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.15 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.14 16-Jan-1997  christos - convert to bus_space_*
- split attachment code to sb_isa.c
 1.13 29-Apr-1996  christos branches: 1.13.2;
Fix gcc -Wall warnings.
 1.12 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.11 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.10 18-Feb-1996  jtk Add bass/treble input filter adjustment controls to SB (Pro) driver
 1.9 16-Feb-1996  mycroft Various:
* Snap the sample rate when setting it, and remember only the time constant.
* Set the time constant when changing between play/record.
* Always return the actual sample rate with AUDIO_GETINFO.
 1.8 16-Feb-1996  mycroft Various, including:
* Add more delays while writing registers.
* Replace sc_dma{in,out}_inprogress with sc_dmadir.
* Eliminate the need for sc_locked.
* Add more DPRINTF()s.
 1.7 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.6 08-May-1995  brezak Remove strings
 1.5 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.4 28-Mar-1995  jtc KERNEL -> _KERNEL
 1.3 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.2 08-Mar-1995  brezak Cleanup for SB16 (From Jan Sparud)
 1.1 21-Feb-1995  brezak SoundBlaster driver for SB, SB16 and SBPRO
 1.13.2.1 18-Jan-1997  thorpej Update from trunk.
 1.20.2.2 24-May-1997  thorpej Update from trunk.
 1.20.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.26.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.26.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.42.4.1 02-Aug-1999  thorpej Update from trunk.
 1.44.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.47.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.47.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.48.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.52.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.52.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.52.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.52.2.1 03-Aug-2004  skrll Sync with HEAD
 1.54.2.2 09-Jan-2005  kent audio_hw_if change
* make open() and close() optional
* add int (AUMODE_PLAY or AUMODE_RECORD) and audio_params_t parameters
to round_blocksize()
 1.54.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.56.10.2 17-Mar-2008  yamt sync with head.
 1.56.10.1 21-Jun-2006  yamt sync with head.
 1.57.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.57.10.1 19-Apr-2006  elad sync with head.
 1.57.8.1 24-May-2006  yamt sync with head.
 1.57.6.1 22-Apr-2006  simonb Sync with head.
 1.57.4.1 09-Sep-2006  rpaulo sync with head
 1.58.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.58.54.1 24-Mar-2008  keiichi sync with head.
 1.58.34.1 23-Mar-2008  matt sync with HEAD
 1.58.16.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.59.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.59.16.2 11-Dec-2008  ad Checkpoint work in progress.
 1.59.16.1 08-Dec-2008  ad Convert some more drivers.
 1.59.4.1 16-May-2009  yamt sync with head
 1.60.14.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.60.12.1 17-Apr-2012  yamt sync with head
 1.61.54.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.61.50.1 10-Jun-2019  christos Sync with HEAD
 1.33 09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.32 31-May-2022  andvar fix various typos in comments, documentation and messages.
 1.31 11-Dec-2005  christos merge ktrace-lwp.
 1.30 13-Jan-2005  kent ansify and KNF
 1.29 02-Nov-1999  augustss branches: 1.29.30;
Allow irq 15 since some clones use it.
 1.28 22-Mar-1999  mycroft branches: 1.28.8; 1.28.10; 1.28.12;
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.27 18-Feb-1999  mycroft Add separate halt_output and halt_input routines.
 1.26 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.25 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.24 24-Aug-1997  augustss Give names to some more mixer registers.
 1.23 11-Aug-1997  augustss Round mixer values correctly when setting them.
This is important for the OSS emulation since OSS
uses a different range of values for the mixer.
 1.22 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.21 23-May-1997  augustss branches: 1.21.4;
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.20 19-May-1997  augustss Redo the SB mixer code. The driver can now distinguish between the
four different mixer options: none, CT1335, CT1345, and CT1745.
It should now be possible to access most of the SB16 functionality.
 1.19 18-May-1997  augustss Mask the level registers as the documentation suggests.
 1.18 20-Mar-1997  mycroft Use autoinitialize DMA mode on the SB2 and later. Partly from Torsten Duwe.
 1.17 20-Mar-1997  mycroft Add 16-bit DRQ support on PnP, and enable 16-bit output.
 1.16 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.15 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.14 20-Feb-1996  mycroft Fix mono volume adjustment.
 1.13 18-Feb-1996  jtk Add bass/treble input filter adjustment controls to SB (Pro) driver
 1.12 08-May-1995  brezak Remove strings
 1.11 15-Mar-1995  glass fix compilation error. don't bother checking for IRQ2
 1.10 13-Mar-1995  brezak Add IRQ 9 as a valid IRQ
 1.9 08-Mar-1995  brezak Cleanup for SB16 (From Jan Sparud)
 1.8 28-Feb-1995  brezak Use irq directly not as a mask
 1.7 21-Feb-1995  brezak SoundBlaster driver for SB, SB16 and SBPRO
 1.6 15-Nov-1994  mycroft Check IRQ 9, not IRQ 2.
 1.5 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.4 27-Oct-1994  cgd new RCS ID format.
 1.3 16-Sep-1994  mycroft Check the SB Pro IRQ and DRQ correctly. From Jason Thorpe.
 1.2 29-Mar-1994  mycroft branches: 1.2.2;
Updates for new autoconfig.
 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.2.2.1 06-Oct-1994  mycroft Update from trunk.
 1.21.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.28.10.1 15-Nov-1999  fvdl Sync with -current
 1.28.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.29.30.1 17-Jan-2005  skrll Sync with HEAD.
 1.6 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.5 15-Mar-2008  cube branches: 1.5.2; 1.5.4;
Split device_t and softc for sb(4) and all its attachments.
 1.4 11-Dec-2005  christos branches: 1.4.46; 1.4.66; 1.4.70;
merge ktrace-lwp.
 1.3 13-Jan-2005  kent branches: 1.3.10;
ansify and KNF
 1.2 05-Sep-1998  christos branches: 1.2.46;
Assign copyright to TNF.
 1.1 16-Jan-1997  christos branches: 1.1.2;
- convert to bus_space_*
- split attachment code to sb_isa.c
 1.1.2.2 18-Jan-1997  thorpej Update from trunk.
 1.1.2.1 16-Jan-1997  thorpej file sbvar.h was added on branch thorpej-setroot on 1997-01-18 04:30:40 +0000
 1.2.46.1 17-Jan-2005  skrll Sync with HEAD.
 1.3.10.1 17-Mar-2008  yamt sync with head.
 1.4.70.2 02-Jun-2008  mjf Sync with HEAD.
 1.4.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.4.66.1 24-Mar-2008  keiichi sync with head.
 1.4.46.1 23-Mar-2008  matt sync with HEAD
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.77 25-Sep-2022  thorpej malloc(9) -> kmem(9)
 1.76 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.75 24-Apr-2021  thorpej branches: 1.75.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.74 14-Jul-2016  msaitoh branches: 1.74.34;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.73 12-Sep-2015  christos fix spl issues, found by brainy.
 1.72 08-Apr-2014  hannken branches: 1.72.4;
Add __diagused.
 1.71 27-Oct-2012  chs branches: 1.71.2; 1.71.10;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.70 23-Nov-2009  rmind branches: 1.70.12; 1.70.22;
Remove some unecessary includes sys/user.h header.
 1.69 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.68 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.67 16-Mar-2009  cegger ansify function definitions
 1.66 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.65 08-Jun-2008  tsutsui branches: 1.65.6; 1.65.12;
Replace device_lookup() with device_lookup_private() on getting softc
for future device_t/softc spilt.
 1.64 08-Apr-2008  cegger branches: 1.64.2; 1.64.4; 1.64.6;
use aprint_*_dev and device_xname
 1.63 19-Oct-2007  ad branches: 1.63.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.62 04-Mar-2007  christos branches: 1.62.2; 1.62.14; 1.62.16; 1.62.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.61 16-Nov-2006  christos branches: 1.61.4;
__unused removal on arguments; approved by core.
 1.60 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.59 11-Dec-2005  christos branches: 1.59.20; 1.59.22;
merge ktrace-lwp.
 1.58 30-May-2005  christos branches: 1.58.2;
- add const
- avoid variable shadowing.
 1.57 27-Feb-2005  perry nuke trailing whitespace
 1.56 04-Feb-2005  perry de-__P
 1.55 14-Sep-2004  drochner branches: 1.55.4; 1.55.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.54 03-Apr-2003  christos branches: 1.54.2;
avoid stupid printfs during probe
 1.53 02-Nov-2002  perry changed asm()s to __asm()s.

XXX Now, could someone please explain to me why in the love of Bob a
file containing inline x86 assembler is in sys/dev/isa/????
This should be moved, fixed, or nuked from space.
 1.52 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.51 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.50 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.49 05-Apr-2002  bouyer Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.
 1.48 28-Jan-2002  sommerfeld really fix it this time.
 1.47 28-Jan-2002  sommerfeld Finish conversion to new-style isa config machinery (#ifdef DEBUG code was
left unconverted)
 1.46 12-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of memset() after malloc().
 1.45 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.44 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.43 13-Nov-2001  lukem add RCSID
 1.42 18-Jul-2001  thorpej bcmp -> memcmp
 1.41 12-Jun-2001  wiz branches: 1.41.2;
receive, not recieve
 1.40 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.39 17-Dec-2000  bouyer branches: 1.39.2;
Fix a reversed test.
Partial fix for kern/11726: now the kernel find the drives, but panics
after a device has been mounted.
 1.38 06-Jul-2000  thorpej Use device_lookup().
 1.37 03-May-2000  mycroft Adjust asm patterns for newer versions of GCC.
 1.36 30-Mar-2000  augustss Remove register declarations.
 1.35 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.34 30-Sep-1999  thorpej branches: 1.34.2;
Update for SCSPI changes.
 1.33 19-Mar-1999  cgd don't need isa_machdep.h, since isavar.h is included
 1.32 19-Feb-1999  mycroft Kill vestiges of isa_establish().
 1.31 05-Dec-1998  mjacob Update HBAs to incorporate the new max_lun property.
 1.30 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.29 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.

Inspired by PR #6090, from Matt Jacob.
 1.28 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.27 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.26 13-Jan-1998  drochner make it compile without BROKEN_INDIRECT_CONFIG
 1.25 12-Jan-1998  thorpej Update for config changes.
 1.24 05-Jan-1998  perry RCSID Police.
 1.23 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.22 05-Nov-1996  mikel branches: 1.22.8; 1.22.10;
Eliminate unsolicited spewage; PR #2108.
 1.21 13-Oct-1996  christos backout kprintf changes
 1.20 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.19 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.18 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.17 12-May-1996  mycroft Use intr.h.
 1.16 29-Apr-1996  christos Fix gcc -Wall warnings.
 1.15 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.14 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.13 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.12 26-Sep-1995  thorpej memcmp -> bcmp. Fixes PR #1518.
 1.11 14-Sep-1995  pk Make *print() a message if no scsibus was attached. Also, return something
valid.
 1.10 28-Jul-1995  mycroft Don't loop if we're out of CCBs/SCBs/MSCPs.
 1.9 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.8 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.7 13-Jan-1995  mycroft Simplify some sanity checks.
 1.6 03-Jan-1995  mycroft Add interrupt sharing types.
 1.5 02-Jan-1995  mycroft Need isareg.h.
 1.4 02-Jan-1995  mycroft Don't assume ia_maddr is in the hole.
 1.3 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.2 03-Nov-1994  mycroft Update to match autoconfig code.
 1.1 03-Nov-1994  mycroft Commit this, though it really does need work.
 1.22.10.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.8.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.34.2.5 05-Jan-2001  bouyer Sync with HEAD
 1.34.2.4 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.34.2.3 01-Nov-1999  thorpej Fixup the SC_DEBUG() stuff for the new world order.
 1.34.2.2 26-Oct-1999  thorpej Update for:

Deal a little more gracefully with the fact that xfer mode parameters
are for the I_T Nexus, and make all xfer mode updates `async events'.
 1.34.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.39.2.9 11-Nov-2002  nathanw Catch up to -current
 1.39.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.39.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.39.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.39.2.5 11-Jan-2002  nathanw More catchup.
 1.39.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.39.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.39.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.39.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.41.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.41.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.41.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.41.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.41.2.1 03-Aug-2001  lukem update to -current
 1.54.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.54.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.54.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.54.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.54.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.55.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.55.6.1 12-Feb-2005  yamt sync with head.
 1.55.4.1 29-Apr-2005  kent sync with -current
 1.58.2.3 27-Oct-2007  yamt sync with head.
 1.58.2.2 03-Sep-2007  yamt sync with head.
 1.58.2.1 30-Dec-2006  yamt sync with head.
 1.59.22.2 10-Dec-2006  yamt sync with head.
 1.59.22.1 22-Oct-2006  yamt sync with head
 1.59.20.1 18-Nov-2006  ad Sync with head.
 1.61.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.62.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.62.16.1 06-Nov-2007  matt sync with HEAD
 1.62.14.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.62.2.1 23-Oct-2007  ad Sync with head.
 1.63.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.63.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.64.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.64.4.3 11-Mar-2010  yamt sync with head
 1.64.4.2 16-May-2009  yamt sync with head
 1.64.4.1 04-May-2009  yamt sync with head.
 1.64.2.1 17-Jun-2008  yamt sync with head.
 1.65.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.65.6.1 28-Apr-2009  skrll Sync with HEAD.
 1.70.22.3 03-Dec-2017  jdolecek update from HEAD
 1.70.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.70.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.70.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.70.12.1 30-Oct-2012  yamt sync with head
 1.71.10.1 10-Aug-2014  tls Rebase.
 1.71.2.1 18-May-2014  rmind sync with head
 1.72.4.2 05-Oct-2016  skrll Sync with HEAD
 1.72.4.1 22-Sep-2015  skrll Sync with HEAD
 1.74.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.75.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file seagate.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file seagate.c.rej was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.15 12-May-2009  cegger branches: 1.15.12; 1.15.22;
struct device * -> device_t, no functional changes intended.
 1.14 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.13 16-Nov-2006  christos branches: 1.13.52; 1.13.68;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 29-Oct-2004  yamt branches: 1.10.12;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.9 14-Jul-2003  lukem add missing __KERNEL_RCSID()
 1.8 02-Oct-2002  thorpej branches: 1.8.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.7 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 03-Sep-2002  augustss Use a different way to recognize tea5759 chips. From OpenBSD.
 1.4 07-Jan-2002  thorpej branches: 1.4.2; 1.4.4;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.3 03-Jan-2002  augustss Add \n in attach messages.
 1.2 02-Jan-2002  augustss Change the probe code. You cannot unmap bus space and then use it.
 1.1 01-Jan-2002  augustss Add support for radio cards. Written by Maxim Tsyplakov and Vladimir Popov
for OpenBSD, from where it was imported.
 1.4.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.4.1 07-Jan-2002  thorpej file sf16fmr2.c was added on branch kqueue on 2002-01-10 19:55:44 +0000
 1.4.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.4.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.3 11-Jan-2002  nathanw More catchup.
 1.4.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.1 07-Jan-2002  nathanw file sf16fmr2.c was added on branch nathanw_sa on 2002-01-08 00:30:32 +0000
 1.8.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.10.12.1 30-Dec-2006  yamt sync with head.
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.13.68.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.13.52.1 16-May-2009  yamt sync with head
 1.15.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.12.1 30-Oct-2012  yamt sync with head
 1.15 14-Jul-2016  msaitoh - Use aprint*() instead of printf() in xxx_attach().
- Add missing aprint_naive("\n");
- KNF
 1.14 30-Jun-2016  skrll Provide some defaults. From Felix Deichmann.
 1.13 23-Apr-2016  skrll Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
 1.12 08-Mar-2011  kiyohara branches: 1.12.14; 1.12.30; 1.12.32; 1.12.36;
Fix hci_private data. slhci(4) is assuming, it is slhci_softc. not device_t.
 1.11 12-May-2009  cegger branches: 1.11.4; 1.11.6;
struct device * -> device_t, no functional changes intended.
 1.10 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.9 28-Mar-2008  drochner branches: 1.9.4; 1.9.18;
split device/softc for USB host controllers and the usb (control)
device,
this is hairy stuff, and I've only tested with uhci/ehci at pci,
please test the rest and report problems
 1.8 19-Oct-2007  ad branches: 1.8.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.7 15-Aug-2007  kiyohara branches: 1.7.2; 1.7.6;
Replace to Matthew Orgass's slhci(4).
http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
 1.6 16-Nov-2006  christos branches: 1.6.8; 1.6.18; 1.6.20; 1.6.24;
__unused removal on arguments; approved by core.
 1.5 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.4 02-Oct-2002  thorpej branches: 1.4.22; 1.4.52; 1.4.54;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.3 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 11-Aug-2002  isaki branches: 1.1.2; 1.1.4; 1.1.6;
Add driver for ScanLogic SL811HS/T USB Host Controller.
XXX It's experimental code yet.

For x68k: USB part of Nereid USB/Ethernet/memory board
For ISA: ISA USB Host board from Morphy planning
 1.1.6.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 11-Aug-2002  jdolecek file slhci_isa.c was added on branch kqueue on 2002-09-06 08:44:52 +0000
 1.1.4.2 29-Aug-2002  gehenna catch up with -current.
 1.1.4.1 11-Aug-2002  gehenna file slhci_isa.c was added on branch gehenna-devsw on 2002-08-29 05:22:36 +0000
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 11-Aug-2002  nathanw file slhci_isa.c was added on branch nathanw_sa on 2002-08-13 02:19:33 +0000
 1.4.54.2 10-Dec-2006  yamt sync with head.
 1.4.54.1 22-Oct-2006  yamt sync with head
 1.4.52.1 18-Nov-2006  ad Sync with head.
 1.4.22.3 27-Oct-2007  yamt sync with head.
 1.4.22.2 03-Sep-2007  yamt sync with head.
 1.4.22.1 30-Dec-2006  yamt sync with head.
 1.6.24.2 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.6.24.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.6.20.1 15-Aug-2007  skrll Sync with HEAD.
 1.6.18.1 22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.6.8.2 23-Oct-2007  ad Sync with head.
 1.6.8.1 20-Aug-2007  ad Sync with HEAD.
 1.7.6.1 25-Oct-2007  bouyer Sync with HEAD.
 1.7.2.1 06-Nov-2007  matt sync with HEAD
 1.8.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.9.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.4.1 16-May-2009  yamt sync with head
 1.11.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.4.1 21-Apr-2011  rmind sync with head
 1.12.36.1 06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.12.32.3 05-Oct-2016  skrll Sync with HEAD
 1.12.32.2 09-Jul-2016  skrll Sync with HEAD
 1.12.32.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.12.30.1 05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.12.14.1 03-Dec-2017  jdolecek update from HEAD
 1.13 29-Jun-2022  mlelstv unregister sensors only when registered.
 1.12 23-Apr-2015  pgoyette Update module dependencies for all the existing modules that depend on sysmon components.
 1.11 31-Jul-2011  jmcneill branches: 1.11.12; 1.11.30;
modularize
 1.10 20-Jun-2011  pgoyette Initialize sensors states before registering.
 1.9 12-May-2009  cegger branches: 1.9.10;
struct device * -> device_t, no functional changes intended.
 1.8 28-Apr-2008  martin branches: 1.8.14;
Remove clause 3 and 4 from TNF licenses
 1.7 03-Apr-2008  xtraeme branches: 1.7.2; 1.7.4;
Add support for the SCH5307-NS and SCH5317 Super I/Os. They are
compatible with LPC47B397, only the device ID is changed.

Simplify and improve the code, and split device_t/softc.
 1.6 17-Nov-2007  kefren branches: 1.6.14;
Initialize sensor's state
on behalf of xtraeme
 1.5 16-Nov-2007  xtraeme Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.4 19-Oct-2007  ad branches: 1.4.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.3 09-Sep-2007  xtraeme branches: 1.3.4;
Add the detach method, will be used by the LKM.
 1.2 01-Jul-2007  xtraeme branches: 1.2.2; 1.2.4; 1.2.8; 1.2.10; 1.2.12;
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.1 01-Jun-2007  blymn branches: 1.1.2;
Add driver for the hardware monitoring portion of the SMSC LPC47B397
 1.1.2.6 23-Oct-2007  ad Sync with head.
 1.1.2.5 09-Oct-2007  ad Sync with head.
 1.1.2.4 15-Jul-2007  ad Sync with head.
 1.1.2.3 09-Jun-2007  ad Sync with head.
 1.1.2.2 09-Jun-2007  ad Sync with head.
 1.1.2.1 01-Jun-2007  ad file smsc.c was added on branch vmlocking on 2007-06-09 21:37:19 +0000
 1.2.12.4 07-Dec-2007  yamt sync with head
 1.2.12.3 27-Oct-2007  yamt sync with head.
 1.2.12.2 03-Sep-2007  yamt sync with head.
 1.2.12.1 01-Jul-2007  yamt file smsc.c was added on branch yamt-lazymbuf on 2007-09-03 14:35:44 +0000
 1.2.10.2 09-Jan-2008  matt sync with HEAD
 1.2.10.1 06-Nov-2007  matt sync with HEAD
 1.2.8.3 21-Nov-2007  joerg Sync with HEAD.
 1.2.8.2 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.2.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.2.4.1 10-Sep-2007  skrll Sync with HEAD.
 1.2.2.2 11-Jul-2007  mjf Sync with head.
 1.2.2.1 01-Jul-2007  mjf file smsc.c was added on branch mjf-ufs-trans on 2007-07-11 20:06:31 +0000
 1.3.4.2 18-Nov-2007  bouyer Sync with HEAD
 1.3.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.6.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.4.2 16-May-2009  yamt sync with head
 1.7.4.1 16-May-2008  yamt sync with head.
 1.7.2.1 18-May-2008  yamt sync with head.
 1.8.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.11.30.1 06-Jun-2015  skrll Sync with HEAD
 1.11.12.1 03-Dec-2017  jdolecek update from HEAD
 1.5 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.4 28-Apr-2008  martin branches: 1.4.34; 1.4.44;
Remove clause 3 and 4 from TNF licenses
 1.3 03-Apr-2008  xtraeme branches: 1.3.2; 1.3.4;
Add support for the SCH5307-NS and SCH5317 Super I/Os. They are
compatible with LPC47B397, only the device ID is changed.

Simplify and improve the code, and split device_t/softc.
 1.2 16-Nov-2007  xtraeme branches: 1.2.14;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.1 01-Jun-2007  blymn branches: 1.1.2; 1.1.4; 1.1.10; 1.1.12; 1.1.14; 1.1.18; 1.1.20;
Add driver for the hardware monitoring portion of the SMSC LPC47B397
 1.1.20.1 19-Nov-2007  mjf Sync with HEAD.
 1.1.18.1 18-Nov-2007  bouyer Sync with HEAD
 1.1.14.3 07-Dec-2007  yamt sync with head
 1.1.14.2 03-Sep-2007  yamt sync with head.
 1.1.14.1 01-Jun-2007  yamt file smscvar.h was added on branch yamt-lazymbuf on 2007-09-03 14:35:45 +0000
 1.1.12.1 09-Jan-2008  matt sync with HEAD
 1.1.10.1 21-Nov-2007  joerg Sync with HEAD.
 1.1.4.2 11-Jul-2007  mjf Sync with head.
 1.1.4.1 01-Jun-2007  mjf file smscvar.h was added on branch mjf-ufs-trans on 2007-07-11 20:06:32 +0000
 1.1.2.4 15-Jul-2007  ad Sync with head.
 1.1.2.3 09-Jun-2007  ad Sync with head.
 1.1.2.2 09-Jun-2007  ad Sync with head.
 1.1.2.1 01-Jun-2007  ad file smscvar.h was added on branch vmlocking on 2007-06-09 21:37:20 +0000
 1.2.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.3.4.1 16-May-2008  yamt sync with head.
 1.3.2.1 18-May-2008  yamt sync with head.
 1.4.44.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.4.34.1 30-Oct-2012  yamt sync with head
 1.5 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.4 24-Apr-2021  thorpej branches: 1.4.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.3 11-Jul-2016  msaitoh branches: 1.3.34;
KNF. No functional change.
 1.2 10-Jun-2013  kardel branches: 1.2.2; 1.2.10; 1.2.14;
adjust soekrisgpio driver to NetBSD
 1.1 10-Jun-2013  kardel branches: 1.1.1;
Initial revision
 1.1.1.1 10-Jun-2013  kardel Import of proposed patch to OpenBSD for supporting GPIO and status
leds on a Soekris net6501

patch posted on 2013-01-14 17:11:00 at
http://permalink.gmane.org/gmane.os.openbsd.tech/31317
 1.2.14.1 05-Oct-2016  skrll Sync with HEAD
 1.2.10.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.2.10.1 10-Jun-2013  yamt file soekrisgpio.c was added on branch yamt-pagecache on 2014-05-22 11:40:23 +0000
 1.2.2.3 03-Dec-2017  jdolecek update from HEAD
 1.2.2.2 23-Jun-2013  tls resync from head
 1.2.2.1 10-Jun-2013  tls file soekrisgpio.c was added on branch tls-maxphys on 2013-06-23 06:20:17 +0000
 1.3.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.4.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.40 09-Dec-2016  christos more spkr rework.
 1.39 09-Dec-2016  christos split out the pcppi attachment of the speaker
XXX: needs more work
 1.38 08-Dec-2016  nat Add a synthesized pc beeper and keyboard bell for platforms with an audio
device.
 1.37 14-Jul-2016  msaitoh branches: 1.37.2;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.36 17-May-2015  pgoyette Modularize the spkr(4) driver (i386 and amd64 only). Adapt parent
pcppi(4) driver to be able to handle rescan().
 1.35 25-Jul-2014  dholland branches: 1.35.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.34 16-Mar-2014  dholland branches: 1.34.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.33 06-Apr-2012  plunky branches: 1.33.2; 1.33.4;
device_pmf_is_registered() is not required
 1.32 01-Feb-2012  matt Use C89 prototypes.
 1.31 27-Jul-2010  jakllsch branches: 1.31.8; 1.31.12;
printf() size_t with 'z' format modifier in debug code.
 1.30 18-Mar-2009  cegger branches: 1.30.2; 1.30.4;
Ansify function definitions w/o arguments. Generated with sed.
 1.29 11-Jan-2009  cegger branches: 1.29.2;
make this compile
 1.28 04-Mar-2008  cube branches: 1.28.4; 1.28.12;
Use CFATTACH_DECL_NEW and other related cosmetic changes.
 1.27 20-Dec-2007  dyoung branches: 1.27.2; 1.27.6;
Use __arraycount().
 1.26 16-Dec-2007  christos add null pmf handlers.
 1.25 19-Oct-2007  ad branches: 1.25.4; 1.25.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.24 04-Mar-2007  christos branches: 1.24.2; 1.24.14; 1.24.16; 1.24.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 16-Nov-2006  christos branches: 1.23.4;
__unused removal on arguments; approved by core.
 1.22 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.21 11-Sep-2006  matt branches: 1.21.2;
deal with 'bool' definitions
 1.20 03-Sep-2006  christos branches: 1.20.2;
add missing initializers
 1.19 11-Dec-2005  christos branches: 1.19.4; 1.19.8;
merge ktrace-lwp.
 1.18 29-May-2005  christos branches: 1.18.2;
avoid nested variables
 1.17 21-Mar-2005  xtraeme This needs <machine/bus.h>, needed for ACPI pcppi(4) attachment.
 1.16 04-Feb-2005  perry de-__P
 1.15 29-Jun-2003  fvdl branches: 1.15.2; 1.15.10; 1.15.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.14 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.13 20-Apr-2003  christos PR/6362: der Mouse: /dev/speaker octave-tracking goes out of range
 1.12 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.11 02-Oct-2002  itojun copyright clarification, from openbsd
 1.10 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6 13-Nov-2001  lukem branches: 1.6.8; 1.6.10;
add RCSID
 1.5 18-Apr-2001  thorpej branches: 1.5.2; 1.5.4;
ctype-like functions are now in libkern.
 1.4 21-Feb-2001  jdolecek branches: 1.4.2;
make some more constant arrays 'const'
 1.3 30-Mar-2000  augustss Remove register declarations.
 1.2 06-Mar-2000  thorpej - Make the pcppi and pckbd drivers cooperate a little more -- pckbd provides
a call to hook up a bell-ringer (since the keyboard itself has no bell).
This eliminates the need for #ifdefs for the bell-ringer in the pckbd
driver.
- Add cnbell() support to pckbd.
 1.1 15-Apr-1998  drochner branches: 1.1.14;
MI driver for the ISA speaker, and the IBM BASIC playstring interpreter
which has so many fans.
 1.1.14.3 21-Apr-2001  bouyer Sync with HEAD
 1.1.14.2 12-Mar-2001  bouyer Sync with HEAD.
 1.1.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.5 11-Nov-2002  nathanw Catch up to -current
 1.4.2.4 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.3 17-Sep-2002  nathanw Catch up to -current.
 1.4.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.1 07-Sep-2001  thorpej Commit my "devvp" changes to the thorpej-devvp branch. This
replaces the use of dev_t in most places with a struct vnode *.

This will form the basic infrastructure for real cloning device
support (besides being architecurally cleaner -- it'll be good
to get away from using numbers to represent objects).
 1.5.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.10.1 07-Dec-2002  he Pull up revision 1.11 (requested by itojun in ticket #896):
License / copyright clarifications.
 1.6.8.1 16-May-2002  gehenna Add the character device switch.
 1.15.12.2 26-Mar-2005  yamt sync with head.
 1.15.12.1 12-Feb-2005  yamt sync with head.
 1.15.10.1 29-Apr-2005  kent sync with -current
 1.15.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.15.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.18.2.6 17-Mar-2008  yamt sync with head.
 1.18.2.5 21-Jan-2008  yamt sync with head
 1.18.2.4 27-Oct-2007  yamt sync with head.
 1.18.2.3 03-Sep-2007  yamt sync with head.
 1.18.2.2 30-Dec-2006  yamt sync with head.
 1.18.2.1 21-Jun-2006  yamt sync with head.
 1.19.8.2 14-Sep-2006  yamt sync with head.
 1.19.8.1 03-Sep-2006  yamt sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.20.2.1 18-Nov-2006  ad Sync with head.
 1.21.2.2 10-Dec-2006  yamt sync with head.
 1.21.2.1 22-Oct-2006  yamt sync with head
 1.23.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.24.16.3 23-Mar-2008  matt sync with HEAD
 1.24.16.2 09-Jan-2008  matt sync with HEAD
 1.24.16.1 06-Nov-2007  matt sync with HEAD
 1.24.14.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.24.2.1 23-Oct-2007  ad Sync with head.
 1.25.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.25.4.1 26-Dec-2007  ad Sync with head.
 1.27.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.27.6.2 05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.27.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.27.2.1 24-Mar-2008  keiichi sync with head.
 1.28.12.2 28-Apr-2009  skrll Sync with HEAD.
 1.28.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.28.4.2 11-Aug-2010  yamt sync with head.
 1.28.4.1 04-May-2009  yamt sync with head.
 1.29.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.30.4.1 05-Mar-2011  rmind sync with head
 1.30.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.31.12.2 29-Apr-2012  mrg sync to latest -current.
 1.31.12.1 18-Feb-2012  mrg merge to -current.
 1.31.8.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.31.8.1 17-Apr-2012  yamt sync with head
 1.33.4.1 18-May-2014  rmind sync with head
 1.33.2.2 03-Dec-2017  jdolecek update from HEAD
 1.33.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.34.2.1 10-Aug-2014  tls Rebase.
 1.35.4.3 05-Feb-2017  skrll Sync with HEAD
 1.35.4.2 05-Oct-2016  skrll Sync with HEAD
 1.35.4.1 06-Jun-2015  skrll Sync with HEAD
 1.37.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.14 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.13 03-Apr-2021  isaki Rework about the rest note in speaker(4).
- Obsolete the sc_rest callback. The rest note operation can be done by
the common spkr layer. This also fixes PR kern/56060.
This work-in-progress patch was left in my local tree for years. :(
- Improve calculations of tone and rest length.
 1.12 03-Apr-2021  isaki Improve SPKRDEBUG code.
- Replace wrong aprint_debug_dev() with device_printf().
By this, it no longer need to print dev_t.
- Improve some messages.
 1.11 14-Jun-2017  pgoyette branches: 1.11.4; 1.11.22; 1.11.24;
Instead of directly referencing a parent device's code (ie, pcppi_bell()
routine), let the parent device pass a pointer to the code (in the aux
config data). This allows us to load the spkr module without requiring
the pcppi parent device to exist. (The spkr device can also have an
audio as parent.)
 1.10 11-Jun-2017  pgoyette Implement xxx_rescan() and xxx_childdet() functions; these will be
needed when child device wsbell(4) becomes a separately-loadable
module.
 1.9 06-Jan-2017  pgoyette branches: 1.9.2; 1.9.6;
Implement a common spkr_detach() function and call it from the
attachment-specific detach functions. Returns EBUSY if the
device instance is busy, based on whether or not a sc->sc_inbuf
is allocated. The buffer is malloc()d at spkropen time, and is
free()d in spkrclose().

Now we can actually implement the MODULE_CMD_FINI command and
unload the driver at will.

Addresses my PR kern/51785
 1.8 15-Dec-2016  pgoyette Create a single combined module for spkr_pcppi and spkr_audio, and
build it for all architectures.

By doing this, we can handle pcppi, audio, or both attachments with
non-built-in modules.

XXX Still to do: the module currently cannot be unloaded, and the
XXX spkr device(s) currently cannot be detached. (Really, two
XXX sides of the same problem.)
 1.7 14-Dec-2016  christos print more info during autoconfig
 1.6 14-Dec-2016  christos correct spkr softc.
 1.5 13-Dec-2016  christos Restructure speaker devices so that there can be multiple of them, and have
proper softc's.
 1.4 09-Dec-2016  christos fix module build
XXX: spkr module is the pcppi version.
 1.3 09-Dec-2016  christos move spkrio.h out of isa
 1.2 09-Dec-2016  christos more spkr rework.
 1.1 09-Dec-2016  christos split out the pcppi attachment of the speaker
XXX: needs more work
 1.9.6.3 28-Aug-2017  skrll Sync with HEAD
 1.9.6.2 05-Feb-2017  skrll Sync with HEAD
 1.9.6.1 06-Jan-2017  skrll file spkr_pcppi.c was added on branch nick-nhusb on 2017-02-05 13:40:28 +0000
 1.9.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.9.2.1 06-Jan-2017  pgoyette file spkr_pcppi.c was added on branch pgoyette-localcount on 2017-01-07 08:56:32 +0000
 1.11.24.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11.22.1 03-Apr-2021  thorpej Sync with HEAD.
 1.11.4.2 03-Dec-2017  jdolecek update from HEAD
 1.11.4.1 14-Jun-2017  jdolecek file spkr_pcppi.c was added on branch tls-maxphys on 2017-12-03 11:37:05 +0000
 1.5 09-Dec-2016  christos put back spkrio.h for compat
 1.4 09-Dec-2016  christos more spkr rework.
 1.3 09-Dec-2016  christos split out the pcppi attachment of the speaker
XXX: needs more work
 1.2 06-Sep-2015  dholland branches: 1.2.2;
More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.1 15-Apr-1998  drochner branches: 1.1.196; 1.1.216;
MI driver for the ISA speaker, and the IBM BASIC playstring interpreter
which has so many fans.
 1.1.216.2 05-Feb-2017  skrll Sync with HEAD
 1.1.216.1 22-Sep-2015  skrll Sync with HEAD
 1.1.196.1 03-Dec-2017  jdolecek update from HEAD
 1.2.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.30 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.29 31-Jul-2021  andvar s/dependend/dependent/
 1.28 12-Nov-2019  msaitoh branches: 1.28.12;
Add missing initialization of sc_dev.
 1.27 14-Jul-2016  msaitoh branches: 1.27.10; 1.27.18; 1.27.24;
- Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.26 27-Oct-2012  chs branches: 1.26.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.25 12-May-2009  cegger branches: 1.25.12; 1.25.22;
struct device * -> device_t, no functional changes intended.
 1.24 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.23 16-Mar-2009  cegger ansify function definitions
 1.22 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.21 26-Jun-2008  drochner branches: 1.21.4; 1.21.10;
constify the pcmcia/cardbus method tables
 1.20 08-Apr-2008  cegger branches: 1.20.4; 1.20.6; 1.20.8;
use aprint_*_dev and device_xname
 1.19 29-Mar-2008  ad Make TCICDEBUG / TCICISADEBUG compile.
 1.18 19-Oct-2007  ad branches: 1.18.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.17 16-Nov-2006  christos branches: 1.17.8; 1.17.22; 1.17.24; 1.17.28;
__unused removal on arguments; approved by core.
 1.16 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.15 03-Sep-2006  christos branches: 1.15.2; 1.15.4;
add missing initializers
 1.14 11-Dec-2005  christos branches: 1.14.4; 1.14.8;
merge ktrace-lwp.
 1.13 27-Feb-2005  perry branches: 1.13.4;
nuke trailing whitespace
 1.12 04-Feb-2005  perry de-__P
 1.11 14-Sep-2004  drochner branches: 1.11.4; 1.11.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.10 11-Aug-2004  mycroft Add a settype function.
Nuke address windows earlier in power up sequence.
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.8 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.5 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.4 13-Nov-2001  lukem add RCSID
 1.3 28-Jun-2000  mrg branches: 1.3.2; 1.3.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.2 08-Apr-1999  bad branches: 1.2.2;
Correct a misleading comment copied over from the PCIC version of this file.
 1.1 23-Mar-1999  bad branches: 1.1.4;
A backend for Databook's TCIC family of PCMCIA chips.

Thanks to Andreas Lohrum, O'Reilly Verlag, Terry Moore, and Holger Czukay
for hardware, documentation, and support.
 1.1.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.3.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.3.2.3 11-Jan-2002  nathanw More catchup.
 1.3.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.3.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.9.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.6.4 04-Feb-2005  skrll Sync with HEAD.
 1.9.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 12-Aug-2004  skrll Sync with HEAD.
 1.11.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.11.6.1 12-Feb-2005  yamt sync with head.
 1.11.4.1 29-Apr-2005  kent sync with -current
 1.13.4.2 27-Oct-2007  yamt sync with head.
 1.13.4.1 30-Dec-2006  yamt sync with head.
 1.14.8.1 03-Sep-2006  yamt sync with head.
 1.14.4.1 09-Sep-2006  rpaulo sync with head
 1.15.4.2 10-Dec-2006  yamt sync with head.
 1.15.4.1 22-Oct-2006  yamt sync with head
 1.15.2.1 18-Nov-2006  ad Sync with head.
 1.17.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.17.24.1 06-Nov-2007  matt sync with HEAD
 1.17.22.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.17.8.1 23-Oct-2007  ad Sync with head.
 1.18.16.3 29-Jun-2008  mjf Sync with HEAD.
 1.18.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.18.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.8.1 27-Jun-2008  simonb Sync with head.
 1.20.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20.4.2 16-May-2009  yamt sync with head
 1.20.4.1 04-May-2009  yamt sync with head.
 1.21.10.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.21.4.1 28-Apr-2009  skrll Sync with HEAD.
 1.25.22.2 03-Dec-2017  jdolecek update from HEAD
 1.25.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.25.12.1 30-Oct-2012  yamt sync with head
 1.26.14.1 05-Oct-2016  skrll Sync with HEAD
 1.27.24.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.

Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

Add missing initialization of sc_dev.
 1.27.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.27.10.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.


Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


Add missing initialization of sc_dev.
 1.28.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.22 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.21 24-Apr-2021  thorpej branches: 1.21.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.20 11-Jul-2016  msaitoh branches: 1.20.34;
KNF. No functional change.
 1.19 12-May-2009  cegger branches: 1.19.22; 1.19.40;
struct device * -> device_t, no functional changes intended.
 1.18 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.17 28-Sep-2008  martin branches: 1.17.2; 1.17.8;
Apply patch from Dave Huang in PR kern/39642: catch up on com(4)'s
device_t/softc split.
 1.16 28-Apr-2008  martin branches: 1.16.2; 1.16.6;
Remove clause 3 and 4 from TNF licenses
 1.15 08-Apr-2008  cegger branches: 1.15.2; 1.15.4;
use aprint_*_dev and device_xname
 1.14 19-Oct-2007  ad branches: 1.14.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.13 16-Nov-2006  christos branches: 1.13.8; 1.13.22; 1.13.24; 1.13.28;
__unused removal on arguments; approved by core.
 1.12 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.11 11-Dec-2005  christos branches: 1.11.20; 1.11.22;
merge ktrace-lwp.
 1.10 04-Feb-2005  perry branches: 1.10.6;
de-__P
 1.9 14-Sep-2004  drochner branches: 1.9.4; 1.9.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.8 14-Sep-2004  drochner replace 7 identical instances if cfprint functions by a single one
 1.7 01-Jan-2003  thorpej branches: 1.7.2;
Use aprint_normal() in cfprint routines.
 1.6 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.5 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.2 13-Nov-2001  lukem add RCSID
 1.1 16-Dec-1998  christos branches: 1.1.20; 1.1.22;
Add Byte Runner Technologies TC-400 and TC-800 driver from Eric S. Hvozda
 1.1.22.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.20.5 03-Jan-2003  thorpej Sync with HEAD.
 1.1.20.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.20.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.20.2 11-Jan-2002  nathanw More catchup.
 1.1.20.1 14-Nov-2001  nathanw Catch up to -current.
 1.7.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.7.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.9.6.1 12-Feb-2005  yamt sync with head.
 1.9.4.1 29-Apr-2005  kent sync with -current
 1.10.6.2 27-Oct-2007  yamt sync with head.
 1.10.6.1 30-Dec-2006  yamt sync with head.
 1.11.22.2 10-Dec-2006  yamt sync with head.
 1.11.22.1 22-Oct-2006  yamt sync with head
 1.11.20.1 18-Nov-2006  ad Sync with head.
 1.13.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.24.1 06-Nov-2007  matt sync with HEAD
 1.13.22.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.13.8.1 23-Oct-2007  ad Sync with head.
 1.14.16.2 05-Oct-2008  mjf Sync with HEAD.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.4.3 16-May-2009  yamt sync with head
 1.15.4.2 04-May-2009  yamt sync with head.
 1.15.4.1 16-May-2008  yamt sync with head.
 1.15.2.1 18-May-2008  yamt sync with head.
 1.16.6.1 19-Oct-2008  haad Sync with HEAD.
 1.16.2.1 10-Oct-2008  skrll Sync with HEAD.
 1.17.8.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.17.2.1 28-Apr-2009  skrll Sync with HEAD.
 1.19.40.1 05-Oct-2016  skrll Sync with HEAD
 1.19.22.1 03-Dec-2017  jdolecek update from HEAD
 1.20.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.21.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.14 23-May-2020  jmcneill GC toaster drivers
 1.13 25-Feb-2014  pooka Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
 1.12 02-Jun-2012  dsl branches: 1.12.2; 1.12.4;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.11 12-Feb-2012  matt Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.10 12-May-2009  cegger branches: 1.10.12; 1.10.16;
struct device * -> device_t, no functional changes intended.
 1.9 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.8 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.7 28-Apr-2008  martin branches: 1.7.8; 1.7.14;
Remove clause 3 and 4 from TNF licenses
 1.6 08-Apr-2008  cegger branches: 1.6.2; 1.6.4;
use aprint_*_dev and device_xname
 1.5 19-Oct-2007  ad branches: 1.5.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.4 09-Jul-2007  ad branches: 1.4.6; 1.4.8; 1.4.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.3 29-Jan-2007  hubertf branches: 1.3.6; 1.3.8;
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.2 11-Dec-2005  christos branches: 1.2.18; 1.2.22;
merge ktrace-lwp.
 1.1 14-Aug-2005  joff branches: 1.1.6;
Device driver that exposes the burner element, magnetic latch, and front-panel
LEDs of the TS-7200 NetBSD/toaster via sysctl.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 14-Aug-2005  skrll file toaster.c was added on branch ktrace-lwp on 2005-11-10 14:05:37 +0000
 1.2.22.1 01-Feb-2007  ad Sync with head.
 1.2.18.5 27-Oct-2007  yamt sync with head.
 1.2.18.4 03-Sep-2007  yamt sync with head.
 1.2.18.3 26-Feb-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file toaster.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.3.8.1 11-Jul-2007  mjf Sync with head.
 1.3.6.2 23-Oct-2007  ad Sync with head.
 1.3.6.1 01-Jul-2007  ad Adapt to callout API change.
 1.4.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.8.1 06-Nov-2007  matt sync with HEAD
 1.4.6.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.5.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.4.3 16-May-2009  yamt sync with head
 1.6.4.2 04-May-2009  yamt sync with head.
 1.6.4.1 16-May-2008  yamt sync with head.
 1.6.2.1 18-May-2008  yamt sync with head.
 1.7.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.7.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.16.1 18-Feb-2012  mrg merge to -current.
 1.10.12.3 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.12.2 30-Oct-2012  yamt sync with head
 1.10.12.1 17-Apr-2012  yamt sync with head
 1.12.4.1 18-May-2014  rmind sync with head
 1.12.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.12 23-May-2020  jmcneill GC toaster drivers
 1.11 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.10 12-May-2009  cegger branches: 1.10.12; 1.10.22;
struct device * -> device_t, no functional changes intended.
 1.9 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.8 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 28-Apr-2008  martin branches: 1.6.8; 1.6.14;
Remove clause 3 and 4 from TNF licenses
 1.5 08-Apr-2008  cegger branches: 1.5.2; 1.5.4;
use aprint_*_dev and device_xname
 1.4 19-Oct-2007  ad branches: 1.4.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.3 29-Jan-2007  hubertf branches: 1.3.6; 1.3.18; 1.3.20; 1.3.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.2 11-Dec-2005  christos branches: 1.2.18; 1.2.22;
merge ktrace-lwp.
 1.1 14-Aug-2005  joff branches: 1.1.6;
wsdisplay device driver for the 4x40 text-mode LCD on the NetBSD/toaster
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 14-Aug-2005  skrll file toasterlcd.c was added on branch ktrace-lwp on 2005-11-10 14:05:37 +0000
 1.2.22.1 01-Feb-2007  ad Sync with head.
 1.2.18.4 27-Oct-2007  yamt sync with head.
 1.2.18.3 26-Feb-2007  yamt sync with head.
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file toasterlcd.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.3.24.1 25-Oct-2007  bouyer Sync with HEAD.
 1.3.20.1 06-Nov-2007  matt sync with HEAD
 1.3.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.3.6.1 23-Oct-2007  ad Sync with head.
 1.4.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.3 16-May-2009  yamt sync with head
 1.5.4.2 04-May-2009  yamt sync with head.
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.10.12.1 30-Oct-2012  yamt sync with head
 1.8 16-Jan-2021  thorpej Add missing printing-of-newlines in the attach routine.
 1.7 09-Oct-2019  maxv branches: 1.7.8;
Provide a better abstraction for the TPM interface. Report it in the ioctl.
 1.6 09-Oct-2019  maxv Add suspend support for TPM 2.0 chips. Check the TPM response also for 1.2
chips. Unfortunately I cannot really test this change since ACPI suspend
does not work on any of my laptops.
 1.5 08-Oct-2019  maxv Improvements in tpm(4):
- Remove interrupt support, do polling only, avoids unnecessary trouble.
- Simplify a few things.
- Fix the suspend function, the SaveState command is 0x98, not 0x9C.
- Make the driver MP-safe.
- Sync the man page with reality.
 1.4 22-Jun-2019  maxv branches: 1.4.2;
Revamp the TPM driver

* Fix several bugs, and clean up.
* Drop the "legacy" interface, it relied on an undocumented global
variable that was never initialized. It likely had never been tested
either, so good riddance.
* Add support for TPM 2.0 chips via ACPI. For these we use the TIS1.2
interface, same as TPM 1.2.
* Provide an ioctl to fetch TPM information from the driver.

Tested on a Lenovo desktop with ACPI-TPM2.0, an HP laptop ACPI-TPM2.0, a
Dell laptop with ISA-TPM1.2.
 1.3 27-Apr-2017  msaitoh branches: 1.3.10;
Use {isa,pci}_intr_establish"_xname"() for intrctl(8).
 1.2 06-Feb-2012  christos branches: 1.2.4; 1.2.6; 1.2.10; 1.2.28; 1.2.42;
PR/45932: Add missing braces... This will probably fix interrupts too!
 1.1 22-Jan-2012  christos add a tpm driver from bsssd.sourceforge.net
 1.2.42.1 02-May-2017  pgoyette Sync with HEAD - tag prg-localcount2-base1
 1.2.28.1 28-Aug-2017  skrll Sync with HEAD
 1.2.10.1 03-Dec-2017  jdolecek update from HEAD
 1.2.6.2 17-Apr-2012  yamt sync with head
 1.2.6.1 06-Feb-2012  yamt file tpm_isa.c was added on branch yamt-pagecache on 2012-04-17 00:07:40 +0000
 1.2.4.2 18-Feb-2012  mrg merge to -current.
 1.2.4.1 06-Feb-2012  mrg file tpm_isa.c was added on branch jmcneill-usbmp on 2012-02-18 07:34:29 +0000
 1.3.10.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4.2.2 29-Aug-2022  martin Pull up following revision(s) (requested by riastradh in ticket #1505):

sys/dev/isa/tpm_isa.c: revision 1.8
sys/dev/ic/tpm.c: revision 1.20

Add missing printing-of-newlines in the attach routine.

Remove extra newline from boot messages (isa and acpi front-ends
already provide the newline).
 1.4.2.1 16-Oct-2019  martin Pull up following revision(s) (requested by maxv in ticket #336):

sys/dev/isa/tpm_isa.c: revision 1.6
sys/dev/ic/tpm.c: revision 1.16
sys/dev/isa/tpm_isa.c: revision 1.7
sys/dev/acpi/tpm_acpi.c: revision 1.10
sys/dev/acpi/tpm_acpi.c: revision 1.11
sys/dev/ic/tpmreg.h: revision 1.5
sys/dev/ic/tpmreg.h: revision 1.6
sys/dev/acpi/tpm_acpi.c: revision 1.9
sys/dev/ic/tpmvar.h: revision 1.5
sys/dev/ic/tpmvar.h: revision 1.6
sys/dev/ic/tpmvar.h: revision 1.7
sys/dev/ic/tpm.c: revision 1.14
share/man/man4/tpm.4: revision 1.5
sys/dev/isa/tpm_isa.c: revision 1.5
sys/dev/ic/tpm.c: revision 1.15

Improvements in tpm(4):
- Remove interrupt support, do polling only, avoids unnecessary trouble.
- Simplify a few things.
- Fix the suspend function, the SaveState command is 0x98, not 0x9C.
- Make the driver MP-safe.
- Sync the man page with reality.

-

Add suspend support for TPM 2.0 chips. Check the TPM response also for 1.2
chips. Unfortunately I cannot really test this change since ACPI suspend
does not work on any of my laptops.

-

Provide a better abstraction for the TPM interface. Report it in the ioctl.
 1.7.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.13 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.12 24-Apr-2021  thorpej branches: 1.12.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.11 27-Oct-2012  chs branches: 1.11.54;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.10 12-May-2009  cegger branches: 1.10.12; 1.10.22;
struct device * -> device_t, no functional changes intended.
 1.9 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.8 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.7 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.6 28-Apr-2008  martin branches: 1.6.8; 1.6.14;
Remove clause 3 and 4 from TNF licenses
 1.5 08-Apr-2008  cegger branches: 1.5.2; 1.5.4;
use aprint_*_dev and device_xname
 1.4 19-Oct-2007  ad branches: 1.4.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.3 11-Dec-2005  christos branches: 1.3.18; 1.3.32; 1.3.46; 1.3.48; 1.3.52;
merge ktrace-lwp.
 1.2 26-Aug-2005  drochner branches: 1.2.6;
s/locdesc_t/int/g
 1.1 14-Aug-2005  joff Simple driver for Technologic Systems TS-DIO24 PC104 board. No
userland interface (yet), basically just can detect a TS-DIO24 on a ISA
bus and provide an attachment for sub-devices.

The TS-DIO24 contains 24 programmable digital input/outputs.
 1.2.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.1 26-Aug-2005  skrll file tsdio.c was added on branch ktrace-lwp on 2005-11-10 14:05:37 +0000
 1.3.52.1 25-Oct-2007  bouyer Sync with HEAD.
 1.3.48.1 06-Nov-2007  matt sync with HEAD
 1.3.46.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.3.32.1 23-Oct-2007  ad Sync with head.
 1.3.18.3 27-Oct-2007  yamt sync with head.
 1.3.18.2 21-Jun-2006  yamt sync with head.
 1.3.18.1 11-Dec-2005  yamt file tsdio.c was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.4.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.4.3 16-May-2009  yamt sync with head
 1.5.4.2 04-May-2009  yamt sync with head.
 1.5.4.1 16-May-2008  yamt sync with head.
 1.5.2.1 18-May-2008  yamt sync with head.
 1.6.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.10.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.10.12.1 30-Oct-2012  yamt sync with head
 1.11.54.6 05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.11.54.5 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.11.54.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.11.54.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.11.54.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.11.54.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.12.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 23-Oct-2009  snj Switch to a 2 clause license. Approved by joff@ (copyright holder).
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76;
merge ktrace-lwp.
 1.1 14-Aug-2005  joff branches: 1.1.6;
Simple driver for Technologic Systems TS-DIO24 PC104 board. No
userland interface (yet), basically just can detect a TS-DIO24 on a ISA
bus and provide an attachment for sub-devices.

The TS-DIO24 contains 24 programmable digital input/outputs.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 14-Aug-2005  skrll file tsdioreg.h was added on branch ktrace-lwp on 2005-11-10 14:05:37 +0000
 1.2.76.1 11-Mar-2010  yamt sync with head
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file tsdioreg.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.4 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.3 23-Oct-2009  snj branches: 1.3.12; 1.3.22;
Switch to a 2 clause license. Approved by joff@ (copyright holder).
 1.2 11-Dec-2005  christos branches: 1.2.18; 1.2.76;
merge ktrace-lwp.
 1.1 14-Aug-2005  joff branches: 1.1.6;
Simple driver for Technologic Systems TS-DIO24 PC104 board. No
userland interface (yet), basically just can detect a TS-DIO24 on a ISA
bus and provide an attachment for sub-devices.

The TS-DIO24 contains 24 programmable digital input/outputs.
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 14-Aug-2005  skrll file tsdiovar.h was added on branch ktrace-lwp on 2005-11-10 14:05:37 +0000
 1.2.76.1 11-Mar-2010  yamt sync with head
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file tsdiovar.h was added on branch yamt-lazymbuf on 2006-06-21 15:04:21 +0000
 1.3.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.3.12.1 30-Oct-2012  yamt sync with head
 1.5 08-May-2007  xtraeme Split the ug(4) driver in three components:

* dev/ic/ug.c (main code shared by the attachments)
* dev/isa/ug_isa.c (isa attachment)
* dev/acpi/ug_acpi.c (acpi attachment)

That means that ug(4) can now be attached via ACPI.

Thanks to Mihai Chelaru for the good work.
 1.4 07-May-2007  xtraeme Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.

Patch from Mihai Chelaru in private email.
 1.3 20-Jan-2007  xtraeme branches: 1.3.2; 1.3.4; 1.3.8; 1.3.10;
Merge defs from ugvar2.h into ugvar.h, suggested by tsutsui.
 1.2 20-Jan-2007  xtraeme PR kern/35438: uGuru 2005 support from Mihai Chelaru.
Also replace bcopy with memcpy.
 1.1 06-Jan-2007  xtraeme branches: 1.1.2; 1.1.4;
Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.

Thanks.
 1.1.4.5 13-May-2007  pavel Pull up patch (requested by xtraeme in ticket #633):
sys/arch/amd64/conf/GENERIC: patch
sys/arch/i386/conf/ALL: patch
sys/arch/i386/conf/GENERIC: patch
sys/conf/files: patch
sys/dev/acpi/files.acpi: patch
sys/dev/acpi/ug_acpi.c: patch
sys/dev/ic/ug.c: patch
sys/dev/ic/ugreg.h: patch
sys/dev/ic/ugvar.h: patch
sys/dev/isa/files.isa: patch
sys/dev/isa/ug_isa.c: patch
share/man/man4/ug.4: patch
doc/CHANGES: patch
sys/dev/isa/ug.c: delete
sys/dev/isa/ugvar.h: delete

Add an acpi attachement for the ug hardware monitor driver.
 1.1.4.4 12-May-2007  snj Pull up following revision(s) (requested by xtraeme in ticket #620):
sys/dev/isa/ug.c: revision 1.4
sys/dev/isa/ugvar.h: revision 1.4
Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.
Patch from Mihai Chelaru in private email.
 1.1.4.3 21-Jan-2007  bouyer Pull up following revision(s) (requested by xtraeme in ticket #382):
sys/dev/isa/ug.c: revisions 1.2 - 1.3
sys/dev/isa/ugvar.h: revisions 1.2 - 1.3
PR kern/35438: uGuru 2005 support from Mihai Chelaru.
 1.1.4.2 12-Jan-2007  bouyer Pull up following revision(s) (requested by xtraeme in ticket #341):
distrib/sets/lists/man/mi: revision 1.965
share/man/man4/ug.4: revision 1.1
sys/dev/isa/files.isa: revision 1.145
sys/arch/amd64/conf/GENERIC: revision 1.124
sys/dev/isa/ug.c: revision 1.1
sys/dev/isa/ugvar.h: revision 1.1
share/man/man4/envsys.4: revision 1.21
share/man/man4/Makefile: revision 1.418
Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.
Thanks.
Add ug0 at isa? commented out (driver for the Abit uGuru
Hardware system monitor).
ug(4): manual page for the Abit uGuru hardware system monitor
(wiz please review, thanks).
+ ug(4)
 1.1.4.1 06-Jan-2007  bouyer file ug.c was added on branch netbsd-4 on 2007-01-12 23:16:49 +0000
 1.1.2.3 01-Feb-2007  ad Sync with head.
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 06-Jan-2007  ad file ug.c was added on branch newlock2 on 2007-01-12 00:57:38 +0000
 1.3.10.1 11-Jul-2007  mjf Sync with head.
 1.3.8.1 27-May-2007  ad Sync with head.
 1.3.4.3 03-Sep-2007  yamt sync with head.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 20-Jan-2007  yamt file ug.c was added on branch yamt-lazymbuf on 2007-02-26 09:10:15 +0000
 1.3.2.1 17-May-2007  yamt sync with head.
 1.10 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.9 29-Jun-2022  mlelstv unregister sensors only when registered.
 1.8 24-Jun-2020  jdolecek rearrange to avoid allocating softc on stack in ug_isa_match()
 1.7 04-Apr-2008  xtraeme Don't forget to unmap I/O space in the error paths.
 1.6 26-Mar-2008  xtraeme Split device_t/softc for ug(4) and other related cosmetic changes.
 1.5 16-Nov-2007  xtraeme branches: 1.5.14;
Extend the envsys2 API (one more time, sorry) as defined in:

http://mail-index.netbsd.org/tech-kern/2007/11/09/0001.html

sysmon_envsys_create() and sysmon_envsys_destroy() were added to
create/destroy sysmon_envsys objects (and its TAILQ/LIST for sensors/events).

sysmon_envsys_sensor_attach() and sysmon_envsys_sensor_detach() were
added to attach/detach sensors to a specified sysmon_envsys device.

The events framework is now per device and configurable via the
ENVSYS_SETDICTIONARY ioctl or /etc/envsys.conf and envstat(8).

Update all users and documentation to reflect these changes.
 1.4 19-Oct-2007  ad branches: 1.4.2;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.3 09-Sep-2007  xtraeme branches: 1.3.4;
Add the detach method, will be used by the LKM.
 1.2 01-Jul-2007  xtraeme branches: 1.2.2; 1.2.4; 1.2.8; 1.2.10; 1.2.12;
Imported envsys 2, a brief description of the new features:
(Part 2: drivers)

* Support for detachable sensors.
* Cleaned up the API for simplicity and efficiency.
* Ability to send capacity/critical/warning events to powerd(8).
* Adapted all the code to the new locking order.
* Compatibility with the old envsys API: the ENVSYS_GTREINFO
and ENVSYS_GTREDATA ioctl(2)s are supported.
* Added support for a 'dictionary based communication channel' between
sysmon_power(9) and powerd(8), that means there is no 32 bytes event
size restriction anymore.
* Binary compatibility with old envstat(8) and powerd(8) via COMPAT_40.
* All drivers with the n^2 gtredata bug were fixed, PR kern/36226.

Tested by:

blymn: smsc(4).
bouyer: ipmi(4), mfi(4).
kefren: ug(4).
njoly: viaenv(4), adt7463.c.
riz: owtemp(4).
xtraeme: acpiacad(4), acpibat(4), acpitz(4), aiboost(4), it(4), lm(4).
 1.1 08-May-2007  xtraeme branches: 1.1.2; 1.1.4; 1.1.6;
Split the ug(4) driver in three components:

* dev/ic/ug.c (main code shared by the attachments)
* dev/isa/ug_isa.c (isa attachment)
* dev/acpi/ug_acpi.c (acpi attachment)

That means that ug(4) can now be attached via ACPI.

Thanks to Mihai Chelaru for the good work.
 1.1.6.5 23-Oct-2007  ad Sync with head.
 1.1.6.4 09-Oct-2007  ad Sync with head.
 1.1.6.3 15-Jul-2007  ad Sync with head.
 1.1.6.2 09-Jun-2007  ad Sync with head.
 1.1.6.1 08-May-2007  ad file ug_isa.c was added on branch vmlocking on 2007-06-09 21:37:20 +0000
 1.1.4.2 17-May-2007  yamt sync with head.
 1.1.4.1 08-May-2007  yamt file ug_isa.c was added on branch yamt-idlelwp on 2007-05-17 13:41:28 +0000
 1.1.2.3 13-May-2007  pavel Fix new files from ticket #633.
 1.1.2.2 13-May-2007  pavel Pull up patch (requested by xtraeme in ticket #633):
sys/arch/amd64/conf/GENERIC: patch
sys/arch/i386/conf/ALL: patch
sys/arch/i386/conf/GENERIC: patch
sys/conf/files: patch
sys/dev/acpi/files.acpi: patch
sys/dev/acpi/ug_acpi.c: patch
sys/dev/ic/ug.c: patch
sys/dev/ic/ugreg.h: patch
sys/dev/ic/ugvar.h: patch
sys/dev/isa/files.isa: patch
sys/dev/isa/ug_isa.c: patch
share/man/man4/ug.4: patch
doc/CHANGES: patch
sys/dev/isa/ug.c: delete
sys/dev/isa/ugvar.h: delete

Add an acpi attachement for the ug hardware monitor driver.
 1.1.2.1 08-May-2007  pavel file ug_isa.c was added on branch netbsd-4 on 2007-05-13 06:52:54 +0000
 1.2.12.4 07-Dec-2007  yamt sync with head
 1.2.12.3 27-Oct-2007  yamt sync with head.
 1.2.12.2 03-Sep-2007  yamt sync with head.
 1.2.12.1 01-Jul-2007  yamt file ug_isa.c was added on branch yamt-lazymbuf on 2007-09-03 14:35:46 +0000
 1.2.10.2 09-Jan-2008  matt sync with HEAD
 1.2.10.1 06-Nov-2007  matt sync with HEAD
 1.2.8.3 21-Nov-2007  joerg Sync with HEAD.
 1.2.8.2 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.2.8.1 02-Oct-2007  joerg Sync with HEAD.
 1.2.4.1 10-Sep-2007  skrll Sync with HEAD.
 1.2.2.2 11-Jul-2007  mjf Sync with head.
 1.2.2.1 01-Jul-2007  mjf file ug_isa.c was added on branch mjf-ufs-trans on 2007-07-11 20:06:33 +0000
 1.3.4.2 18-Nov-2007  bouyer Sync with HEAD
 1.3.4.1 25-Oct-2007  bouyer Sync with HEAD.
 1.4.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.5.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.5.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.5 08-May-2007  xtraeme Split the ug(4) driver in three components:

* dev/ic/ug.c (main code shared by the attachments)
* dev/isa/ug_isa.c (isa attachment)
* dev/acpi/ug_acpi.c (acpi attachment)

That means that ug(4) can now be attached via ACPI.

Thanks to Mihai Chelaru for the good work.
 1.4 07-May-2007  xtraeme Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.

Patch from Mihai Chelaru in private email.
 1.3 20-Jan-2007  xtraeme branches: 1.3.2; 1.3.4; 1.3.8; 1.3.10;
Merge defs from ugvar2.h into ugvar.h, suggested by tsutsui.
 1.2 20-Jan-2007  xtraeme PR kern/35438: uGuru 2005 support from Mihai Chelaru.
Also replace bcopy with memcpy.
 1.1 06-Jan-2007  xtraeme branches: 1.1.2; 1.1.4;
Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.

Thanks.
 1.1.4.5 13-May-2007  pavel Pull up patch (requested by xtraeme in ticket #633):
sys/arch/amd64/conf/GENERIC: patch
sys/arch/i386/conf/ALL: patch
sys/arch/i386/conf/GENERIC: patch
sys/conf/files: patch
sys/dev/acpi/files.acpi: patch
sys/dev/acpi/ug_acpi.c: patch
sys/dev/ic/ug.c: patch
sys/dev/ic/ugreg.h: patch
sys/dev/ic/ugvar.h: patch
sys/dev/isa/files.isa: patch
sys/dev/isa/ug_isa.c: patch
share/man/man4/ug.4: patch
doc/CHANGES: patch
sys/dev/isa/ug.c: delete
sys/dev/isa/ugvar.h: delete

Add an acpi attachement for the ug hardware monitor driver.
 1.1.4.4 12-May-2007  snj Pull up following revision(s) (requested by xtraeme in ticket #620):
sys/dev/isa/ug.c: revision 1.4
sys/dev/isa/ugvar.h: revision 1.4
Don't refresh all sensors in the gtredata function, just the sensor
that was requested. This is related to PR kern/36226.
Patch from Mihai Chelaru in private email.
 1.1.4.3 21-Jan-2007  bouyer Pull up following revision(s) (requested by xtraeme in ticket #382):
sys/dev/isa/ug.c: revisions 1.2 - 1.3
sys/dev/isa/ugvar.h: revisions 1.2 - 1.3
PR kern/35438: uGuru 2005 support from Mihai Chelaru.
 1.1.4.2 12-Jan-2007  bouyer Pull up following revision(s) (requested by xtraeme in ticket #341):
distrib/sets/lists/man/mi: revision 1.965
share/man/man4/ug.4: revision 1.1
sys/dev/isa/files.isa: revision 1.145
sys/arch/amd64/conf/GENERIC: revision 1.124
sys/dev/isa/ug.c: revision 1.1
sys/dev/isa/ugvar.h: revision 1.1
share/man/man4/envsys.4: revision 1.21
share/man/man4/Makefile: revision 1.418
Driver for the Abit uGuru Hardware system monitor, contributed by
Mihai Chelaru. Minor changes (simplification and KNF) by me.
Thanks.
Add ug0 at isa? commented out (driver for the Abit uGuru
Hardware system monitor).
ug(4): manual page for the Abit uGuru hardware system monitor
(wiz please review, thanks).
+ ug(4)
 1.1.4.1 06-Jan-2007  bouyer file ugvar.h was added on branch netbsd-4 on 2007-01-12 23:16:49 +0000
 1.1.2.3 01-Feb-2007  ad Sync with head.
 1.1.2.2 12-Jan-2007  ad Sync with head.
 1.1.2.1 06-Jan-2007  ad file ugvar.h was added on branch newlock2 on 2007-01-12 00:57:38 +0000
 1.3.10.1 11-Jul-2007  mjf Sync with head.
 1.3.8.2 09-Jun-2007  ad Sync with head.
 1.3.8.1 27-May-2007  ad Sync with head.
 1.3.4.3 03-Sep-2007  yamt sync with head.
 1.3.4.2 26-Feb-2007  yamt sync with head.
 1.3.4.1 20-Jan-2007  yamt file ugvar.h was added on branch yamt-lazymbuf on 2007-02-26 09:10:16 +0000
 1.3.2.1 17-May-2007  yamt sync with head.
 1.2 20-Jan-2007  xtraeme Merge defs from ugvar2.h into ugvar.h, suggested by tsutsui.
 1.1 20-Jan-2007  xtraeme PR kern/35438: uGuru 2005 support from Mihai Chelaru.
Also replace bcopy with memcpy.
 1.42 12-Nov-2019  msaitoh Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.
 1.41 18-Oct-2014  snj branches: 1.41.12; 1.41.20; 1.41.26;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.40 04-Nov-2013  christos use __USE for debug variable
 1.39 27-Oct-2012  chs branches: 1.39.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.38 23-Nov-2009  rmind branches: 1.38.12; 1.38.22;
Remove some unecessary includes sys/user.h header.
 1.37 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.36 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.35 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.34 28-Apr-2008  martin branches: 1.34.8; 1.34.14;
Remove clause 3 and 4 from TNF licenses
 1.33 08-Apr-2008  cegger branches: 1.33.2; 1.33.4;
use aprint_*_dev and device_xname
 1.32 19-Oct-2007  ad branches: 1.32.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.31 16-Nov-2006  christos branches: 1.31.8; 1.31.22; 1.31.24; 1.31.28;
__unused removal on arguments; approved by core.
 1.30 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.29 11-Dec-2005  christos branches: 1.29.20; 1.29.22;
merge ktrace-lwp.
 1.28 04-Feb-2005  perry branches: 1.28.6;
de-__P
 1.27 14-Sep-2004  drochner branches: 1.27.4; 1.27.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.26 02-Oct-2002  thorpej branches: 1.26.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.25 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.24 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.23 05-Apr-2002  bouyer Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.
 1.22 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.21 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.20 13-Nov-2001  lukem add RCSID
 1.19 23-Mar-2000  thorpej branches: 1.19.6; 1.19.8;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.18 30-Sep-1999  thorpej branches: 1.18.2;
Update for SCSPI changes.
 1.17 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.16 04-Jul-1998  jonathan defopt DDB.
 1.15 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.14 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.13 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.12 17-Feb-1998  thorpej - Perform all necessary bus_dmamap_sync() operations.
- Greatly simplify allocation and DMA mapping of the mailbox and ccbs.
- Be more robust against resource shortage errors, and report errors better.
 1.11 20-Oct-1997  thorpej Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.10 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.9 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.8 06-Jun-1997  thorpej branches: 1.8.2; 1.8.4;
Pull thorpej-bus-dma branch into mainline.
 1.7 29-Mar-1997  mycroft branches: 1.7.2;
Use a temporary data structure for holding probe information, rather than a
full softc.
 1.6 15-Nov-1996  jonathan Fix front-ends of split uha driver to compile when DDB is not configured:
Propagate Debugger() macro from uha.c to uha_{eisa,isa}.c.
update file names accordingly.
 1.5 21-Oct-1996  thorpej New bus.h implementation/interface:
- No more distinction between i/o-mapped and memory-mapped
devices. It's all "bus space" now, and space tags
differentiate the space with finer grain than the
bus chipset tag.
- Add memory barrier methods.
- Implement space alloc/free methods.
- Implement region read/write methods (like memcpy to/from
bus space).
This interface provides a better abstraction for dealing with
machine-independent chipset drivers.
 1.4 13-Oct-1996  christos backout kprintf changes
 1.3 10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
- provide a default case to handle an unknown model number.
- include <systm.h>
- remove unused variable.
 1.2 01-Sep-1996  mycroft Minor changes.
 1.1 31-Aug-1996  mycroft Split the UltraStor driver apart.
 1.7.2.2 18-May-1997  thorpej Do the __BROKEN_INDIRECT_CONFIG dance.
 1.7.2.1 13-May-1997  thorpej - Convert to use bus dma.
- Use 32-bit DMA on VLB flavors of the card.
 1.8.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.18.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.8.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.19.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.19.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.6.6 18-Oct-2002  nathanw Catch up to -current.
 1.19.6.5 17-Apr-2002  nathanw Catch up to -current.
 1.19.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.19.6.3 11-Jan-2002  nathanw More catchup.
 1.19.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.19.6.1 14-Nov-2001  nathanw Catch up to -current.
 1.26.6.3 04-Feb-2005  skrll Sync with HEAD.
 1.26.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.27.6.1 12-Feb-2005  yamt sync with head.
 1.27.4.1 29-Apr-2005  kent sync with -current
 1.28.6.2 27-Oct-2007  yamt sync with head.
 1.28.6.1 30-Dec-2006  yamt sync with head.
 1.29.22.2 10-Dec-2006  yamt sync with head.
 1.29.22.1 22-Oct-2006  yamt sync with head
 1.29.20.1 18-Nov-2006  ad Sync with head.
 1.31.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.31.24.1 06-Nov-2007  matt sync with HEAD
 1.31.22.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.31.8.1 23-Oct-2007  ad Sync with head.
 1.32.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.33.4.4 11-Mar-2010  yamt sync with head
 1.33.4.3 16-May-2009  yamt sync with head
 1.33.4.2 04-May-2009  yamt sync with head.
 1.33.4.1 16-May-2008  yamt sync with head.
 1.33.2.1 18-May-2008  yamt sync with head.
 1.34.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.38.22.3 03-Dec-2017  jdolecek update from HEAD
 1.38.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.38.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.12.1 30-Oct-2012  yamt sync with head
 1.39.2.1 18-May-2014  rmind sync with head
 1.41.26.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.

Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.

Add missing initialization of sc_dev.
 1.41.20.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.41.12.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

sys/dev/sbus/sio16.c: revision 1.25
sys/dev/gpib/mt.c: revision 1.33
sys/arch/mvme68k/dev/wdsc.c: revision 1.33
sys/dev/gpib/ct.c: revision 1.31
sys/dev/isa/mcd.c: revision 1.119
sys/dev/pci/if_stge.c: revision 1.73
sys/dev/gpib/ppi.c: revision 1.25
sys/dev/pcmcia/if_tr_pcmcia.c: revision 1.29
sys/arch/amiga/dev/zssc.c: revision 1.46
sys/arch/mac68k/obio/iwm_fd.c: revision 1.57
sys/arch/amiga/dev/if_qn.c: revision 1.48
sys/dev/isa/tcic2_isa.c: revision 1.28
sys/dev/isa/uha_isa.c: revision 1.42
sys/dev/pci/neo.c: revision 1.55
sys/arch/next68k/dev/nextdisplay.c: revision 1.22
sys/dev/isa/if_iy.c: revision 1.111

Add missing initialization of sc_dev.


Initialize sc_dev correctly to avoid null pointer dereference when
bus_space_map() failed.


Add missing initialization of sc_dev.
 1.69 31-Aug-1996  mycroft Split the UltraStor driver apart.
 1.68 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.67 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.66 12-May-1996  mycroft Use intr.h.
 1.65 29-Apr-1996  christos - gcc -Wall fixes
 1.64 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.63 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.62 24-Feb-1996  mycroft Switch byte order of ID and configuration registers for 14f and 34f.
 1.61 09-Feb-1996  mycroft Read the 14f/34f registers in 8-bit mode.
 1.60 26-Dec-1995  mycroft Fix Ultrastor 24f probe, per Andrew Gillham.
 1.59 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.58 10-Nov-1995  mycroft Correct the format of some diagnostics.
 1.57 04-Oct-1995  mycroft branches: 1.57.2;
Fix typo.
 1.56 03-Oct-1995  mycroft Modularize the CCB/MSCP/ACB/ECB handling a little. No functional changes.
 1.55 26-Sep-1995  thorpej Don't declare Debugger(). It's handled in <sys/systm.h>
 1.54 14-Sep-1995  pk Make *print() a message if no scsibus was attached. Also, return something
valid.
 1.53 12-Aug-1995  mycroft opri --> s
 1.52 12-Aug-1995  mycroft minphys() functions really should return void.
 1.51 28-Jul-1995  mycroft Don't loop if we're out of CCBs/SCBs/MSCPs.
 1.50 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.49 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.48 14-Mar-1995  mycroft Turn off two diagnostic printfs by default.
 1.47 10-Feb-1995  mycroft Make some guesses about how to properly configure the interrupt masks. Back
out part of the previous change until I get some documentation on these boards.
 1.46 13-Jan-1995  mycroft Simplify some sanity checks.
 1.45 03-Jan-1995  mycroft Add interrupt sharing types.
 1.44 28-Dec-1994  mycroft Numerous changes. Many bugs fixed, better autoconfig, a few new features.
 1.43 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.42 04-Nov-1994  mycroft No longer needs icu.h.
 1.41 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.40 03-Nov-1994  mycroft Update to match autoconfig code.
 1.39 27-Oct-1994  cgd new RCS ID format.
 1.38 22-Aug-1994  mycroft Disable EISA reset, for now.
 1.37 03-Aug-1994  mycroft Change iosize to 16.
 1.36 31-Jul-1994  mycroft Fix up u14_find() a bit; mainly, don't include a DRQ for the 34f.
 1.35 28-Jul-1994  mycroft Redo some of the EISA config stuff.
 1.34 27-Jul-1994  mycroft Remove unused macros.
 1.33 27-Jul-1994  mycroft Fix typo.
 1.32 27-Jul-1994  mycroft Fix the DMA setup.
 1.31 27-Jul-1994  mycroft Enable IRQ probing.
 1.30 08-Jun-1994  mycroft branches: 1.30.2;
Add (experimental) 24f handling.
 1.29 11-May-1994  mycroft Nothing of consequence.
 1.28 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.27 29-Apr-1994  cgd change timeout/untimeout/wakeup/sleep/tsleep args to void *
 1.26 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.25 29-Mar-1994  mycroft New SCSI system, based on Julian's more recent work.
 1.24 25-Mar-1994  mycroft Put controller target in scsi_switch.
 1.23 14-Mar-1994  mycroft Remove two bogus splx()s.
 1.22 12-Mar-1994  mycroft Fix bug in last change.
 1.21 12-Mar-1994  mycroft Update to match config(8).
 1.20 10-Mar-1994  mycroft Updates to match config(8).
 1.19 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.18 21-Jan-1994  glass cleaned up some warnings
 1.17 03-Jan-1994  mycroft Use KERNBASE, not 0xfe000000.
 1.16 20-Dec-1993  davidb Fixed bug where with two or more SCSI controllers of the same type, you
could not have devices at the same ID on each bus.
This patch not directly applicable to magnum branch, which is using Julian's
new SCSI code.
 1.15 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.14 07-Dec-1993  deraadt __386BSD__ -> __NetBSD__
 1.13 28-Jul-1993  cgd branches: 1.13.2;
incorporate changes from 0-9-base to 0-9-ALPHA
 1.12 17-Jul-1993  deraadt branches: 1.12.2;
scsi_switch had wrong entries for these controllers...
 1.11 09-Jun-1993  deraadt minor silliness related to two or more controllers
 1.10 22-May-1993  cgd add rcsids to everything and clean up headers
 1.9 04-May-1993  deraadt support for making dev->id_alive be set, this is for iostat to
find disk devices. wee bit of a kludge. sub-device attach()
routines must now return 1 for successful attach(), 0 otherwise.
Other bsd's do this too..
 1.8 15-Apr-1993  deraadt ioconf changes, see previous cvs's that dumped core
 1.7 15-Apr-1993  deraadt ooops. DDB instead of NDDB. A typo, i swear
 1.6 15-Apr-1993  deraadt #ifdef DDB fix
 1.5 12-Apr-1993  deraadt new scsi subsystem.
changes also in config/mkioconf.c & sys/scsi/*
 1.4 10-Apr-1993  cgd was saying "not responding" on failed probe. that's bogus.
 1.3 10-Apr-1993  glass fixed to be compliant, subservient, and to take advantage of the newly
hacked config(8)
 1.2 08-Apr-1993  deraadt dmesg output at boottime now tries to print out information as
soon as it is available. The output looks much more like Sunos.
 1.1 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.12.2.1 22-Jul-1993  cgd slight (strange!) mod from julian to make it work with ultra34f, as well.
 1.13.2.11 25-Mar-1994  mycroft Stylistic changes.
 1.13.2.10 02-Feb-1994  mycroft Change some structure names.
 1.13.2.9 02-Feb-1994  mycroft Change second arg of probe to self.
 1.13.2.8 04-Dec-1993  mycroft Various cleanup, and two bug fixes.
 1.13.2.7 29-Nov-1993  mycroft Add some bzero()s before it bites me.
 1.13.2.6 28-Nov-1993  mycroft Stylistic changes.
 1.13.2.5 28-Nov-1993  mycroft Remove some unused variables.
 1.13.2.4 28-Nov-1993  mycroft Delete useless `flags' field in uha_data.
 1.13.2.3 28-Nov-1993  mycroft Stylistic changes.
 1.13.2.2 28-Nov-1993  mycroft Works.
 1.13.2.1 25-Nov-1993  mycroft New code from Julian, not yet converted.
 1.30.2.5 22-Aug-1994  mycroft update from trunk
 1.30.2.4 03-Aug-1994  cgd from trunk
 1.30.2.3 01-Aug-1994  cgd From trunk.
 1.30.2.2 28-Jul-1994  cgd from trunk.
 1.30.2.1 27-Jul-1994  cgd from trunk, per mycroft
 1.57.2.1 26-Dec-1995  mycroft Pull in Ultrastor 24f probe fix from trunk.
 1.22 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.21 14-Mar-2008  cube Split device_t and softc for all attachments of vga(4).
 1.20 16-Nov-2006  christos branches: 1.20.24; 1.20.44; 1.20.48;
__unused removal on arguments; approved by core.
 1.19 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.18 11-Dec-2005  christos branches: 1.18.20; 1.18.22;
merge ktrace-lwp.
 1.17 27-Feb-2005  perry branches: 1.17.4;
nuke trailing whitespace
 1.16 14-Sep-2004  drochner branches: 1.16.4; 1.16.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.15 02-Oct-2002  thorpej branches: 1.15.6;
Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 09-Jul-2002  junyoung ANSIfy.
 1.11 28-Jun-2002  drochner clean up font handling:
-treat the builtin font like any other font at runtime
-for that, copy it to malloc()'d memory during attach()
-in early console initialization, if we have to consider a broken card
(VGA_CONSOLE_ATI_BROKEN_FONTSEL), copy the builtin font to another
location in font ram; the attach() code will do the rest
put the "quirk" code into effect again
 1.10 27-Jun-2002  junyoung - Work around a hardware bug that loaded fonts don't work, which is
found on many (all?) of PCI-based ATI graphics cards. It is fully optional
and can be enabled by adding `options VGA_CONSOLE_ATI_BROKEN_FONTSEL'
to config file.
- Temporarily remove `quirk' mechanism. Similar code already exists
in pci_quirks.c.
 1.9 26-Jun-2002  simonb Whitespace KNF.
 1.8 25-Jun-2002  drochner allow to overwrite the builtin VGA font if necessary,
make the number of available font slots variable,
set up a "quirk" mechanism to tell the generic vga code about crippled
VGA adapters which ignore the "fontsel" TS register,
initiate the quirk table with an ATI chip which happened to be on a board
I tested with.
Afaik quite a number of ATI chips suffers from the "loaded fonts don't
work" problem - these should be added.
Bad side effect of my change: The builtin font will be kicked out
always if a VGA_CONSOLE_SCREENTYPE is specified which needs a loaded
font. In early console initialization, we don't know much about the
graphics card, so we have to assume the worst (ie ATI:-).
 1.7 07-Jan-2002  thorpej branches: 1.7.8;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.6 13-Nov-2001  lukem add RCSID
 1.5 14-Sep-2001  thorpej Allow bus front-end to provide both ioctl and mmap entry points,
and also the wsdisplay type.

Based on changes from Simon Burge <simonb@wasabisystems.com>.
 1.4 14-Aug-2000  thorpej branches: 1.4.2; 1.4.4; 1.4.6;
Just add the mmap argument to vga_common_attach(), don't bother
with vga_extended_attach().
 1.3 12-Jun-1998  drochner branches: 1.3.14;
clean up vga_isa_match() - always return "2" on success to make the
driver win over "pcdisplay"
 1.2 28-May-1998  drochner Put definitions and subroutines needed for all PC display adapters
(MGA/GCA and compatibles) into global headers / source files.
Let the VGA driver use them.
 1.1 22-Mar-1998  drochner ISA frontend for sys/dev/ic/vga.c
 1.3.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.4.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.4.2.5 01-Aug-2002  nathanw Catch up to -current.
 1.4.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.4.2.3 11-Jan-2002  nathanw More catchup.
 1.4.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.4.2.1 21-Sep-2001  nathanw Catch up to -current.
 1.7.8.1 15-Jul-2002  gehenna catch up with -current.
 1.15.6.3 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.15.6.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.1 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.16.4.1 29-Apr-2005  kent sync with -current
 1.17.4.2 17-Mar-2008  yamt sync with head.
 1.17.4.1 30-Dec-2006  yamt sync with head.
 1.18.22.2 10-Dec-2006  yamt sync with head.
 1.18.22.1 22-Oct-2006  yamt sync with head
 1.18.20.1 18-Nov-2006  ad Sync with head.
 1.20.48.1 03-Apr-2008  mjf Sync with HEAD.
 1.20.44.1 24-Mar-2008  keiichi sync with head.
 1.20.24.1 23-Mar-2008  matt sync with HEAD
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 27-Feb-2005  perry nuke trailing whitespace
 1.2 04-Feb-2005  perry de-__P
 1.1 22-Mar-1998  drochner branches: 1.1.48; 1.1.56; 1.1.58;
ISA frontend for sys/dev/ic/vga.c
 1.1.58.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.58.1 12-Feb-2005  yamt sync with head.
 1.1.56.1 29-Apr-2005  kent sync with -current
 1.1.48.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.48.1 04-Feb-2005  skrll Sync with HEAD.
 1.30 16-Dec-2022  msaitoh lm(4): Add Nuvoton NCT6797D support.
 1.29 02-Nov-2022  andvar fix various typos in comments and messages.
 1.28 01-Oct-2022  msaitoh Add Nuvoton NCT6799D support.
 1.27 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.26 24-Apr-2021  thorpej branches: 1.26.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.25 10-Jul-2019  msaitoh branches: 1.25.2; 1.25.12;
Identify Nuvoton NCT6798D correctly. It seems that the bit width of NCT6796D
and newer devices' device ID is 13bit. The previous series was 12bits.
 1.24 25-Apr-2018  yamaguchi branches: 1.24.2;
Use spin mutex to fix a panic

The GPIO part of wbsio(4) has a lock to keep the register access
order. In addition to the lock, gpio(4) has a look to prevent
multiple control through gpio_pin_ctl(). Those locks hold at
once when gpio_pin_ctl() is called, and the lock of gpio(4) hold
before that of wbsio(4).

Therefore, the wbsio(4) has to use spin lock if gpio(4) uses
spin lock.
 1.23 07-Mar-2018  msaitoh Add NCT6796D. Some functions of NCT6796D is extended from NCT6795D,
but this commit doesn't support them yet.
 1.22 20-Feb-2018  pgoyette branches: 1.22.2;
Handle watchdog attachment in the wbsio_rescan() function, where we
take care of other children.

ok knakahara@ and yamaguchi@
 1.21 02-Jan-2018  pgoyette Now that watchdog support has been added, make sure that a modular driver
requires the sysmon_wdog module.
 1.20 13-Dec-2017  knakahara Improve the error log message to use product name. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.19 13-Dec-2017  knakahara Add an option to enable GPIO function of wbsio. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.18 13-Dec-2017  knakahara Add Watchdog timer implementation to wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.17 13-Dec-2017  knakahara Fix NCT6779 gpio pin configuration. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.16 13-Dec-2017  knakahara Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.15 18-Aug-2017  msaitoh - WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from otehrs, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
 1.14 17-Aug-2017  msaitoh Print chip name correctly.
 1.13 09-Aug-2017  msaitoh - Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
 1.12 11-Jul-2017  msaitoh lm(4): Add suport for NCT5174D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
 1.11 07-Jul-2017  msaitoh Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
 1.10 01-Jun-2016  pgoyette branches: 1.10.10;
Add support for Nuvoton NCT6776F from OpenBSD

From PR kern/49747
 1.9 18-Jan-2012  jakllsch branches: 1.9.6; 1.9.24;
wbsio(4) rescan support.
 1.8 17-Jan-2012  jakllsch Make this compile.
 1.7 17-Jan-2012  jakllsch No module dependencies are denoted with NULL. Pointed out by jmcneill.
 1.6 17-Jan-2012  jakllsch Add module glue.
 1.5 17-Jan-2012  jakllsch Add and enable detachment and child detachment functions.
 1.4 17-Jan-2012  jakllsch Add NULL pmf handlers.
 1.3 18-May-2011  dyoung branches: 1.3.4; 1.3.8;
#include <sys/bus.h>, not <machine/bus.h>.
 1.2 19-Mar-2010  cnst branches: 1.2.2; 1.2.4;
support W83667HG (0xa5) in wbsio(4); its hw mon is already supported by lm(4) as W83627DHG (0xc1)
 1.1 21-Feb-2010  cnst branches: 1.1.2; 1.1.4;
New wbsio(4) driver for Winbond Super I/O attachment of lm(4) on any port.

http://mail-index.netbsd.org/tech-kern/2010/02/17/msg007338.html

Reviewed by <pgoyette>, <tech-kern>.
 1.1.4.2 31-May-2011  rmind sync with head
 1.1.4.1 30-May-2010  rmind sync with head
 1.1.2.3 11-Aug-2010  yamt sync with head.
 1.1.2.2 11-Mar-2010  yamt sync with head
 1.1.2.1 21-Feb-2010  yamt file wbsio.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:37 +0000
 1.2.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.2.2.2 30-Apr-2010  uebayasi Sync with HEAD.
 1.2.2.1 19-Mar-2010  uebayasi file wbsio.c was added on branch uebayasi-xip on 2010-04-30 14:43:27 +0000
 1.3.8.1 18-Feb-2012  mrg merge to -current.
 1.3.4.1 17-Apr-2012  yamt sync with head
 1.9.24.2 28-Aug-2017  skrll Sync with HEAD
 1.9.24.1 09-Jul-2016  skrll Sync with HEAD
 1.9.6.1 03-Dec-2017  jdolecek update from HEAD
 1.10.10.8 19-Jan-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1784):

share/man/man4/lm.4: revision 1.38
sys/dev/ic/nslm7x.c: revision 1.79
sys/dev/isa/wbsio.c: revision 1.30
sys/dev/isa/wbsioreg.h: revision 1.11

lm(4): Add Nuvoton NCT6797D support.
 1.10.10.7 15-Oct-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1774):

share/man/man4/lm.4: revision 1.37
sys/dev/isa/wbsio.c: revision 1.28
sys/dev/ic/nslm7x.c: revision 1.78
sys/dev/isa/wbsioreg.h: revision 1.10

Add Nuvoton NCT6799D support.
 1.10.10.6 17-Jul-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1294):

sys/dev/isa/wbsio.c: revision 1.25
sys/dev/ic/nslm7x.c: revision 1.72
sys/dev/ic/nslm7x.c: revision 1.73
sys/dev/isa/wbsioreg.h: revision 1.9

Use pmf_device_{register,deregister}().

-

Identify Nuvoton NCT6798D correctly. It seems that the bit width of NCT6796D
and newer devices' device ID is 13bit. The previous series was 12bits.
 1.10.10.5 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #927):
share/man/man4/lm.4: 1.35, 1.36
sys/dev/ic/nslm7x.c: 1.71
sys/dev/isa/wbsio.c: 1.23
sys/dev/isa/wbsioreg.h: 1.8
Add NCT6796D. Some functions of NCT6796D is extended from NCT6795D,
but this commit doesn't support them yet.
--
Add NCT6796D.
--
Remove Tn. Add serial comma.
 1.10.10.4 05-May-2018  martin Pull up following revision(s) (requested by yamaguchi in ticket #789):

sys/dev/isa/wbsio.c: revision 1.24

Use spin mutex to fix a panic

The GPIO part of wbsio(4) has a lock to keep the register access
order. In addition to the lock, gpio(4) has a look to prevent
multiple control through gpio_pin_ctl(). Those locks hold at
once when gpio_pin_ctl() is called, and the lock of gpio(4) hold
before that of wbsio(4).

Therefore, the wbsio(4) has to use spin lock if gpio(4) uses
spin lock.
 1.10.10.3 16-Apr-2018  martin Pull up following revision(s) (requested by yamaguchi in ticket #765):

sys/dev/isa/wbsio.c: revision 1.22

Handle watchdog attachment in the wbsio_rescan() function, where we
take care of other children.

ok knakahara@ and yamaguchi@
 1.10.10.2 19-Feb-2018  snj Pull up following revision(s) (requested by yamaguchi in ticket #558):
share/man/man4/wbsio.4: 1.7-1.8
sys/dev/isa/files.isa: 1.168-1.169
sys/dev/isa/wbsio.c: 1.16-1.21
sys/dev/isa/wbsioreg.h: 1.6-1.7
Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Fix NCT6779 gpio pin configuration. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Add Watchdog timer implementation to wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Add an option to enable GPIO function of wbsio. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Improve the error log message to use product name. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Update the manual of wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
New sentence, new line. Fix xref. Sort SEE ALSO.
--
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.
--
Now that watchdog support has been added, make sure that a modular driver
requires the sysmon_wdog module.
 1.10.10.1 22-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #374):
share/man/man4/lm.4: revision 1.33
share/man/man4/lm.4: revision 1.34
sys/dev/ic/nslm7x.c: revision 1.70
sys/dev/isa/lm_isa_common.c: revision 1.5
sys/dev/isa/lm_isa_common.c: revision 1.6
sys/dev/isa/wbsio.c: revision 1.11
sys/dev/i2c/lm_i2c.c: revision 1.3
sys/dev/isa/wbsio.c: revision 1.12
sys/dev/i2c/lm_i2c.c: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.1
sys/dev/isa/wbsio.c: revision 1.13
sys/dev/isa/wbsioreg.h: revision 1.2
sys/dev/isa/wbsio.c: revision 1.14
sys/dev/isa/wbsioreg.h: revision 1.3
sys/dev/isa/wbsio.c: revision 1.15
sys/dev/isa/wbsioreg.h: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.5
share/man/man4/wbsio.4: revision 1.4
share/man/man4/wbsio.4: revision 1.5
sys/dev/ic/nslm7xvar.h: revision 1.30
sys/dev/ic/nslm7x.c: revision 1.65
share/man/man4/wbsio.4: revision 1.6
sys/dev/ic/nslm7xvar.h: revision 1.31
sys/dev/ic/nslm7x.c: revision 1.66
sys/dev/ic/nslm7xvar.h: revision 1.32
sys/dev/ic/nslm7x.c: revision 1.67
sys/dev/ic/nslm7xvar.h: revision 1.33
sys/dev/ic/nslm7x.c: revision 1.68
sys/dev/ic/nslm7x.c: revision 1.69
Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT610[246]D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
Add note about Nuvoton.
- Add new Nuvoton devices.
- Add CAVEATS section from OpenBSD.
Add space before left-paren
Remove superfluous Pp.
Whitespace.
Fix a bug that fan RPM wasn't printed correctly. 0xbX is not RPM but counter.
Use 0xcX.
Fix typo.
- Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
Use uint8_t instead of int. No functional change.
Print chip name correctly.
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from others, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
s/Id/NetBSD/. Pointed out by wiz!
 1.22.2.2 02-May-2018  pgoyette Synch with HEAD
 1.22.2.1 15-Mar-2018  pgoyette Synch with HEAD
 1.24.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.25.12.3 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.25.12.2 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.25.12.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.25.2.2 19-Jan-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1568):

share/man/man4/lm.4: revision 1.38
sys/dev/ic/nslm7x.c: revision 1.79
sys/dev/isa/wbsio.c: revision 1.30
sys/dev/isa/wbsioreg.h: revision 1.11

lm(4): Add Nuvoton NCT6797D support.
 1.25.2.1 15-Oct-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1541):

share/man/man4/lm.4: revision 1.37
sys/dev/isa/wbsio.c: revision 1.28
sys/dev/ic/nslm7x.c: revision 1.78
sys/dev/isa/wbsioreg.h: revision 1.10

Add Nuvoton NCT6799D support.

Add NCT679[89] to the supported list.
 1.26.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.11 16-Dec-2022  msaitoh lm(4): Add Nuvoton NCT6797D support.
 1.10 01-Oct-2022  msaitoh Add Nuvoton NCT6799D support.
 1.9 10-Jul-2019  msaitoh branches: 1.9.2;
Identify Nuvoton NCT6798D correctly. It seems that the bit width of NCT6796D
and newer devices' device ID is 13bit. The previous series was 12bits.
 1.8 07-Mar-2018  msaitoh branches: 1.8.2;
Add NCT6796D. Some functions of NCT6796D is extended from NCT6795D,
but this commit doesn't support them yet.
 1.7 13-Dec-2017  knakahara branches: 1.7.2;
Add Watchdog timer implementation to wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.6 13-Dec-2017  knakahara Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.

I just commit by proxy.
 1.5 15-Nov-2017  msaitoh branches: 1.5.2; 1.5.4;
s/Id/NetBSD/. Pointed out by wiz!
 1.4 15-Nov-2017  msaitoh Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
 1.3 18-Aug-2017  msaitoh branches: 1.3.2;
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from otehrs, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
 1.2 11-Jul-2017  msaitoh lm(4): Add suport for NCT5174D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
 1.1 07-Jul-2017  msaitoh Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
 1.3.2.2 28-Aug-2017  skrll Sync with HEAD
 1.3.2.1 18-Aug-2017  skrll file wbsioreg.h was added on branch nick-nhusb on 2017-08-28 17:52:04 +0000
 1.5.4.2 03-Dec-2017  jdolecek update from HEAD
 1.5.4.1 15-Nov-2017  jdolecek file wbsioreg.h was added on branch tls-maxphys on 2017-12-03 11:37:05 +0000
 1.5.2.7 19-Jan-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1784):

share/man/man4/lm.4: revision 1.38
sys/dev/ic/nslm7x.c: revision 1.79
sys/dev/isa/wbsio.c: revision 1.30
sys/dev/isa/wbsioreg.h: revision 1.11

lm(4): Add Nuvoton NCT6797D support.
 1.5.2.6 15-Oct-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1774):

share/man/man4/lm.4: revision 1.37
sys/dev/isa/wbsio.c: revision 1.28
sys/dev/ic/nslm7x.c: revision 1.78
sys/dev/isa/wbsioreg.h: revision 1.10

Add Nuvoton NCT6799D support.
 1.5.2.5 17-Jul-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1294):

sys/dev/isa/wbsio.c: revision 1.25
sys/dev/ic/nslm7x.c: revision 1.72
sys/dev/ic/nslm7x.c: revision 1.73
sys/dev/isa/wbsioreg.h: revision 1.9

Use pmf_device_{register,deregister}().

-

Identify Nuvoton NCT6798D correctly. It seems that the bit width of NCT6796D
and newer devices' device ID is 13bit. The previous series was 12bits.
 1.5.2.4 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #927):
share/man/man4/lm.4: 1.35, 1.36
sys/dev/ic/nslm7x.c: 1.71
sys/dev/isa/wbsio.c: 1.23
sys/dev/isa/wbsioreg.h: 1.8
Add NCT6796D. Some functions of NCT6796D is extended from NCT6795D,
but this commit doesn't support them yet.
--
Add NCT6796D.
--
Remove Tn. Add serial comma.
 1.5.2.3 19-Feb-2018  snj Pull up following revision(s) (requested by yamaguchi in ticket #558):
share/man/man4/wbsio.4: 1.7-1.8
sys/dev/isa/files.isa: 1.168-1.169
sys/dev/isa/wbsio.c: 1.16-1.21
sys/dev/isa/wbsioreg.h: 1.6-1.7
Add wbsio(4) GPIO driver. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Fix NCT6779 gpio pin configuration. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Add Watchdog timer implementation to wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Add an option to enable GPIO function of wbsio. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Improve the error log message to use product name. Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
Update the manual of wbsio(4). Implemeted by s-yamaguchi@IIJ, reviewed by msaitoh@n.o.
I just commit by proxy.
--
New sentence, new line. Fix xref. Sort SEE ALSO.
--
PR/52887: HITOSHI Osada: wbsio needs sysmon_wdog.
--
Now that watchdog support has been added, make sure that a modular driver
requires the sysmon_wdog module.
 1.5.2.2 22-Nov-2017  martin Pull up following revision(s) (requested by msaitoh in ticket #374):
share/man/man4/lm.4: revision 1.33
share/man/man4/lm.4: revision 1.34
sys/dev/ic/nslm7x.c: revision 1.70
sys/dev/isa/lm_isa_common.c: revision 1.5
sys/dev/isa/lm_isa_common.c: revision 1.6
sys/dev/isa/wbsio.c: revision 1.11
sys/dev/i2c/lm_i2c.c: revision 1.3
sys/dev/isa/wbsio.c: revision 1.12
sys/dev/i2c/lm_i2c.c: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.1
sys/dev/isa/wbsio.c: revision 1.13
sys/dev/isa/wbsioreg.h: revision 1.2
sys/dev/isa/wbsio.c: revision 1.14
sys/dev/isa/wbsioreg.h: revision 1.3
sys/dev/isa/wbsio.c: revision 1.15
sys/dev/isa/wbsioreg.h: revision 1.4
sys/dev/isa/wbsioreg.h: revision 1.5
share/man/man4/wbsio.4: revision 1.4
share/man/man4/wbsio.4: revision 1.5
sys/dev/ic/nslm7xvar.h: revision 1.30
sys/dev/ic/nslm7x.c: revision 1.65
share/man/man4/wbsio.4: revision 1.6
sys/dev/ic/nslm7xvar.h: revision 1.31
sys/dev/ic/nslm7x.c: revision 1.66
sys/dev/ic/nslm7xvar.h: revision 1.32
sys/dev/ic/nslm7x.c: revision 1.67
sys/dev/ic/nslm7xvar.h: revision 1.33
sys/dev/ic/nslm7x.c: revision 1.68
sys/dev/ic/nslm7x.c: revision 1.69
Add Winbond W83627DHG-P, W83627SF, W83627UHG, W83667HGB, W83687THF, W83697UG,
Nuvoton NCT5104D, NCT610[246]D, NCT6775, NCT6779, NCT6791, NCT6792 and NCT6793.
lm(4): Add support for NCT5104D, NCT610[246]D, NCT6775F, NCT6779D and NCT679[1235]D.
wbsio(4): Add support for NCT6795D.
Add note about Nuvoton.
- Add new Nuvoton devices.
- Add CAVEATS section from OpenBSD.
Add space before left-paren
Remove superfluous Pp.
Whitespace.
Fix a bug that fan RPM wasn't printed correctly. 0xbX is not RPM but counter.
Use 0xcX.
Fix typo.
- Sprinkle static and const. No functional change.
- Print chip ID in hexadecimal instead of octal in def_match().
Use uint8_t instead of int. No functional change.
Print chip name correctly.
- WBSIO_ID_W83627DHG and newer devices have 12bit device ID. So, change sioid
from 8bit to 16bit and check with it strictly.
- s/lm_match/nslm_match/
- split {wb,lm,def}_match() to XXX_match and XXX_attach().
- Rename lm_probe with lm_match and call {wb,nslm,def}_match() at the end of
the function to check strictly.
- NCT610[246]D is different from others, so add new nct6102d_sensors[] table.
- Register offsets of vendor ID and chip id of NCT610[246]D are different
from others. When it failed reading vendor ID or chip ID, fallback to
NCT610[246]D's register offsets.
- Add debug messages.
Restore NetBSD RCS Id which was accidentally removed in rev. 1.2.
s/Id/NetBSD/. Pointed out by wiz!
 1.5.2.1 15-Nov-2017  martin file wbsioreg.h was added on branch netbsd-8 on 2017-11-22 14:56:30 +0000
 1.7.2.1 15-Mar-2018  pgoyette Synch with HEAD
 1.8.2.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9.2.2 19-Jan-2023  martin Pull up following revision(s) (requested by msaitoh in ticket #1568):

share/man/man4/lm.4: revision 1.38
sys/dev/ic/nslm7x.c: revision 1.79
sys/dev/isa/wbsio.c: revision 1.30
sys/dev/isa/wbsioreg.h: revision 1.11

lm(4): Add Nuvoton NCT6797D support.
 1.9.2.1 15-Oct-2022  martin Pull up following revision(s) (requested by msaitoh in ticket #1541):

share/man/man4/lm.4: revision 1.37
sys/dev/isa/wbsio.c: revision 1.28
sys/dev/ic/nslm7x.c: revision 1.78
sys/dev/isa/wbsioreg.h: revision 1.10

Add Nuvoton NCT6799D support.

Add NCT679[89] to the supported list.
 1.168 14-Jan-1998  cgd Various cleanups and bug fixes to the wdc/wd code:
* Fix bug in wdc that would overflow ATAPI transfer length.
* Improve wdc probe code so that 'wdc' is probed in if present
even if there are no drives attached, and so that it works
properly even if the only device is an ATAPI slave.
* bus_space-ify.
* split the ISA attachment from the wdc driver, and remove
ISA dependencies from non-ISA files.
* claim that wd and wdc are now machine-independent (probably not
completely true, but mostly so; they at least work on arm32 and
i386).
* Various other minor fixups and cleanups, some of which were pointed
out by Kazuki Sakamoto.
 1.167 12-Jan-1998  thorpej Update for config changes.
 1.166 13-Oct-1997  explorer branches: 1.166.2;
o Make usage of /dev/random dependant on
pseudo-device rnd # /dev/random and in-kernel generator
in config files.

o Add declaration to all architectures.

o Clean up copyright message in rnd.c, rnd.h, and rndpool.c to include
that this code is derived in part from Ted Tyso's linux code.
 1.165 10-Oct-1997  explorer Add hooks to insert timing info into the random system
 1.164 08-Oct-1997  thorpej Implement DIOCGDEFLABEL.
 1.163 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.162 18-Jul-1997  fvdl branches: 1.162.2;
Work around possible race condition with 2 drives on one controller
in wd_get_parms. PR 3773, from Onno van der Linden (onno@simplex.nl)
 1.161 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]

still to be done and/or decided not to be done: replace all *UNK uses in
isa code with the native names from locators.h
 1.160 24-Jun-1997  thorpej branches: 1.160.2;
foosize()'s return value is in DEV_BSIZE units; adjust the size obtained
from the disklabel accordingly.
 1.159 18-Jun-1997  pk Remove spurious line left over in previous commit.
 1.158 18-Jun-1997  pk wdsize(): only call wdopen()/wdclose() if not already open, per the
current `openmask'.
 1.157 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.156 17-Jan-1997  perry branches: 1.156.6;
Fixes to wd driver from cgd -- corrects several nasty bugs typically
associated with coming out of suspends/sleeps on laptops.
Approved by fvdl.
 1.155 27-Nov-1996  thorpej In wdattach(), when printing out info about the drive, make the output
look a little more like a SCSI disk's. This has the pleasant side-effect
of preventing the output from annoyingly extending past 80 columns.
 1.154 07-Nov-1996  mikel Fix WDDEBUG code; PR kern/1480.
 1.153 13-Oct-1996  christos backout kprintf changes
 1.152 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.151 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.150 12-May-1996  mycroft Use intr.h.
 1.149 29-Apr-1996  christos - gcc -Wall fixes
 1.148 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.147 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.146 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.145 08-Jan-1996  mycroft Make sure we disk_busy() for every transfer we start.
 1.144 07-Jan-1996  thorpej New generic disk framework. Highlights:

- New metrics handling. Metrics are now kept in the new
`struct disk'. Busy time is now stored as a timeval, and
transfer count in bytes.

- Storage for disklabels is now dynamically allocated, so that
the size of the disk structure is not machine-dependent.

- Several new functions for attaching and detaching disks, and
handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
 1.143 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.142 05-Aug-1995  mycroft Use an intermediate variable to shorten label initialization code.
Make wddump() work on more machines.
 1.141 04-Jul-1995  mycroft Make each disk and tape driver define its own read and write functions.
Deprecate rawread() and rawwrite() completely. Remove d_strategy from cdevsw to
force the abstraction barrier.
 1.140 26-Jun-1995  cgd implement new-style block device dump routine if __BDEVSW_DUMP_OLD_TYPE
not defined, otherwise use an "not implemented" stub.
 1.139 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.138 15-Apr-1995  mycroft Don't boundary check I/O to the `raw' partition.
 1.137 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.136 01-Apr-1995  mycroft Add a missing unlock.
 1.135 29-Mar-1995  mycroft Revamp the locking mechanism slightly. Update some outdated comments, and add
a few new ones.
 1.134 25-Mar-1995  mycroft Remove the write protect check altogether, and rely on the drive to do it.
 1.133 23-Mar-1995  mycroft Check for read-only media in open(), not write().
 1.132 23-Mar-1995  mycroft Allow DIOCWDINFO even if label is not `writable'.
 1.131 27-Feb-1995  cgd use wdc_softc in wdccd, rather than wd_softc; from chuck cranor. (pr 828)
 1.130 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.129 13-Jan-1995  mycroft (Almost) allow sector sizes other than 512 bytes. Reduce some expensive operations.
 1.128 13-Jan-1995  mycroft Always boundary check I/O.
 1.127 13-Jan-1995  mycroft Fix another bug in the DMA code.
 1.126 13-Jan-1995  mycroft Minor rearrangement.
 1.125 13-Jan-1995  mycroft Change the way sc_skip is used. Fix a bug in the (incomplete) DMA code. Add a
new sc_blkno (which will be useful later).
 1.124 07-Jan-1995  mycroft Fix a race condition between normal I/O and wd_get_parms().
 1.123 03-Jan-1995  mycroft Add interrupt sharing types.
 1.122 14-Dec-1994  mycroft Remove dkbad.h.
 1.121 01-Dec-1994  mycroft Ignore ERR during diagnostics.
 1.120 30-Nov-1994  mycroft Clear the controller active flag after a timeout.
 1.119 23-Nov-1994  mycroft Officially credit Onno.
 1.118 23-Nov-1994  mycroft There's no point in bothering to unlock what we didn't lock.
 1.117 23-Nov-1994  mycroft Fix an outdated comment.
 1.116 23-Nov-1994  mycroft Use logical block addressing if available. Be a little more careful about
maintaining timeouts. Clean up wddump() a bit.
 1.115 22-Nov-1994  mycroft Implement 32-bit reads and writes, but for now assume 16-bit mode.
 1.114 22-Nov-1994  mycroft Add a missing newline in some error messages.
 1.113 22-Nov-1994  mycroft Implement EIDE multi-sector PIO and DMA modes, based on code from Onno van
der Linden. Also, various structural cleanup, and fix two bogons that crept
in, and remove all of the old clustering nonsense.
 1.112 22-Nov-1994  mycroft Minor fix to debugging code.
 1.111 22-Nov-1994  mycroft Fudge a couple more fields for ancient disks.
 1.110 22-Nov-1994  mycroft Change some constant names, etc., to better match the ATA spec.
 1.109 22-Nov-1994  mycroft Add still more locking.
 1.108 20-Nov-1994  mycroft Add some missing locking, and some general cleanup.
 1.107 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.106 04-Nov-1994  mycroft Fix stupid bug in last change.
 1.105 04-Nov-1994  mycroft Add a simplified version of wdcommand() that can be used in some cases.
Avoid needing a wd_softc inside wdprobe().
 1.104 04-Nov-1994  mycroft No longer needs icu.h.
 1.103 03-Nov-1994  mycroft *intr() arg does not need to be void*.
 1.102 03-Nov-1994  mycroft Use indirect config for subdevices, and add dkdrivers where missing.
 1.101 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.100 27-Oct-1994  cgd new RCS ID format.
 1.99 20-Oct-1994  mycroft Be careful not to stack multiple timeouts.
 1.98 20-Oct-1994  mycroft Remove the local timeout mechanism, and just use explicit timeout()/untimeout()
calls.
 1.97 20-Oct-1994  mycroft Always set d_secsize to 512 for now.
 1.96 20-Oct-1994  mycroft Don't switch to single-sector mode just because we got a corrected error.
 1.95 20-Oct-1994  mycroft Rearrange wdcstart() in a more logical fashion, and eliminate many redundant
calculations. Also, speed up bad block searching a little.
 1.94 20-Oct-1994  mycroft openpart -> openmask
 1.93 20-Oct-1994  mycroft Various changes:
* Add a dkdevice; move sc_*openpart, sc_label, and sc_cpulabel into it.
* Turn sc_wlabel into a flag, and don't set it automatically in DIOCWLABEL.
* If there is no label, disallow all I/O except to the raw partition.
* Don't allow I/O to `unused' partitions.
* Beginnings of support for block sizes other than 512 bytes.
Other minor changes.
 1.92 14-Oct-1994  cgd move arch dependence to archs. clean up a bit. deal with weird MAXPARTITONS.
 1.91 09-Oct-1994  mycroft Remove unneeded #includes.
 1.90 07-Oct-1994  mycroft Don't poll the BUSY bit until the SDH register is set.
 1.89 12-Sep-1994  mycroft Turn off the delay debugging messages again.
 1.88 15-Aug-1994  mycroft Eliminate struct pte and struct pde.
 1.87 15-Aug-1994  mycroft Don't use altsts. Sigh.
 1.86 26-Jul-1994  mycroft Normalize label handling.
 1.85 21-Jul-1994  mycroft Return EINVAL if the requested transfer size is weird.
 1.84 16-Jun-1994  mycroft branches: 1.84.2;
b_un.b_addr -> b_data
 1.83 09-Jun-1994  pk Set `uio_procp' field in case we ever need it.
 1.82 05-May-1994  mycroft Remove now-bogus casts.
 1.81 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.80 25-Apr-1994  mycroft Fix uninitialized pointer, pointed out by Michael VanLoon.
 1.79 24-Apr-1994  mycroft Don't need isa.h.
 1.78 20-Apr-1994  mycroft Use TAILQ_*() to maintain the drive activation queues.
 1.77 09-Apr-1994  mycroft Don't print a duplicate message about stray interrupts.
 1.76 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.75 30-Mar-1994  mycroft Turn off the timeout debugging info by default.
 1.74 29-Mar-1994  mycroft Updates for new autoconfig.
 1.73 12-Mar-1994  mycroft Prefix the busy-wait messages with `ignore this:' so people stop reporting
it as a bug.
 1.72 12-Mar-1994  mycroft Fix problem with reading the disk label if it's not at the beginning of the
disk.
 1.71 12-Mar-1994  mycroft Remove backward compatibility hacks for config(8), as they are no longer
useful.
 1.70 12-Mar-1994  mycroft Update to match config(8).
 1.69 11-Mar-1994  mycroft Various:
Put WDF_ERROR in the wdc_softc, to avoid gratuitously forcing non-active drives
into single-sector mode on the next transfer. Arrange to wait for an interrupt
after wdsetctlr(); this avoids long busy-wait delays, and gets rid of the
`extra interrupt' messages (except for one immediately after autoconfig on some
machines). Replace some uses of wdsetctlr() with simply lowering wd->sc_state;
no point in forcing this immediately. Allow control operations to time out.
Enable the warnings for long busy-wait delays by default. Some other minor
things not worth mentioning.
 1.68 10-Mar-1994  mycroft Add a heuristic for detecting old config(8)s. This is very temporary.
 1.67 10-Mar-1994  mycroft Now that the disk probe routines are actually called, they need to return
something.
 1.66 10-Mar-1994  mycroft More updates for new config.
 1.65 10-Mar-1994  mycroft Update for new config.
 1.64 10-Mar-1994  mycroft Cleanup to fit standard coding conventions, and *many* bugs fixed.
 1.63 07-Mar-1994  mycroft Some changes inspired by Bruce Evans's driver:
Consolidate error reporting in one function. Actually use the dk_status and
dk_error fields, and pass around only the error bit to avoid lots of unneeded
assignments and tests. No functional differences.
 1.62 07-Mar-1994  mycroft Remove DKFL_QUIET.
 1.61 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.60 05-Mar-1994  mycroft Move the drive select and various other things into wdcommand(), to avoid
duplicating code.
 1.59 04-Mar-1994  mycroft Make sure we clear the interrupt when necessary. Why this isn't needed on
my hardware is a mystery.
 1.58 04-Mar-1994  mycroft Add another missing splx().
 1.57 04-Mar-1994  mycroft Remember to splx() on some error conditions.
 1.56 04-Mar-1994  mycroft Start the timeout loop *after* we've decided there is a disk there.
 1.55 04-Mar-1994  mycroft De-ANSIfy. Move the timeout counter into struct disk. Remove unneeded args
to wd[gs]etctlr(). Other minor changes.
 1.54 03-Mar-1994  mycroft Watch `seek complete' bit per IBM documentation. Clean up wdioctl(). Other
minor cleanup.
 1.53 02-Mar-1994  mycroft Be more careful about clearing the controller and drive active flags.
 1.52 02-Mar-1994  mycroft Don't busy-wait for read or write completion.
 1.51 02-Mar-1994  mycroft Make wdc_wait() do an implicit wait_for_unbusy(). Pass structure pointers
rahter than unit numbers where appropriate. Fix conflict if two drives have
I/O pending at the same time. Add some more sanity checks. Some other minor
cleanup.
 1.50 26-Feb-1994  mycroft Get the residual count right.
 1.49 26-Feb-1994  mycroft Clean up busy-wait code a little, and we need a special disksort() to skip
over bufs in a combined transfer.
 1.48 26-Feb-1994  mycroft Fix bug from 1.43 correctly.
 1.47 26-Feb-1994  mycroft Fix typo.
 1.46 26-Feb-1994  mycroft Various cleanup, and fix last night's bug.
 1.45 26-Feb-1994  mycroft Fix typo.
 1.44 26-Feb-1994  mycroft Some more stylistic cleanup.
 1.43 25-Feb-1994  mycroft Fix an obvious bug that could stall the queue.
 1.42 25-Feb-1994  mycroft Remove some redundant code.
 1.41 25-Feb-1994  mycroft Increase polling delay.
 1.40 25-Feb-1994  mycroft Generalize busy-wait loops.
 1.39 25-Feb-1994  mycroft Don't bother #ifdefing things that are needed and always enabled.
 1.38 25-Feb-1994  mycroft Don't reimplement disksort().
 1.37 25-Feb-1994  mycroft `We are the KNF. You will be assimilated.'
 1.36 10-Feb-1994  mycroft Back pointers are not useful for disksort().
 1.35 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.34 06-Feb-1994  mycroft Remove another use of b_actl.
 1.33 06-Feb-1994  mycroft Use b_actf, not av_forw.
 1.32 03-Jan-1994  mycroft Inline all the [lr]cr[023]() `functions' in cpufunc.h.
 1.31 03-Jan-1994  mycroft Inline all the [lr]cr[023]() `functions' in cpufunc.h.
 1.30 24-Dec-1993  ws Correct dumping to WD (was destroyed by MACHINE_NONCONTIG code)
 1.29 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.28 16-Dec-1993  mycroft Eliminate reference to Maxmem.
 1.27 13-Dec-1993  cgd from Soeren Schmidt <sos@login.dkuug.dk>:
Basically it does a timeout on lost interrupts, starting the operation
again and logging and error message on the console.
additionally fixes some of the (newer ending) while loops
(that made it work with two IDE disks !)
 1.26 01-Aug-1993  mycroft branches: 1.26.2;
Add RCS identifiers (this time on the correct side of the branch), and
incorporate recent changes in netbsd-0-9 branch.
 1.25 28-Jul-1993  cgd incorporate changes from 0-9-base to 0-9-ALPHA
 1.24 08-Jul-1993  deraadt branches: 1.24.2;
documentation error
 1.23 07-Jul-1993  deraadt added a timeout debugging mode to wd.c so that people can see how slow
their controllers really are. Look for the WDCNDELAY_DEBUG definition.
 1.22 07-Jul-1993  deraadt ok, 5 second command timeouts..
 1.21 06-Jul-1993  deraadt number of changes:
1. controller reset code moved into one function, called from more places now.
2. more places now do timeouts. TIPCAT code turned on.
3. blew away the unused WDOPENLOCK test code.
4. delay is now done using WDCNDELAY repetitions of DELAY(25). Up to 2.5 second
pause accepted from controller (some controllers have some commands that are
actually this slow)
5. some of the old timeout code was really whacked.
 1.20 05-Jul-1993  deraadt added a missing {/} pair that barsoom seems to have taken out, but
which the standard 386bsd 0.1 driver did have. This is for a piece of
code in the bad block handling. found/fixed by hpeyerl.
 1.19 05-Jul-1993  deraadt all timeout code now calls DELAY() so the timeout delays are the same
length on all processors. Where possible, the controller is reset if it
times out.
 1.18 05-Jul-1993  deraadt increased the timeout inside wdcommand(). Some controllers impliment some
commands very slowly.
 1.17 18-Jun-1993  cgd fix the divide-by-zero problem w/old disks. this patch is ws's "fault."
 1.16 28-May-1993  deraadt 1. It is now possible to build a kernel that does not have a pc0 device driver.
2. "press any key to reboot" reads the key from the console.
3. wddump() still needs a non-blocking getc() routine (or flush)
 1.15 22-May-1993  cgd add rcsids to everything and clean up headers
 1.14 20-May-1993  deraadt First cut at cpu independent disklabels.
There will be niggly little details no doubt..
 1.13 10-May-1993  deraadt This patch allows the wd device driver to tell how big the disks are on
WD1007-derived controllers. In this example, wdc0 is a WD1007-clone,
and wdc1 is a WD1003-clone. WD1007 controllers are generally ESDI
and IDE controllers.
wdc0 at 0x1f0-0x1f7 irq 14 on isa
wd0 at wdc0 targ 0: 322MB 1224 cyl, 15 head, 36 sec <disktype>
wdc1 at 0x170-0x17f irq 7 on isa
wd2 at wdc1 targ 0: (unknown size) <disktype>
 1.12 09-May-1993  deraadt i thought i deleted this line before!
 1.11 04-May-1993  deraadt support for making dev->id_alive be set, this is for iostat to
find disk devices. wee bit of a kludge. sub-device attach()
routines must now return 1 for successful attach(), 0 otherwise.
Other bsd's do this too..
 1.10 18-Apr-1993  deraadt slight code quality improvement. not related to the bug with very
old controllers or disks! :-)
 1.9 15-Apr-1993  deraadt Once more: some changes to the ioconf.c structure. It will now handle
devices hanging off controllers, any kind of controller.
A device on isa0 is called at probe(self), then attach(self)
A controller on isa0 is called at probe(self), then all it's children with
defined unit numbers are initialized by calling attach(subdev); next all
subdevices with unit ? are initialized by calling attach(sundev).
Almost all device entry points is now like the vax/sun model (intr being
the weird one)
 1.8 15-Apr-1993  deraadt wd driver would fail on calling wdgetctlr() for older drives and
controllers. New behaviour is that if the standard method fails, try
to recalibrate the drive. Success means the drive exists. patch by
hpeyerl@novatel.cuc.ab.ca (who owns several of these historical
artifacts)
 1.7 12-Apr-1993  deraadt new scsi subsystem.
changes also in config/mkioconf.c & sys/scsi/*
 1.6 09-Apr-1993  cgd have probe return size of io space on successful return, rather
than simply 1.
 1.5 08-Apr-1993  deraadt dmesg output at boottime now tries to print out information as
soon as it is available. The output looks much more like Sunos.
 1.4 06-Apr-1993  deraadt ripped out a message
 1.3 06-Apr-1993  deraadt Mod-barsoom wd additions. config program + kernel config files changed too.
fd support had to change slightly too.
 1.2 21-Mar-1993  cgd after 0.2.2 "stable" patches applied
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.24.2.3 28-Jul-1993  deraadt wd.c: fixes 1 drive systems
fd.c: improves reliability
changes from wolfgang
 1.24.2.2 22-Jul-1993  cgd fix comment for previous commit...
 1.24.2.1 20-Jul-1993  cgd change WDCNDELAY to 400000 -- delay -> 10s, at theo's request
 1.26.2.5 06-Feb-1994  mycroft Use b_actf, not av_forw.
 1.26.2.4 13-Dec-1993  cgd partial (hopefully correct) update from trunk
 1.26.2.3 27-Oct-1993  mycroft Minor cleanup.
 1.26.2.2 24-Sep-1993  mycroft clock.c: Finish conversion. Make rtcput() work if VRT bit not set. Speed up
time conversion in delay().
fd.c: Minor changes to autoconfig. Use dv_parent rather than storing another
pointer to the fdc_softc in each fd_softc. Change disk label stuff for our
kernel.
icu.s: Make splx() and splnone() return previous cpl for now.
isa.c: Minor autoconfig changes.
isa.h: rtcin() is now nvram() and is declare in nvram.h. Make isaphysmem a
caddr_t.
pccons.c: XXXX: Maybe we should insist they open /dev/io now.
timerreg.h: #define TIMER_NPORTS.
wd.c: Delete unused wdnoreloc() and wddospart(), and use remaining two bits in
unit number. struct disk --> struct wd_softc. struct board --> struct
wdc_softc. Still needs much work.
 1.26.2.1 14-Sep-1993  mycroft New i386 code.
 1.84.2.7 11-Oct-1994  mycroft Update from trunk.
 1.84.2.6 07-Oct-1994  mycroft Update from trunk.
 1.84.2.5 12-Sep-1994  cgd from trunk.
 1.84.2.4 15-Aug-1994  mycroft update from trunk
 1.84.2.3 15-Aug-1994  mycroft update from trunk
 1.84.2.2 26-Jul-1994  cgd update from trunk.
 1.84.2.1 22-Jul-1994  cgd from trunk.
 1.156.6.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.160.2.3 17-Jul-1997  bouyer Use "locator.h".
 1.160.2.2 17-Jul-1997  bouyer Update from trunck.
 1.160.2.1 01-Jul-1997  bouyer Add the ide atapi driver from my original atapi driver, ported
to scsipi.
 1.162.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.162.2.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.166.2.3 09-May-1998  mycroft Pull up patch from mycroft.
 1.166.2.2 08-May-1998  mycroft Pull up patch from mycroft.
 1.166.2.1 05-May-1998  mycroft Pull up patch from bouyer.
 1.23 30-Mar-1996  mycroft This version is deprecated.
 1.22 12-Aug-1995  mycroft minphys() functions really should return void.
 1.21 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.20 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.19 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.18 27-Oct-1994  cgd new RCS ID format.
 1.17 16-Jun-1994  mycroft b_un.b_addr -> b_data
 1.16 25-Mar-1994  mycroft Put controller target in scsi_switch.
 1.15 12-Mar-1994  mycroft Fix bug in last change.
 1.14 12-Mar-1994  mycroft Update to match config(8).
 1.13 10-Mar-1994  mycroft Updates to match config(8).
 1.12 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.11 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.10 03-Jan-1994  mycroft Use KERNBASE, not 0xfe000000.
 1.9 20-Dec-1993  davidb Fixed bug where with two or more SCSI controllers of the same type, you
could not have devices at the same ID on each bus.
This patch not directly applicable to magnum branch, which is using Julian's
new SCSI code.
 1.8 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.7 10-Jun-1993  deraadt sigh. one day i'll finish this driver, meanwhile, one more fix..
 1.6 22-May-1993  cgd add rcsids to everything and clean up headers
 1.5 22-May-1993  deraadt fixed typo
 1.4 04-May-1993  deraadt support for making dev->id_alive be set, this is for iostat to
find disk devices. wee bit of a kludge. sub-device attach()
routines must now return 1 for successful attach(), 0 otherwise.
Other bsd's do this too..
 1.3 12-Apr-1993  deraadt new scsi subsystem.
changes also in config/mkioconf.c & sys/scsi/*
 1.2 06-Apr-1993  deraadt wd7000 device driver, put in IO_WDS entry in isa.h. You can now build a
kernel with it. Hope your dma works better than mine <grr>
 1.1 06-Apr-1993  deraadt added: incomplete wd7000-asc scsi controller device driver.
 1.12 14-Jan-1998  cgd Various cleanups and bug fixes to the wdc/wd code:
* Fix bug in wdc that would overflow ATAPI transfer length.
* Improve wdc probe code so that 'wdc' is probed in if present
even if there are no drives attached, and so that it works
properly even if the only device is an ATAPI slave.
* bus_space-ify.
* split the ISA attachment from the wdc driver, and remove
ISA dependencies from non-ISA files.
* claim that wd and wdc are now machine-independent (probably not
completely true, but mostly so; they at least work on arm32 and
i386).
* Various other minor fixups and cleanups, some of which were pointed
out by Kazuki Sakamoto.
 1.11 12-Jan-1998  thorpej Update for config changes.
 1.10 07-Jan-1998  mikel fix some typos in error messages & comments
 1.9 24-Dec-1997  fvdl Add extra delay after wdcreset() call in wdcprobe. Needed by at least
one controller, where registers otherwise will still be inaccesible
(even though the busy bit has been reset), making the probe fail.
 1.8 05-Nov-1997  bouyer Various bug fixes for atapi part:
- clean up debug code
- Don't check ATAPI signature when probing ATA drives, ATAPI devices were
detected before
- Reset controller after disks probes. The probe, with some combinations of
ATA/ATAPI device keep it in a mostly working, but strange state (with busy
led on)
- The WDCF_IRQ_WAIT flag is now cleared by wdc_ata_intr and wdc_atapi_intr
when appropriate (helps recover from failure conditions)
- In wdcunwedge, send ATAPI_SOFT_RESET to non-ata drives
(helps recover from failure conditions)
- in wdctimeout be a bit more verbose when we missed an interrupt
- Always Increment xfer->c_skip where it should be
- Set the ITSDONE flag when a polled command completed.
 1.7 27-Oct-1997  bouyer Changes to the probe and attach routine:
- at end of attach, explicitely select an existing drive. This fixes hangs
some users reported (such as the one reported in port-i386/4247).
- Some atapi cdrom drives (e.g. Nec 24x) don't enables their registers before
a controller reset is issued. The controller probe routine is changed as
follow: issue a controller reset. If fail, test atapi signature on slave.
If fail, wait 5s and retry a reset. If the second reset fail, return(0).
If the first reset succeed, test presence of a master drive:
atapi signature, and if this fail RO/RW registers test. If no master, test
atapi signature on slave. If no slave, return 0.
 1.6 16-Oct-1997  matt branches: 1.6.2;
Fix a misspelling of slave in a comment.
 1.5 24-Sep-1997  bouyer Return the rigth value in the interrupt handler. This change the semantic
of wdc_atapi_intr, so we check for ITSDONE rather than the return value for
a pooled command.
 1.4 03-Sep-1997  bouyer Add a map to wdc_softc to track the already known devices to prevent them to
be probed several times. This fixes the "ATAPI CD probed as wd drive" problem.
Thanks to Geoff Wing <mason@primenet.com.au> for testing this on his hardware.
 1.3 28-Aug-1997  bouyer Change an ATAPI_DEBUG2->ATAPI_DEBUG. This debug message is needed when
looking what's the autoconfig do on strange harware, and ATAPI_DEBUG2 is
for debuging data transfers (and is really verbose once the machine has booted
from an IDE disk).
 1.2 27-Aug-1997  bouyer branches: 1.2.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.1 01-Jul-1997  bouyer branches: 1.1.2;
file wdc.c was initially added on branch bouyer-scsipi.
 1.1.2.2 18-Jul-1997  bouyer Update from trunck:
fvdl: "Work around possible race condition with 2 drives on one controller
in wd_get_parms. PR 3773, from Onno van der Linden (onno@simplex.nl)"
 1.1.2.1 01-Jul-1997  bouyer Add the ide atapi driver from my original atapi driver, ported
to scsipi.
 1.2.2.5 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.4 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 27-Aug-1997  thorpej file wdc.c was added on branch marc-pcmcia on 1997-08-27 23:32:12 +0000
 1.6.2.5 08-May-1998  mycroft Pull up patch from mycroft.
 1.6.2.4 05-May-1998  mycroft Pull up patch from bouyer.
 1.6.2.3 24-Dec-1997  perry pull up emergency patch from trunk (fvdl)
 1.6.2.2 06-Nov-1997  mellon Pull rev 1.8 up from trunk (bouyer)
 1.6.2.1 27-Oct-1997  mellon Pull rev 1.7 up from trunk (bouyer)
 1.62 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.61 20-Oct-2017  jdolecek move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)

on topic of PR kern/52606
 1.60 07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.59 31-Jul-2012  bouyer branches: 1.59.2; 1.59.28;
Apply back changes that were reverted on Jul 24 and Jul 26 (general ata/wdc
cleanup and SATA PMP support), now that I'm back to fix the fallouts.
 1.58 26-Jul-2012  jakllsch Revert, with intention of restoring in a less invasive way, the SATA Port
Multiplier code.

ok christos@
 1.57 02-Jul-2012  bouyer Add sata Port MultiPlier (PMP) support to the ata bus layer,
as described in
http://mail-index.netbsd.org/tech-kern/2012/06/23/msg013442.html
PMP support in integrated to the atabus layer.
struct ata_channel's ch_drive[] is not dynamically allocated, and ch_ndrive
(renamed to ch_ndrives) closely reflects the size of the ch_drive[] array.
Add helper functions atabus_alloc_drives() and atabus_free_drives()
to manage ch_drive[]/ch_ndrives.
Add wdc_maxdrives to struct wdc_softc so that bus front-end can specify
how much drive they really support (master/slave or single).
ata_reset_drive() callback gains a uint32_t *sigp argument which,
when not NULL, will contain the signature of the device being reset.
While there, some cosmetic changes:
- added a drive_type enum to ata_drive_datas, and stop encoding the
probed drive type in drive_flags (we were out of drive flags anyway).
- rename DRIVE_ATAPIST to DRIVE_ATAPIDSCW to better reflect what this
really is
- remove ata_channel->ata_drives, it's redundant with the pointer in
ata_drive_datas
- factor out the interpretation of SATA signatures in sata_interpet_sig()

propagate these changes to the ATA HBA drivers, and add support for PMP
to ahcisata(4) and siisata(4).

Thanks to:
- Protocase (http://www.protocase.com/) which provided a system
with lots of controllers, SATA PMP and drive slots
- Conservation Genomics Laboratory, Department of Biology, New Mexico State
University for hosting the above system
- Brook Milligan, who set up remote access and has been very responsive
when SATA cable move was needed
 1.56 02-Apr-2009  dyoung branches: 1.56.12;
During shutdown, detach devices in an orderly fashion.

Call the detach routine for every device in the device tree, starting
with the leaves and moving toward the root, expecting that each
(pseudo-)device driver will use the opportunity to gracefully commit
outstandings transactions to the underlying (pseudo-)device and to
relinquish control of the hardware to the system BIOS.

Detaching devices is not suitable for every shutdown: in an emergency,
or if the system state is inconsistent, we should resort to a fast,
simple shutdown that uses only the pmf(9) shutdown hooks and the
(deprecated) shutdownhooks. For now, if the flag RB_NOSYNC is set in
boothowto, opt for the fast, simple shutdown.

Add a device flag, DVF_DETACH_SHUTDOWN, that indicates by its presence
that it is safe to detach a device during shutdown. Introduce macros
CFATTACH_DECL3() and CFATTACH_DECL3_NEW() for creating autoconf
attachments with default device flags. Add DVF_DETACH_SHUTDOWN
to configuration attachments for atabus(4), atw(4) at cardbus(4),
cardbus(4), cardslot(4), com(4) at isa(4), elanpar(4), elanpex(4),
elansc(4), gpio(4), npx(4) at isa(4), nsphyter(4), pci(4), pcib(4),
pcmcia(4), ppb(4), sip(4), wd(4), and wdc(4) at isa(4).

Add a device-detachment "reason" flag, DETACH_SHUTDOWN, that tells the
autoconf code and a device driver that the reason for detachment is
system shutdown.

Add a sysctl, kern.detachall, that tells the system to try to detach
every device at shutdown, regardless of any device's DVF_DETACH_SHUTDOWN
flag. The default for kern.detachall is 0. SET IT TO 1, PLEASE, TO
HELP TEST AND DEBUG DEVICE DETACHMENT AT SHUTDOWN.

This is a work in progress. In future work, I aim to treat
pseudo-devices more thoroughly, and to gracefully tear down a stack of
(pseudo-)disk drivers and filesystems, including cgd(4), vnd(4), and
raid(4) instances at shutdown.

Also commit some changes that are not easily untangled from the rest:

(1) begin to simplify device_t locking: rename struct pmf_private to
device_lock, and incorporate device_lock into struct device.

(2) #include <sys/device.h> in sys/pmf.h in order to get some
definitions that it needs. Stop unnecessarily #including <sys/device.h>
in sys/arch/x86/include/pic.h to keep the amd64, xen, and i386 releases
building.
 1.55 28-Apr-2008  martin branches: 1.55.8; 1.55.14;
Remove clause 3 and 4 from TNF licenses
 1.54 18-Mar-2008  cube branches: 1.54.2; 1.54.4;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.53 10-Jan-2008  dyoung branches: 1.53.2; 1.53.6;
Let us detach atabus* from wdc*, and wdc* from isa*.

Use device_t, device_private().
 1.52 19-Oct-2007  ad branches: 1.52.2; 1.52.8;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.51 16-Nov-2006  christos branches: 1.51.8; 1.51.22; 1.51.24; 1.51.28;
__unused removal on arguments; approved by core.
 1.50 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.49 29-Mar-2006  thorpej branches: 1.49.8; 1.49.10;
Use device_cfdata().
 1.48 16-Jan-2006  bouyer branches: 1.48.2; 1.48.4; 1.48.6; 1.48.8; 1.48.10;
properly use ata_channel->ch_ndrive:
- initialize it properly in the bus front-ends (all 2, exept in wdc_pcmcia.c
for the "Sandisk CompactFlash Card" where it's set to 1)
- remplace hardcoded '2' by ata_channel->ch_ndrive in MI IDE drivers.

From Christos Zoulas in kern/32501.
 1.47 11-Dec-2005  christos branches: 1.47.2;
merge ktrace-lwp.
 1.46 14-Sep-2004  drochner branches: 1.46.12;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.45 20-Aug-2004  thorpej Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
 1.44 19-Aug-2004  thorpej Use ANSI function decls and "static".
 1.43 16-Aug-2004  mycroft wdc_init_shadow_regs() must now be called after ch_wdc is filled in, or we get
a null pointer dereference.
 1.42 14-Aug-2004  thorpej - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
ata_channel. Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
maximum number of drives that can be present on the channel. For now,
this is always 2. Add an ATA_MAXDRIVES constant that places an upper
limit on this value, also currently 2.
 1.41 25-May-2004  thorpej Add the notion of "shadow registers" to the wdc driver. These shadow
registers are registers that overlap with others on many controllers, but
which may actually be distinct on some controllers. Right now, the two
shadows are:

- wd_status (usually overlaps wd_command)
- wd_features (usually overlaps wd_error)

Add a new helper function, wdc_init_shadow_regs(), used to initialize
the shadow register handles on controllers where they do actually overlap.

Partially from Jordan Rhody @ Wasabi Systems, Inc.
 1.40 03-Jan-2004  thorpej More wdc_channel structure member namespace cleanup:
- channel -> ch_channel
- wdc -> ch_wdc
 1.39 03-Jan-2004  thorpej Rename "struct channel_softc" to "struct wdc_channel".
 1.38 01-Jan-2004  thorpej Rename:
- wdc_xfer to ata_xfer
- channel_queue to ata_queue
and move them to <dev/ata/atavar.h> so they can be used by non-wdc ATA
controllers. Clean up the member names of these structures while at it.
 1.37 27-Nov-2003  fvdl There are some cards that map the ATA control and IDE DMA registers
in a different fashion. Individually, they have the same functionality,
but their layout is different. An example of such a chipset is
the Promise 203xx.

To be able to deal with this, transform the cmd and dma bus_space handles
into an array of handles, each seperately created with bus_space_subregion.
The code generated by using the extra indirection shouldn't change much,
since the extra indirection is negated by having the offset calculation
already done in bus_space_subregion. E.g.

bus_space_write_4(tag, handle, offset, value)

becomes

bus_space_write_4(tag, handles[offset], 0, value)

Reviewed by Manuel Bouyer. Tested on wdc_isa, wdc_pcmcia, viaide, piixide (i386)
and on cmdide (sparc64).
 1.36 08-Oct-2003  bouyer Make the ATA mid-layer appears as atabus, as proposed in
http://mail-index.netbsd.org/tech-kern/2003/09/25/0006.html
This adds a device (atabus) between IDE controllers and wd or atapibus, to
have each ATA channel show up in the device tree. Later there will be atabus
devices in /dev, so that we can do IOCTL on them.
Each atabus has its own kernel thread, to handle operations that needs polling,
e.g. reset and others.

Device probing on each bus it defered to the atabus thread creation.
This allows to do the reset and basic device probes in parallel, which reduce
boot time on systems with several pciide controllers.
 1.35 25-Sep-2003  mycroft Hide the use of config_interrupts() in one place.
 1.34 23-Sep-2003  mycroft Fix more probe delay and/or failure problems:
1) Don't wait for DRQ on an IDENTIFY command -- if it's not set when we see
BSY clear, abort the command and ignore the drive. (Do this by testing
for DRQ in the read/write cases in __wdccommand_intr().)
2) Don't wait for DRQ to deassert when we finish an IDENTIFY (or any other
non-block command that reads data) -- we don't do this for block I/O, and
empirically it doesn't clear on my CF cards at all, causing a pointless 1s
delay.
3) Add comments to some of the delay()s, and add missing ones in wdcreset()
and the WDCC_RECAL in the so-called "pre-ATA" probe.
4) Slightly simplify the reset sequence -- we were doing an extra I/O.
5) Modify the register writability test to make sure that registers are not
overlapped -- this can happen in some weird cases with a missing device 1.
6) Check the error register value after the reset -- if it's not 01h or 81h,
as appropriate (see ATA spec), punt.
Tested with a number of ATA-only, ATAPI-only, mixed ATA-ATAPI, CF, and IDE
disk configurations.

Also remove the SINGLE_DRIVE nonsense again.
 1.33 21-Sep-2003  bouyer Since we can't detect ghost drives in the wdc back-end, resurect
WDC_CAPABILITY_SINGLE_DRIVE.
 1.32 19-Sep-2003  mycroft 1) Use config_interrupts() to attach IDE and ATAPI drives. This eliminates
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
(it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
*_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
drives more quickly.
 1.31 09-May-2003  fvdl branches: 1.31.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.30 22-Mar-2003  matt No reason to malloc channel_queue, put it in the softc instead. Clean up
a few other things while here.
 1.29 03-Mar-2003  mycroft The DMA support here never worked, so yank it out.
 1.28 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.27 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.26 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.25 19-Apr-2002  gmcgarry Set ndrq to zero if no drq is specified.
 1.24 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.23 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.22 13-Nov-2001  lukem add RCSID
 1.21 07-Jun-2001  leo branches: 1.21.2;
Make the WDC_{ATA|ATAPI}_NOSTREAM flags settable through configuration
options. Needed on the Atari Milan.
 1.20 11-Mar-2001  takemura Add configration flag 0x02 to set WDC_CAPABILITY_SINGLE_DRIVE.
 1.19 02-Apr-2000  itojun branches: 1.19.6;
sync with ata driver change (dma_start args).
 1.18 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.17 08-Feb-2000  thorpej Cast bus_size_t to u_long for printing.
 1.16 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.15 19-May-1999  bouyer branches: 1.15.2;
32 bits I/O ocasionally fails on some hardware, so the test succeed but
the kernel can get a 'protection fault trap' later. Enable the 32 bits I/O
test conditionally on a config flag, disabled by default (problem
reported by kurt.schreiner@uni-mainz.de).
 1.14 11-Apr-1999  bouyer Fix probe code for IDE devices:
- Don't rely on ATA signature: some ide controllers seems to not transmit it
properly (SIMIDE on arm32 machines). Instead, when we guess a drive is here
after reset, just mark it as ATA and OLD is it's not ATAPI.
- at attach time, use IDENTIFY to eliminate ghost from the probe. If the
drive had the old flag and IDENTIFY failed, issue a WDCC_RECAL command
to detect a pre-ATA disk. If IDENTIFY succeded, remove the OLD flag,
it's obviously not a pre-ATA disk.
- add a new controller flag, WDC_CAPABILITY_PREATA, used to shorcut parts
of the probe (not necessary, but makes the probe/attach faster). This is
only set by the ISA front-end, all other controllers supported can't have
pre-ATA drives attached.
The mechanism used are more or less the same as before, they have just been
reordered. Should solve port-arm32/7324 (waiting for feedback).
 1.13 22-Feb-1999  mycroft branches: 1.13.2;
Use DMAMODE_DEMAND.
 1.12 03-Dec-1998  bouyer Rename pio_mode, etc ... to PIO_cap, etc ... for consistency with the
ata_drive_datas struct. Suggested by Soren S. Jorvan.
 1.11 21-Nov-1998  drochner in wdc_softc: access the per-channel data via a pointer array instead of
an array of fixed-sized channel_softc elements. This way IDE controllers
which more than 1 channel (pciide) can extend the channel data easily
for private needs.
To avoid the double dereference at runtime, change the argument of
wdcstart() to the channel data pointer instead of the array index.
 1.10 12-Oct-1998  bouyer Merge bouyer-ide
 1.9 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.8 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.7 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.6 13-Mar-1998  cgd branches: 1.6.2;
don't forget to set dma_arg, when using DMA functions. also, minor
spacing bogon cleanup. Pointed out by Kazuki Sakamoto in PR 5157.
 1.5 27-Jan-1998  drochner I'm not responsible for this address window splitting hack, but I fix it
anyway.
 1.4 23-Jan-1998  mycroft Print a newline in wdc_isa_attach().
 1.3 22-Jan-1998  mycroft Half the include files are unnecessary.
 1.2 17-Jan-1998  cgd Put each of two labels one line to early. That could cause a panic,
if the wdc space couldn't be mapped. Pointed out by fvdl@netbsd.org.
 1.1 14-Jan-1998  cgd Various cleanups and bug fixes to the wdc/wd code:
* Fix bug in wdc that would overflow ATAPI transfer length.
* Improve wdc probe code so that 'wdc' is probed in if present
even if there are no drives attached, and so that it works
properly even if the only device is an ATAPI slave.
* bus_space-ify.
* split the ISA attachment from the wdc driver, and remove
ISA dependencies from non-ISA files.
* claim that wd and wdc are now machine-independent (probably not
completely true, but mostly so; they at least work on arm32 and
i386).
* Various other minor fixups and cleanups, some of which were pointed
out by Kazuki Sakamoto.
 1.6.2.7 04-Oct-1998  bouyer atavar.h: drv_softc is a struct device * instead of void*, as it's mostly
used for dv_xname
wd.c: convert for drv_softc type change, printf cleanup
wdc.c: always call ata_get_params() (params was used initialised with
non-32bit controllers, leaving to bogus PIO/DMA mode report).
Cleaup of the PIO/DMA mode message.
pciide_piix_reg.h: Fix definition of PIIX_IDETIM_CLEAR (unused before)
pciide.c: add a method do disable a channel on know device. If a channel
doesn't have any drive, we disable it and free its resources if disable
was successfull. This should help with laptops where the second channel
of the PIIX4 is unused but not disabled by BIOS. On such laptops,
irq15 can be used for PCMCIA but it was claimed by pciide.
Misc printf cleanup.
wdc_isa.c: printf cleanup.
 1.6.2.6 02-Oct-1998  bouyer Cleanup a few error message, remove some dead code. Re-add a reset at end of
attach, unless we have WDC_NO_EXTRA_RESETS.
Add support for data32iot/data32ioh from -current: each controller pass
WDC_CAPABILITY_DATA32 if they can do 32bit, and WDC_CAPABILITY_DATA16 if they
can do 16bit. For controller that support both, the usual autodetect
mechanism is still used.
 1.6.2.5 21-Aug-1998  bouyer Sync with -current
 1.6.2.4 13-Aug-1998  bouyer - sync with -current
- b* -> mem*
 1.6.2.3 13-Jun-1998  bouyer Sync with HEAD.
 1.6.2.2 09-Jun-1998  bouyer Sync with trunk.
 1.6.2.1 04-Jun-1998  bouyer Commit changes to the IDE system in a branch. This allows a better separation
between higth-level and low-level (i.e. registers read/write) and generalize
the queue for all commands. This also add supports for IDE DMA.
 1.13.2.3 07-Jul-2000  he Apply patch (requested by bouyer):
Add support for the following PCIIDE controllers:
o AMD 756
o CMD PCI0648 and PCI0649
o Hightpoint HPT366
o OPTi 82c621 (and a few of its derivatives)
o Promise Ultra/33 and Ultra/66
o Intel 82801 (ICH/ICH0)
Also fix PR#10437 (detect more ATAPI devices).
 1.13.2.2 21-Jun-1999  perry pullup 1.14->1.15 (bouyer)
 1.13.2.1 12-Apr-1999  bouyer branches: 1.13.2.1.2; 1.13.2.1.4;
Sync with ic/wdc.c 1.67, ic/wdcvar.h 1.17, isa/wdc_isa.c 1.14:
Revert to a more conservative probe: it controller responded and we don't find
ATAPI signature, assume it and ATA or OLD drive (OLD is only set if the
wdc front end passed WDC_CAPABILITIES_OLD, only used for ISA front-end).
At attach time, issue an IDENTIFY to detect drives and eliminates ghosts.
If IDENTIFY failed and OLD is set, issue a RECAL to check for the presence
of old drives.
Should fix the 'disk dissapeared' problems reported by some users, including
port-arm32/7324.
 1.13.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.13.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.6.8 18-Oct-2002  nathanw Catch up to -current.
 1.19.6.7 20-Jun-2002  nathanw Catch up to -current.
 1.19.6.6 28-Feb-2002  nathanw Catch up to -current.
 1.19.6.5 11-Jan-2002  nathanw More catchup.
 1.19.6.4 08-Jan-2002  nathanw Catch up to -current.
 1.19.6.3 14-Nov-2001  nathanw Catch up to -current.
 1.19.6.2 21-Jun-2001  nathanw Catch up to -current.
 1.19.6.1 09-Apr-2001  nathanw Catch up with -current.
 1.21.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.31.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.31.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.31.2.2 25-Aug-2004  skrll Sync with HEAD.
 1.31.2.1 03-Aug-2004  skrll Sync with HEAD
 1.46.12.5 24-Mar-2008  yamt sync with head.
 1.46.12.4 21-Jan-2008  yamt sync with head
 1.46.12.3 27-Oct-2007  yamt sync with head.
 1.46.12.2 30-Dec-2006  yamt sync with head.
 1.46.12.1 21-Jun-2006  yamt sync with head.
 1.47.2.1 01-Feb-2006  yamt sync with head.
 1.48.10.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.48.8.1 19-Apr-2006  elad sync with head.
 1.48.6.1 01-Apr-2006  yamt sync with head.
 1.48.4.1 22-Apr-2006  simonb Sync with head.
 1.48.2.1 09-Sep-2006  rpaulo sync with head
 1.49.10.2 10-Dec-2006  yamt sync with head.
 1.49.10.1 22-Oct-2006  yamt sync with head
 1.49.8.1 18-Nov-2006  ad Sync with head.
 1.51.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.51.24.2 23-Mar-2008  matt sync with HEAD
 1.51.24.1 06-Nov-2007  matt sync with HEAD
 1.51.22.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.51.8.1 23-Oct-2007  ad Sync with head.
 1.52.8.1 10-Jan-2008  bouyer Sync with HEAD
 1.52.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.53.6.2 02-Jun-2008  mjf Sync with HEAD.
 1.53.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.53.2.1 24-Mar-2008  keiichi sync with head.
 1.54.4.2 04-May-2009  yamt sync with head.
 1.54.4.1 16-May-2008  yamt sync with head.
 1.54.2.1 18-May-2008  yamt sync with head.
 1.55.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.55.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.56.12.1 30-Oct-2012  yamt sync with head
 1.59.28.4 27-Sep-2017  jdolecek change wdc_init_shadow_regs() to accept only struct wdc_regs, it doesn't
touch anything else

factor out the probe-only struct ata_channel initialization to wdcprobe(), to
reduce duplication of logic in individual drivers, and to actually work now
that more init is needed beyond the memset()
 1.59.28.3 20-Sep-2017  jdolecek deallocate the channel structures properly in wdc_isa_probe() also when
already the initial bus_space_map() fails
 1.59.28.2 20-Sep-2017  jdolecek initialize properly ata_channel during probe
 1.59.28.1 21-Jun-2017  jdolecek actually remove the KASSERT() for queue_active in wdc.c as it's superfluous,
and make struct ata_queue completly opaque to attachment code; fix two other
places which were not converted to ata_queue_alloc() which were surfaced
by this change
 1.59.2.1 03-Dec-2017  jdolecek update from HEAD
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file wdc_isa.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4 14-Jan-1998  cgd Various cleanups and bug fixes to the wdc/wd code:
* Fix bug in wdc that would overflow ATAPI transfer length.
* Improve wdc probe code so that 'wdc' is probed in if present
even if there are no drives attached, and so that it works
properly even if the only device is an ATAPI slave.
* bus_space-ify.
* split the ISA attachment from the wdc driver, and remove
ISA dependencies from non-ISA files.
* claim that wd and wdc are now machine-independent (probably not
completely true, but mostly so; they at least work on arm32 and
i386).
* Various other minor fixups and cleanups, some of which were pointed
out by Kazuki Sakamoto.
 1.3 03-Sep-1997  bouyer branches: 1.3.4;
Add a map to wdc_softc to track the already known devices to prevent them to
be probed several times. This fixes the "ATAPI CD probed as wd drive" problem.
Thanks to Geoff Wing <mason@primenet.com.au> for testing this on his hardware.
 1.2 27-Aug-1997  bouyer branches: 1.2.2;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.1 01-Jul-1997  bouyer branches: 1.1.2;
file wdlink.h was initially added on branch bouyer-scsipi.
 1.1.2.1 01-Jul-1997  bouyer Add the ide atapi driver from my original atapi driver, ported
to scsipi.
 1.2.2.3 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 27-Aug-1997  thorpej file wdlink.h was added on branch marc-pcmcia on 1997-08-27 23:32:14 +0000
 1.3.4.2 08-May-1998  mycroft Pull up patch from mycroft.
 1.3.4.1 05-May-1998  mycroft Pull up patch from bouyer.
 1.15 14-Jan-1998  cgd Various cleanups and bug fixes to the wdc/wd code:
* Fix bug in wdc that would overflow ATAPI transfer length.
* Improve wdc probe code so that 'wdc' is probed in if present
even if there are no drives attached, and so that it works
properly even if the only device is an ATAPI slave.
* bus_space-ify.
* split the ISA attachment from the wdc driver, and remove
ISA dependencies from non-ISA files.
* claim that wd and wdc are now machine-independent (probably not
completely true, but mostly so; they at least work on arm32 and
i386).
* Various other minor fixups and cleanups, some of which were pointed
out by Kazuki Sakamoto.
 1.14 27-Aug-1997  bouyer branches: 1.14.4;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.13 29-Mar-1995  briggs branches: 1.13.12; 1.13.14;
KERNEL -> _KERNEL.
 1.12 26-Mar-1995  jtc KERNEL -> _KERNEL
 1.11 23-Nov-1994  mycroft Forgot to commit this as part of the LBA changes.
 1.10 22-Nov-1994  mycroft Implement EIDE multi-sector PIO and DMA modes, based on code from Onno van
der Linden. Also, various structural cleanup, and fix two bogons that crept
in, and remove all of the old clustering nonsense.
 1.9 22-Nov-1994  mycroft Change some constant names, etc., to better match the ATA spec.
 1.8 04-Nov-1994  mycroft Add a simplified version of wdcommand() that can be used in some cases.
Avoid needing a wd_softc inside wdprobe().
 1.7 27-Oct-1994  cgd new RCS ID format.
 1.6 22-Aug-1994  mycroft Fix typo in WDCS_BITS.
 1.5 10-Mar-1994  mycroft branches: 1.5.2;
Cleanup to fit standard coding conventions, and *many* bugs fixed.
 1.4 02-Mar-1994  mycroft Fix prototype of wdintr().
 1.3 11-Feb-1994  mycroft Add proc arg to wdioctl() proto.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.5.2.1 22-Aug-1994  mycroft update from trunk
 1.13.14.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.12.1 01-Jul-1997  bouyer Add the ide atapi driver from my original atapi driver, ported
to scsipi.
 1.14.4.1 08-May-1998  mycroft Pull up patch from mycroft.
 1.80 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.79 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.78 24-Apr-2021  thorpej branches: 1.78.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.77 11-Jul-2016  msaitoh branches: 1.77.34;
KNF. No functional change.
 1.76 27-Oct-2012  chs branches: 1.76.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.75 13-Nov-2010  uebayasi branches: 1.75.8; 1.75.18;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.74 23-Nov-2009  rmind branches: 1.74.4;
Remove some unecessary includes sys/user.h header.
 1.73 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.72 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.71 14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.70 14-Mar-2009  dsl Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.69 28-Apr-2008  martin branches: 1.69.8; 1.69.14;
Remove clause 3 and 4 from TNF licenses
 1.68 08-Apr-2008  cegger branches: 1.68.2; 1.68.4;
use aprint_*_dev and device_xname
 1.67 19-Oct-2007  ad branches: 1.67.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.66 04-Mar-2007  christos branches: 1.66.2; 1.66.14; 1.66.16; 1.66.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.65 16-Nov-2006  christos branches: 1.65.4;
__unused removal on arguments; approved by core.
 1.64 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.63 17-Aug-2006  christos branches: 1.63.2; 1.63.4;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
 1.62 11-Dec-2005  christos branches: 1.62.4; 1.62.8;
merge ktrace-lwp.
 1.61 27-Feb-2005  perry branches: 1.61.4;
nuke trailing whitespace
 1.60 04-Feb-2005  perry de-__P
 1.59 07-Dec-2004  thorpej branches: 1.59.2; 1.59.4;
Don't use "struct scsi_generic" in a hardware-defined structure. Instead,
use an array of 12 bytes. Check the incoming CDB to see that it will fit,
and print and error and fail the command if it won't.
 1.58 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.57 24-Jun-2004  drochner fic some questionable pointer arithmetics; gcc-3.4.x
didn't like it
 1.56 04-Aug-2003  christos branches: 1.56.4;
avoid the pruned type gcc-3.x warning.
 1.55 14-May-2003  wiz branches: 1.55.2;
create, not craete.
 1.54 03-May-2003  wiz DMA, not dma nor Dma.
 1.53 23-Feb-2003  simonb Remove assigned-to but not used variable.
 1.52 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.51 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.50 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.49 05-Apr-2002  bouyer Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.
 1.48 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.47 15-Nov-2001  lukem don't need <sys/types.h> when including <sys/param.h>
 1.46 13-Nov-2001  lukem add RCSID
 1.45 19-Jul-2001  thorpej Use BUS_DMA_READ and BUS_DMA_WRITE in some obvious places.
 1.44 18-Jul-2001  thorpej bcopy -> memcpy
 1.43 18-Jul-2001  thorpej bzero -> memset
 1.42 25-Apr-2001  bouyer branches: 1.42.2;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.41 14-Nov-2000  thorpej branches: 1.41.2;
NBPG -> PAGE_SIZE
 1.40 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.39 30-Sep-1999  thorpej branches: 1.39.2;
Update for SCSPI changes.
 1.38 09-Dec-1998  thorpej Update for changed scsipi_xfer struct.
 1.37 05-Dec-1998  mjacob Update HBAs to incorporate the new max_lun property.
 1.36 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.35 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

Add a scsipi_ioctl entry point to struct scsipi_adapter. This will be
used to issue ioctl commands to the host adapters.

Inspired by PR #6090, from Matt Jacob.
 1.34 04-Jul-1998  jonathan defopt DDB.
 1.33 25-Jun-1998  thorpej Don't panic if a DRQ is already allocated. Instead, just return EAGAIN
to indicate that the resource is unavailable.
 1.32 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.31 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.30 04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.29 04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC to
BUS_DMA_COHERENT.
 1.28 28-Jan-1998  thorpej Use offsetof() from libkern.h
 1.27 12-Jan-1998  thorpej Update for config changes.
 1.26 30-Nov-1997  drochner make it compile without "__BROKEN_INDIRECT_CONFIG"
 1.25 04-Nov-1997  thorpej Implement a simple queueing mechanism that makes these drivers much
more robust in resource shortage situations, basically identical to
code I added to the "ahc" driver some time ago.

Thanks to Brad Spencer for the testing help.
 1.24 29-Oct-1997  thorpej When creating ccbs, be a little more informative about why we couldn't
should creation/initialization of a ccb fail. Also, don't panic in
these situations. Instead, simply return an error condition and allow
the caller to deal with it. It may be the case that we were able to
create one ccb what we can grab, and continue to hobble along.

Also, fix the scb freelist fencepost, like the aha/bha/uha drivers.
 1.23 20-Oct-1997  thorpej branches: 1.23.2;
Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.22 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.21 26-Sep-1997  mycroft Rearrange the initialization a bit so we have SCBs available in
wds_inquire_setup_information(), rather than faking it.
 1.20 26-Sep-1997  mycroft Set sc_dmat.
 1.19 04-Sep-1997  thorpej Convert this driver to use bus_dma.
 1.18 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.17 06-Jun-1997  thorpej branches: 1.17.2; 1.17.4;
Pull thorpej-bus-dma branch into mainline.
 1.16 01-May-1997  marc branches: 1.16.2;
wds_find has the sense of its return value backwards (0 vs 1). This
caused the probe to succeed when there was no device present.
 1.15 29-Mar-1997  mycroft General cleanup: bus.h, etc.
 1.14 10-Dec-1996  thorpej Fill in sc_link.max_target
 1.13 03-Nov-1996  mycroft Rearrange wds_attach() to initialize DMA channel before setting to cascade
mode.
Fix silly error in -ASC case, pointed out by Niklas Hallqvist.
 1.12 13-Oct-1996  christos backout kprintf changes
 1.11 10-Oct-1996  christos - printf -> kprintf, sprintf -> ksprintf
- ifdef an unused variable.
 1.10 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.9 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.8 18-Jun-1996  mycroft Turn off *DIAG by default.
 1.7 12-May-1996  mycroft branches: 1.7.4;
Use intr.h.
 1.6 05-May-1996  mycroft Fix a trivial typo.
 1.5 29-Apr-1996  christos - missing argument in printf
- gcc -Wall fixes
 1.4 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.3 10-Apr-1996  cgd if no DDB, define Debugger() to be a panic.
 1.2 30-Mar-1996  mycroft Fix return type of wds_sense().
 1.1 29-Mar-1996  mycroft Working WD7000 and TMC-7000 driver, from Julian Highfield, with additional work by me.
Needs some refinement, but it works.
 1.7.4.2 10-Dec-1996  mycroft From trunk:
Fix a couple of bugs that caused -ASC cards to fail completely.
 1.7.4.1 10-Dec-1996  mycroft Turn off diagnostic code by default.
 1.16.2.1 13-May-1997  thorpej Adapt to new software interface to the ISA DMA controller. (This driver
has _NOT_ yet been converted to bus dma).
 1.17.4.3 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.4.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.17.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.23.2.2 04-Nov-1997  thorpej Pull up from trunk: add a queueing mechanism to make this much more
robust in resource shortage conditions.
 1.23.2.1 29-Oct-1997  thorpej Pull up from trunk: Be more verbose/robust about scb allocation/initialization
failure, and fix a fencepost in scb freelist management.
 1.39.2.6 02-Apr-2001  bouyer Leave SCSI_CHECK handling to mid-layer.
 1.39.2.5 22-Nov-2000  bouyer Sync with HEAD.
 1.39.2.4 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.39.2.3 26-Oct-1999  thorpej Update for:

Deal a little more gracefully with the fact that xfer mode parameters
are for the I_T Nexus, and make all xfer mode updates `async events'.
 1.39.2.2 20-Oct-1999  thorpej Eliminate sleeping from adapter routines.
 1.39.2.1 19-Oct-1999  thorpej Adapt to scsipi API changes.
 1.41.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.41.2.7 17-Apr-2002  nathanw Catch up to -current.
 1.41.2.6 28-Feb-2002  nathanw Catch up to -current.
 1.41.2.5 11-Jan-2002  nathanw More catchup.
 1.41.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.41.2.3 14-Nov-2001  nathanw Catch up to -current.
 1.41.2.2 24-Aug-2001  nathanw Catch up with -current.
 1.41.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.42.2.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.42.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.42.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.42.2.1 03-Aug-2001  lukem update to -current
 1.55.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.55.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.55.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.55.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.55.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.55.2.1 03-Aug-2004  skrll Sync with HEAD
 1.56.4.1 02-Apr-2005  he Pull up revision 1.59 (requested by thorpej in ticket #1022):
Don't use "struct scsi_generic" in a hardware-defined structure.
Instead, use an array of 12 bytes. Check the incoming CDB to see
that it will fit, and print and error and fail the command if it
won't.
 1.59.4.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.59.4.1 12-Feb-2005  yamt sync with head.
 1.59.2.1 29-Apr-2005  kent sync with -current
 1.61.4.3 27-Oct-2007  yamt sync with head.
 1.61.4.2 03-Sep-2007  yamt sync with head.
 1.61.4.1 30-Dec-2006  yamt sync with head.
 1.62.8.1 03-Sep-2006  yamt sync with head.
 1.62.4.1 09-Sep-2006  rpaulo sync with head
 1.63.4.2 10-Dec-2006  yamt sync with head.
 1.63.4.1 22-Oct-2006  yamt sync with head
 1.63.2.1 18-Nov-2006  ad Sync with head.
 1.65.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.66.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.66.16.1 06-Nov-2007  matt sync with HEAD
 1.66.14.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.66.2.1 23-Oct-2007  ad Sync with head.
 1.67.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.68.4.4 11-Mar-2010  yamt sync with head
 1.68.4.3 16-May-2009  yamt sync with head
 1.68.4.2 04-May-2009  yamt sync with head.
 1.68.4.1 16-May-2008  yamt sync with head.
 1.68.2.1 18-May-2008  yamt sync with head.
 1.69.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.69.8.1 28-Apr-2009  skrll Sync with HEAD.
 1.74.4.1 05-Mar-2011  rmind sync with head
 1.75.18.2 03-Dec-2017  jdolecek update from HEAD
 1.75.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.75.8.1 30-Oct-2012  yamt sync with head
 1.76.14.1 05-Oct-2016  skrll Sync with HEAD
 1.77.34.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.78.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file wds.c.orig was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 20-Nov-2000  bouyer branches: 1.1.2;
file wds.c.rej was initially added on branch thorpej_scsipi.
 1.1.2.2 20-Nov-2000  bouyer Remove files that should not have been added
 1.1.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8 11-Dec-2005  christos merge ktrace-lwp.
 1.7 21-Feb-2005  thorpej Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.
 1.6 07-Dec-2004  thorpej branches: 1.6.2; 1.6.4;
Don't use "struct scsi_generic" in a hardware-defined structure. Instead,
use an array of 12 bytes. Check the incoming CDB to see that it will fit,
and print and error and fail the command if it won't.
 1.5 05-Jan-1998  perry branches: 1.5.48; 1.5.54;
RCSID Police.
 1.4 09-Sep-1997  mycroft Make `hashkey' unsigned.
 1.3 04-Sep-1997  thorpej Convert this driver to use bus_dma.
 1.2 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.1 29-Mar-1996  mycroft branches: 1.1.10; 1.1.12;
Working WD7000 and TMC-7000 driver, from Julian Highfield, with additional work by me.
Needs some refinement, but it works.
 1.1.12.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.12.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.12.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.1.10.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.5.54.1 02-Apr-2005  he Pull up revision 1.6 (requested by thorpej in ticket #1022):
Don't use "struct scsi_generic" in a hardware-defined structure.
Instead, use an array of 12 bytes. Check the incoming CDB to see
that it will fit, and print and error and fail the command if it
won't.
 1.5.48.2 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.5.48.1 18-Dec-2004  skrll Sync with HEAD.
 1.6.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.2.1 29-Apr-2005  kent sync with -current
 1.6 16-Dec-2001  thorpej Rename weasel.c to weasel_isa.c in preparation for supporting the
PCI version of the Weasel.
 1.5 16-Dec-2001  thorpej weasel -> weasel_isa
 1.4 13-Nov-2001  lukem add RCSID
 1.3 03-May-2001  hpeyerl branches: 1.3.2;
Make weasel watchdog timer work reliably with help from <thorpej@zembu.com>

Remaining issues to deal with:
- recognize when watchdog timer is deactivated on the Weasel.
- deactivate weasel watchdog timer if we pop into ddb.
 1.2 26-Apr-2001  thorpej Cast the config block buffer to (u_int8_t *) when reading it
from ISA memory space.
 1.1 04-Nov-2000  thorpej branches: 1.1.2; 1.1.4;
Add a device driver for the Middle Digital, Inc. PC-Weasel serial
console board. This glues into the `pcdisplay' driver and provides
support for the watchdog timer function on the PC-Weasel.
 1.1.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 04-Nov-2000  bouyer file weasel.c was added on branch thorpej_scsipi on 2000-11-22 16:03:49 +0000
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6 20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.5 08-Apr-2008  cegger branches: 1.5.48; 1.5.68;
use aprint_*_dev and device_xname
 1.4 19-Oct-2007  ad branches: 1.4.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.3 11-Dec-2005  christos branches: 1.3.30; 1.3.44; 1.3.46; 1.3.50;
merge ktrace-lwp.
 1.2 27-Feb-2005  perry branches: 1.2.4;
nuke trailing whitespace
 1.1 16-Dec-2001  thorpej branches: 1.1.2; 1.1.4; 1.1.20; 1.1.28; 1.1.30;
Rename weasel.c to weasel_isa.c in preparation for supporting the
PCI version of the Weasel.
 1.1.30.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.1.28.1 29-Apr-2005  kent sync with -current
 1.1.20.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.1.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 16-Dec-2001  thorpej file weasel_isa.c was added on branch kqueue on 2002-01-10 19:55:46 +0000
 1.1.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.1 16-Dec-2001  nathanw file weasel_isa.c was added on branch nathanw_sa on 2002-01-08 00:30:34 +0000
 1.2.4.1 27-Oct-2007  yamt sync with head.
 1.3.50.1 25-Oct-2007  bouyer Sync with HEAD.
 1.3.46.1 06-Nov-2007  matt sync with HEAD
 1.3.44.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.3.30.1 23-Oct-2007  ad Sync with head.
 1.4.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.68.1 22-Sep-2015  skrll Sync with HEAD
 1.5.48.1 03-Dec-2017  jdolecek update from HEAD
 1.8 11-Apr-2022  andvar s/serivce/service/ in comments.
 1.7 25-Dec-2007  perry Convert many of the uses of __attribute__ to equivalent
__packed, __unused and __dead macros from cdefs.h
 1.6 03-May-2001  hpeyerl branches: 1.6.38; 1.6.96; 1.6.102; 1.6.106; 1.6.110;
Make weasel watchdog timer work reliably with help from <thorpej@zembu.com>

Remaining issues to deal with:
- recognize when watchdog timer is deactivated on the Weasel.
- deactivate weasel watchdog timer if we pop into ddb.
 1.5 23-Jan-2001  hpeyerl branches: 1.5.2;
add missing Weasel command.
 1.4 04-Nov-2000  thorpej branches: 1.4.2;
Update comment regarding watchdog timer toggle.
 1.3 17-Oct-2000  thorpej Oops, wdt_msec is a short, not a char.
 1.2 16-Oct-2000  thorpej Fix a typo in an constant name that is currently unused.
 1.1 16-Oct-2000  thorpej Register definitions for the Middle Digital, Inc. PC-Weasel
serial console board.
 1.4.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.4.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.4.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 04-Nov-2000  bouyer file weaselreg.h was added on branch thorpej_scsipi on 2000-11-20 11:41:23 +0000
 1.5.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.110.1 02-Jan-2008  bouyer Sync with HEAD
 1.6.106.1 26-Dec-2007  ad Sync with head.
 1.6.102.1 18-Feb-2008  mjf Sync with HEAD.
 1.6.96.1 09-Jan-2008  matt sync with HEAD
 1.6.38.1 21-Jan-2008  yamt sync with head
 1.3 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.2 16-Dec-2001  thorpej branches: 1.2.118; 1.2.134;
weasel -> weasel_isa
 1.1 04-Nov-2000  thorpej branches: 1.1.2; 1.1.4; 1.1.6;
Add a device driver for the Middle Digital, Inc. PC-Weasel serial
console board. This glues into the `pcdisplay' driver and provides
support for the watchdog timer function on the PC-Weasel.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 08-Jan-2002  nathanw Catch up to -current.
 1.1.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.1.2.1 04-Nov-2000  bouyer file weaselvar.h was added on branch thorpej_scsipi on 2000-11-22 16:03:50 +0000
 1.2.134.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.2.118.1 16-May-2009  yamt sync with head
 1.77 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.76 26-Apr-2021  thorpej branches: 1.76.6;
Be explicit about using the "wss" interface attribute when attaching
the "opl" instance.
 1.75 24-Apr-2021  thorpej branches: 1.75.2;
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.74 29-Feb-2020  isaki branches: 1.74.8;
Remove rounding by 4 bytes on round_blocksize().
For drivers which supports only 16bit * 2channels sampling,
rounding by 4 bytes no longer meaningful.
 1.73 08-May-2019  isaki branches: 1.73.4;
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.72 16-Mar-2019  isaki branches: 1.72.2;
Use C99 style struct initializer to audio_hw_if.
 1.71 24-Nov-2011  mrg branches: 1.71.50;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.70 23-Nov-2011  jmcneill 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.69 02-Jun-2011  nonaka branches: 1.69.2; 1.69.4;
fix compile failure.
 1.68 19-Oct-2007  ad branches: 1.68.32; 1.68.42; 1.68.48; 1.68.52;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.67 16-Nov-2006  christos branches: 1.67.6; 1.67.8; 1.67.22; 1.67.24; 1.67.28;
__unused removal on arguments; approved by core.
 1.66 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.65 03-Sep-2006  christos branches: 1.65.2; 1.65.4;
add missing initializer
 1.64 29-Mar-2006  thorpej Use device_cfdata().
 1.63 11-Dec-2005  christos branches: 1.63.4; 1.63.6; 1.63.8; 1.63.10; 1.63.12;
merge ktrace-lwp.
 1.62 14-Jan-2005  kent branches: 1.62.10;
ansify and KNF
 1.61 29-Oct-2004  yamt constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.60 27-Sep-2002  provos branches: 1.60.6;
remove trailing \n in panic(). approved perry.
 1.59 13-Nov-2001  lukem add RCSID
 1.58 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.57 18-Feb-1999  mycroft branches: 1.57.20; 1.57.22; 1.57.24;
Add separate halt_input and halt_output methods in ad1848_isa, which disable
the DMA channel.
 1.56 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.55 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.54 08-Dec-1998  augustss Make the OPL information string more informative.
 1.53 06-Sep-1998  pk Use `ad1848_isa_{open|close}' (Ezra Story; PR#6108).
 1.52 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.51 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.50 29-Jul-1998  augustss Don't print chip name in attach, the ad1848 attach already does.
 1.49 30-Jun-1998  mycroft Nuke unused variable.
 1.48 30-Jun-1998  mycroft Add a monitor mute. The mixer here really needs more work for the
Crystal chips.
 1.47 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.46 21-May-1998  augustss KNF.
 1.45 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.44 12-Mar-1998  augustss Update probing for GUS a little. From soren@t.dk,
closes PR kern/5148.
 1.43 23-Feb-1998  drochner -make compile without BROKEN_INDIRECT_CONFIG
-don't include <machine/pio.h>
 1.42 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.41 12-Jan-1998  thorpej Update for config changes.
 1.40 30-Nov-1997  drochner fix inconsistent declaration in non-"__BROKEN_INDIRECT_CONFIG" case
 1.39 19-Oct-1997  augustss branches: 1.39.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.38 11-Oct-1997  mycroft AudioC[A-Z] -> AudioC[a-z]
 1.37 28-Aug-1997  augustss Zap drq2 if unused.
 1.36 26-Aug-1997  augustss XXX Add a drq2 locator for the ISA bus. Many sound cards need
two DMA channels to do e.g. full-duplex. This allows
a way of specifying the second channel in a sane way.
THIS IS TEMPORARY. The drq2 locator will go away when
the locator system has been changed to allow multiple
values per locator.
 1.35 25-Aug-1997  augustss Fix the "non-broken" indirect configuration so it might actually work.
 1.34 24-Aug-1997  augustss Improve error message.
 1.33 20-Aug-1997  augustss Convert WSS driver to use non-broken indirect configuration.
 1.32 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.31 04-Aug-1997  augustss Implement a function to test if a drq is taken and use it
in two drivers. There are still many drivers left to fix...
 1.30 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.29 28-Jul-1997  augustss branches: 1.29.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.28 27-Jul-1997  augustss audio: Simplify handling of AUDIO_SETFD and committing of encoding mode.
 1.27 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.26 06-Jun-1997  thorpej Pull thorpej-bus-dma branch into mainline.
 1.25 09-May-1997  augustss branches: 1.25.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.24 07-May-1997  augustss Convert to new orthogonal audio encoding scheme and implement
some of the new encodings. The change to ioctl AUDIO_GETENC is
NOT backwards compatible.
 1.23 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.22 06-Apr-1997  augustss Make sure the bus tag is set where we need it.
 1.21 06-Apr-1997  augustss Add support for MAD16 based audio cards.
XXX Change the way we determine to probe for it when
multiple I/O ranges are available.
 1.20 05-Apr-1997  augustss Busify the WSS driver.
 1.19 20-Mar-1997  mycroft Combine set_encoding and set_precision into a single set_format interface.
 1.18 19-Mar-1997  mikel normalize off-by-four ad1848 register offsets.
also silence probe unless debugging is enabled.
 1.17 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.16 05-Dec-1996  mikel return proper output port. Fixes PR kern/2014.
 1.15 13-Oct-1996  christos backout kprintf changes
 1.14 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 12-May-1996  mycroft Use intr.h.
 1.12 29-Apr-1996  christos Prototype fixes
 1.11 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.10 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.9 16-Feb-1996  mycroft Prototype the probe and attach functions.
 1.8 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.7 10-Nov-1995  mycroft Convert IRQ, DRQ, and port numbers to int.
 1.6 07-Jul-1995  brezak Setup irq correctly (PR#1179)
 1.5 08-May-1995  brezak Remove strings
 1.4 17-Apr-1995  cgd update for new locations
 1.3 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.2 25-Mar-1995  mycroft Use void* rather than caddr_t in many places.
 1.1 21-Feb-1995  brezak Driver for Windows sound system; not extensively tested
 1.25.2.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.29.2.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.2.3 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.29.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.39.2.1 05-Dec-1998  cgd work around a problem that could cause the wss driver to panic during
attach when a DRQ gets allocated twice. Done differently in -current.
(augustss)
 1.57.24.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.57.22.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.57.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.57.20.3 18-Oct-2002  nathanw Catch up to -current.
 1.57.20.2 14-Nov-2001  nathanw Catch up to -current.
 1.57.20.1 08-Oct-2001  nathanw Catch up to -current.
 1.60.6.2 17-Jan-2005  skrll Sync with HEAD.
 1.60.6.1 02-Nov-2004  skrll Sync with HEAD.
 1.62.10.3 27-Oct-2007  yamt sync with head.
 1.62.10.2 30-Dec-2006  yamt sync with head.
 1.62.10.1 21-Jun-2006  yamt sync with head.
 1.63.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.63.10.1 19-Apr-2006  elad sync with head.
 1.63.8.2 14-Sep-2006  yamt sync with head.
 1.63.8.1 01-Apr-2006  yamt sync with head.
 1.63.6.1 22-Apr-2006  simonb Sync with head.
 1.63.4.1 09-Sep-2006  rpaulo sync with head
 1.65.4.2 10-Dec-2006  yamt sync with head.
 1.65.4.1 22-Oct-2006  yamt sync with head
 1.65.2.1 18-Nov-2006  ad Sync with head.
 1.67.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.67.24.1 06-Nov-2007  matt sync with HEAD
 1.67.22.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.67.8.1 23-Oct-2007  ad Sync with head.
 1.67.6.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.68.52.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.68.48.1 06-Jun-2011  jruoho Sync with HEAD.
 1.68.42.1 12-Jun-2011  rmind sync with head
 1.68.32.2 12-Dec-2008  ad Checkpoint work in progress.
 1.68.32.1 11-Dec-2008  ad Checkpoint work in progress.
 1.69.4.3 23-Nov-2011  jakllsch Hold the intr lock for the duration of ad1848_isa_intr().
 1.69.4.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.69.4.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.69.2.1 17-Apr-2012  yamt sync with head
 1.71.50.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.71.50.1 10-Jun-2019  christos Sync with HEAD
 1.72.2.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.72.2.2 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.72.2.1 21-Apr-2019  isaki Adapt ad1848/cs4231 families to audio2.
 1.73.4.1 29-Feb-2020  ad Sync with head.
 1.74.8.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.75.2.1 13-May-2021  thorpej Sync with HEAD.
 1.76.6.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.31 12-Feb-2022  riastradh sys: Fix various abuse of struct device internals.

Will help to make struct device opaque later.
 1.30 08-May-2019  isaki 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.29 02-Jun-2011  tsutsui branches: 1.29.54; 1.29.58;
Split device_t/softc of all ad1848 variants properly. Compile test only.

Please check all attribute users in all files.* on device_t/softc split.

XXX: not sure if gus(4) needs device_t in ad1848_isa_softc
 1.28 02-Jun-2011  nonaka fix compile failure.
 1.27 12-May-2009  cegger branches: 1.27.4; 1.27.6; 1.27.10;
struct device * -> device_t, no functional changes intended.
 1.26 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.25 08-Apr-2008  cegger branches: 1.25.4; 1.25.18;
use aprint_*_dev and device_xname
 1.24 19-Oct-2007  ad branches: 1.24.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.23 16-Nov-2006  christos branches: 1.23.8; 1.23.22; 1.23.24; 1.23.28;
__unused removal on arguments; approved by core.
 1.22 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.21 14-May-2006  elad branches: 1.21.8; 1.21.10;
integrate kauth.
 1.20 29-Mar-2006  thorpej Use device_cfdata().
 1.19 11-Dec-2005  christos branches: 1.19.4; 1.19.6; 1.19.8; 1.19.10; 1.19.12;
merge ktrace-lwp.
 1.18 14-Jan-2005  kent branches: 1.18.10;
ansify and KNF
 1.17 14-Sep-2004  drochner Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.16 03-May-2003  wiz branches: 1.16.2;
DMA, not dma nor Dma.
 1.15 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 07-Jan-2002  thorpej Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.11 13-Nov-2001  lukem add RCSID
 1.10 18-Jul-2001  thorpej bzero -> memset
 1.9 25-Oct-1999  drochner branches: 1.9.8; 1.9.10;
avoid cast
 1.8 14-Aug-1999  augustss branches: 1.8.2; 1.8.4; 1.8.6;
Implement opl at wss.
 1.7 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.6 15-Oct-1998  mycroft Disable the I/O address, DRQ and IRQ validation; assume that the config file
is sane.
 1.5 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.4 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.3 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.2 23-Feb-1998  drochner -make compile without BROKEN_INDIRECT_CONFIG
-don't include <machine/pio.h>
 1.1 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.8.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.4.1 15-Nov-1999  fvdl Sync with -current
 1.8.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.10.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.10.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.9.10.1 03-Aug-2001  lukem update to -current
 1.9.8.5 18-Oct-2002  nathanw Catch up to -current.
 1.9.8.4 28-Feb-2002  nathanw Catch up to -current.
 1.9.8.3 11-Jan-2002  nathanw More catchup.
 1.9.8.2 14-Nov-2001  nathanw Catch up to -current.
 1.9.8.1 24-Aug-2001  nathanw Catch up with -current.
 1.16.2.3 17-Jan-2005  skrll Sync with HEAD.
 1.16.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.18.10.2 27-Oct-2007  yamt sync with head.
 1.18.10.1 21-Jun-2006  yamt sync with head.
 1.19.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.19.10.1 19-Apr-2006  elad sync with head.
 1.19.8.1 01-Apr-2006  yamt sync with head.
 1.19.6.1 22-Apr-2006  simonb Sync with head.
 1.19.4.1 09-Sep-2006  rpaulo sync with head
 1.21.10.2 10-Dec-2006  yamt sync with head.
 1.21.10.1 22-Oct-2006  yamt sync with head
 1.21.8.1 18-Nov-2006  ad Sync with head.
 1.23.28.1 25-Oct-2007  bouyer Sync with HEAD.
 1.23.24.1 06-Nov-2007  matt sync with HEAD
 1.23.22.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.23.8.1 23-Oct-2007  ad Sync with head.
 1.24.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.25.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.25.4.1 16-May-2009  yamt sync with head
 1.27.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.27.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.27.4.1 12-Jun-2011  rmind sync with head
 1.29.58.1 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.29.54.1 10-Jun-2019  christos Sync with HEAD
 1.4 19-Mar-1997  mikel normalize off-by-four ad1848 register offsets.
 1.3 07-Jul-1995  brezak Setup irq correctly (PR#1179)
 1.2 08-May-1995  brezak Remove strings
 1.1 21-Feb-1995  brezak Driver for Windows sound system; not extensively tested
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 14-Jan-2005  kent ansify and KNF
 1.7 14-Aug-1999  augustss branches: 1.7.36;
Implement opl at wss.
 1.6 19-Feb-1999  mycroft Kill vestiges of isa_establish().
 1.5 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.4 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.3 30-Jun-1998  mycroft Add a monitor mute.
 1.2 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.1 19-Jan-1998  augustss Split out the ISA part of the WSS driver to allow PnP attachment.
Make the AD1848 driver a little more readable with some macros.
 1.7.36.1 17-Jan-2005  skrll Sync with HEAD.
 1.89 25-Sep-2022  thorpej malloc(9) -> kmem(9)
 1.88 14-Jul-2016  msaitoh - Use aprint*() more in xxx_attach().
- Add missing aprint_naive("\n").
- Remove extra spaces and tabs.
- KNF.
 1.87 11-Jul-2016  msaitoh KNF. No functional change.
 1.86 25-Jul-2014  dholland branches: 1.86.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.85 25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.84 16-Mar-2014  dholland branches: 1.84.2;
Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.83 27-Oct-2012  chs branches: 1.83.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.82 12-May-2009  cegger branches: 1.82.12; 1.82.22;
struct device * -> device_t, no functional changes intended.
 1.81 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.80 08-Jun-2008  tsutsui branches: 1.80.12;
Replace device_lookup() with device_lookup_private() on getting softc
for future device_t/softc spilt.
 1.79 08-Apr-2008  cegger branches: 1.79.2; 1.79.4; 1.79.6;
use aprint_*_dev and device_xname
 1.78 19-Oct-2007  ad branches: 1.78.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.77 29-Jul-2007  ad branches: 1.77.4; 1.77.6; 1.77.10; 1.77.12;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.76 09-Jul-2007  ad branches: 1.76.2;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.75 04-Mar-2007  christos branches: 1.75.2; 1.75.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.74 16-Nov-2006  christos branches: 1.74.4;
__unused removal on arguments; approved by core.
 1.73 12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.72 26-Apr-2006  rpaulo branches: 1.72.8; 1.72.10;
Make wtintr() prototype static too.
In wtsense(), make msg local variable const.
 1.71 26-Apr-2006  rpaulo Put back sys/proc.h for wakeup/tsleep.
Fix more typos.
 1.70 26-Apr-2006  rpaulo Make 3rd argument of wtwait() const.
 1.69 26-Apr-2006  rpaulo Fix an obvious typo.
 1.68 26-Apr-2006  rpaulo ktrace-lwp merge.
 1.67 26-Apr-2006  rpaulo ANSIfy, statify, KNfy.
(and maybe deadfy some day?)
 1.66 11-Dec-2005  christos branches: 1.66.4; 1.66.6; 1.66.8; 1.66.10; 1.66.12;
merge ktrace-lwp.
 1.65 28-Feb-2005  simonb branches: 1.65.4;
Add a missing return after an "if" that checks for something then
did nothing.
 1.64 27-Feb-2005  perry nuke trailing whitespace
 1.63 04-Feb-2005  perry de-__P
 1.62 14-Sep-2004  drochner branches: 1.62.4; 1.62.6;
Separate the namespace for default (ie unspecified) locators used
by the isa.c bus driver and the "address/whatever not specified"
argument passed to leaf device drivers.
The former is "ISACF_XXX_DEFAULT" as generaterd by config(8), the latter
"ISA_UNKNOWN_XXX", defined in isavar.h.
This way we save a dependency of every ISA device driver on "locators.h".
 1.61 09-May-2003  fvdl branches: 1.61.2;
A few ISA sound drivers like to share dma channels, and hence deferred
isa_dmamap_create() calls to their open/close entrypoints. This worked
with some luck, but broke on i386 when _bus_dmamap_create started
to allocate bounce buffers upfront, since memory below 16M may well
not be available when the sound devices is opened for the Nth time.

To fix this, create a new simple interface, isa_drq_alloc/isa_drq_free,
wrappers around already existing bitmask macros. These are expected
to be used before an isa_dmamap_create call, and after an
isa_dmamap_destroy call, respectively. For the sb and ad1848 drivers,
they're deferred until open/close.

All isa_dmamap_create calls can now use BUS_DMA_ALLOCNOW and be done
at attach time.
 1.60 03-May-2003  wiz DMA, not dma nor Dma.
 1.59 23-Oct-2002  jdolecek merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.58 02-Oct-2002  thorpej Fix sizeof and whitespace bug from the script I'm using to do the
CFATTACH_DECL conversion. (Grumble.)
 1.57 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.56 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.55 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.54 07-Jan-2002  thorpej branches: 1.54.8;
Overhaul of the ISA autoconfiguration code to support direct
configuration of devices logically attached to the ISA bus:

* Change the isa_attach_args to have arrays of io, mem, irq, drq
resources.
* Add a "pnpnames" and a linked list of "pnpcompatnames" to the
isa_attach_args. If either of these members are non-NULL,
direct configuration of the bus is being performed. Add an
ISA_DIRECT_CONFIG() macro to test for this.
* Drivers are not allowed to modify the isa_attach_args unless
direct configuration is not being performed and the probe fucntion
is returning success.
* Adapt device drivers -- currently, all driver probe routines return
"no match" if ISA_DIRECT_CONFIG() evaluates to true.
 1.53 13-Nov-2001  lukem add RCSID
 1.52 18-Jul-2001  thorpej branches: 1.52.2;
bcopy -> memcpy
 1.51 06-Jul-2000  thorpej branches: 1.51.2; 1.51.4;
Use device_lookup().
 1.50 26-Jun-2000  mrg <vm/vm_param.h> -> <uvm/uvm_param.h>
 1.49 23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.48 08-Feb-2000  thorpej Cast bus_size_t to u_long for printing.
 1.47 07-Feb-2000  thorpej Add a new function call to the ISA DMA API: isa_dmamaxsize(), which returns
the maximum transfer size for the specified DMA channel. Make all clients
of ISA DMA use this call to determine their maximum transfer size.
 1.46 10-Jan-1999  augustss branches: 1.46.8;
Avoid `void *' arithmetic. Fixes PR 6783.
 1.45 09-Jun-1998  thorpej Nuke __BROKEN_INDIRECT_CONFIG.
 1.44 09-Jun-1998  thorpej Adjust for changes to the ISA DMA API.
 1.43 20-Jan-1998  drochner make compile without BROKEN_INDIRECT_CONFIG,
fix obvious brokeness in port offset calculation
(untested)
 1.42 12-Jan-1998  thorpej Update for config changes.
 1.41 20-Oct-1997  thorpej branches: 1.41.2;
Don't panic if we fail to remap i/o or mem space in the attach function.
Instead, print a diagnostic and return. (Some drivers do this already.)

Also, normalize the diagnostic message, and fix some places where the
printfs were getting ugly.
 1.40 19-Oct-1997  thorpej Make sure the i/o and/or mem addresses aren't wildcarded (i.e. -1) before
using the address in a bus_space_map() call.
 1.39 08-Aug-1997  jonathan Add back ia->iobase to initializer macros for softc device-register offsets.
 1.38 05-Aug-1997  jonathan Use <bus.h>.
 1.37 06-Jun-1997  thorpej branches: 1.37.4;
Pull thorpej-bus-dma branch into mainline.
 1.36 13-Oct-1996  christos branches: 1.36.8;
backout kprintf changes
 1.35 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.34 05-Sep-1996  mycroft wtpoll() -> wtsoft()
 1.33 12-May-1996  mycroft Use intr.h.
 1.32 29-Apr-1996  christos Prototype fixes
 1.31 11-Apr-1996  cgd update for addition of a machine-dependent cookie as the first argument
to isa_intr_{,dis}establish().
 1.30 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.29 01-Mar-1996  mycroft Add support to the ISA DMA framework for auto-initialize mode.
Add experimental SB16 code, disabled for now.
 1.28 12-Jan-1996  thorpej Use WTDBPRINT() instead of DEBUG() for driver debugging printf()s..
Fixes PR #1927, from Erik Bertelsen <erik@arhpc214.uni-c.dk>
 1.27 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.26 04-Jul-1995  mycroft Make each disk and tape driver define its own read and write functions.
Deprecate rawread() and rawwrite() completely. Remove d_strategy from cdevsw to
force the abstraction barrier.
 1.25 26-Jun-1995  cgd make dump stubs consistent
 1.24 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.23 29-Jan-1995  cgd lip service to making ISA support machine-independent. This is the first
round: moving the drivers into a machine-independent directory.
Some drivers (e.g. fd.c) not moved because they use other pc features (e.g.
CMOS settings), and none of the non-driver files moved, because they're
still pretty much PC specific. eventually (when other ports with ISA
busses really start using this code), more 'high-level' ISA support will
live here.
 1.22 03-Jan-1995  mycroft Add interrupt sharing types.
 1.21 18-Nov-1994  mycroft Convert port, IRQ, and DRQ numbers to ints.
 1.20 03-Nov-1994  mycroft Update to match autoconfig code.
 1.19 30-Oct-1994  cgd be more careful with types, also pull in headers where necessary.
 1.18 27-Oct-1994  cgd new RCS ID format.
 1.17 25-Jul-1994  mycroft Add missing splbio()s, pointed out by Gene Stark.
 1.16 16-Jun-1994  mycroft branches: 1.16.2;
b_un.b_addr -> b_data
 1.15 05-May-1994  mycroft Remove now-bogus cast.
 1.14 05-May-1994  cgd lots of changes: prototype migration, move lots of variables, definitions,
and structure elements around. kill some unnecessary type and macro
definitions. standardize clock handling. More changes than you'd want.
 1.13 22-Apr-1994  mycroft Separate DMA functions.
 1.12 21-Apr-1994  mycroft Fix return of I/O space size from wtprobe(), as reported by Rafal Boni.
 1.11 07-Apr-1994  mycroft Implement dynamic IRQ configuration and IRQ sharing. Inline spl*() calls.
Reorganize and clean up the relevant code.
 1.10 29-Mar-1994  mycroft New version from Sergey Ryzhkov and Serge Vakulenko.
 1.9 08-Mar-1994  mycroft #include cpu.h in all files which use spl*().
 1.8 06-Mar-1994  mycroft DELAY() --> delay(). This is not a macro.
 1.7 09-Feb-1994  mycroft All ioctl routines take a struct proc * now.
 1.6 20-Dec-1993  mycroft Canonicalize all #includes, and add pio.h where appropriate.
 1.5 28-Jul-1993  cgd branches: 1.5.2;
incorporate changes from 0-9-base to 0-9-ALPHA
 1.4 19-Jul-1993  cgd branches: 1.4.2;
kill damned RCS Log
 1.3 19-Jul-1993  cgd Reading file marks or writing end of tape return 0 bytes, AND THEY
DON'T SET THE ERROR BIT ON THE BUFFER UNLESS THE AUTHOR OF PHYSIO
IS STUPID!
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.4.2.1 19-Jul-1993  cgd my previous change to get rid of error flagging on EOM/EOF was wrong-headed
 1.5.2.2 02-Feb-1994  mycroft Partial cleanup; needs work.
 1.5.2.1 24-Sep-1993  mycroft clock.c: Finish conversion. Make rtcput() work if VRT bit not set. Speed up
time conversion in delay().
fd.c: Minor changes to autoconfig. Use dv_parent rather than storing another
pointer to the fdc_softc in each fd_softc. Change disk label stuff for our
kernel.
icu.s: Make splx() and splnone() return previous cpl for now.
isa.c: Minor autoconfig changes.
isa.h: rtcin() is now nvram() and is declare in nvram.h. Make isaphysmem a
caddr_t.
pccons.c: XXXX: Maybe we should insist they open /dev/io now.
timerreg.h: #define TIMER_NPORTS.
wd.c: Delete unused wdnoreloc() and wddospart(), and use remaining two bits in
unit number. struct disk --> struct wd_softc. struct board --> struct
wdc_softc. Still needs much work.
 1.16.2.1 26-Jul-1994  cgd from trunk
 1.36.8.1 13-May-1997  thorpej Adapt to new software interface to the on-board ISA DMA controller.
 1.37.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.41.2.1 08-May-1998  mycroft Pull up 1.43, per request of drochner.
 1.46.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.51.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.51.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.51.4.1 03-Aug-2001  lukem update to -current
 1.51.2.7 11-Nov-2002  nathanw Catch up to -current
 1.51.2.6 18-Oct-2002  nathanw Catch up to -current.
 1.51.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.51.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.51.2.3 11-Jan-2002  nathanw More catchup.
 1.51.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.51.2.1 24-Aug-2001  nathanw Catch up with -current.
 1.52.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.54.8.1 16-May-2002  gehenna Add the block/character device switches.
 1.61.2.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.61.2.3 04-Feb-2005  skrll Sync with HEAD.
 1.61.2.2 21-Sep-2004  skrll Fix the sync with head I botched.
 1.61.2.1 18-Sep-2004  skrll Sync with HEAD.
 1.62.6.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.62.6.1 12-Feb-2005  yamt sync with head.
 1.62.4.1 29-Apr-2005  kent sync with -current
 1.65.4.4 27-Oct-2007  yamt sync with head.
 1.65.4.3 03-Sep-2007  yamt sync with head.
 1.65.4.2 30-Dec-2006  yamt sync with head.
 1.65.4.1 21-Jun-2006  yamt sync with head.
 1.66.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.66.10.1 11-May-2006  elad sync with head
 1.66.8.1 24-May-2006  yamt sync with head.
 1.66.6.1 01-Jun-2006  kardel Sync with head.
 1.66.4.1 09-Sep-2006  rpaulo sync with head
 1.72.10.2 10-Dec-2006  yamt sync with head.
 1.72.10.1 22-Oct-2006  yamt sync with head
 1.72.8.1 18-Nov-2006  ad Sync with head.
 1.74.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.75.4.1 11-Jul-2007  mjf Sync with head.
 1.75.2.4 23-Oct-2007  ad Sync with head.
 1.75.2.3 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.75.2.2 01-Jul-2007  ad Adapt to callout API change.
 1.75.2.1 09-Jun-2007  ad Sync with head.
 1.76.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.77.12.2 29-Jul-2007  ad It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.77.12.1 29-Jul-2007  ad file wt.c was added on branch matt-mips64 on 2007-07-29 12:50:22 +0000
 1.77.10.1 25-Oct-2007  bouyer Sync with HEAD.
 1.77.6.1 06-Nov-2007  matt sync with HEAD
 1.77.4.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.78.16.3 29-Jun-2008  mjf Sync with HEAD.
 1.78.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.78.16.1 05-Apr-2008  mjf - add "file-system DEVFS" and "pseudo-device devfsctl" to conf/std seeing
as these are always needed.

- convert many, many drivers over to the New Devfs World Order. For a
list of device drivers yet to be converted see,
http://www.netbsd.org/~mjf/devfs-todo.html.

- add a new device_unregister_all(device_t) function to remove all device
names associated with a device_t, which saves us having to construct
device names when the driver is detached.

- add a DEV_AUDIO type for devices.
 1.79.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.79.4.2 16-May-2009  yamt sync with head
 1.79.4.1 04-May-2009  yamt sync with head.
 1.79.2.1 17-Jun-2008  yamt sync with head.
 1.80.12.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.82.22.3 03-Dec-2017  jdolecek update from HEAD
 1.82.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.82.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.82.12.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.82.12.1 30-Oct-2012  yamt sync with head
 1.83.2.1 18-May-2014  rmind sync with head
 1.84.2.1 10-Aug-2014  tls Rebase.
 1.86.4.1 05-Oct-2016  skrll Sync with HEAD
 1.9 06-Sep-2015  dholland More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
 1.8 11-Dec-2005  christos branches: 1.8.120; 1.8.140;
merge ktrace-lwp.
 1.7 27-Feb-2005  perry nuke trailing whitespace
 1.6 03-May-2003  wiz branches: 1.6.2; 1.6.10; 1.6.12;
DMA, not dma nor Dma.
 1.5 27-Oct-1994  cgd new RCS ID format.
 1.4 29-Mar-1994  mycroft New version from Sergey Ryzhkov and Serge Vakulenko.
 1.3 15-Feb-1994  mycroft Remove imbedded RCS logs.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.6.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.6.10.1 29-Apr-2005  kent sync with -current
 1.6.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.8.140.1 22-Sep-2015  skrll Sync with HEAD
 1.8.120.1 03-Dec-2017  jdolecek update from HEAD
 1.50 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.49 26-Apr-2021  thorpej branches: 1.49.6;
Be explicit about using the "ym" interface attribute when attaching
the "opl" and "mpu" instances.
 1.48 24-Apr-2021  thorpej branches: 1.48.2;
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.47 29-Feb-2020  isaki branches: 1.47.8;
Remove rounding by 4 bytes on round_blocksize().
For drivers which supports only 16bit * 2channels sampling,
rounding by 4 bytes no longer meaningful.
 1.46 08-May-2019  isaki branches: 1.46.4;
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.45 16-Mar-2019  isaki branches: 1.45.2;
Use C99 style struct initializer to audio_hw_if.
 1.44 08-Nov-2013  christos branches: 1.44.30;
fix unused variable warnings
 1.43 24-Nov-2011  mrg branches: 1.43.8; 1.43.12;
put back IPL_AUDIO and splaudio(), at the request of rmind. they are
aliases and now we can easily revert audio to IPL_VM if necessary,
without having to revert the whole branch.
 1.42 23-Nov-2011  jmcneill 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.41 02-Jun-2011  tsutsui branches: 1.41.2; 1.41.4;
Split device_t/softc of all ad1848 variants properly. Compile test only.

Please check all attribute users in all files.* on device_t/softc split.

XXX: not sure if gus(4) needs device_t in ad1848_isa_softc
 1.40 02-Jun-2011  nonaka fix compile failure.
 1.39 24-Feb-2010  dyoung branches: 1.39.2; 1.39.4; 1.39.8;
A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
 1.38 08-Jan-2010  dyoung branches: 1.38.2;
Expand PMF_FN_* macros.
 1.37 02-Jan-2010  christos make rhis compile.
 1.36 02-Jan-2010  christos convert to pmf
 1.35 28-Apr-2008  martin branches: 1.35.12;
Remove clause 3 and 4 from TNF licenses
 1.34 08-Apr-2008  cegger branches: 1.34.2; 1.34.4;
use aprint_*_dev and device_xname
 1.33 01-Apr-2008  xtraeme Fix fallout from device_t/softc split to mpu(4):
always pass the mpu_softc to mpu_intr(). Found by Takeshi Nakayama.
 1.32 19-Oct-2007  ad branches: 1.32.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.31 09-Jul-2007  ad branches: 1.31.6; 1.31.8; 1.31.12;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.30 16-Feb-2007  ad branches: 1.30.4; 1.30.6; 1.30.8;
Fix spllowersoftclock() fallout.
 1.29 24-Sep-2006  jmcneill Add "name" parameter to powerhook_establish, to aid debugging. No objections
on tech-kern@
 1.28 03-Sep-2006  christos branches: 1.28.2; 1.28.4;
add missing initializer.
 1.27 24-Dec-2005  perry branches: 1.27.4; 1.27.8;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.26 11-Dec-2005  christos merge ktrace-lwp.
 1.25 30-May-2005  christos branches: 1.25.2;
- add const
- avoid variable shadowing.
 1.24 14-Jan-2005  kent ansify and KNF
 1.23 29-Oct-2004  yamt constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.22 22-Apr-2004  itojun sprintf -> snprintf
 1.21 10-Mar-2002  itohy branches: 1.21.12;
Add explicit support of OPL3-SA2 (YMF711).
Not well tested....
 1.20 26-Feb-2002  itohy 1. Change equalizer (treble, bass) to be ``flat'' if the values set at
the center position (128), so as to be compatible with other drivers.
The equalizer is enhancement only, and the values < 128 don't take
any effect.

Yeah, this causes spec change....
For equalization.treble and equalization.bass, the relation between
old and new value is

new_value = (old_value / 2) + 128.

(Note this does not apply to equalization.surround.)

2. Support ++ and -- of mixerctl(1) for stepping volume variables.

3. Fix problem where the chip is not powered up
when the mic input is unmuted.
 1.19 13-Nov-2001  lukem add RCSID
 1.18 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.17 26-Nov-2000  takemura branches: 1.17.2; 1.17.4; 1.17.6;
Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
 1.16 04-Sep-2000  itohy Move ym_mixer_set_port() (if used) during attach AFTER initialization of
power ctl stuff, or it makes unwanted changes to the CODEC settings.
 1.15 04-Jul-2000  augustss MAke sure bass&treble start in their mid position.
 1.14 23-Mar-2000  thorpej branches: 1.14.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.13 27-Dec-1999  itohy - Unmuting an external input source (CD playback, line input, and speaker)
now prevents power down/save the device.
The external input sources are muted by default at initialization.
- Change "power.power.*" to "power.save.*". Sorry, spec change....
- Shorten tsleep(9) ident string for "ps l".
 1.12 07-Oct-1999  itohy branches: 1.12.2;
Oops! Make it compile again.
 1.11 07-Oct-1999  itohy Fix power-related init code.
Change the default mixer setting to make wave and OPL3 volume even.
Mute the chip during attach not to make noise.
 1.10 05-Oct-1999  itohy branches: 1.10.2;
New ym driver.
1. Add power control to reduce power consumption.
The behavior can be controlled by mixerctl(1).
2. Add suspend/resume hook to keep the parameters.
Currently this includes CODEC and control registers but
does not include the DMA state. FIXME.
3. Support "opl at ym" and "mpu at ym" attachment.
Actually, this is required for power control.
4. Add support for the on-chip 3D enhancement hardware.
This includes bass/treble enhancement, wide stereo, and
the equalization mode. This can be controlled by mixerctl(1).
5. Make "audioctl -w play.gain=xxx" work like as
"mixerctl -w inputs.dac=xxx" and now it changes
the wave output volume correctly.
6. Support hardware master volume switches.
7. Change formula of calculating gain so that all the levels
should be used equally.
8. Change "audioctl name" to "OPL3-SA3" and "audioctl version"
to the version of the chip.
 1.9 18-Feb-1999  mycroft Add separate halt_input and halt_output methods in ad1848_isa, which disable
the DMA channel.
 1.8 17-Feb-1999  mycroft Use the trigger interface, and clean up a pile of cruft.
 1.7 17-Feb-1999  mycroft Pass the direction to the allocm and round_buffersize methods.
Some drivers need this to properly allocate DMAable memory.
 1.6 11-Oct-1998  augustss Call correct ad1848 attach routine. Fixes PR 6269.
 1.5 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.4 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.3 17-Jun-1998  augustss Remove a bunch of totally unnecessary #include <machine/pio.h>
left over from the olden days.
 1.2 21-May-1998  augustss Add a newline.
KNF.
 1.1 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.10.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.12.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.12.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.4.4 27-Mar-2002  he Pull up revisions 1.19-1.21 (via patch, requested by itohy):
Several changes to wss-compatible audio devices:
o Fix ADPCM playback/recording
o Add explicit support for OPL3-SA2 (YMF711), fixes PR#14819
o Add AD1845 support
o other minor bugfixes and cleanups
 1.14.4.3 06-May-2001  he Pull up revision 1.17 (requested by he):
Add new powerhook argument values, PWR_SOFTSUSPEND, PWR_SOFTSTANDBY and
PWR_SOFTRESUME. Apm calls powerhook with the values in normal interrupt
priority level while others are protected with splhigh().
 1.14.4.2 04-Sep-2000  itohy Pull up revision 1.16 (requested by itohy, approved by jhawk):
Move ym_mixer_set_port() (if used) during attach AFTER initialization of
power ctl stuff, or it makes unwanted changes to the CODEC settings.
Split YM_VOL_EQUAL macro into YM_ENHANCE_TREBLE and YM_ENHANCE_BASS.
 1.14.4.1 07-Aug-2000  augustss Pull up 1.14-1.15. Start tone controls in middle position.
Approved by thorpej.
 1.17.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.17.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.17.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.2.6 10-Jul-2002  nathanw Don't need curlwp here.
 1.17.2.5 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.17.2.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.17.2.3 28-Feb-2002  nathanw Catch up to -current.
 1.17.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.17.2.1 08-Oct-2001  nathanw Catch up to -current.
 1.21.12.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.12.5 17-Jan-2005  skrll Sync with HEAD.
 1.21.12.4 02-Nov-2004  skrll Sync with HEAD.
 1.21.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.12.1 03-Aug-2004  skrll Sync with HEAD
 1.25.2.5 27-Oct-2007  yamt sync with head.
 1.25.2.4 03-Sep-2007  yamt sync with head.
 1.25.2.3 26-Feb-2007  yamt sync with head.
 1.25.2.2 30-Dec-2006  yamt sync with head.
 1.25.2.1 21-Jun-2006  yamt sync with head.
 1.27.8.1 14-Sep-2006  yamt sync with head.
 1.27.4.1 09-Sep-2006  rpaulo sync with head
 1.28.4.1 22-Oct-2006  yamt sync with head
 1.28.2.1 18-Nov-2006  ad Sync with head.
 1.30.8.1 11-Jul-2007  mjf Sync with head.
 1.30.6.2 23-Oct-2007  ad Sync with head.
 1.30.6.1 01-Jul-2007  ad Adapt to callout API change.
 1.30.4.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.31.12.1 25-Oct-2007  bouyer Sync with HEAD.
 1.31.8.1 06-Nov-2007  matt sync with HEAD
 1.31.6.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.32.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.32.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.34.4.2 11-Mar-2010  yamt sync with head
 1.34.4.1 16-May-2008  yamt sync with head.
 1.34.2.1 18-May-2008  yamt sync with head.
 1.35.12.2 12-Dec-2008  ad Checkpoint work in progress.
 1.35.12.1 11-Dec-2008  ad Checkpoint work in progress.
 1.38.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.39.8.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.39.4.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.2.1 12-Jun-2011  rmind sync with head
 1.41.4.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.41.4.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.41.2.2 22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.41.2.1 17-Apr-2012  yamt sync with head
 1.43.12.1 18-May-2014  rmind sync with head
 1.43.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.44.30.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.44.30.1 10-Jun-2019  christos Sync with HEAD
 1.45.2.3 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.45.2.2 04-May-2019  isaki Remove obsoleted methods in audio_hw_if.
- drain: is handled in audio upper layer now.
- mappage: is handled in audio upper layer now.
- setfd: no one uses and it's meaningless now.
 1.45.2.1 21-Apr-2019  isaki Adapt ad1848/cs4231 families to audio2.
 1.46.4.1 29-Feb-2020  ad Sync with head.
 1.47.8.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.48.2.1 13-May-2021  thorpej Sync with HEAD.
 1.49.6.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.13 23-Nov-2011  jmcneill 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.12 12-May-2009  cegger branches: 1.12.12; 1.12.14;
struct device * -> device_t, no functional changes intended.
 1.11 28-Apr-2008  martin branches: 1.11.12; 1.11.14;
Remove clause 3 and 4 from TNF licenses
 1.10 11-Dec-2005  christos branches: 1.10.70; 1.10.72; 1.10.74;
merge ktrace-lwp.
 1.9 14-Jan-2005  kent ansify and KNF
 1.8 10-Mar-2002  itohy branches: 1.8.12;
Add explicit support of OPL3-SA2 (YMF711).
Not well tested....
 1.7 26-Feb-2002  itohy 1. Change equalizer (treble, bass) to be ``flat'' if the values set at
the center position (128), so as to be compatible with other drivers.
The equalizer is enhancement only, and the values < 128 don't take
any effect.

Yeah, this causes spec change....
For equalization.treble and equalization.bass, the relation between
old and new value is

new_value = (old_value / 2) + 128.

(Note this does not apply to equalization.surround.)

2. Support ++ and -- of mixerctl(1) for stepping volume variables.

3. Fix problem where the chip is not powered up
when the mic input is unmuted.
 1.6 23-Mar-2000  thorpej branches: 1.6.4; 1.6.6; 1.6.8;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.5 27-Dec-1999  itohy - Unmuting an external input source (CD playback, line input, and speaker)
now prevents power down/save the device.
The external input sources are muted by default at initialization.
- Change "power.power.*" to "power.save.*". Sorry, spec change....
- Shorten tsleep(9) ident string for "ps l".
 1.4 05-Oct-1999  itohy branches: 1.4.2;
New ym driver.
1. Add power control to reduce power consumption.
The behavior can be controlled by mixerctl(1).
2. Add suspend/resume hook to keep the parameters.
Currently this includes CODEC and control registers but
does not include the DMA state. FIXME.
3. Support "opl at ym" and "mpu at ym" attachment.
Actually, this is required for power control.
4. Add support for the on-chip 3D enhancement hardware.
This includes bass/treble enhancement, wide stereo, and
the equalization mode. This can be controlled by mixerctl(1).
5. Make "audioctl -w play.gain=xxx" work like as
"mixerctl -w inputs.dac=xxx" and now it changes
the wave output volume correctly.
6. Support hardware master volume switches.
7. Change formula of calculating gain so that all the levels
should be used equally.
8. Change "audioctl name" to "OPL3-SA3" and "audioctl version"
to the version of the chip.
 1.3 23-Feb-1999  nathanw Update for minor changes in the ad1848 back end.
 1.2 25-Aug-1998  pk Split the AD1848 driver into MI (dev/ic/ad1848.c) and ISA parts.
 1.1 20-May-1998  augustss Add a Yamaha OPL3-SA3 driver and clean up all AD1848 drivers.
Submitted by Constantine Sapuntzakis <csapuntz@reeducation-labor.lcs.mit.edu>
and originally written for OpenBSD.
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.6.6.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.6.6.1 28-Feb-2002  nathanw Catch up to -current.
 1.6.4.1 27-Mar-2002  he Pull up revisions 1.7-1.8 (via patch, requested by itohy):
Several changes to wss-compatible audio devices:
o Fix ADPCM playback/recording
o Add explicit support for OPL3-SA2 (YMF711), fixes PR#14819
o Add AD1845 support
o other minor bugfixes and cleanups
 1.8.12.1 17-Jan-2005  skrll Sync with HEAD.
 1.10.74.2 16-May-2009  yamt sync with head
 1.10.74.1 16-May-2008  yamt sync with head.
 1.10.72.1 18-May-2008  yamt sync with head.
 1.10.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.14.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.11.12.2 12-Dec-2008  ad Checkpoint work in progress.
 1.11.12.1 11-Dec-2008  ad Checkpoint work in progress.
 1.12.14.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.12.12.1 17-Apr-2012  yamt sync with head

RSS XML Feed