Home | History | Annotate | only in /src/sys/dev/sun
History log of /src/sys/dev/sun
RevisionDateAuthorComments
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 20-Jun-2005  thorpej Install eeprom.h and idprom.h
 1.8 06-May-2002  lukem branches: 1.8.10;
Replace <dev/sun/sun_boot.h> with <sys/bootinfo.h>, which is intended
to be more generic than ``bbinfo definitions for Sun-based systems''.
Other platforms can store bbinfo-style information here, and possibly
other platform-specific boot information that needs to be accessible
by foriegn platforms in tools such as /usr/sbin/installboot.
 1.7 24-Apr-2002  lukem Add <dev/sun/sun_boot.h>, which contains common boot block stuff for
Sun based systems.
 1.6 22-Mar-2002  fredette Added Sun common kbd_reg.h, kbio.h, and vuid_event.h files.
 1.5 11-Apr-2001  jdolecek branches: 1.5.2;
Put back all header files defining ioctls
 1.4 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.3 20-Aug-2000  pk branches: 1.3.2;
Move fbio.h and fbvar.h here.
 1.2 20-Jun-1998  mrg branches: 1.2.14;
add <dev/sun/disklabel.h>
 1.1 12-Jun-1998  cgd 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.2.14.2 21-Apr-2001  bouyer Sync with HEAD
 1.2.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.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.3.2.3 04-May-2002  thorpej Update from trunk.
 1.3.2.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.5.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15 13-Nov-2010  uebayasi 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.14 12-Sep-2009  tsutsui branches: 1.14.4;
Remove an extra parenthesis in #ifdef'ed out part. PR kern/41858
 1.13 18-Apr-2009  tsutsui Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
 1.12 18-Mar-2009  cegger bcopy -> memcpy
 1.11 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.10 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.9 11-Dec-2005  christos branches: 1.9.74; 1.9.84; 1.9.90;
merge ktrace-lwp.
 1.8 13-Nov-2003  chs eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
 1.7 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.6 24-Aug-2003  uwe #include "opt_rcons.h"
 1.5 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.4 04-Sep-2002  itojun branches: 1.4.6;
correct integer overrun
 1.3 06-Aug-2002  itojun integer overflow. from silvio@qualys.com
 1.2 13-Nov-2001  lukem branches: 1.2.8; 1.2.10;
add RCSIDs
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 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 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.1.4.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.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.1.2.1 20-Aug-2000  bouyer file bt_subr.c was added on branch thorpej_scsipi on 2000-11-20 11:43:08 +0000
 1.2.10.2 04-Sep-2002  lukem Pull up revision 1.4 (requested by itojun in ticket #768):
correct integer overrun
 1.2.10.1 07-Aug-2002  lukem Pull up revision 1.3 (requested by itojun in ticket #616):
integer overflow. from silvio@qualys.com
 1.2.8.1 29-Aug-2002  gehenna catch up with -current.
 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.9.90.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.84.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.74.2 16-Sep-2009  yamt sync with head
 1.9.74.1 04-May-2009  yamt sync with head.
 1.14.4.1 05-Mar-2011  rmind sync with head
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 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.1 20-Aug-2000  pk branches: 1.1.2; 1.1.26;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.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.1.2.1 20-Aug-2000  bouyer file btreg.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 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.1 20-Aug-2000  pk branches: 1.1.2; 1.1.26;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.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.1.2.1 20-Aug-2000  bouyer file btvar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.39 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.38 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.37 24-Apr-2021  thorpej branches: 1.37.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.36 21-Jan-2019  macallan branches: 1.36.14;
apply patches from PR 49639
compile tested only for lack of hardware
 1.35 21-Apr-2016  macallan branches: 1.35.16; 1.35.18;
RASTERCONSOLE is gone, wsdisplay no longer optional
 1.34 25-Jul-2014  dholland branches: 1.34.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.33 16-Mar-2014  dholland branches: 1.33.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.32 20-Feb-2014  joerg Call memset in a loop, not loop around doing nothing and calling memset
once.
 1.31 02-Dec-2013  jdc Only write to the framebuffer memory 32 bits at a time. If we try to write
larger amounts, we will generate SER_WRITE|SER_SZERR with P4 framebuffers.
(Writing 64 bits at a time is the default with memset().)
Also, set the default attributes to zero to avoid vertical stripes from
uninitialised defattr.
XXX; screen is still not cleared of old text.
 1.30 11-Jan-2012  macallan branches: 1.30.6; 1.30.10;
use rasops_init(0,0)
 1.29 10-May-2010  tsutsui branches: 1.29.8; 1.29.12;
Make this compile on sparc64.
 1.28 19-Sep-2009  tsutsui branches: 1.28.2; 1.28.4;
Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.27 19-Sep-2009  tsutsui Split device_t/softc.
Tested on TME emulating SS2.

XXX: bwtwo at obmem on TME emulating sun2 didn't match and cannot test
 1.26 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.25 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.24 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.23 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.22 23-Feb-2009  jdc Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:

Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.21 01-Jan-2009  jdc branches: 1.21.2;
Back out previous and clear the screen directly.
Pointed out by macallan@.
 1.20 29-Dec-2008  jdc Clear the screen (via rasops) when attaching.
Pointed out by Bill Green on port-sparc.
 1.19 05-Dec-2008  jdc Add wscons/vcons support for bw2 (sbus and P4).
 1.18 11-Jun-2008  drochner branches: 1.18.2; 1.18.4; 1.18.6;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.17 28-Apr-2008  martin branches: 1.17.2; 1.17.4;
Remove clause 3 and 4 from TNF licenses
 1.16 05-Apr-2008  cegger branches: 1.16.2; 1.16.4;
use aprint_*_dev and device_xname
 1.15 04-Mar-2007  christos branches: 1.15.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 11-Dec-2005  christos branches: 1.14.26;
merge ktrace-lwp.
 1.13 03-Jun-2005  tsutsui branches: 1.13.2;
Add const.
 1.12 04-Dec-2003  keihan NetBSD.ORG -> NetBSD.org

Now all "NetBSD.ORG" are gone from src/sys.
 1.11 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.10 24-Aug-2003  uwe #include "opt_rcons.h"
 1.9 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.8 29-Jun-2003  fvdl branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.6 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.5 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.4 13-Nov-2001  lukem branches: 1.4.8;
add RCSIDs
 1.3 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.2 20-Aug-2000  pk branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
<machine/fbio.h> -> <dev/sun/fbio.h>
 1.1 20-Aug-2000  pk Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.2.8.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.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.6.3 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.2.6.2 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.4 11-Nov-2002  nathanw Catch up to -current
 1.2.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.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.2.2.1 20-Aug-2000  bouyer file bwtwo.c was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.4.8.1 16-May-2002  gehenna Add the character device switch.
 1.8.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.4 04-Feb-2005  skrll Adapt to branch.
 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.13.2.2 03-Sep-2007  yamt sync with head.
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.14.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.36.3 17-Jan-2009  mjf Sync with HEAD.
 1.15.36.2 29-Jun-2008  mjf Sync with HEAD.
 1.15.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.16.4.5 11-Aug-2010  yamt sync with head.
 1.16.4.4 11-Mar-2010  yamt sync with head
 1.16.4.3 16-May-2009  yamt sync with head
 1.16.4.2 04-May-2009  yamt sync with head.
 1.16.4.1 16-May-2008  yamt sync with head.
 1.16.2.2 17-Jun-2008  yamt sync with head.
 1.16.2.1 18-May-2008  yamt sync with head.
 1.17.4.1 18-Jun-2008  simonb Sync with head.
 1.17.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.18.6.4 26-Feb-2009  snj Pull up following revision(s) (requested by jdc in ticket #494):
sys/dev/sun/bwtwo.c: revision 1.22
sys/dev/sun/bwtwovar.h: revision 1.8
sys/dev/sun/cgthree.c: revision 1.20
sys/dev/sun/cgthreevar.h: revision 1.7
Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.18.6.3 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.21
sys/dev/sun/cgthree.c: revision 1.19
Back out previous and clear the screen directly.
Pointed out by macallan@.
 1.18.6.2 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.20
sys/dev/sun/cgthree.c: revision 1.18
Clear the screen (via rasops) when attaching.
Pointed out by Bill Green on port-sparc.
 1.18.6.1 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.19
sys/dev/sun/bwtwovar.h: revision 1.7
sys/dev/sun/files.sun: revision 1.16
Add wscons/vcons support for bw2 (sbus and P4).
 1.18.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.18.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.18.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.18.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.21.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.4.1 30-May-2010  rmind sync with head
 1.28.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.29.12.1 18-Feb-2012  mrg merge to -current.
 1.29.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.29.8.1 17-Apr-2012  yamt sync with head
 1.30.10.1 18-May-2014  rmind sync with head
 1.30.6.2 03-Dec-2017  jdolecek update from HEAD
 1.30.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.2.1 10-Aug-2014  tls Rebase.
 1.34.4.1 22-Apr-2016  skrll Sync with HEAD
 1.35.18.1 10-Jun-2019  christos Sync with HEAD
 1.35.16.1 26-Jan-2019  pgoyette Sync with HEAD
 1.36.14.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.37.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 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.1 20-Aug-2000  pk branches: 1.1.2; 1.1.26;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.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.1.2.1 20-Aug-2000  bouyer file bwtworeg.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.9 19-Sep-2009  tsutsui Split device_t/softc.
Tested on TME emulating SS2.

XXX: bwtwo at obmem on TME emulating sun2 didn't match and cannot test
 1.8 23-Feb-2009  jdc Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:

Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.7 05-Dec-2008  jdc branches: 1.7.4;
Add wscons/vcons support for bw2 (sbus and P4).
 1.6 28-Apr-2008  martin branches: 1.6.6; 1.6.8; 1.6.10;
Remove clause 3 and 4 from TNF licenses
 1.5 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 03-Jun-2005  tsutsui Add const.
 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 11-Mar-2002  pk branches: 1.2.12;
`bus_type_t' is gone.
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.1.6.1 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.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.1.2.1 20-Aug-2000  bouyer file bwtwovar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.2.12.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.12.1 03-Aug-2004  skrll Sync with HEAD
 1.5.74.3 11-Mar-2010  yamt sync with head
 1.5.74.2 04-May-2009  yamt sync with head.
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.5.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.6.10.2 26-Feb-2009  snj Pull up following revision(s) (requested by jdc in ticket #494):
sys/dev/sun/bwtwo.c: revision 1.22
sys/dev/sun/bwtwovar.h: revision 1.8
sys/dev/sun/cgthree.c: revision 1.20
sys/dev/sun/cgthreevar.h: revision 1.7
Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.6.10.1 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.19
sys/dev/sun/bwtwovar.h: revision 1.7
sys/dev/sun/files.sun: revision 1.16
Add wscons/vcons support for bw2 (sbus and P4).
 1.6.8.2 03-Mar-2009  skrll Sync with HEAD.
 1.6.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.6.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.7.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.74 14-Apr-2025  macallan fix lazy cursor updates - no more artifacts when scrolling around
 1.73 19-Mar-2025  macallan don't set BUS_SPACCE_MAP_PREFETCHABLE - no known bus we can be connected to
supports it
 1.72 25-Sep-2022  thorpej branches: 1.72.10;
Remove unnecessary include of <sys/malloc.h>.
 1.71 28-Apr-2022  macallan be lazy about clearing the cursor - in most cases we're about to overwrite it
anyway. Same logic as with VCONS_DONT_READ.
visible speedup in things like systat and top
 1.70 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.69 24-Apr-2021  thorpej branches: 1.69.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.68 19-Jan-2019  macallan branches: 1.68.14;
allow font loading, resizing etc.
 1.67 21-Apr-2016  macallan branches: 1.67.16; 1.67.18;
RASTERCONSOLE is gone, wsdisplay no longer optional
 1.66 13-Apr-2016  macallan return correct parameters in ioctl(WSDISPLAYIO_GINFO), from lausgans
while there, support WSDISPLAYIO_GET_FBINFO
 1.65 25-Jul-2014  dholland branches: 1.65.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.64 16-Mar-2014  dholland branches: 1.64.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.63 03-Dec-2013  macallan - don't use defattr before it actually contains something useful
- clear the screen only once, when we know what colour to use
- set up the colour map only once, when we know which one to use
-> no more funky colour flashing while cgsix attaches on my U1
 1.62 12-Sep-2013  martin Simplify CG6_DRAW() and CG6_BLIT() macros so gcc 4.8.1 does not warn about
them - assembler looks good, but Michael, can you please test nevertheless?
 1.61 30-Jul-2013  macallan avoid uninitialized use of defattr
 1.60 13-Nov-2012  macallan branches: 1.60.2;
don't claim alpha font support unless we have enough off-screen memory to
cache a useful number of glyphs
this should probably be CPU speed dependent, most UltraSPARCs can likely
render anti-aliased fonts fast enough on the fly
 1.59 18-Jul-2012  macallan branches: 1.59.2;
wipe the glyph cache when re-entring terminal emulation mode
 1.58 13-Jul-2012  macallan wait for the blitter to go idle before trying to send another command
Apparently on some CG6 the GX_FULL bit is not a reliable indication wether the
engine is ready to accept another command ( LX onboard for example ) - might
be a hardware bug.
 1.57 12-Jul-2012  macallan support anti-aliased fonts
 1.56 11-Jul-2012  macallan don't wait for the blitter unless we want to send another command and the
pipeline is full
 1.55 11-Jul-2012  macallan don't set clipping parameters and such every time we send a blitter command
 1.54 10-Jul-2012  macallan perry some whitespace nits & remove some obsolete comments
no functional change
 1.53 10-Jul-2012  macallan magic number reduction, no functional change
 1.52 10-Jul-2012  macallan - re-initialize only when we're really going back to terminal emulation
- don't try to redraw a non-existing screen
- don't try to mmap sbus ranges through /dev/ttyE*
 1.51 11-Jan-2012  macallan use rasops_init(0,0)
 1.50 23-Nov-2010  mrg branches: 1.50.8; 1.50.12;
add support for WSDISPLAYIO_LINEBYTES. mostly from macallan.
 1.49 13-Nov-2010  uebayasi 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 14-Sep-2010  macallan don't muck with the screen description if we're not the console, for some
reason this leads to a NULL jump later on, at least on sparc64
should fix PR43873
 1.47 04-May-2010  macallan use box drawing font if needed
 1.46 19-Sep-2009  tsutsui branches: 1.46.2; 1.46.4;
Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.45 20-Aug-2009  macallan call vcons_replay_msgbuf() when appropriate
 1.44 20-Feb-2009  martin Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.43 01-Jan-2009  jdc branches: 1.43.2;
Back out previous and clear the screen directly.
Pointed out by macallan@.
 1.42 29-Dec-2008  jdc On old chip revisions, clear the screen using rasops when attaching.
 1.41 22-Dec-2008  macallan make this compile again with NWSDISPLAY==0
 1.40 13-Dec-2008  mrg remove unused variable.
 1.39 12-Dec-2008  macallan device_t-ification
 1.38 11-Jun-2008  drochner branches: 1.38.4; 1.38.6;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.37 28-Apr-2008  martin branches: 1.37.2; 1.37.4;
Remove clause 3 and 4 from TNF licenses
 1.36 05-Apr-2008  cegger branches: 1.36.2; 1.36.4;
use aprint_*_dev and device_xname
 1.35 19-Oct-2007  ad branches: 1.35.16;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.34 04-Mar-2007  christos branches: 1.34.2; 1.34.14; 1.34.16; 1.34.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.33 16-Oct-2006  macallan branches: 1.33.4;
use vcons.
Works fine on sparc64, needs testing on sparc.
 1.32 15-Oct-2006  martin Add some initializers
 1.31 15-Apr-2006  jmmv branches: 1.31.8; 1.31.10;
Remove the getwschar and putwschar accessops from wsdisplay drivers as
requested by uwe@. These were wrong because they were receiving an
emulcookie yet they were accessops (thus having to receive an accesscookie).
Instead, just handle the WSDISPLAYIO_{GET,PUT}WSCHAR ioctls from the
driver's ioctl accessop.

As this reduces the amount of code needed to handle these operations to
two small functions in each driver, remove the WSDISPLAY_CHARFUNCS kernel
option.

Reviewed by, at least, uwe@ and macallan@. No objections in tech-kern@.
 1.30 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.29 12-Dec-2005  christos branches: 1.29.4; 1.29.6; 1.29.8; 1.29.10; 1.29.12;
welcome to the new lwp world.
 1.28 11-Dec-2005  christos merge ktrace-lwp.
 1.27 28-Jun-2005  macallan branches: 1.27.2;
deal with more than one cgsix, make sure to get things right even when none
of them is the console.
 1.26 21-Jun-2005  thorpej Fix mis-placed newline.
 1.25 04-Jun-2005  tsutsui Add const.
 1.24 22-May-2005  macallan fixed a typo in cg6_ras_do_cursor and made using the blitter to draw the
cursor optional when using RASTERCONSOLE
 1.23 16-May-2005  macallan Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.22 14-Mar-2005  martin branches: 1.22.2;
KNF
 1.21 03-Mar-2005  martin Fix a conditional: sparc's will use the raster ops via RASTERCONSOL
 1.20 03-Mar-2005  martin Make it (at least) compile w/o wsdisplay @ cgsix.
Pointed out by Juergen Hannken-Illjes.
 1.19 27-Feb-2005  perry nuke trailing whitespace
 1.18 25-Feb-2005  martin From Micahel Lorenz: wsdisplay support for cg6
 1.17 13-Feb-2004  wiz branches: 1.17.8; 1.17.10;
Uppercase CPU, plural is CPUs.
 1.16 13-Nov-2003  chs eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
 1.15 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.14 24-Aug-2003  uwe #include "opt_rcons.h"
 1.13 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.12 29-Jun-2003  fvdl branches: 1.12.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.10 18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9 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.8 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.7 13-Nov-2001  lukem branches: 1.7.8;
add RCSIDs
 1.6 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.5 10-Jan-2001  tsutsui branches: 1.5.2; 1.5.4; 1.5.6;
Initialize the FBC mode register in cg6attach().
Values are taken from sunGX.[ch] in xsrc.

Now RASTERCONSOLE works properly on my SS1+ with old 2-slot sbus cg6.
 1.4 05-Nov-2000  chs branches: 1.4.2;
fix types in debug code.
 1.3 26-Aug-2000  eeh Don't bcopy() from luserland.
 1.2 26-Aug-2000  eeh Make 64-bit clean.
 1.1 20-Aug-2000  pk Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.4.2.4 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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 05-Nov-2000  bouyer file cgsix.c was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.5.6.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.5.6.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.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.5.4.3 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.5.4.2 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.5.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.2.6 11-Nov-2002  nathanw Catch up to -current
 1.5.2.5 17-Sep-2002  nathanw Catch up to -current.
 1.5.2.4 23-Aug-2002  petrov compile with DEBUG option.
 1.5.2.3 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.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.7.8.1 16-May-2002  gehenna Add the character device switch.
 1.12.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.12.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.12.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.17.8.1 29-Apr-2005  kent sync with -current
 1.22.2.2 24-Mar-2006  riz Pull up following revision(s) (requested by macallan in ticket #1220):
sys/dev/sun/cgsix.c: revision 1.24
fixed a typo in cg6_ras_do_cursor and made using the blitter to draw the
cursor optional when using RASTERCONSOLE
 1.22.2.1 08-Jun-2005  tron Pull up revision 1.23 (requested by martin in ticket #378):
Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.27.2.4 27-Oct-2007  yamt sync with head.
 1.27.2.3 03-Sep-2007  yamt sync with head.
 1.27.2.2 30-Dec-2006  yamt sync with head.
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.29.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.29.10.1 19-Apr-2006  elad sync with head.
 1.29.8.1 24-May-2006  yamt sync with head.
 1.29.6.1 22-Apr-2006  simonb Sync with head.
 1.29.4.1 09-Sep-2006  rpaulo sync with head
 1.31.10.1 22-Oct-2006  yamt sync with head
 1.31.8.1 18-Nov-2006  ad Sync with head.
 1.33.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.34.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.34.16.1 06-Nov-2007  matt sync with HEAD
 1.34.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.34.2.1 23-Oct-2007  ad Sync with head.
 1.35.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.35.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.35.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.36.4.6 09-Oct-2010  yamt sync with head
 1.36.4.5 11-Aug-2010  yamt sync with head.
 1.36.4.4 11-Mar-2010  yamt sync with head
 1.36.4.3 16-Sep-2009  yamt sync with head
 1.36.4.2 04-May-2009  yamt sync with head.
 1.36.4.1 16-May-2008  yamt sync with head.
 1.36.2.2 17-Jun-2008  yamt sync with head.
 1.36.2.1 18-May-2008  yamt sync with head.
 1.37.4.1 18-Jun-2008  simonb Sync with head.
 1.37.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.38.6.7 18-Oct-2009  bouyer Back out ticket 978
 1.38.6.6 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #978):
sys/dev/sun/cgsix.c: revision 1.45
call vcons_replay_msgbuf() when appropriate
 1.38.6.5 02-Mar-2009  snj branches: 1.38.6.5.4;
Pull up following revision(s) (requested by jdc in ticket #525):
sys/dev/sun/cgsix.c: revision 1.43
Back out previous and clear the screen directly.
Pointed out by macallan@.
 1.38.6.4 02-Mar-2009  snj Pull up following revision(s) (requested by jdc in ticket #525):
sys/dev/sun/cgsix.c: revision 1.42
On old chip revisions, clear the screen using rasops when attaching.
 1.38.6.3 26-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #486):
sys/dev/sun/cgsix.c: revision 1.44 via patch
sys/dev/sun/cgsixvar.h: revision 1.12
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.38.6.2 29-Dec-2008  jdc Back out revision 1.38.6.1.
 1.38.6.1 29-Dec-2008  jdc On old chip revisions, clear the screen using rasops when attaching.
 1.38.6.5.4.1 21-Apr-2010  matt sync to netbsd-5
 1.38.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.38.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.43.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.46.4.2 05-Mar-2011  rmind sync with head
 1.46.4.1 30-May-2010  rmind sync with head
 1.46.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.46.2.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.50.12.1 18-Feb-2012  mrg merge to -current.
 1.50.8.4 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.50.8.3 16-Jan-2013  yamt sync with (a bit old) head
 1.50.8.2 30-Oct-2012  yamt sync with head
 1.50.8.1 17-Apr-2012  yamt sync with head
 1.59.2.3 03-Dec-2017  jdolecek update from HEAD
 1.59.2.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.60.2.2 18-May-2014  rmind sync with head
 1.60.2.1 28-Aug-2013  rmind sync with head
 1.64.2.1 10-Aug-2014  tls Rebase.
 1.65.4.1 22-Apr-2016  skrll Sync with HEAD
 1.67.18.1 10-Jun-2019  christos Sync with HEAD
 1.67.16.1 26-Jan-2019  pgoyette Sync with HEAD
 1.68.14.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.69.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.72.10.1 02-Aug-2025  perseant Sync with HEAD
 1.10 28-May-2013  macallan add a bunch of register definitions and clarify some comments
 1.9 10-Jul-2012  macallan branches: 1.9.2;
add some register definitions from xf86-video-suncg6
 1.8 16-Oct-2006  macallan branches: 1.8.88;
use vcons.
Works fine on sparc64, needs testing on sparc.
 1.7 11-Dec-2005  christos branches: 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 16-May-2005  macallan branches: 1.6.2;
Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.5 07-Aug-2003  agc branches: 1.5.14;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 10-Jan-2001  tsutsui branches: 1.4.24;
Get rid of (unintentionally added) ^M.
 1.3 10-Jan-2001  tsutsui Initialize the FBC mode register in cg6attach().
Values are taken from sunGX.[ch] in xsrc.

Now RASTERCONSOLE works properly on my SS1+ with old 2-slot sbus cg6.
 1.2 26-Aug-2000  eeh branches: 1.2.2;
Make 64-bit clean.
 1.1 20-Aug-2000  pk Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.2.2.3 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.2.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.2.2.1 26-Aug-2000  bouyer file cgsixreg.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.4.24.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.24.1 03-Aug-2004  skrll Sync with HEAD
 1.5.14.1 08-Jun-2005  tron Pull up revision 1.6 (requested by martin in ticket #378):
Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.6.2.1 30-Dec-2006  yamt sync with head.
 1.7.22.1 22-Oct-2006  yamt sync with head
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.8.88.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.8.88.1 30-Oct-2012  yamt sync with head
 1.9.2.1 23-Jun-2013  tls resync from head
 1.14 21-Apr-2016  macallan RASTERCONSOLE is gone, wsdisplay no longer optional
 1.13 12-Jul-2012  macallan branches: 1.13.2; 1.13.16;
support anti-aliased fonts
 1.12 20-Feb-2009  martin branches: 1.12.12;
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.11 22-Dec-2008  macallan branches: 1.11.2;
make this compile again with NWSDISPLAY==0
 1.10 12-Dec-2008  macallan device_t-ification
 1.9 28-Apr-2008  martin branches: 1.9.8; 1.9.10;
Remove clause 3 and 4 from TNF licenses
 1.8 16-Oct-2006  macallan branches: 1.8.48; 1.8.50; 1.8.52;
use vcons.
Works fine on sparc64, needs testing on sparc.
 1.7 11-Dec-2005  christos branches: 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 04-Jun-2005  tsutsui branches: 1.6.2;
Add const.
 1.5 16-May-2005  macallan Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.4 01-Oct-2002  thorpej branches: 1.4.6; 1.4.20;
Remove unused extern decl of cgsix_sbus_ca.
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 11-Mar-2002  pk `bus_type_t' is gone.
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 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 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.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.1.2.1 20-Aug-2000  bouyer file cgsixvar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.4.20.1 08-Jun-2005  tron Pull up revision 1.5 (requested by martin in ticket #378):
Added support for virtual consoles, colour and some code to determine the
usable amount of VRAM for XFree86
 1.4.6.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.2.1 30-Dec-2006  yamt sync with head.
 1.7.22.1 22-Oct-2006  yamt sync with head
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.8.52.2 04-May-2009  yamt sync with head.
 1.8.52.1 16-May-2008  yamt sync with head.
 1.8.50.1 18-May-2008  yamt sync with head.
 1.8.48.2 17-Jan-2009  mjf Sync with HEAD.
 1.8.48.1 02-Jun-2008  mjf Sync with HEAD.
 1.9.10.1 26-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #486):
sys/dev/sun/cgsix.c: revision 1.44 via patch
sys/dev/sun/cgsixvar.h: revision 1.12
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.9.8.2 03-Mar-2009  skrll Sync with HEAD.
 1.9.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.12.12.1 30-Oct-2012  yamt sync with head
 1.13.16.1 22-Apr-2016  skrll Sync with HEAD
 1.13.2.1 03-Dec-2017  jdolecek update from HEAD
 1.36 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.35 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.34 24-Apr-2021  thorpej branches: 1.34.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.33 09-Nov-2016  macallan branches: 1.33.32;
- use bus_space_mmap()
- pass the right colour depth in ioctl()
should fix PR49639
 1.32 21-Apr-2016  macallan branches: 1.32.2;
RASTERCONSOLE is gone, wsdisplay no longer optional
 1.31 25-Jul-2014  dholland branches: 1.31.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.30 16-Mar-2014  dholland branches: 1.30.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.29 11-Jan-2012  macallan branches: 1.29.6; 1.29.10;
use rasops_init(0,0)
 1.28 14-Sep-2010  macallan branches: 1.28.8; 1.28.12;
clear the screen when attaching, not when adding screens since that may
happen much later
while there, call vcons_replay_msgbuf()
 1.27 14-Sep-2010  macallan leave the screen description alone when we're not the console in order to
avoid a NULL deref later on ( which only happens on sparc64 for some reason )
While there, use VCONS_DONT_READ
 1.26 25-Nov-2009  macallan branches: 1.26.2; 1.26.4;
make this compile on sparc64
 1.25 19-Sep-2009  tsutsui Include "ioconf.h" instead of extern struct cfdriver foo_cd decls.
 1.24 18-Sep-2009  tsutsui Split device_t/softc. Tested on SS1+.

XXX: sparc/dev/cgthree.c in Attic had an attachment for cgthree* at obio?
XXX: and sparc/conf/files.sparc still has an entry of nonexistent (or not yet)
XXX: sparc/dev/cgthree_obio.c. Is there any sun4m machine which requires it?
 1.23 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.22 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.21 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.20 23-Feb-2009  jdc Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:

Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.19 01-Jan-2009  jdc branches: 1.19.2;
Back out previous and clear the screen directly.
Pointed out by macallan@.
 1.18 29-Dec-2008  jdc Clear the screen (via rasops) when attaching.
Pointed out by Bill Green on port-sparc.
 1.17 28-Nov-2008  jdc Add wscons/vcons support for cg3.
 1.16 11-Jun-2008  drochner branches: 1.16.2; 1.16.4; 1.16.6;
mechanical changes to use device_private() or device_lookup_private()
to get softcs, makes the code compile under the stricter type checking
introduced earlier today
 1.15 28-Apr-2008  martin branches: 1.15.2; 1.15.4;
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 04-Mar-2007  christos branches: 1.13.2; 1.13.14; 1.13.16; 1.13.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 11-Dec-2005  christos branches: 1.12.26;
merge ktrace-lwp.
 1.11 04-Jun-2005  tsutsui branches: 1.11.2;
Add const.
 1.10 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.9 24-Aug-2003  uwe #include "opt_rcons.h"
 1.8 29-Jun-2003  fvdl branches: 1.8.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.7 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.6 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.5 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.4 13-Nov-2001  lukem branches: 1.4.8;
add RCSIDs
 1.3 24-Sep-2001  eeh Change bus_space_mmap() signature to the official one.
 1.2 20-Aug-2000  pk branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8;
Move declaration up, before it is used.
 1.1 20-Aug-2000  pk Split & move cgthree from arch/sparc.
 1.2.8.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.2.8.1 01-Oct-2001  fvdl Catch up with -current.
 1.2.6.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.6.3 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.2.6.2 28-Jun-2002  jdolecek prove kqfilter hook; it's very simple equivalent of seltrue()
 1.2.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.4.4 11-Nov-2002  nathanw Catch up to -current
 1.2.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.2.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.1 26-Sep-2001  nathanw Catch up to -current.
Again.
 1.2.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.2.2.1 20-Aug-2000  bouyer file cgthree.c was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.4.8.1 16-May-2002  gehenna Add the character device switch.
 1.8.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.8.2.4 04-Feb-2005  skrll Adapt to branch.
 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.2.3 27-Oct-2007  yamt sync with head.
 1.11.2.2 03-Sep-2007  yamt sync with head.
 1.11.2.1 21-Jun-2006  yamt sync with head.
 1.12.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.20.1 25-Oct-2007  bouyer Sync with HEAD.
 1.13.16.1 06-Nov-2007  matt sync with HEAD
 1.13.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.13.2.1 23-Oct-2007  ad Sync with head.
 1.14.20.5 09-Oct-2010  yamt sync with head
 1.14.20.4 11-Mar-2010  yamt 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.2 17-Jun-2008  yamt sync with head.
 1.14.18.1 18-May-2008  yamt sync with head.
 1.14.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.14.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.14.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.4.1 18-Jun-2008  simonb Sync with head.
 1.15.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.16.6.4 26-Feb-2009  snj Pull up following revision(s) (requested by jdc in ticket #494):
sys/dev/sun/bwtwo.c: revision 1.22
sys/dev/sun/bwtwovar.h: revision 1.8
sys/dev/sun/cgthree.c: revision 1.20
sys/dev/sun/cgthreevar.h: revision 1.7
Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.16.6.3 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.21
sys/dev/sun/cgthree.c: revision 1.19
Back out previous and clear the screen directly.
Pointed out by macallan@.
 1.16.6.2 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.20
sys/dev/sun/cgthree.c: revision 1.18
Clear the screen (via rasops) when attaching.
Pointed out by Bill Green on port-sparc.
 1.16.6.1 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/cgthree.c: revision 1.17
sys/dev/sun/cgthreevar.h: revision 1.6
sys/dev/sun/files.sun: revision 1.15
Add wscons/vcons support for cg3.
 1.16.4.3 28-Apr-2009  skrll Sync with HEAD.
 1.16.4.2 03-Mar-2009  skrll Sync with HEAD.
 1.16.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.19.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.26.4.1 05-Mar-2011  rmind sync with head
 1.26.2.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.28.12.1 18-Feb-2012  mrg merge to -current.
 1.28.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.28.8.1 17-Apr-2012  yamt sync with head
 1.29.10.1 18-May-2014  rmind sync with head
 1.29.6.2 03-Dec-2017  jdolecek update from HEAD
 1.29.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.2.1 10-Aug-2014  tls Rebase.
 1.31.4.2 05-Dec-2016  skrll Sync with HEAD
 1.31.4.1 22-Apr-2016  skrll Sync with HEAD
 1.32.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.33.32.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.34.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 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.1 20-Aug-2000  pk branches: 1.1.2; 1.1.26;
Split & move cgthree from arch/sparc.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.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.1.2.1 20-Aug-2000  bouyer file cgthreereg.h was added on branch thorpej_scsipi on 2000-11-20 11:43:09 +0000
 1.8 18-Sep-2009  tsutsui Split device_t/softc. Tested on SS1+.

XXX: sparc/dev/cgthree.c in Attic had an attachment for cgthree* at obio?
XXX: and sparc/conf/files.sparc still has an entry of nonexistent (or not yet)
XXX: sparc/dev/cgthree_obio.c. Is there any sun4m machine which requires it?
 1.7 23-Feb-2009  jdc Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:

Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.6 28-Nov-2008  jdc branches: 1.6.4;
Add wscons/vcons support for cg3.
 1.5 28-Apr-2008  martin branches: 1.5.6; 1.5.8; 1.5.10;
Remove clause 3 and 4 from TNF licenses
 1.4 11-Dec-2005  christos branches: 1.4.70; 1.4.72; 1.4.74;
merge ktrace-lwp.
 1.3 04-Jun-2005  tsutsui Add const.
 1.2 11-Mar-2002  pk branches: 1.2.12;
`bus_type_t' is gone.
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6;
Split & move cgthree from arch/sparc.
 1.1.6.1 16-Mar-2002  jdolecek Catch up with -current.
 1.1.4.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.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.1.2.1 20-Aug-2000  bouyer file cgthreevar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:10 +0000
 1.2.12.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.74.3 11-Mar-2010  yamt sync with head
 1.4.74.2 04-May-2009  yamt sync with head.
 1.4.74.1 16-May-2008  yamt sync with head.
 1.4.72.1 18-May-2008  yamt sync with head.
 1.4.70.2 17-Jan-2009  mjf Sync with HEAD.
 1.4.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.10.2 26-Feb-2009  snj Pull up following revision(s) (requested by jdc in ticket #494):
sys/dev/sun/bwtwo.c: revision 1.22
sys/dev/sun/bwtwovar.h: revision 1.8
sys/dev/sun/cgthree.c: revision 1.20
sys/dev/sun/cgthreevar.h: revision 1.7
Mimic cgsix memory corruption fix (bwtwo and cgthree wscons code is
based on cgsix). Original commit message:
Include wsdisplay.h directly in the header to avoid different sizes
of cgsix_softc depending on proper previous includes by the includer
due to #ifdef NWSDISPLAY. Thanks to kmem poison check and DEBUG kernels.
 1.5.10.1 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/cgthree.c: revision 1.17
sys/dev/sun/cgthreevar.h: revision 1.6
sys/dev/sun/files.sun: revision 1.15
Add wscons/vcons support for cg3.
 1.5.8.2 03-Mar-2009  skrll Sync with HEAD.
 1.5.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.6.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6 26-Sep-2015  christos avoid conflicts with our own ioctls
 1.5 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.4 11-Dec-2005  christos branches: 1.4.120; 1.4.140;
merge ktrace-lwp.
 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 22-Aug-1998  mrg branches: 1.2.46;
make "struct sun_dkpart" the same for sparc/sparc64 (sparc64 must have been broken?)
 1.1 20-Jun-1998  mrg add <dev/sun/disklabel.h>
 1.2.46.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.46.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.46.1 03-Aug-2004  skrll Sync with HEAD
 1.4.140.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.4.140.1 22-Sep-2015  skrll Sync with HEAD
 1.4.120.1 03-Dec-2017  jdolecek update from HEAD
 1.17 03-May-2020  jdc If the sector size is 0, return early in readdisklabel().
Prevents a panic trying to use a 0-sized buffer, which can happen if we run
(e.g.) `scsictl /dev/cd0c identify` with no medium in the CD drive.
 1.16 03-Apr-2019  christos branches: 1.16.4;
centralize setdisklabel(9)
 1.15 26-Feb-2017  martin branches: 1.15.14;
Disks without a disk label happen in normal operation (both as USB
stick or with GPT), so do not cause an error message when opening
them.
 1.14 23-Mar-2010  martin branches: 1.14.18; 1.14.36; 1.14.40; 1.14.44;
Properly convert values according to block size differences between the
underlying device (might be a CD drive) and the sun label when carrying
over defaults from a ISO9660 partition.
 1.13 16-Mar-2010  martin Do not overwrite a ISO9660 partition (which the sunlabel can not properly
represent, but the cd driver carefully crafted including session data).
This makes it possible to just mount cd0a as cd9660fs on a sparc* install
CD. Solution suggested by <mlelstv>.
 1.12 16-Mar-2009  dsl branches: 1.12.2; 1.12.4;
ANSIfy functions with function-pointer arguments
 1.11 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.10 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.9 08-Oct-2007  ad branches: 1.9.22; 1.9.30; 1.9.36;
brelse() stragglers.
 1.8 25-Nov-2006  scw branches: 1.8.22; 1.8.24; 1.8.26;
Replace the myriad copies of bounds_check_with_label() with a single MI
version.

Add disk_blocksize(9) so that disk drivers can record the physical
block size of a disk if it is different to DEV_BSIZE. Right now this
simply initialises dk_blkshift and dk_byteshift according to the
supplied block size. This information is used in the MI version of
bounds_check_with_label().
 1.7 11-Dec-2005  christos branches: 1.7.20; 1.7.22;
merge ktrace-lwp.
 1.6 31-May-2005  christos branches: 1.6.2;
add a missing const.
 1.5 30-May-2005  christos Add const.
 1.4 27-Feb-2005  perry nuke trailing whitespace
 1.3 04-Feb-2005  perry de-__P
 1.2 10-Dec-2003  jdolecek branches: 1.2.4; 1.2.10; 1.2.12;
Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt.
 1.1 15-Nov-2003  bouyer Commit changes proposed on tech-kern Thu, 6 Nov 2003
- factor out disksubr.c between sun3, sparc and sparc64. Keep the sun3
groveling code to find a NetBSD disklabel in the first sector (so that it
can find a label at the old sun3 LABELOFFSET) as a fallback is not
label at LABELOFFSET, or sun label is present.
- Fix the sun3 LABELOFFSET (was 64, but the kernel wrote the NetBSD label at
128)
- Make next68k disksubr.c always write a next-compatible disklabel.
- remove #ifdef __sparc__ hack from disklabel(8), and change it to issue
a DIOCWDINFO after writing the disklabel to the raw partition in the
-r/-I case (so that the kernel can convert the label if needed).
 1.2.12.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.2.12.1 12-Feb-2005  yamt sync with head.
 1.2.10.1 29-Apr-2005  kent sync with -current
 1.2.4.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.4.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.4.5 04-Feb-2005  skrll Sync with HEAD.
 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 10-Dec-2003  skrll file disksubr.c was added on branch ktrace-lwp on 2004-08-03 10:51:16 +0000
 1.6.2.2 27-Oct-2007  yamt sync with head.
 1.6.2.1 30-Dec-2006  yamt sync with head.
 1.7.22.1 10-Dec-2006  yamt sync with head.
 1.7.20.1 12-Jan-2007  ad Sync with head.
 1.8.26.1 14-Oct-2007  yamt sync with head.
 1.8.24.1 06-Nov-2007  matt sync with HEAD
 1.8.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.36.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.9.30.1 28-Apr-2009  skrll Sync with HEAD.
 1.9.22.2 11-Aug-2010  yamt sync with head.
 1.9.22.1 04-May-2009  yamt sync with head.
 1.12.4.1 30-May-2010  rmind sync with head
 1.12.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.14.44.1 21-Apr-2017  bouyer Sync with HEAD
 1.14.40.1 20-Mar-2017  pgoyette Sync with HEAD
 1.14.36.1 28-Aug-2017  skrll Sync with HEAD
 1.14.18.1 03-Dec-2017  jdolecek update from HEAD
 1.15.14.1 10-Jun-2019  christos Sync with HEAD
 1.16.4.1 04-May-2020  martin Pull up following revision(s) (requested by jdc in ticket #886):

sys/dev/sun/disksubr.c: revision 1.17

If the sector size is 0, return early in readdisklabel().
Prevents a panic trying to use a 0-sized buffer, which can happen if we run
(e.g.) `scsictl /dev/cd0c identify` with no medium in the CD drive.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.70; 1.2.72; 1.2.74;
merge ktrace-lwp.
 1.1 19-Jun-2005  thorpej branches: 1.1.8;
Move common Sun3/Sun4 EEPROM definitions in to <dev/sun/eeprom.h>
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 19-Jun-2005  skrll file eeprom.h was added on branch ktrace-lwp on 2005-11-10 14:08:05 +0000
 1.2.74.1 16-May-2008  yamt sync with head.
 1.2.72.1 18-May-2008  yamt sync with head.
 1.2.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.26 26-Sep-2021  thorpej Change the kqueue filterops::f_isfd field to filterops::f_flags, and
define a flag FILTEROP_ISFD that has the meaning of the prior f_isfd.
Field and flag name aligned with OpenBSD.

This does not constitute a functional or ABI change, as the field location
and size, and the value placed in that field, are the same as the previous
code, but we're bumping __NetBSD_Version__ so 3rd-party module source code
can adapt, as needed.

NetBSD 9.99.89
 1.25 18-Dec-2020  thorpej Use sel{record,remove}_knote().
 1.24 25-Oct-2017  maya branches: 1.24.18;
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.23 14-Mar-2009  dsl branches: 1.23.22;
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.22 01-Mar-2008  rmind branches: 1.22.4; 1.22.12; 1.22.18;
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.21 05-Dec-2007  pooka branches: 1.21.8; 1.21.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.20 04-Mar-2007  christos branches: 1.20.14; 1.20.16; 1.20.22; 1.20.24;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19 17-Feb-2007  pavel Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
 1.18 11-Dec-2005  christos branches: 1.18.26;
merge ktrace-lwp.
 1.17 27-Feb-2005  perry branches: 1.17.4;
nuke trailing whitespace
 1.16 04-Feb-2005  perry de-__P
 1.15 07-Aug-2003  agc branches: 1.15.8; 1.15.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.14 29-Jun-2003  fvdl branches: 1.14.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.13 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.12 26-Nov-2002  christos si_ -> sel_
 1.11 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.10 21-Oct-2002  uwe vuid_event.h is in dev/sun now.
 1.9 14-Jan-2002  tsutsui Call malloc(9) with M_ZERO flag instead of bzero() after malloc().
 1.8 13-Nov-2001  lukem add RCSIDs
 1.7 07-Jun-2001  mrg branches: 1.7.2;
LKM friendly: move ev_out32() to netbsd32 specific code; add an ev_out32 hook.
 1.6 22-Aug-2000  mrg branches: 1.6.2;
#include <compat/netbsd32/netbsd32.h> if necessary
 1.5 20-Aug-2000  eeh Add COMPAT_NETBSD32 support.
 1.4 30-Mar-2000  augustss branches: 1.4.4;
Remove register declarations.
 1.3 12-Sep-1996  mrg branches: 1.3.28;
update these for poll(2) changes.
 1.2 29-May-1996  pk branches: 1.2.2;
Add missing splx(), per Jason.
Also, change `"event_var"' to `<dev/sun/event_var.h>'.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.2.2.2 29-May-1996  pk Add missing splx(), per Jason.
Also, change `"event_var"' to `<dev/sun/event_var.h>'.
 1.2.2.1 29-May-1996  pk file event.c was added on branch netbsd-1-2 on 1996-05-29 21:24:42 +0000
 1.3.28.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.4.1 26-Aug-2000  mrg pull up 1.5. approved by thorpej:
>Add COMPAT_NETBSD32 support.
 1.6.2.7 11-Dec-2002  thorpej Sync with HEAD.
 1.6.2.6 11-Nov-2002  nathanw Catch up to -current
 1.6.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.6.2.4 28-Feb-2002  nathanw Catch up to -current.
 1.6.2.3 15-Nov-2001  pk Fix `curproc' usage.
 1.6.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.6.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.2.4 02-Oct-2002  jdolecek do not need the (void *) cast for kn_hook anymore
 1.7.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.7.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.1 12-Sep-2001  thorpej Add kqueue support (not compiled yet).
 1.14.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.14.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.15.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.15.10.1 12-Feb-2005  yamt sync with head.
 1.15.8.1 29-Apr-2005  kent sync with -current
 1.17.4.5 17-Mar-2008  yamt sync with head.
 1.17.4.4 07-Dec-2007  yamt sync with head
 1.17.4.3 03-Sep-2007  yamt sync with head.
 1.17.4.2 26-Feb-2007  yamt sync with head.
 1.17.4.1 21-Jun-2006  yamt sync with head.
 1.18.26.2 12-Mar-2007  rmind Sync with HEAD.
 1.18.26.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.20.24.1 08-Dec-2007  ad Sync with head.
 1.20.22.1 08-Dec-2007  mjf Sync with HEAD.
 1.20.16.2 23-Mar-2008  matt sync with HEAD
 1.20.16.1 09-Jan-2008  matt sync with HEAD
 1.20.14.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.21.12.1 03-Apr-2008  mjf Sync with HEAD.
 1.21.8.1 24-Mar-2008  keiichi sync with head.
 1.22.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.22.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.22.4.1 04-May-2009  yamt sync with head.
 1.23.22.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.14 24-May-2020  hannken Change proc_lock -> &proc_lock.
 1.13 24-Apr-2008  ad Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
be sent from a hardware interrupt handler. Signal activity must be
deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
 1.12 01-Mar-2008  rmind branches: 1.12.2;
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.11 04-Mar-2007  christos branches: 1.11.16; 1.11.32; 1.11.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.10 09-Feb-2007  ad branches: 1.10.2;
Merge newlock2 to head.
 1.9 11-Dec-2005  christos branches: 1.9.20;
merge ktrace-lwp.
 1.8 04-Feb-2005  perry branches: 1.8.6;
de-__P
 1.7 07-Aug-2003  agc branches: 1.7.8; 1.7.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 29-Jun-2003  fvdl branches: 1.6.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.5 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.4 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.3 07-Jun-2001  mrg branches: 1.3.2;
LKM friendly: move ev_out32() to netbsd32 specific code; add an ev_out32 hook.
 1.2 12-Sep-1996  mrg branches: 1.2.40;
update these for poll(2) changes.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.2.40.2 11-Nov-2002  nathanw Catch up to -current
 1.2.40.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.2 17-Jun-2002  jdolecek add ev_kqfilter() prototype
 1.3.2.1 12-Sep-2001  thorpej Add kqueue support (not compiled yet).
 1.6.2.5 04-Feb-2005  skrll Sync with HEAD.
 1.6.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 12-Feb-2005  yamt sync with head.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.8.6.4 17-Mar-2008  yamt sync with head.
 1.8.6.3 03-Sep-2007  yamt sync with head.
 1.8.6.2 26-Feb-2007  yamt sync with head.
 1.8.6.1 21-Jun-2006  yamt sync with head.
 1.9.20.1 19-Jan-2007  ad Acquire proclist_mutex before sending signals.
 1.10.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.36.2 02-Jun-2008  mjf Sync with HEAD.
 1.11.36.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.32.1 24-Mar-2008  keiichi sync with head.
 1.11.16.1 23-Mar-2008  matt sync with HEAD
 1.12.2.1 18-May-2008  yamt sync with head.
 1.37 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.36 21-Apr-2016  macallan branches: 1.36.18;
RASTERCONSOLE is gone, wsdisplay no longer optional
 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 11-Mar-2010  mrg branches: 1.33.10; 1.33.20; 1.33.24;
various aprint_* fixes.
 1.32 18-Mar-2009  cegger branches: 1.32.2;
bzero -> memset
 1.31 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 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 05-Apr-2008  cegger branches: 1.28.4; 1.28.12; 1.28.18;
use aprint_*_dev and device_xname
 1.27 04-Mar-2007  christos branches: 1.27.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 29-Jan-2007  hubertf branches: 1.26.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.25 15-Oct-2006  martin Missing initializer
 1.24 28-Mar-2006  thorpej branches: 1.24.8; 1.24.10;
Use device_unit().
 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 08-Oct-2005  macallan Fixes the following bug:
Framebuffer drivers use their own minor device number to find their device entry
in fbdriver methods ( like cgsix uses cgsix_cd[minor] ) but fb passed the fb
device's unit number which works only as long as all registered fb devices use
the same underlying driver. With different fb drivers, like a cgsix and an ffb, both will be (native) unit number 0 so with the old code /dev/fb1 would be
unusable.
 1.21 24-Jun-2005  jdc branches: 1.21.2;
Attach multiple displays as fb0, fb1, ... so that X can use multiple heads
via the /dev/fbn abstraction. Framebuffers are attached in probe order.
However, the previous semantics are kept, so that the detected or forced
console will always be fb0.
 1.20 04-Feb-2005  perry de-__P
 1.19 19-Mar-2004  pk branches: 1.19.8; 1.19.10;
fb_is_console/SUN4U: fbnode => prom_stdout_node.
 1.18 17-Mar-2004  pk Rename PROM_getprop*() => prom_getprop*().
 1.17 17-Mar-2004  pk Update previous change: set defaults properly.
 1.16 16-Mar-2004  pk Use prom_getoption() and drop home-grown string-to-integer conversion code.
 1.15 25-Aug-2003  uwe Undo previous as it broke things.

There are some scattered implicit RASTERCONSOLE dependencies,
so there should be a better way.
 1.14 24-Aug-2003  uwe #include "opt_rcons.h"
 1.13 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.12 29-Jun-2003  fvdl branches: 1.12.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.11 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.10 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.9 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.8 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.7 22-Mar-2002  fredette branches: 1.7.4;
Changed some preprocessor tests for SUN4 to test for !SUN4U
instead. Now this file can be used by the sun2 port.
 1.6 13-Nov-2001  lukem add RCSIDs
 1.5 12-Nov-2001  uwe In fb_bell call kbd_docmd only #if NKBD > 0.
This allows kernels without kbd at zs to be linked.
(JavaStation-1 does not have zs, it uses pckbc instead)
 1.4 26-Sep-2001  eeh branches: 1.4.2;
getprop* -> PROM_getprop*
 1.3 24-Jun-2001  pk branches: 1.3.2; 1.3.4;
Avoid unused variables if RASTERCONS_FULLSCREEN is defined. (see PR#13231)
 1.2 31-Oct-2000  pk branches: 1.2.2; 1.2.4;
fb_is_console(): we must match on the `fb' propery in a V0 PROMs root node
only after establishing that the PROM output device is a frame buffer device.
 1.1 23-Aug-2000  pk Common framebuffer functions.
(currently includes a special cased fb_isconsole() for sun4u).
 1.2.4.7 11-Nov-2002  nathanw Catch up to -current
 1.2.4.6 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.5 17-Sep-2002  nathanw Catch up to -current.
 1.2.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.3 14-Nov-2001  nathanw Catch up to -current.
 1.2.4.2 08-Oct-2001  nathanw Catch up to -current.
 1.2.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.2.2.3 22-Nov-2000  bouyer Sync with HEAD.
 1.2.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.2.2.1 31-Oct-2000  bouyer file fb.c was added on branch thorpej_scsipi on 2000-11-20 11:43:10 +0000
 1.3.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.4.1 01-Oct-2001  fvdl 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 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.3.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.7.4.1 16-May-2002  gehenna Add the character device switch.
 1.12.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.12.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.12.2.5 21-Sep-2004  skrll Adapt to branch.
 1.12.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.10.1 12-Feb-2005  yamt sync with head.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.21.2.4 03-Sep-2007  yamt sync with head.
 1.21.2.3 26-Feb-2007  yamt sync with head.
 1.21.2.2 30-Dec-2006  yamt sync with head.
 1.21.2.1 21-Jun-2006  yamt sync with head.
 1.23.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.23.10.1 19-Apr-2006  elad sync with head.
 1.23.8.1 01-Apr-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.24.10.1 22-Oct-2006  yamt sync with head
 1.24.8.2 01-Feb-2007  ad Sync with head.
 1.24.8.1 18-Nov-2006  ad Sync with head.
 1.26.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.36.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.12.1 28-Apr-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.32.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.33.24.1 18-May-2014  rmind sync with head
 1.33.20.2 03-Dec-2017  jdolecek update from HEAD
 1.33.20.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.10.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.34.2.1 10-Aug-2014  tls Rebase.
 1.35.4.1 22-Apr-2016  skrll Sync with HEAD
 1.36.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13 07-May-2016  macallan add FBTYPE_MGX
 1.12 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.11 26-Aug-2009  macallan branches: 1.11.22; 1.11.40;
apparently the official name for the S24 is FBTYPE_TCXCOLOR
 1.10 15-Aug-2009  macallan add FBTYPE_SUNTCX - forgot to commit that along with the tcx(8) update
found by he@
 1.9 12-Dec-2008  macallan add display type for Fujitsu AG-10e (oops)
 1.8 13-Apr-2006  macallan branches: 1.8.58; 1.8.62; 1.8.72; 1.8.74; 1.8.80;
add a framebuffer type for generic PCI devices
 1.7 11-Dec-2005  christos branches: 1.7.4; 1.7.6; 1.7.8; 1.7.10; 1.7.12;
merge ktrace-lwp.
 1.6 15-Oct-2005  macallan Add a multiple include guard.
 1.5 04-May-2005  martin branches: 1.5.2;
Make ffb take part in the /dev/fbN circus.
 1.4 07-Aug-2003  agc branches: 1.4.14;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 19-Sep-2001  thorpej branches: 1.3.18;
Define the DECstation framebuffer types, from pmax/include/fbio.h.

XXX Yes, this is disgusting, but it's also pretty stupid to have
what amounts to essentially the same include file duplicated in
so many places.
 1.2 05-Aug-2001  jdolecek branches: 1.2.2;
use unsigned variable types as appropriate
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6;
Move fbio.h and fbvar.h here.
 1.1.6.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.6.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.1.4.2 21-Sep-2001  nathanw Catch up to -current.
 1.1.4.1 24-Aug-2001  nathanw Catch up with -current.
 1.1.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.1.2.1 20-Aug-2000  bouyer file fbio.h was added on branch thorpej_scsipi on 2000-11-20 11:43:10 +0000
 1.2.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.18.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.18.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.18.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.18.1 03-Aug-2004  skrll Sync with HEAD
 1.4.14.1 07-Jun-2005  tron Pull up revision 1.5 (requested by martin in ticket #376):
Make ffb take part in the /dev/fbN circus.
 1.5.2.1 21-Jun-2006  yamt sync with head.
 1.7.12.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.7.10.1 19-Apr-2006  elad sync with head.
 1.7.8.1 24-May-2006  yamt sync with head.
 1.7.6.1 22-Apr-2006  simonb Sync with head.
 1.7.4.1 09-Sep-2006  rpaulo sync with head
 1.8.80.1 21-Apr-2010  matt sync to netbsd-5
 1.8.74.2 18-Oct-2009  bouyer Back out ticket 991
 1.8.74.1 18-Oct-2009  bouyer Pull up following revision(s) (requested by macallan in ticket #991):
sys/dev/sun/fbio.h: revision 1.10
add FBTYPE_SUNTCX - forgot to commit that along with the tcx(8) update
found by he@
 1.8.72.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.62.3 16-Sep-2009  yamt sync with head
 1.8.62.2 19-Aug-2009  yamt sync with head.
 1.8.62.1 04-May-2009  yamt sync with head.
 1.8.58.1 17-Jan-2009  mjf Sync with HEAD.
 1.11.40.2 29-May-2016  skrll Sync with HEAD
 1.11.40.1 22-Sep-2015  skrll Sync with HEAD
 1.11.22.1 03-Dec-2017  jdolecek update from HEAD
 1.13 21-Apr-2016  macallan RASTERCONSOLE is gone, wsdisplay no longer optional
 1.12 12-Dec-2008  macallan branches: 1.12.24; 1.12.42;
device_t-ification
 1.11 04-Mar-2007  christos branches: 1.11.36; 1.11.40; 1.11.50;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.10 11-Dec-2005  christos branches: 1.10.26;
merge ktrace-lwp.
 1.9 27-Feb-2005  perry branches: 1.9.4;
nuke trailing whitespace
 1.8 25-Feb-2005  martin From Micahel Lorenz: wsdisplay support for cg6
 1.7 07-Aug-2003  agc branches: 1.7.8; 1.7.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 29-Jun-2003  fvdl branches: 1.6.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.5 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.4 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.3 23-Aug-2000  pk branches: 1.3.2; 1.3.4; 1.3.6; 1.3.8;
Add fb_setsize_pfour() prototype.
 1.2 20-Aug-2000  pk De-P__
 1.1 20-Aug-2000  pk Move fbio.h and fbvar.h here.
 1.3.8.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.3.6.1 28-Jun-2002  jdolecek hook fbkqfilter to leaf drivers' kqfilter
 1.3.4.1 11-Nov-2002  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 23-Aug-2000  bouyer file fbvar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:10 +0000
 1.6.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.6.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.6.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.6.2.1 03-Aug-2004  skrll Sync with HEAD
 1.7.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.4.2 03-Sep-2007  yamt sync with head.
 1.9.4.1 21-Jun-2006  yamt sync with head.
 1.10.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.50.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.40.1 04-May-2009  yamt sync with head.
 1.11.36.1 17-Jan-2009  mjf Sync with HEAD.
 1.12.42.1 22-Apr-2016  skrll Sync with HEAD
 1.12.24.1 03-Dec-2017  jdolecek update from HEAD
 1.18 12-Jul-2012  macallan support anti-aliased fonts
 1.17 26-Apr-2012  macallan report power button events to sysmon
also send pwm events for volume control keys directly with
options KBD_HIJACK_VOLUME_BUTTONS
so they work in X as well
 1.16 05-Dec-2008  jdc branches: 1.16.16; 1.16.20;
Add wscons/vcons support for bw2 (sbus and P4).
 1.15 28-Nov-2008  jdc Add wscons/vcons support for cg3.
 1.14 21-Feb-2008  martin branches: 1.14.4; 1.14.8; 1.14.14; 1.14.16; 1.14.18;
rasops is global now
 1.13 25-May-2007  macallan branches: 1.13.8; 1.13.24;
defflag SPARCBOOK_CMD
 1.12 16-Oct-2006  macallan branches: 1.12.8; 1.12.10;
use vcons.
Works fine on sparc64, needs testing on sparc.
 1.11 28-May-2006  martin branches: 1.11.6; 1.11.8;
Move definition of the 'fb' attribute to global scope and make machfb@pci
require it. On most archs this does not change anything, but on sparc{,64}
it allows linking of kernels that have machfb as the only framebuffer.
Solution suggested by Quentin.
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.14;
merge ktrace-lwp.
 1.9 25-Feb-2005  martin branches: 1.9.4;
From Micahel Lorenz: wsdisplay support for cg6
 1.8 30-May-2003  petrov branches: 1.8.2; 1.8.10; 1.8.12;
wsmouse for ms@tty.
 1.7 24-Jan-2003  nakayama fix kernel build error, such a configs w/o kbd, ms.
(approved by martin)
 1.6 26-Oct-2002  martin Allow attaching wskbd at kbd, idea from Valeriy Ushakov.
This allows us to use both the old sun keyboard events (/dev/kbd) as
new wscons events (/dev/wskbd*).

TODO: Not implemented for the kbd at zstty attachment.
Wskbd as console does not yet work.
 1.5 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.4 21-Sep-2000  eeh branches: 1.4.2;
Support for Sun Keyboard/Mouse line disciplines.
 1.3 23-Aug-2000  pk Common framebuffer functions.
(currently includes a special cased fb_isconsole() for sun4u).
 1.2 22-Aug-2000  pk Declare drivers moved here from arch/sparc/dev.
 1.1 29-May-1996  pk branches: 1.1.28;
A configuration file for devices found on Sun machines.
Currently holds just `event.c' which should actually be considered
a candidate for `sys/dev'.
 1.1.28.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 11-Nov-2002  nathanw Catch up to -current
 1.4.2.1 18-Oct-2002  nathanw Catch up to -current.
 1.8.12.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.8.10.1 29-Apr-2005  kent sync with -current
 1.8.2.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.4.4 27-Feb-2008  yamt sync with head.
 1.9.4.3 03-Sep-2007  yamt sync with head.
 1.9.4.2 30-Dec-2006  yamt sync with head.
 1.9.4.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.6.1 01-Jun-2006  kardel Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo 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.12.10.1 11-Jul-2007  mjf Sync with head.
 1.12.8.1 27-May-2007  ad Sync with head.
 1.13.24.1 24-Mar-2008  keiichi sync with head.
 1.13.8.1 23-Mar-2008  matt sync with HEAD
 1.14.18.2 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/bwtwo.c: revision 1.19
sys/dev/sun/bwtwovar.h: revision 1.7
sys/dev/sun/files.sun: revision 1.16
Add wscons/vcons support for bw2 (sbus and P4).
 1.14.18.1 08-Jan-2009  snj Pull up following revision(s) (requested by jdc in ticket #221):
sys/dev/sun/cgthree.c: revision 1.17
sys/dev/sun/cgthreevar.h: revision 1.6
sys/dev/sun/files.sun: revision 1.15
Add wscons/vcons support for cg3.
 1.14.16.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.14.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.14.8.1 04-May-2009  yamt sync with head.
 1.14.4.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.4.1 21-Feb-2008  mjf file files.sun was added on branch mjf-devfs2 on 2009-01-17 13:29:08 +0000
 1.16.20.1 29-Apr-2012  mrg sync to latest -current.
 1.16.16.2 30-Oct-2012  yamt sync with head
 1.16.16.1 23-May-2012  yamt sync with head.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 11-Dec-2005  christos branches: 1.2.70; 1.2.72; 1.2.74;
merge ktrace-lwp.
 1.1 19-Jun-2005  thorpej branches: 1.1.8;
Move common Sun ID PROM definitions into <dev/sun/idprom.h>.
 1.1.8.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.1 19-Jun-2005  skrll file idprom.h was added on branch ktrace-lwp on 2005-11-10 14:08:05 +0000
 1.2.74.1 16-May-2008  yamt sync with head.
 1.2.72.1 18-May-2008  yamt sync with head.
 1.2.70.1 02-Jun-2008  mjf Sync with HEAD.
 1.73 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.72 24-Apr-2021  thorpej branches: 1.72.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.71 18-Jan-2020  tsutsui branches: 1.71.8;
Fix panic on sun3 when any key is typed when kbd is not console. PR/54873

Should be pulled up to netbsd-9.
 1.70 10-Nov-2019  chs branches: 1.70.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.69 08-Feb-2018  mrg branches: 1.69.4; 1.69.10;
update for GCC 6:

kbd_input_wskbd() has a missing {} issue.
 1.68 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.67 16-Mar-2014  dholland branches: 1.67.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.66 02-May-2012  christos branches: 1.66.2; 1.66.4;
make this compile again.
 1.65 27-Apr-2012  martin Make it compilable without envsys
 1.64 26-Apr-2012  macallan report power button events to sysmon
also send pwm events for volume control keys directly with
options KBD_HIJACK_VOLUME_BUTTONS
so they work in X as well
 1.63 12-May-2009  cegger branches: 1.63.12; 1.63.16;
struct device * -> device_t, no functional changes intended.
 1.62 11-Jan-2009  christos branches: 1.62.2;
retain compatibility with old firm_event. Perhaps we should bump the protocol
version with an ioctl?
 1.61 20-Apr-2008  tsutsui branches: 1.61.2; 1.61.10;
- use device_lookup_private() where appropriate
- some KNF and cosmetics
 1.60 29-Mar-2008  tsutsui branches: 1.60.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.59 09-Jul-2007  ad branches: 1.59.28;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.58 04-Mar-2007  christos branches: 1.58.2; 1.58.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.57 15-Oct-2006  martin branches: 1.57.4;
Missing initializer
 1.56 07-Jun-2006  kardel branches: 1.56.6; 1.56.8;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.55 14-Dec-2005  christos branches: 1.55.4; 1.55.6; 1.55.8; 1.55.14;
whitespace.
 1.54 12-Dec-2005  christos welcome to the new lwp world.
 1.53 11-Dec-2005  christos merge ktrace-lwp.
 1.52 28-Sep-2005  martin Remove spurious debug output accidently commited in revision 1.44.
 1.51 14-Sep-2005  martin Ignore KBD_IDLE one layer earlier - wskbd does not like it [and complains
in DEBUG kernels], and we already ignored it for raw mode.
 1.50 08-Jun-2005  martin branches: 1.50.2;
Use KBD_IDLE instead of magic constants
 1.49 07-Jun-2005  martin Do not bother to post "keyboard idle" events to userland when we are
in wskbd raw input mode.
 1.48 17-May-2005  martin Fix indentation.
 1.47 16-May-2005  martin Make the raw keyboard code #ifdef WSDISPLAY_COMPAT_RAWKBD only.
 1.46 16-May-2005  martin Fix WSDISPLAY_COMPAT_RAWKBD. Also return keyboard types < 4 as SUN instead
of SUN5.
 1.45 29-Apr-2005  martin Add a missing #if to allow non-wscons compilation.
Noted by Juergen Hannken-Illjes.
 1.44 28-Apr-2005  martin Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.43 27-Feb-2005  perry branches: 1.43.2;
nuke trailing whitespace
 1.42 04-Feb-2005  perry de-__P
 1.41 31-Dec-2004  bjh21 branches: 1.41.2; 1.41.4;
Go back to filtering out KBD_IDLE events by default. The Xsun shipped with
NetBSD 2.0 gets confused by them (generating events for keycode 134 when
all keys are released), and even when that's fixed we should keep one release
worth of backward compatibility.
 1.40 22-Apr-2004  itojun sprintf -> snprintf
 1.39 21-Sep-2003  jdolecek branches: 1.39.4;
cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
the owner of descriptor, according to appropriate sematics
of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
 1.38 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.37 29-Jun-2003  fvdl branches: 1.37.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.36 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.35 26-Oct-2002  martin Allow attaching wskbd at kbd, idea from Valeriy Ushakov.
This allows us to use both the old sun keyboard events (/dev/kbd) as
new wscons events (/dev/wskbd*).

TODO: Not implemented for the kbd at zstty attachment.
Wskbd as console does not yet work.
 1.34 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.33 21-Oct-2002  uwe Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.32 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.31 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.30 13-May-2002  pk branches: 1.30.2;
Check whether a console is attached before sending data upstream.
 1.29 13-Nov-2001  lukem add RCSIDs
 1.28 08-Jun-2001  mrg branches: 1.28.2; 1.28.4;
#endif /* takes no argument */
 1.27 21-Sep-2000  eeh branches: 1.27.2;
Support for Sun Keyboard/Mouse line disciplines.
 1.26 24-Mar-2000  hannken branches: 1.26.4;
Fix typos from last commit (callout).
 1.25 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.24 22-Mar-2000  pk Make kbd_iopen/kbd_iclose internal routines; introduce kbd_cc_{open,close}
for opening and closing the device when attached to /dev/console.
 1.23 19-Mar-2000  pk Use a somewhat more flexible method to hook up the keyboard driver
as the console input device.
 1.22 14-May-1999  mrg branches: 1.22.2;
split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.

this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
 1.21 03-Feb-1999  mycroft branches: 1.21.4;
Catch up with a change to the stint interface.
 1.20 12-Jan-1998  thorpej Update for changes to config.
 1.19 03-Nov-1997  mycroft Trivial change; use KB_SUN4 rather than the constant in one place.
 1.18 03-Nov-1997  gwr KIOCSLED ioctl takes a char (from Krister Walfridsson).
 1.17 28-Oct-1997  gwr Print more helpful information if we get unexpected keysyms.
Call kbd_xlate_init() after we know the keyboard type so it
has a chance to install the RIGHT keymap pointers! (Duh!)
 1.16 21-Oct-1997  gwr Clean up kbdioctl():
* Make sure all uses of the data pointer are type-cast appropriately.
* Eliminate the super-user check in the KIOCSKEY case (back as it was).
* Return ENOTTY if the ioctl command code is unrecognized.
 1.15 03-Oct-1997  gwr branches: 1.15.2;
Export kbd_docmd() because the sparc fb.c wants it.
 1.14 17-Jul-1997  jtk branches: 1.14.2;
use locator defines in "locators.h" to index cf_loc[]
 1.13 17-Dec-1996  gwr Adapt to the new definition of struct zsc_softc
(the zsc_cs[2] members are now POINTERS!)
Also fix warnings...
 1.12 16-Oct-1996  gwr Replace the field cs_rr0_new with cs_rr0_delta (keep changes instead).
 1.11 13-Oct-1996  christos backout kprintf changes
 1.10 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.9 09-Oct-1996  mrg select -> poll
 1.8 17-May-1996  gwr Rename cs_pclk_div16 to cs_brg_clk to clarify the fact that the
Baud Rate Generator (BRG) clock is not necessarily PCLK/16.
 1.7 10-Apr-1996  gwr Make the ring size configurable in the tty driver.
Make the pseudo-interrupt functions return void.
Call the tty layer at spltty (to be safe).
 1.6 21-Mar-1996  gwr Fix typo
 1.5 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.4 29-Feb-1996  gwr Add support for CapsLock and NumLock toggles.
 1.3 19-Feb-1996  gwr Attach should get unit from _dev.dv_unit not sc_unit
 1.2 30-Jan-1996  gwr Eliminate remaining direct references to the z8530 chip
to allow the MD access functions to do delays, etc.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.14.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.3 03-Nov-1997  mellon Pull rev 1.18 up from trunk (gwr)
 1.15.2.2 28-Oct-1997  mellon Pull rev 1.17 up from trunk (gwr)
 1.15.2.1 22-Oct-1997  mellon pull up from main trunk
 1.21.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.22.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.26.4.1 06-Jun-2002  he Pull up revision 1.30 (requested by pk):
Avoid a NULL pointer dereference if a workstation keyboard is
connected but not configured as the console input device.
 1.27.2.6 11-Nov-2002  nathanw Catch up to -current
 1.27.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.27.2.4 17-Sep-2002  nathanw Catch up to -current.
 1.27.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.27.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.27.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.28.4.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.28.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.28.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.28.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.28.2.2 17-Jun-2002  jdolecek add kqfilter hook, using ev_kqfilter()
 1.28.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.2.1 16-May-2002  gehenna Add the character device switch.
 1.37.2.8 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.37.2.7 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.37.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.37.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.37.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.37.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.37.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.37.2.1 03-Aug-2004  skrll Sync with HEAD
 1.39.4.1 16-Apr-2005  tron Pull up revision 1.41 (requested by bjh21 in ticket #1075):
Go back to filtering out KBD_IDLE events by default. The Xsun shipped with
NetBSD 2.0 gets confused by them (generating events for keycode 134 when
all keys are released), and even when that's fixed we should keep one release
worth of backward compatibility.
 1.41.4.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.41.4.1 12-Feb-2005  yamt sync with head.
 1.41.2.1 29-Apr-2005  kent sync with -current
 1.43.2.9 01-Oct-2005  tron Pull up following revision(s) (requested by martin in ticket #841):
sys/dev/sun/kbd.c: revision 1.52
Remove spurious debug output accidently commited in revision 1.44.
 1.43.2.8 15-Sep-2005  tron Pull up following revision(s) (requested by martin in ticket #785):
sys/dev/sun/kbd.c: revision 1.51
Ignore KBD_IDLE one layer earlier - wskbd does not like it [and complains
in DEBUG kernels], and we already ignored it for raw mode.
 1.43.2.7 09-Jun-2005  snj Pull up revision 1.50 (requested by martin in ticket #430):
Use KBD_IDLE instead of magic constants
 1.43.2.6 09-Jun-2005  snj Pull up revision 1.49 (requested by martin in ticket #430):
Do not bother to post "keyboard idle" events to userland when we are
in wskbd raw input mode.
 1.43.2.5 09-Jun-2005  snj Pull up revision 1.48 (requested by martin in ticket #380):
Fix indentation.
 1.43.2.4 09-Jun-2005  snj Pull up revision 1.47 (requested by martin in ticket #380):
Make the raw keyboard code #ifdef WSDISPLAY_COMPAT_RAWKBD only.
 1.43.2.3 09-Jun-2005  snj Pull up revision 1.46 (requested by martin in ticket #380):
Fix WSDISPLAY_COMPAT_RAWKBD. Also return keyboard types < 4 as SUN instead
of SUN5.
 1.43.2.2 09-Jun-2005  snj Pull up revision 1.45 (requested by martin in ticket #380):
Add a missing #if to allow non-wscons compilation.
Noted by Juergen Hannken-Illjes.
 1.43.2.1 09-Jun-2005  snj Pull up revision 1.44 (requested by martin in ticket #380):
Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.50.2.3 03-Sep-2007  yamt sync with head.
 1.50.2.2 30-Dec-2006  yamt sync with head.
 1.50.2.1 21-Jun-2006  yamt sync with head.
 1.55.14.1 19-Jun-2006  chap Sync with head.
 1.55.8.1 26-Jun-2006  yamt sync with head.
 1.55.6.1 27-May-2006  kardel convert to timecounters
 1.55.4.1 09-Sep-2006  rpaulo sync with head
 1.56.8.1 22-Oct-2006  yamt sync with head
 1.56.6.1 18-Nov-2006  ad Sync with head.
 1.57.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.58.4.1 11-Jul-2007  mjf Sync with head.
 1.58.2.1 01-Jul-2007  ad Adapt to callout API change.
 1.59.28.3 17-Jan-2009  mjf Sync with HEAD.
 1.59.28.2 02-Jun-2008  mjf Sync with HEAD.
 1.59.28.1 03-Apr-2008  mjf Sync with HEAD.
 1.60.2.1 18-May-2008  yamt sync with head.
 1.61.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.61.2.2 16-May-2009  yamt sync with head
 1.61.2.1 04-May-2009  yamt sync with head.
 1.62.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.63.16.2 02-Jun-2012  mrg sync to latest -current.
 1.63.16.1 29-Apr-2012  mrg sync to latest -current.
 1.63.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.63.12.1 23-May-2012  yamt sync with head.
 1.66.4.1 18-May-2014  rmind sync with head
 1.66.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.67.2.1 10-Aug-2014  tls Rebase.
 1.69.10.1 21-Jan-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #637):

sys/dev/sun/kbd.c: revision 1.71

Fix panic on sun3 when any key is typed when kbd is not console. PR/54873
Should be pulled up to netbsd-9.
 1.69.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.69.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.70.2.1 25-Jan-2020  ad Sync with head.
 1.71.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.72.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 30-May-2005  christos Add const.
 1.2 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.1 21-Sep-2000  eeh branches: 1.1.2; 1.1.26;
Guts of the Sun Keyboard/Mouse line disciplines.
N.B. They don't recognize L1-A yet.
 1.1.26.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.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.1.2.1 21-Sep-2000  bouyer file kbd_ms_ttyvar.h was added on branch thorpej_scsipi on 2000-11-20 11:43:10 +0000
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 20-Feb-2005  heas Add commented about keyboard IDs. No functional change.
 1.3 07-Aug-2003  agc branches: 1.3.8; 1.3.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 03-Oct-2002  uwe branches: 1.2.6;
Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.10;
Added Sun common kbd_reg.h, kbio.h, and vuid_event.h files.
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file kbd_reg.h was added on branch kqueue on 2002-06-23 17:48:53 +0000
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file kbd_reg.h was added on branch nathanw_sa on 2002-04-01 07:47:24 +0000
 1.2.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 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.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.10 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.9 11-Dec-2005  christos branches: 1.9.74;
merge ktrace-lwp.
 1.8 27-Feb-2005  perry nuke trailing whitespace
 1.7 12-Apr-2002  pk branches: 1.7.10; 1.7.18; 1.7.20;
Add entries for Type5 keys T5_Insert, T5_Home, T5_End, T5_PgUp and T5_PgDn
as suggested by uwe@netbsd.org.
 1.6 13-Nov-2001  lukem add RCSIDs
 1.5 28-Oct-1997  gwr branches: 1.5.26; 1.5.28;
The release and control maps are shared by all keyboard types, so
change KEYSYM_HOLE to KEYSYM_NOP most places in those tables.
Map the `R' function keys with KEYSYM_FUNC_R instead of the
arrow key strings so that numlock indirection works.
 1.4 02-May-1997  gwr branches: 1.4.8;
Update an obsolete comment. (We DO handle CapsLock and NumLock.)
 1.3 17-Dec-1996  gwr Adapt to the new definition of struct zsc_softc
(the zsc_cs[2] members are now POINTERS!)
Also fix warnings...
 1.2 29-Feb-1996  gwr Add support for CapsLock and NumLock toggles.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.4.8.1 28-Oct-1997  mellon Pull rev 1.5 up from trunk (gwr)
 1.5.28.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.26.2 17-Apr-2002  nathanw Catch up to -current.
 1.5.26.1 14-Nov-2001  nathanw Catch up to -current.
 1.7.20.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.7.18.1 29-Apr-2005  kent sync with -current
 1.7.10.1 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.9.74.1 11-Mar-2010  yamt sync with head
 1.5 21-Oct-2009  snj Drop 3rd and 4th clauses. Approved by gwr@ (copyright holder).
 1.4 17-Dec-1996  gwr branches: 1.4.164;
Adapt to the new definition of struct zsc_softc
(the zsc_cs[2] members are now POINTERS!)
Also fix warnings...
 1.3 29-Feb-1996  gwr Remove obsolete comment.
 1.2 29-Feb-1996  gwr Add support for CapsLock and NumLock toggles.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.4.164.1 11-Mar-2010  yamt sync with head
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 04-Feb-2005  perry de-__P
 1.5 07-Aug-2003  agc branches: 1.5.8; 1.5.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 03-Oct-2002  uwe branches: 1.4.6;
Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.3 19-Mar-2000  pk branches: 1.3.6;
Use a somewhat more flexible method to hook up the keyboard driver
as the console input device.
 1.2 17-Dec-1996  gwr branches: 1.2.28;
Adapt to the new definition of struct zsc_softc
(the zsc_cs[2] members are now POINTERS!)
Also fix warnings...
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.2.28.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.6.1 18-Oct-2002  nathanw Catch up to -current.
 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.5.10.1 12-Feb-2005  yamt sync with head.
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.24 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.23 20-Apr-2008  tsutsui Misc cosmetics.
 1.22 29-Mar-2008  tsutsui branches: 1.22.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.21 30-Mar-2006  thorpej branches: 1.21.58;
Use device_private().
 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 28-Apr-2005  martin branches: 1.19.2;
Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.18 27-Feb-2005  perry branches: 1.18.2;
nuke trailing whitespace
 1.17 04-Feb-2005  perry de-__P
 1.16 07-Aug-2003  agc branches: 1.16.8; 1.16.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.15 21-Oct-2002  uwe branches: 1.15.6;
Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.14 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.13 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.12 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10 09-Dec-2001  pk KBD_BPS => KBD_DEFAULT_BPS (sync with ms driver nomenclature).
 1.9 13-Nov-2001  lukem add RCSIDs
 1.8 28-Sep-2001  pk Don't force a fixed baud rate if the parent zs driver has already determined
the baud rate set by the PROM.
 1.7 12-Jun-2001  wiz branches: 1.7.2; 1.7.4;
receive, not recieve
 1.6 19-May-2000  eeh branches: 1.6.6;
Fix the sparc64 console.

Unlike the other Sun machines, UltraSPARCs can have consoles run on different
chips than zs, so we need to support them. So, here we go:

Add a new PROM console driver with a major number and everything.
This is the default driver if nothing else attaches. It does not
use the keyboard driver since the PROM translates keystrokes itself.
(Unfortunately it also swallows L1-A).

Have the keyboard driver take over the console when it attaches on a
serial port. When a serial port detects a keyboard and attaches the
keyboard driver, it needs to provide a set of consdev vectors. They
keyboard driver will use those to send I/O to the keyboard and mouse.
 1.5 30-Mar-2000  augustss Remove register declarations.
 1.4 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.3 22-Mar-2000  pk Make kbd_iopen/kbd_iclose internal routines; introduce kbd_cc_{open,close}
for opening and closing the device when attached to /dev/console.
 1.2 19-Mar-2000  pk Use a somewhat more flexible method to hook up the keyboard driver
as the console input device.
 1.1 14-May-1999  mrg branches: 1.1.2; 1.1.4;
split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.

this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
 1.1.4.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.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.6.6.6 11-Nov-2002  nathanw Catch up to -current
 1.6.6.5 18-Oct-2002  nathanw Catch up to -current.
 1.6.6.4 08-Jan-2002  nathanw Catch up to -current.
 1.6.6.3 14-Nov-2001  nathanw Catch up to -current.
 1.6.6.2 08-Oct-2001  nathanw Catch up to -current.
 1.6.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.7.4.3 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.7.4.2 11-Oct-2001  fvdl Work around some evil, like directly calling interrupt functions
from the attach path, which devvp didn't like because of incompletely
inited tty structs.

All the struct tty init stuff should really be deferred to the first
open for all drivers; the structures are idle before then and
shouldn't be referenced.
 1.7.4.1 01-Oct-2001  fvdl 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.15.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.6.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 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.16.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.16.10.1 12-Feb-2005  yamt sync with head.
 1.16.8.1 29-Apr-2005  kent sync with -current
 1.18.2.1 09-Jun-2005  snj Pull up revision 1.19 (requested by martin in ticket #380):
Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 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.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.21.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.22.2.1 18-May-2008  yamt sync with head.
 1.12 14-Sep-2024  andvar s/intterupt/interrupt/ in comments.
 1.11 29-Mar-2008  tsutsui branches: 1.11.130;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.10 04-Mar-2007  christos branches: 1.10.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.9 11-Dec-2005  christos branches: 1.9.26;
merge ktrace-lwp.
 1.8 30-May-2005  christos branches: 1.8.2;
remove unneeded casts.
 1.7 28-Apr-2005  martin Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.6 21-Feb-2005  heas branches: 1.6.2;
oops, missed adding a return value for KBD_LAYOUT
 1.5 21-Feb-2005  heas Place busy loops around the tsleep()s for keyboard ID and layout codes in
the attach routine. In autoconf or "cold" state, tsleep does not wait for
a wakeup and my type 5 keyboard takes around 70ms to reset, so the keyboard
ID was being missed (read much later on) and key translation would be wrong.
Thanks Martin, Jochen, and Jason for help.
 1.4 20-Feb-2005  heas Return 0, not return -1, to the serial chip's input routine except when a
keyboard error is received. For zs(4) and com(4), -1 causes the driver to
flush it's buffer. This should eliminate missed keyboard codes, such as the
"key repeats forever until another key is hit" problem that happens because
the keyboard idle code gets flushed from the input buffer.
 1.3 07-Aug-2003  agc branches: 1.3.8; 1.3.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 21-Oct-2002  uwe branches: 1.2.6;
Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.1 03-Oct-2002  uwe branches: 1.1.2;
Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.1.2.3 11-Nov-2002  nathanw Catch up to -current
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 03-Oct-2002  nathanw file kbdsun.c was added on branch nathanw_sa on 2002-10-18 02:44:23 +0000
 1.2.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 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.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.6.2.1 09-Jun-2005  snj Pull up revision 1.7 (requested by martin in ticket #380):
Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.8.2.1 03-Sep-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.36.1 03-Apr-2008  mjf Sync with HEAD.
 1.11.130.1 02-Aug-2025  perseant Sync with HEAD
 1.7 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.6 29-Mar-2008  tsutsui branches: 1.6.4; 1.6.18;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.5 11-Dec-2005  christos branches: 1.5.70;
merge ktrace-lwp.
 1.4 20-Feb-2005  heas Return 0, not return -1, to the serial chip's input routine except when a
keyboard error is received. For zs(4) and com(4), -1 causes the driver to
flush it's buffer. This should eliminate missed keyboard codes, such as the
"key repeats forever until another key is hit" problem that happens because
the keyboard idle code gets flushed from the input buffer.
 1.3 07-Aug-2003  agc branches: 1.3.8; 1.3.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.2 21-Oct-2002  uwe branches: 1.2.6;
Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.1 03-Oct-2002  uwe branches: 1.1.2;
Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.1.2.3 11-Nov-2002  nathanw Catch up to -current
 1.1.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.1 03-Oct-2002  nathanw file kbdsunvar.h was added on branch nathanw_sa on 2002-10-18 02:44:23 +0000
 1.2.6.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 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.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.6.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.6.4.1 16-May-2009  yamt sync with head
 1.21 26-Apr-2012  macallan report power button events to sysmon
also send pwm events for volume control keys directly with
options KBD_HIJACK_VOLUME_BUTTONS
so they work in X as well
 1.20 12-May-2009  cegger branches: 1.20.12; 1.20.16;
struct device * -> device_t, no functional changes intended.
 1.19 29-Mar-2008  tsutsui branches: 1.19.4; 1.19.18;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.18 11-Dec-2005  christos branches: 1.18.70;
merge ktrace-lwp.
 1.17 16-May-2005  martin Make the raw keyboard code #ifdef WSDISPLAY_COMPAT_RAWKBD only.
 1.16 16-May-2005  martin Fix WSDISPLAY_COMPAT_RAWKBD. Also return keyboard types < 4 as SUN instead
of SUN5.
 1.15 28-Apr-2005  martin Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.14 20-Feb-2005  heas branches: 1.14.2;
Fix typo in a comment.
 1.13 27-Aug-2003  uwe branches: 1.13.8; 1.13.10;
cc_callout does not belong to struct cons_channel, as it's only used
by sparc for PROM console input channel. Demote it to kd.c as a
static variable.

While there, use callout_schedule instead of callout_reset to
reschedule the PROM polling callout, and init prom_cons_channel
statically.
 1.12 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.11 26-Oct-2002  martin branches: 1.11.6;
Allow attaching wskbd at kbd, idea from Valeriy Ushakov.
This allows us to use both the old sun keyboard events (/dev/kbd) as
new wscons events (/dev/wskbd*).

TODO: Not implemented for the kbd at zstty attachment.
Wskbd as console does not yet work.
 1.10 21-Oct-2002  uwe Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.9 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.8 09-Dec-2001  pk KBD_BPS => KBD_DEFAULT_BPS (sync with ms driver nomenclature).
 1.7 21-Sep-2000  eeh branches: 1.7.2; 1.7.4; 1.7.6;
Support for Sun Keyboard/Mouse line disciplines.
 1.6 19-May-2000  eeh Fix the sparc64 console.

Unlike the other Sun machines, UltraSPARCs can have consoles run on different
chips than zs, so we need to support them. So, here we go:

Add a new PROM console driver with a major number and everything.
This is the default driver if nothing else attaches. It does not
use the keyboard driver since the PROM translates keystrokes itself.
(Unfortunately it also swallows L1-A).

Have the keyboard driver take over the console when it attaches on a
serial port. When a serial port detects a keyboard and attaches the
keyboard driver, it needs to provide a set of consdev vectors. They
keyboard driver will use those to send I/O to the keyboard and mouse.
 1.5 24-Mar-2000  hannken Fix typos from last commit (callout).
 1.4 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.3 22-Mar-2000  pk Make kbd_iopen/kbd_iclose internal routines; introduce kbd_cc_{open,close}
for opening and closing the device when attached to /dev/console.
 1.2 19-Mar-2000  pk Use a somewhat more flexible method to hook up the keyboard driver
as the console input device.
 1.1 14-May-1999  mrg branches: 1.1.2; 1.1.4;
oops, forgot to add these files.
 1.1.4.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.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.7.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.7.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.3 11-Nov-2002  nathanw Catch up to -current
 1.7.2.2 18-Oct-2002  nathanw Catch up to -current.
 1.7.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.11.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 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.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.8.1 29-Apr-2005  kent sync with -current
 1.14.2.3 09-Jun-2005  snj Pull up revision 1.17 (requested by martin in ticket #380):
Make the raw keyboard code #ifdef WSDISPLAY_COMPAT_RAWKBD only.
 1.14.2.2 09-Jun-2005  snj Pull up revision 1.16 (requested by martin in ticket #380):
Fix WSDISPLAY_COMPAT_RAWKBD. Also return keyboard types < 4 as SUN instead
of SUN5.
 1.14.2.1 09-Jun-2005  snj Pull up revision 1.15 (requested by martin in ticket #380):
Finish support for wskbd @ kbd @ zs/sab for sparc64 consoles.
Based on work from John Heasley and Michael Lorenz.
 1.18.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.19.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.19.4.1 16-May-2009  yamt sync with head
 1.20.16.1 29-Apr-2012  mrg sync to latest -current.
 1.20.12.1 23-May-2012  yamt sync with head.
 1.5 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.4 28-Aug-2006  he branches: 1.4.102; 1.4.122;
Add duplicate include protection to <dev/sun/kbio.h>.
Make the x68k port use this include file, so that what remains
is only the port-specific additions.
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.8;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.10; 1.1.16;
Added Sun common kbd_reg.h, kbio.h, and vuid_event.h files.
 1.1.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.16.1 03-Aug-2004  skrll Sync with HEAD
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file kbio.h was added on branch kqueue on 2002-06-23 17:48:54 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file kbio.h was added on branch nathanw_sa on 2002-04-01 07:47:24 +0000
 1.2.16.1 30-Dec-2006  yamt sync with head.
 1.3.8.1 03-Sep-2006  yamt sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.122.1 22-Sep-2015  skrll Sync with HEAD
 1.4.102.1 03-Dec-2017  jdolecek update from HEAD
 1.40 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.39 16-Mar-2014  dholland branches: 1.39.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.38 11-Jan-2009  christos branches: 1.38.14; 1.38.24; 1.38.28;
retain compatibility with old firm_event. Perhaps we should bump the protocol
version with an ioctl?
 1.37 20-Apr-2008  tsutsui branches: 1.37.2; 1.37.10;
- use device_lookup_private() where appropriate
- some KNF and cosmetics
 1.36 29-Mar-2008  tsutsui branches: 1.36.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.35 04-Mar-2007  christos branches: 1.35.36;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.34 12-Nov-2006  plunky branches: 1.34.4;
Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.33 15-Oct-2006  martin Missing initializers
 1.32 07-Jun-2006  kardel branches: 1.32.6; 1.32.8;
merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
time.tv_sec -> time_second
- struct timeval mono_time is gone
mono_time.tv_sec -> time_uptime
- access to time via
{get,}{micro,nano,bin}time()
get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
 1.31 10-Mar-2006  macallan branches: 1.31.4;
Make external mice work on Tadpole SPARCbook
The tadpole microcontroller sets an additional bit in frame headers from
an external mouse which caused our driver to discard the frame - now we
just ignore the bit.
 1.30 11-Dec-2005  christos branches: 1.30.4; 1.30.6; 1.30.8; 1.30.10;
merge ktrace-lwp.
 1.29 27-Feb-2005  perry branches: 1.29.4;
nuke trailing whitespace
 1.28 21-Sep-2003  jdolecek branches: 1.28.8; 1.28.10;
cleanup & uniform descriptor owner handling:
* introduce fsetown(), fgetown(), fownsignal() - this sets/retrieves/signals
the owner of descriptor, according to appropriate sematics
of TIOCSPGRP/FIOSETOWN/SIOCSPGRP/TIOCGPGRP/FIOGETOWN/SIOCGPGRP ioctl; use
these routines instead of custom code where appropriate
* make every place handling TIOCSPGRP/TIOCGPGRP handle also FIOSETOWN/FIOGETOWN
properly, and remove the translation of FIO[SG]OWN to TIOC[SG]PGRP
in sys_ioctl() & sys_fcntl()
* also remove the socket-specific hack in sys_ioctl()/sys_fcntl() and
pass the ioctls down to soo_ioctl() as any other ioctl

change discussed on tech-kern@
 1.27 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.26 29-Jun-2003  fvdl branches: 1.26.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.25 29-Jun-2003  darrenr More changes for providing lwpid for ktrace (sparc GENERIC built)
 1.24 30-May-2003  petrov wsmouse for ms@tty.
 1.23 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.22 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.21 13-Nov-2001  lukem branches: 1.21.8;
add RCSIDs
 1.20 27-Sep-2000  abs branches: 1.20.2; 1.20.4; 1.20.6;
Add missing cast of ms to (struct device *) in ms_deviopen and ms_deviclose
 1.19 21-Sep-2000  eeh Support for Sun Keyboard/Mouse line disciplines.
 1.18 30-Mar-2000  augustss Remove register declarations.
 1.17 02-Aug-1999  matt branches: 1.17.2;
The Tadpole 3GX uses a modified Sun Mouse protocol. Instead of
sending 5 bytes per sample, it sends 3 omitting the 2nd set of
dx/dy updates. You can distinguish between the two forms since
the first byte of 5-bytes seq will be 0b10000xxx which a 3-byte
will have 0b10001xxx. This changes allows the Xsun server to
run unchanged on the Tadpole 3GX (ignoring for now that the
colormap is still broken).
 1.16 14-May-1999  mrg split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.

this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
 1.15 03-Feb-1999  mycroft branches: 1.15.4;
Catch up with a change to the stint interface.
 1.14 29-Sep-1998  jeremy Changed to allow the mouse baud rate to be set at kernel compile time.
Inspired by Mochida Shuji <mocid@yo.rim.or.jp>.
 1.13 12-Jan-1998  thorpej Update for changes to config.
 1.12 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]
 1.11 17-Dec-1996  gwr Adapt to the new definition of struct zsc_softc
(the zsc_cs[2] members are now POINTERS!)
Also fix warnings...
 1.10 16-Oct-1996  gwr Replace the field cs_rr0_new with cs_rr0_delta (keep changes instead).
 1.9 13-Oct-1996  christos backout kprintf changes
 1.8 10-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.7 09-Oct-1996  mrg select -> poll
 1.6 17-May-1996  gwr Rename cs_pclk_div16 to cs_brg_clk to clarify the fact that the
Baud Rate Generator (BRG) clock is not necessarily PCLK/16.
 1.5 10-Apr-1996  gwr Make the ring size configurable in the tty driver.
Make the pseudo-interrupt functions return void.
Call the tty layer at spltty (to be safe).
 1.4 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.3 19-Feb-1996  gwr Attach should get unit from _dev.dv_unit not sc_unit
 1.2 30-Jan-1996  gwr Eliminate remaining direct references to the z8530 chip
to allow the MD access functions to do delays, etc.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.15.4.2 02-Aug-1999  thorpej Update from trunk.
 1.15.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.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.20.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.20.6.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.20.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.20.4.2 17-Jun-2002  jdolecek add kqfilter hook, using ev_kqfilter()
 1.20.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.3 11-Nov-2002  nathanw Catch up to -current
 1.20.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.20.2.1 14-Nov-2001  nathanw Catch up to -current.
 1.21.8.1 16-May-2002  gehenna Add the character device switch.
 1.26.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.26.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.28.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.28.8.1 29-Apr-2005  kent sync with -current
 1.29.4.3 03-Sep-2007  yamt sync with head.
 1.29.4.2 30-Dec-2006  yamt sync with head.
 1.29.4.1 21-Jun-2006  yamt sync with head.
 1.30.10.1 19-Apr-2006  elad sync with head.
 1.30.8.2 26-Jun-2006  yamt sync with head.
 1.30.8.1 13-Mar-2006  yamt sync with head.
 1.30.6.2 27-May-2006  kardel convert to timecounters
 1.30.6.1 22-Apr-2006  simonb Sync with head.
 1.30.4.1 09-Sep-2006  rpaulo sync with head
 1.31.4.1 19-Jun-2006  chap Sync with head.
 1.32.8.2 10-Dec-2006  yamt sync with head.
 1.32.8.1 22-Oct-2006  yamt sync with head
 1.32.6.1 18-Nov-2006  ad Sync with head.
 1.34.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.35.36.3 17-Jan-2009  mjf Sync with HEAD.
 1.35.36.2 02-Jun-2008  mjf Sync with HEAD.
 1.35.36.1 03-Apr-2008  mjf Sync with HEAD.
 1.36.2.1 18-May-2008  yamt sync with head.
 1.37.10.1 19-Jan-2009  skrll Sync with HEAD.
 1.37.2.1 04-May-2009  yamt sync with head.
 1.38.28.1 18-May-2014  rmind sync with head
 1.38.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.14.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.39.2.1 10-Aug-2014  tls Rebase.
 1.20 07-Nov-2013  christos remove unused
 1.19 12-May-2009  cegger branches: 1.19.12; 1.19.22; 1.19.26;
struct cfdata * -> cfdata_t, no functional changes intended.
 1.18 20-Apr-2008  tsutsui branches: 1.18.2; 1.18.16;
Misc cosmetics.
 1.17 29-Mar-2008  tsutsui branches: 1.17.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.16 30-Mar-2006  thorpej branches: 1.16.58;
Use device_private().
 1.15 29-Mar-2006  thorpej Use device_cfdata().
 1.14 28-Mar-2006  thorpej Use device_unit().
 1.13 11-Dec-2005  christos branches: 1.13.4; 1.13.6; 1.13.8; 1.13.10; 1.13.12;
merge ktrace-lwp.
 1.12 27-Feb-2005  perry branches: 1.12.4;
nuke trailing whitespace
 1.11 04-Feb-2005  perry de-__P
 1.10 07-Aug-2003  agc branches: 1.10.8; 1.10.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Add trailing ; to CFATTACH_DECL.
 1.8 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.7 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.6 09-Dec-2001  pk Allow SUN_MS_BPS to override the mouse baud rate at all times. (see PR14774).
 1.5 13-Nov-2001  lukem add RCSIDs
 1.4 28-Sep-2001  pk Don't force a fixed baud rate if the parent zs driver has already determined
the baud rate set by the PROM.
 1.3 30-Mar-2000  augustss branches: 1.3.6; 1.3.8; 1.3.10;
Remove register declarations.
 1.2 02-Aug-1999  matt branches: 1.2.2;
Allow the mouse baud rate to be patched (rather than forcing a recompilation
of the kernel). Also, if the mouse baud rate is 0, say the mouse the isn't
there (so a terminal may be attached in its place). Make debugging mouse
problems much easier.
 1.1 14-May-1999  mrg branches: 1.1.2;
split the sun ms/kbd drivers into frontend/backend parts at the serial
interface border, so that other serial interfaces can be attached to the
ms/kbd. zero functional changes and mostly involves moving code around
a bit. tested on the SS2.

this is necessary to attach the PCI ultrasparc keyboard/mouse drivers.
 1.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.1.2.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.10.3 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.3.10.2 11-Oct-2001  fvdl Work around some evil, like directly calling interrupt functions
from the attach path, which devvp didn't like because of incompletely
inited tty structs.

All the struct tty init stuff should really be deferred to the first
open for all drivers; the structures are idle before then and
shouldn't be referenced.
 1.3.10.1 01-Oct-2001  fvdl Catch up with -current.
 1.3.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.3.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.3.6.3 08-Jan-2002  nathanw Catch up to -current.
 1.3.6.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.6.1 08-Oct-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 03-Aug-2004  skrll Sync with HEAD
 1.10.10.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.10.1 12-Feb-2005  yamt sync with head.
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.12.4.1 21-Jun-2006  yamt sync with head.
 1.13.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.13.10.1 19-Apr-2006  elad sync with head.
 1.13.8.1 01-Apr-2006  yamt sync with head.
 1.13.6.1 22-Apr-2006  simonb Sync with head.
 1.13.4.1 09-Sep-2006  rpaulo sync with head
 1.16.58.2 02-Jun-2008  mjf Sync with HEAD.
 1.16.58.1 03-Apr-2008  mjf Sync with HEAD.
 1.17.2.1 18-May-2008  yamt sync with head.
 1.18.16.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.18.2.1 16-May-2009  yamt sync with head
 1.19.26.1 18-May-2014  rmind sync with head
 1.19.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.12.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.9 12-May-2009  cegger struct device * -> device_t, no functional changes intended.
 1.8 29-Mar-2008  tsutsui branches: 1.8.4; 1.8.18;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.7 11-Dec-2005  christos branches: 1.7.70;
merge ktrace-lwp.
 1.6 04-Feb-2005  perry de-__P
 1.5 07-Aug-2003  agc branches: 1.5.8; 1.5.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.4 30-May-2003  petrov branches: 1.4.2;
wsmouse for ms@tty.
 1.3 09-Dec-2001  pk Allow SUN_MS_BPS to override the mouse baud rate at all times. (see PR14774).
 1.2 21-Sep-2000  eeh branches: 1.2.2; 1.2.4; 1.2.6;
Support for Sun Keyboard/Mouse line disciplines.
 1.1 14-May-1999  mrg branches: 1.1.2; 1.1.4;
oops, forgot to add these files.
 1.1.4.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.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.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.2.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 08-Jan-2002  nathanw Catch up to -current.
 1.4.2.4 04-Feb-2005  skrll Sync with HEAD.
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.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.7.70.1 03-Apr-2008  mjf Sync with HEAD.
 1.8.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.8.4.1 16-May-2009  yamt sync with head
 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 11-Dec-2005  christos branches: 1.5.70; 1.5.72; 1.5.74;
merge ktrace-lwp.
 1.4 28-Oct-2003  chs keep the caller's defaults instead of supplying our own.
 1.3 28-Oct-2003  chs uninitialized variables.
 1.2 13-Nov-2001  lukem branches: 1.2.16;
add RCSIDs
 1.1 22-Aug-2000  pk branches: 1.1.2; 1.1.4; 1.1.6;
Split off `pfour' code from sparc/dev/fb.c into a separate file.
This file will be pulled in by framebuffer drivers that define the `pfour'
attribute.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 14-Nov-2001  nathanw Catch up to -current.
 1.1.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.1.2.1 22-Aug-2000  bouyer file pfour_subr.c was added on branch thorpej_scsipi on 2000-11-20 11:43:11 +0000
 1.2.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.16.1 03-Aug-2004  skrll Sync with HEAD
 1.5.74.2 04-May-2009  yamt sync with head.
 1.5.74.1 16-May-2008  yamt sync with head.
 1.5.72.1 18-May-2008  yamt sync with head.
 1.5.70.1 02-Jun-2008  mjf 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.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 10-Dec-2003  agc Modify the licences of code written by Theo De Raadt from a 4-clause
to a 2-clause licence (retaining UCB clauses (1) and (2)), per PR
22409 from Joel Baker, approved by Theo de Raadt, and ratified by
myself - the only discrepancy being the handling of the original
clause 3 in src/usr.sbin/yppoll/yppoll.c.
 1.1 20-Aug-2000  pk branches: 1.1.2; 1.1.26;
Move cgsix, bwtwo and BT DAC support here from arch/sparc.
 1.1.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.26.1 03-Aug-2004  skrll Sync with HEAD
 1.1.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.1.2.1 20-Aug-2000  bouyer file pfourreg.h was added on branch thorpej_scsipi on 2000-11-20 11:43: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.2 13-Feb-2024  thorpej Add the Sun3 obio flavor's DMA controller access registers.
 1.1 13-Feb-2024  thorpej Move sireg.h from vme/ to sun/ -- the same (or nearly so) register defns
are used by multiple bus attachments.
 1.3 06-May-2002  lukem Replace <dev/sun/sun_boot.h> with <sys/bootinfo.h>, which is intended
to be more generic than ``bbinfo definitions for Sun-based systems''.
Other platforms can store bbinfo-style information here, and possibly
other platform-specific boot information that needs to be accessible
by foriegn platforms in tools such as /usr/sbin/installboot.
 1.2 24-Apr-2002  bjh21 branches: 1.2.2;
Include <stdint.h> or <sys/stdint.h> to get the C99 fixed-width types, since
<sys/types.h> doesn't necessarily provide them.
 1.1 24-Apr-2002  lukem Add <dev/sun/sun_boot.h>, which contains common boot block stuff for
Sun based systems.
 1.2.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.2 04-May-2002  thorpej Update from trunk.
 1.2.2.1 24-Apr-2002  thorpej file sun_boot.h was added on branch nathanw_sa on 2002-05-04 19:44:58 +0000
 1.32 26-Oct-2022  riastradh sunkbd(4): Convert to ttylock/ttyunlock.
 1.31 25-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.30 31-Oct-2017  martin PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,
so userland will not touch it (and change serial params w/o our
controll).
 1.29 15-Sep-2013  martin branches: 1.29.22;
Remove unused variable
 1.28 14-Aug-2010  jym branches: 1.28.8; 1.28.18; 1.28.22;
Flush tty only when K_TXBUSY is not set.

'!' takes precedence over bitwise operation '&', so use parenthesis.
 1.27 29-Mar-2008  tsutsui branches: 1.27.4; 1.27.24; 1.27.26;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.26 10-Nov-2007  ad branches: 1.26.14;
Call ttyoutput/ttstart with tty_lock held.
 1.25 09-Jul-2007  ad branches: 1.25.6; 1.25.8; 1.25.12; 1.25.14;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.24 30-Mar-2006  thorpej branches: 1.24.18; 1.24.20;
Use device_private().
 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 27-Nov-2005  thorpej Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().
 1.21 21-Feb-2005  heas branches: 1.21.4; 1.21.10;
GC SUNKBDDISC & SUNMSDISC line discipline slot definitions. Both are already
entered by ttyldisc_add() calls such that ttyldisc_add chooses the slot anyway.
Double checked by Martin.
 1.20 20-Feb-2005  heas Return 0, not return -1, to the serial chip's input routine except when a
keyboard error is received. For zs(4) and com(4), -1 causes the driver to
flush it's buffer. This should eliminate missed keyboard codes, such as the
"key repeats forever until another key is hit" problem that happens because
the keyboard idle code gets flushed from the input buffer.
 1.19 07-Aug-2003  agc branches: 1.19.8; 1.19.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.18 29-Jun-2003  fvdl branches: 1.18.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.17 29-Jun-2003  martin struct proc * -> struct lwp *
 1.16 19-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15 26-Oct-2002  martin Allow attaching wskbd at kbd, idea from Valeriy Ushakov.
This allows us to use both the old sun keyboard events (/dev/kbd) as
new wscons events (/dev/wskbd*).

TODO: Not implemented for the kbd at zstty attachment.
Wskbd as console does not yet work.
 1.14 21-Oct-2002  uwe Clean-up kbd driver layers a bit more. Lift common code into the upper layer.
Add some wskbd TODO remarks (hi, martin).
 1.13 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.12 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.11 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.9 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.8 11-Dec-2001  pk branches: 1.8.8;
Name changes: {KBD,MS}_BPS => {KBD,MS}_DEFAULT_BPS
 1.7 13-Nov-2001  lukem add RCSIDs
 1.6 17-May-2001  chs branches: 1.6.2; 1.6.4;
give sunkbd and sunms a "poll" routine.
 1.5 19-Dec-2000  eeh branches: 1.5.2;
Kill extra "attached" message.
 1.4 08-Nov-2000  eeh branches: 1.4.2;
Support for MI console magic framework.
 1.3 01-Nov-2000  eeh Adapt to new line discipline scheme.
 1.2 10-Oct-2000  pk Fix compilation errors: unused variable & missing function return values.
 1.1 21-Sep-2000  eeh Guts of the Sun Keyboard/Mouse line disciplines.
N.B. They don't recognize L1-A yet.
 1.4.2.4 05-Jan-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 08-Nov-2000  bouyer file sunkbd.c was added on branch thorpej_scsipi on 2000-11-20 11:43:11 +0000
 1.5.2.9 11-Nov-2002  nathanw Catch up to -current
 1.5.2.8 18-Oct-2002  nathanw Catch up to -current.
 1.5.2.7 17-Sep-2002  nathanw Catch up to -current.
 1.5.2.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.5.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.5.2.4 08-Jan-2002  nathanw Catch up to -current.
 1.5.2.3 15-Nov-2001  pk Fix `curproc' usage.
 1.5.2.2 14-Nov-2001  nathanw Catch up to -current.
 1.5.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.4.3 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.6.4.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.6.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.6.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.6.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.8.1 16-May-2002  gehenna Replace the direct-access to devsw table with calling devsw API.
Fix conflicts of namespace.
 1.18.2.6 11-Dec-2005  christos Sync with head.
 1.18.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.18.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.21.10.1 29-Nov-2005  yamt sync with head.
 1.21.4.3 15-Nov-2007  yamt sync with head.
 1.21.4.2 03-Sep-2007  yamt sync with head.
 1.21.4.1 21-Jun-2006  yamt sync with head.
 1.23.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.23.10.1 19-Apr-2006  elad sync with head.
 1.23.8.1 01-Apr-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.24.20.1 11-Jul-2007  mjf Sync with head.
 1.24.18.1 13-Apr-2007  ad - Make the devsw interface MP safe, and add some comments.
- Allow individual block/character drivers to be marked MP safe.
- Provide wrappers around the device methods that look up the
device, returning ENXIO if it's not found, and acquire the
kernel lock if needed.
 1.25.14.1 19-Nov-2007  mjf Sync with HEAD.
 1.25.12.1 13-Nov-2007  bouyer Sync with HEAD
 1.25.8.1 09-Jan-2008  matt sync with HEAD
 1.25.6.1 11-Nov-2007  joerg Sync with HEAD.
 1.26.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.27.26.1 05-Mar-2011  rmind sync with head
 1.27.24.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.27.4.1 09-Oct-2010  yamt sync with head
 1.28.22.1 18-May-2014  rmind sync with head
 1.28.18.2 03-Dec-2017  jdolecek update from HEAD
 1.28.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.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.29.22.1 06-Nov-2017  snj Pull up following revision(s) (requested by martin in ticket #338):
sys/arch/sparc64/dev/sab.c: revision 1.55
sys/dev/ic/com.c: revision 1.345
sys/dev/ic/z8530tty.c: revision 1.132
sys/dev/sun/sunkbd.c: revision 1.30
sys/dev/sun/sunms.c: revision 1.33
sys/sys/tty.h: revision 1.94
As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY
Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.
--
PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,
so userland will not touch it (and change serial params w/o our
control).
 1.35 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.34 24-Apr-2021  thorpej branches: 1.34.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.33 31-Oct-2017  martin branches: 1.33.20;
PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,
so userland will not touch it (and change serial params w/o our
controll).
 1.32 15-Sep-2013  martin branches: 1.32.22;
Remove unused variables
 1.31 12-May-2009  cegger branches: 1.31.12; 1.31.22; 1.31.26;
struct device * -> device_t, no functional changes intended.
 1.30 12-May-2009  cegger struct cfdata * -> cfdata_t, no functional changes intended.
 1.29 21-Apr-2008  martin branches: 1.29.2; 1.29.16;
Fix minor device_t split fallout.
 1.28 29-Mar-2008  tsutsui branches: 1.28.2;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.27 09-Jul-2007  ad branches: 1.27.28;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.26 04-Mar-2007  christos branches: 1.26.2; 1.26.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.25 29-Jan-2007  hubertf branches: 1.25.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.24 30-Mar-2006  thorpej branches: 1.24.8;
Use device_private().
 1.23 29-Mar-2006  thorpej Use device_cfdata().
 1.22 28-Mar-2006  thorpej Use device_unit().
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.6; 1.21.8; 1.21.10; 1.21.12;
merge ktrace-lwp.
 1.20 27-Nov-2005  thorpej Overhaul how TTY line disciplines are handled:
- Replace references to linesw[0] with a ttyldisc_default() function
that returns the default ("termios") line discipline.
- The linesw[] array is gone, replaced by a linked list.
- ttyldisc_add() and ttyldisc_remove() have been replaced by
ttyldisc_attach() and ttyldisc_detach().
- Things that provide line disciplines are now responsible for
registering those disciplines with the system. The linesw
structures are no longer declared in tty_conf.c
- Line disciplines are now refcounted; a lookup causes a reference to
be held. ttyldisc_release() releases the reference. Attempts to
detach an in-use line discipline result in EBUSY.
- Fix function signature lossage in if_sl.c, if_strip.c, and tty_tb.c
that was masked by the old tty_conf.c
- tty_init() is no longer necessary; delete it and its call from main().
 1.19 27-Feb-2005  perry branches: 1.19.4; 1.19.10;
nuke trailing whitespace
 1.18 21-Feb-2005  heas GC SUNKBDDISC & SUNMSDISC line discipline slot definitions. Both are already
entered by ttyldisc_add() calls such that ttyldisc_add chooses the slot anyway.
Double checked by Martin.
 1.17 07-Aug-2003  agc branches: 1.17.8; 1.17.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.16 29-Jun-2003  fvdl branches: 1.16.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.15 29-Jun-2003  martin struct proc * -> struct lwp *
 1.14 30-May-2003  petrov wsmouse for ms@tty.
 1.13 19-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.12 03-Oct-2002  uwe Refactor kbd and mouse drivers so that they can use different middle
layers. Common middle layer shared by kbd_zs and sunkbd is moved into
the new file. Move shared config directives to files.sun and adjust
ports' files.* accordingly.

Need this to support console/Xsun on Mr.Coffee JavaStation.

Tested on sparc, sparc64 (by martin) and sun3 (by jdc).
 1.11 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.10 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.9 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.8 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.7 11-Dec-2001  pk branches: 1.7.8;
Name changes: {KBD,MS}_BPS => {KBD,MS}_DEFAULT_BPS
 1.6 27-Nov-2001  fredette When opening the mouse port, be sure to open it for 8 data bits.
The sun2 PROM can leave the port configured for 7.
 1.5 13-Nov-2001  lukem add RCSIDs
 1.4 17-May-2001  chs branches: 1.4.2; 1.4.4;
give sunkbd and sunms a "poll" routine.
 1.3 01-Nov-2000  eeh branches: 1.3.2; 1.3.4;
Adapt to new line discipline scheme.
 1.2 10-Oct-2000  pk Fix compilation errors: unused variable & missing function return values.
 1.1 21-Sep-2000  eeh Guts of the Sun Keyboard/Mouse line disciplines.
N.B. They don't recognize L1-A yet.
 1.3.4.8 18-Oct-2002  nathanw Catch up to -current.
 1.3.4.7 17-Sep-2002  nathanw Catch up to -current.
 1.3.4.6 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.3.4.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.3.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.3.4.3 15-Nov-2001  pk Fix `curproc' usage.
 1.3.4.2 14-Nov-2001  nathanw Catch up to -current.
 1.3.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.2.3 22-Nov-2000  bouyer Sync with HEAD.
 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 01-Nov-2000  bouyer file sunms.c was added on branch thorpej_scsipi on 2000-11-20 11:43:11 +0000
 1.4.4.3 13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.4.4.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.4.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.4.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.4.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.8.1 16-May-2002  gehenna Replace the direct-access to devsw table with calling devsw API.
Fix conflicts of namespace.
 1.16.2.7 11-Dec-2005  christos Sync with head.
 1.16.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.16.2.5 13-Jan-2005  skrll Adapt to branch
 1.16.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.2 26-Aug-2004  skrll Adapt to branch.

sparc64 GENERIC compiles.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.17.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.17.8.1 29-Apr-2005  kent sync with -current
 1.19.10.1 29-Nov-2005  yamt sync with head.
 1.19.4.3 03-Sep-2007  yamt sync with head.
 1.19.4.2 26-Feb-2007  yamt sync with head.
 1.19.4.1 21-Jun-2006  yamt sync with head.
 1.21.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.21.10.1 19-Apr-2006  elad sync with head.
 1.21.8.1 01-Apr-2006  yamt sync with head.
 1.21.6.1 22-Apr-2006  simonb Sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.24.8.1 01-Feb-2007  ad Sync with head.
 1.25.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.4.1 11-Jul-2007  mjf Sync with head.
 1.26.2.1 13-Apr-2007  ad - Make the devsw interface MP safe, and add some comments.
- Allow individual block/character drivers to be marked MP safe.
- Provide wrappers around the device methods that look up the
device, returning ENXIO if it's not found, and acquire the
kernel lock if needed.
 1.27.28.2 02-Jun-2008  mjf Sync with HEAD.
 1.27.28.1 03-Apr-2008  mjf Sync with HEAD.
 1.28.2.1 18-May-2008  yamt sync with head.
 1.29.16.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.29.2.1 16-May-2009  yamt sync with head
 1.31.26.1 18-May-2014  rmind sync with head
 1.31.22.2 03-Dec-2017  jdolecek update from HEAD
 1.31.22.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.12.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.32.22.1 06-Nov-2017  snj Pull up following revision(s) (requested by martin in ticket #338):
sys/arch/sparc64/dev/sab.c: revision 1.55
sys/dev/ic/com.c: revision 1.345
sys/dev/ic/z8530tty.c: revision 1.132
sys/dev/sun/sunkbd.c: revision 1.30
sys/dev/sun/sunms.c: revision 1.33
sys/sys/tty.h: revision 1.94
As discussed on tech-kern: define a new tty internal state flag: TS_KERN_ONLY
Implement it in a few tty drivers. If this flag is set, the underlying
hardware is used by another driver and userland has no right to open
it. A few uses will appear soon in sys/dev/sun/sun{kbd,ms}.c.
--
PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,
so userland will not touch it (and change serial params w/o our
control).
 1.33.20.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.34.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.8 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.7 12-Jan-2009  christos branches: 1.7.24; 1.7.42;
protect kernel inline with _KERNEL
 1.6 11-Jan-2009  christos s/set/get/
 1.5 11-Jan-2009  christos retain compatibility with old firm_event. Perhaps we should bump the protocol
version with an ioctl?
 1.4 28-Aug-2006  he branches: 1.4.52; 1.4.56; 1.4.66;
Use the common <dev/sun/vuid_event.h> header file instead of maintaining
separate copies in port-specific directories. Add duplicate include
protection. Makes the alpha and atari ports build usr.bin/kdump/ again.
 1.3 11-Dec-2005  christos branches: 1.3.4; 1.3.8;
merge ktrace-lwp.
 1.2 07-Aug-2003  agc branches: 1.2.16;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.1 22-Mar-2002  fredette branches: 1.1.4; 1.1.10; 1.1.16;
Added Sun common kbd_reg.h, kbio.h, and vuid_event.h files.
 1.1.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.16.1 03-Aug-2004  skrll Sync with HEAD
 1.1.10.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.10.1 22-Mar-2002  jdolecek file vuid_event.h was added on branch kqueue on 2002-06-23 17:48:54 +0000
 1.1.4.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.4.1 22-Mar-2002  nathanw file vuid_event.h was added on branch nathanw_sa on 2002-04-01 07:47:24 +0000
 1.2.16.1 30-Dec-2006  yamt sync with head.
 1.3.8.1 03-Sep-2006  yamt sync with head.
 1.3.4.1 09-Sep-2006  rpaulo sync with head
 1.4.66.1 19-Jan-2009  skrll Sync with HEAD.
 1.4.56.1 04-May-2009  yamt sync with head.
 1.4.52.1 17-Jan-2009  mjf Sync with HEAD.
 1.7.42.1 22-Sep-2015  skrll Sync with HEAD
 1.7.24.1 03-Dec-2017  jdolecek update from HEAD
 1.17 14-Jan-2010  macallan actually assign audio control command codes to the audio control keys
 1.16 02-Jan-2009  jdc Remove duplicated key symbol in UK keymap.
 1.15 25-May-2008  ghen branches: 1.15.6;
Implement wscons colemak and dvorak keyboard variants for Sun keyboards.
 1.14 06-Aug-2007  macallan branches: 1.14.22; 1.14.24; 1.14.26; 1.14.28; 1.14.30;
add keysyms for scroll commands
 1.13 25-May-2007  macallan branches: 1.13.2; 1.13.6;
defflag SPARCBOOK_CMD
 1.12 11-Dec-2005  christos branches: 1.12.24; 1.12.30; 1.12.32; 1.12.38;
merge ktrace-lwp.
 1.11 25-Aug-2005  jdc Fix cut and paste error in UK keymap.
 1.10 18-Jun-2005  jdc branches: 1.10.2;
Add UK keyboard map.
 1.9 08-Jun-2005  martin Add a key symbol for the "Power" key.
 1.8 01-Jun-2005  martin Add german keymaps
 1.7 01-May-2005  macallan fixed tab width and formatting
 1.6 01-May-2005  macallan Made the Alt key act like STOP when options SPARCBOOK_CMD is #defined to
allow console switching with Alt-Fn because the SPARCbook 3 keyboard has no
STOP
 1.5 27-Feb-2005  perry branches: 1.5.2;
nuke trailing whitespace
 1.4 25-Feb-2005  martin From Michael Lorenz: add screen switching keyboard symbols
 1.3 14-Jul-2003  lukem branches: 1.3.8; 1.3.10;
add missing __KERNEL_RCSID()
 1.2 25-Oct-2002  martin branches: 1.2.2; 1.2.8;
Fix pasto.
 1.1 25-Oct-2002  martin Scan code/keymap table for sun keyboards and wscons.
From OpenBSD, written by Jason L. Wright.
 1.2.8.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.8.4 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.2.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.8.1 03-Aug-2004  skrll Sync with HEAD
 1.2.2.2 11-Nov-2002  nathanw Catch up to -current
 1.2.2.1 25-Oct-2002  nathanw file wskbdmap_sun.c was added on branch nathanw_sa on 2002-11-11 22:12:43 +0000
 1.3.10.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.3.8.1 29-Apr-2005  kent sync with -current
 1.5.2.5 14-Sep-2005  tron Pull up following revision(s) (requested by jdc in ticket #771):
sys/dev/sun/wskbdmap_sun.c: revision 1.11
Fix cut and paste error in UK keymap.
 1.5.2.4 14-Sep-2005  tron Pull up following revision(s) (requested by jdc in ticket #771):
sys/dev/sun/wskbdmap_sun.c: revision 1.10
Add UK keyboard map.
 1.5.2.3 09-Jun-2005  snj Pull up revision 1.8 (requested by martin in ticket #380):
Add german keymaps
 1.5.2.2 09-Jun-2005  snj Pull up revision 1.7 (requested by martin in ticket #380):
fixed tab width and formatting
 1.5.2.1 09-Jun-2005  snj Pull up revision 1.6 (requested by martin in ticket #380):
Made the Alt key act like STOP when options SPARCBOOK_CMD is #defined to
allow console switching with Alt-Fn because the SPARCbook 3 keyboard has no
STOP
 1.10.2.2 03-Sep-2007  yamt sync with head.
 1.10.2.1 21-Jun-2006  yamt sync with head.
 1.12.38.1 04-Sep-2008  skrll Sync with netbsd-4.
 1.12.32.1 11-Jul-2007  mjf Sync with head.
 1.12.30.2 20-Aug-2007  ad Sync with HEAD.
 1.12.30.1 27-May-2007  ad Sync with head.
 1.12.24.1 08-Jun-2008  bouyer Pull up following revision(s) (requested by ghen in ticket #1155):
sys/dev/wscons/wsksymdef.h: revision 1.61
x11/bin/xkbcomp/symbols/pc/Makefile: revision 1.5
sys/dev/sun/wskbdmap_sun.c: revision 1.15
x11/bin/xkbcomp/symbols/Makefile: revision 1.6
sys/dev/pckbport/wskbdmap_mfii.c: revision 1.15
share/man/man4/pckbd.4: revision 1.15
distrib/sets/lists/xbase/mi: revision 1.57
sys/dev/usb/ukbdmap.c: revision 1.20
distrib/sets/lists/xbase4/mi: revision 1.21
xsrc/xfree/xc/programs/xkbcomp/symbols/colemak: revision 1.1
xsrc/xfree/xc/programs/xkbcomp/symbols/pc/colemak: revision 1.1
Add support for the Colemak keyboard layout variant, see http://colemak.com
 1.13.6.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.13.2.1 15-Aug-2007  skrll Sync with HEAD.
 1.14.30.2 06-Aug-2007  macallan add keysyms for scroll commands
 1.14.30.1 06-Aug-2007  macallan file wskbdmap_sun.c was added on branch matt-mips64 on 2007-08-06 03:04:09 +0000
 1.14.28.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.14.26.2 11-Mar-2010  yamt sync with head
 1.14.26.1 04-May-2009  yamt sync with head.
 1.14.24.1 04-Jun-2008  yamt sync with head
 1.14.22.2 17-Jan-2009  mjf Sync with HEAD.
 1.14.22.1 02-Jun-2008  mjf Sync with HEAD.
 1.15.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.2 24-Jan-1996  gwr Oops, I didn't mean to check in that file.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.
 1.2 24-Jan-1996  gwr Oops, I didn't mean to check in that file.
 1.1 24-Jan-1996  gwr branches: 1.1.1;
Initial revision
 1.1.1.1 24-Jan-1996  gwr New "child" drivers for Sun keyboard and mouse attached to z8530sc.

RSS XML Feed