Home | History | Annotate | only in /src/sys/arch/x68k/dev
History log of /src/sys/arch/x68k/dev
RevisionDateAuthorComments
 1.3 02-May-2001  minoura Remove old obsolete audio driver.
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.27 17-Dec-2023  andvar Fix format specifiers and use BMD_UNIT(dev) macro to fix BMD_DEBUG build.
 1.26 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.25 07-Jul-2016  msaitoh KNF. Remove extra spaces. No functional change.
 1.24 26-Apr-2015  mlelstv Use C99-style initializers for struct dkdriver.
 1.23 02-Jan-2015  christos We have three sets of DTYPE_ constants in the kernel:
altq Drop Type
disklabel Disk Type
file Descriptor Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
 1.22 31-Dec-2014  christos make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
 1.21 25-Jul-2014  dholland branches: 1.21.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.20 25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

I've set them all to nodiscard. Some of them (wd, dk, vnd, ld,
raidframe, maybe cgd) should be implemented for real.
 1.19 16-Mar-2014  dholland branches: 1.19.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.18 16-Oct-2011  isaki branches: 1.18.2; 1.18.12; 1.18.16;
Switch to 2-clause license.
 1.17 08-Aug-2010  isaki Probe not only ctrl address but also bank window address.
This prevents the wrong matching when other boards like
Neptune-X exist. Reported by Yasushi Oshima.
 1.16 18-Dec-2008  isaki branches: 1.16.4; 1.16.6;
Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.15 25-Jun-2008  isaki branches: 1.15.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.14 14-Jun-2008  isaki Fix compile errors.
 1.13 13-Jun-2008  cegger use device_lookup_private to get softc
 1.12 15-Dec-2007  perry branches: 1.12.6; 1.12.8; 1.12.10; 1.12.12; 1.12.14;
__FUNCTION__ -> __func__
 1.11 17-Oct-2007  garbled branches: 1.11.4; 1.11.8;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.10 08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.9 29-Jul-2007  ad branches: 1.9.4; 1.9.6; 1.9.8;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.8 11-Mar-2007  isaki branches: 1.8.8; 1.8.10; 1.8.12;
white space, indent and KNF.
 1.7 05-Mar-2007  he branches: 1.7.2;
Cast to char* before doing pointer arithmetic.
 1.6 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5 11-Dec-2005  christos branches: 1.5.26;
merge ktrace-lwp.
 1.4 13-Jun-2005  he branches: 1.4.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.3 07-Sep-2003  isaki Remove an advertising clause.
 1.2 15-Jul-2003  lukem rcsid
 1.1 01-Dec-2002  isaki branches: 1.1.2; 1.1.8;
Add bmd, memory disk driver for Nereid bank memory.
 1.1.8.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.8.4 04-Feb-2005  skrll Adapt to branch.
 1.1.8.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.8.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.8.1 03-Aug-2004  skrll Sync with HEAD
 1.1.2.2 11-Dec-2002  thorpej Sync with HEAD.
 1.1.2.1 01-Dec-2002  thorpej file bmd.c was added on branch nathanw_sa on 2002-12-11 06:12:47 +0000
 1.4.2.4 21-Jan-2008  yamt sync with head
 1.4.2.3 27-Oct-2007  yamt sync with head.
 1.4.2.2 03-Sep-2007  yamt sync with head.
 1.4.2.1 21-Jun-2006  yamt sync with head.
 1.5.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.2.3 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.7.2.2 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.7.2.1 13-Mar-2007  ad Sync with head.
 1.8.12.1 15-Aug-2007  skrll Sync with HEAD.
 1.8.10.1 07-Aug-2007  matt Sync with HEAD.
 1.8.8.2 16-Oct-2007  garbled Sync with HEAD
 1.8.8.1 03-Oct-2007  garbled Sync with HEAD
 1.9.8.1 14-Oct-2007  yamt sync with head.
 1.9.6.2 09-Jan-2008  matt sync with HEAD
 1.9.6.1 06-Nov-2007  matt sync with HEAD
 1.9.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.11.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.11.4.1 26-Dec-2007  ad Sync with head.
 1.12.14.2 27-Jun-2008  simonb Sync with head.
 1.12.14.1 18-Jun-2008  simonb Sync with head.
 1.12.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.12.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.12.10.2 11-Aug-2010  yamt sync with head.
 1.12.10.1 04-May-2009  yamt sync with head.
 1.12.8.1 17-Jun-2008  yamt sync with head.
 1.12.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.12.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.15.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.6.1 05-Mar-2011  rmind sync with head
 1.16.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.18.16.1 18-May-2014  rmind sync with head
 1.18.12.2 03-Dec-2017  jdolecek update from HEAD
 1.18.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.2.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.19.2.1 10-Aug-2014  tls Rebase.
 1.21.4.2 06-Jun-2015  skrll Sync with HEAD
 1.21.4.1 06-Apr-2015  skrll Sync with HEAD
 1.7 02-May-2001  minoura Remove old obsolete audio driver.
 1.6 24-May-1998  is Back out the defopt for M680?0. As pointed out to me, this breaks ports which
dont use the M680?0 the way Amiga, Atari, Mac68k, and X68k do. I must have
missed this in the past discussion about this project.
 1.5 23-May-1998  is Move M680[2346]0 to opt_m68kcpu.h.
XXX Some explicit dependencies could be removed now from the individual
arch/$ARCH/conf/Makefile.$ARCH files, but this is still to be done.
 1.4 12-Jan-1998  thorpej Update for changes to config.
 1.3 13-Oct-1996  christos backout previous kprintf change
 1.2 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.3 02-May-2001  minoura Remove old obsolete audio driver.
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3 02-May-2001  minoura Remove old obsolete audio driver.
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.58 29-Apr-2012  tsutsui Finally switch PSX16550 fast serial board driver to using MI com(4) driver.
Based on isaki@'s patch and debugged by both isaki@ and tsutsui@.

PSX16550 specific hardware infomation is taken from Human68k's PSXIO driver:
http://retropc.net/x68000/software/hardware/psx16550/

XXX1: TL16C550C seems to have some timing critical issue around THRE interrupt
XXX2: auto hardware flow control of TL16C550 is not implemented in MI com(4)
 1.57 24-Apr-2011  rmind branches: 1.57.4; 1.57.8;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.56 23-Nov-2009  rmind branches: 1.56.4; 1.56.6;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.55 18-Jan-2009  isaki Clean up header files.
 1.54 29-Nov-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
Not tested. I don't have its hardware and no response in port-x68k.
 1.53 13-Jun-2008  cegger branches: 1.53.2; 1.53.4;
use device_lookup_private to get softc
 1.52 27-May-2008  ad branches: 1.52.2;
PR kern/38763 "hanging in tty" bugfix breaks the build for vax (and
probably others)
 1.51 28-Apr-2008  martin branches: 1.51.2;
Remove clause 3 and 4 from TNF licenses
 1.50 19-Nov-2007  ad branches: 1.50.14; 1.50.16; 1.50.18;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.49 17-Oct-2007  garbled branches: 1.49.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.48 14-Jul-2007  isaki branches: 1.48.8; 1.48.10; 1.48.14;
Make it compilable after the merge of some vmlocking branch.
OK'ed by ad@.
 1.47 14-Jul-2007  ad - Restore com.c 1.45, par.c 1.31. They were trashed due to file system
corruption on my machine.
- Adjust to match callout_init signature change.
 1.46 09-Jul-2007  ad Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.45 12-May-2007  isaki Clean up white spaces and tabs.
 1.44 11-Mar-2007  isaki branches: 1.44.2; 1.44.8;
white space, indent and KNF.
 1.43 04-Mar-2007  christos branches: 1.43.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 01-Oct-2006  elad branches: 1.42.4;
More from Matt Fleming:

Adapt to KAUTH_DEVICE_TTY_PRIVSET and KAUTH_DEVICE_TTY_OPEN.
 1.41 01-Oct-2006  elad Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.40 23-Jul-2006  ad branches: 1.40.4; 1.40.6;
Use the LWP cached credentials where sane.
 1.39 14-May-2006  elad integrate kauth.
 1.38 07-Mar-2006  he branches: 1.38.2; 1.38.4;
Remove another instance of the macro triplet SET/CLR/ISSET, now
found in <sys/types.h>.
 1.37 11-Dec-2005  christos branches: 1.37.4; 1.37.6; 1.37.8;
merge ktrace-lwp.
 1.36 06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.35 13-Jun-2005  he branches: 1.35.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.34 18-Jan-2005  chs use a global variable to ensure that only one instance is configured
rather than requiring that its unit number be zero.
simplify by not pretending that x68ks can have more than 1 com
(which they might actually have, but the driver doesn't currently allow it).
determine which instance is the console by comparing the iobase rather than
the unit number (which is silly given the above, but whatever).
 1.33 18-Jan-2005  chs de-__P, remove register, ansify.
 1.32 07-Aug-2003  agc branches: 1.32.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.31 15-Jul-2003  lukem rcsid
 1.30 23-Oct-2002  jdolecek branches: 1.30.6;
merge kqueue branch into -current

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

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.29 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.28 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.27 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.26 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.25 30-May-2002  thorpej Don't include macro params when #undef'ing it.
 1.24 17-Mar-2002  atatat branches: 1.24.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.23 25-Nov-2001  minoura Previous commit was incomplete.
 1.22 25-Nov-2001  minoura Make this file compile again.
 1.21 30-May-2001  lukem branches: 1.21.2; 1.21.4; 1.21.8;
add missing #include "opt_kgdb.h"
 1.20 05-May-2001  minoura Use cdev_decl for prototype declarations (port-x68k/12829, thanks to scw
for suggestion).
Add static to some non-external functions.
 1.19 02-May-2001  scw Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.18 02-Nov-2000  eeh branches: 1.18.2;
Adapt to new line discipline scheme.
 1.17 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.16 22-Nov-1999  sommerfeld defopt COM_DEBUG, COM_HAYESP, and COM16650
 1.15 24-Mar-1999  minoura branches: 1.15.8; 1.15.14;
Shut up gcc -Wall.
 1.14 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.13 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.12 04-Jul-1998  jonathan defopt DDB.
 1.11 30-Jun-1998  msaitoh sync with -current after a long silence
 1.10 12-Jan-1998  thorpej Update for changes to config.
 1.9 17-Oct-1997  oki Make this compile again.
 1.8 15-Oct-1997  thorpej Pulldown from marc-pcmcia branch: minimal changes to change x68k port's
"com" (now "xcom") driver to avoid name collision with the more
heaviliy-used "com" driver.
 1.7 12-Oct-1997  oki Added prototypes.
 1.6 13-Oct-1996  christos branches: 1.6.10;
backout previous kprintf change
 1.5 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.4 16-Jul-1996  oki call Debugger() with options DDB, added #ifdef.
 1.3 05-Jun-1996  oki add tty_attach(tp);
 1.2 21-May-1996  oki branches: 1.2.2;
Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.2.2 16-Jul-1996  jtc Pulled up from rev 1.4 by request from Masaru Oki
 1.2.2.1 05-Jun-1996  oki pull up tty_attach() changes from trunk
 1.6.10.2 15-Oct-1997  thorpej Minimal changes to rename the x68k port's "com" driver to "xcom", to
avoid a namespace collision with the more heavily-used "com" driver,
which needs to be declared in sys/conf/files.
 1.6.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.8.2 22-Nov-2000  bouyer Sync with HEAD.
 1.15.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.21.8.7 11-Nov-2002  nathanw Catch up to -current
 1.21.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.21.8.5 17-Sep-2002  nathanw Catch up to -current.
 1.21.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.21.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.21.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.21.8.1 30-May-2001  nathanw file com.c was added on branch nathanw_sa on 2002-01-08 00:28:37 +0000
 1.21.4.2 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.21.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.21.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.21.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.21.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.24.4.2 15-Jul-2002  gehenna catch up with -current.
 1.24.4.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.30.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.30.6.5 04-Feb-2005  skrll Adapt to branch.
 1.30.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.30.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.30.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.30.6.1 03-Aug-2004  skrll Sync with HEAD
 1.32.8.1 29-Apr-2005  kent sync with -current
 1.35.2.4 07-Dec-2007  yamt sync with head
 1.35.2.3 03-Sep-2007  yamt sync with head.
 1.35.2.2 30-Dec-2006  yamt sync with head.
 1.35.2.1 21-Jun-2006  yamt sync with head.
 1.37.8.3 11-Aug-2006  yamt sync with head
 1.37.8.2 24-May-2006  yamt sync with head.
 1.37.8.1 13-Mar-2006  yamt sync with head.
 1.37.6.2 01-Jun-2006  kardel Sync with head.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.38.4.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.38.2.4 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.38.2.3 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.38.2.2 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.38.2.1 07-Mar-2006  elad file com.c was added on branch elad-kernelauth on 2006-03-08 00:43:19 +0000
 1.40.6.1 22-Oct-2006  yamt sync with head
 1.40.4.1 18-Nov-2006  ad Sync with head.
 1.42.4.2 17-May-2007  yamt sync with head.
 1.42.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.43.2.4 03-Dec-2007  ad Sync with HEAD.
 1.43.2.3 15-Jul-2007  ad Sync with head.
 1.43.2.2 27-May-2007  ad Sync with head.
 1.43.2.1 13-Mar-2007  ad Sync with head.
 1.44.8.2 03-Oct-2007  garbled Sync with HEAD
 1.44.8.1 22-May-2007  matt Update to HEAD.
 1.44.2.1 11-Jul-2007  mjf Sync with head.
 1.48.14.1 21-Nov-2007  bouyer Sync with HEAD
 1.48.10.2 09-Jan-2008  matt sync with HEAD
 1.48.10.1 06-Nov-2007  matt sync with HEAD
 1.48.8.1 21-Nov-2007  joerg Sync with HEAD.
 1.49.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.50.18.3 11-Mar-2010  yamt sync with head
 1.50.18.2 04-May-2009  yamt sync with head.
 1.50.18.1 16-May-2008  yamt sync with head.
 1.50.16.3 17-Jun-2008  yamt sync with head.
 1.50.16.2 04-Jun-2008  yamt sync with head
 1.50.16.1 18-May-2008  yamt sync with head.
 1.50.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.50.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.50.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.51.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.52.2.1 18-Jun-2008  simonb Sync with head.
 1.53.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.53.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.56.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.56.4.1 31-May-2011  rmind sync with head
 1.57.8.1 29-Apr-2012  mrg sync to latest -current.
 1.57.4.1 23-May-2012  yamt sync with head.
 1.2 08-Dec-2018  thorpej Clean up initialization of com_regs structure, in preparation for
some additional changers.
 1.1 29-Apr-2012  tsutsui branches: 1.1.2; 1.1.4; 1.1.42; 1.1.44;
Finally switch PSX16550 fast serial board driver to using MI com(4) driver.
Based on isaki@'s patch and debugged by both isaki@ and tsutsui@.

PSX16550 specific hardware infomation is taken from Human68k's PSXIO driver:
http://retropc.net/x68000/software/hardware/psx16550/

XXX1: TL16C550C seems to have some timing critical issue around THRE interrupt
XXX2: auto hardware flow control of TL16C550 is not implemented in MI com(4)
 1.1.44.1 10-Jun-2019  christos Sync with HEAD
 1.1.42.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.1.4.2 23-May-2012  yamt sync with head.
 1.1.4.1 29-Apr-2012  yamt file com_intio.c was added on branch yamt-pagecache on 2012-05-23 10:07:50 +0000
 1.1.2.2 29-Apr-2012  mrg sync to latest -current.
 1.1.2.1 29-Apr-2012  mrg file com_intio.c was added on branch jmcneill-usbmp on 2012-04-29 23:04:42 +0000
 1.5 29-Apr-2012  tsutsui Finally switch PSX16550 fast serial board driver to using MI com(4) driver.
Based on isaki@'s patch and debugged by both isaki@ and tsutsui@.

PSX16550 specific hardware infomation is taken from Human68k's PSXIO driver:
http://retropc.net/x68000/software/hardware/psx16550/

XXX1: TL16C550C seems to have some timing critical issue around THRE interrupt
XXX2: auto hardware flow control of TL16C550 is not implemented in MI com(4)
 1.4 11-Dec-2005  christos branches: 1.4.112; 1.4.116;
merge ktrace-lwp.
 1.3 13-Dec-2004  chs rather than duplicate the contents of the MI version of this file,
just include it and redefine the one thing that we want to be different.
 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 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.4 18-Dec-2004  skrll Sync with HEAD.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.4.116.1 29-Apr-2012  mrg sync to latest -current.
 1.4.112.1 23-May-2012  yamt sync with head.
 1.7 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.6 22-Aug-1998  minoura branches: 1.6.6;
Eliminated vm_offset_t and vm_size_t.
 1.5 15-Aug-1998  mycroft Assign my copyrights to TNF.
 1.4 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.3 24-May-1998  is Back out the defopt for M680?0. As pointed out to me, this breaks ports which
dont use the M680?0 the way Amiga, Atari, Mac68k, and X68k do. I must have
missed this in the past discussion about this project.
 1.2 23-May-1998  is Move M680[2346]0 to opt_m68kcpu.h.
XXX Some explicit dependencies could be removed now from the individual
arch/$ARCH/conf/Makefile.$ARCH files, but this is still to be done.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.6.6.1 13-Feb-1999  minoura Now we have bus_dma implementation, this file is unnecessary.
 1.12 11-Aug-2017  isaki Fix a Continue Operation.
Patch from Y.Sugahara.
 1.11 11-Aug-2017  isaki Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
 1.10 25-Jun-2008  isaki branches: 1.10.40; 1.10.60; 1.10.76;
Split device_t/softc for dmac_*_xfer().
Rename some variables to avoid confusing.
 1.9 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.8 28-Apr-2008  martin branches: 1.8.2; 1.8.4;
Remove clause 3 and 4 from TNF licenses
 1.7 11-Dec-2005  christos branches: 1.7.74; 1.7.76; 1.7.78;
merge ktrace-lwp.
 1.6 12-Jun-2005  he Change the `name' argument of dmac_alloc_channel to const char*, so that
a string constant can be used without generating a warning.
 1.5 18-Jan-2005  chs de-__P, remove register, ansify.
 1.4 02-May-2001  minoura branches: 1.4.8; 1.4.24; 1.4.32;
Disable array chain mode by default, since it is unused by any of
the current devices.
Add more flexibility in the API.
 1.3 30-Apr-2001  minoura Correct memory leak.
Use single block transfer when appropriate.
 1.2 16-Mar-1999  minoura branches: 1.2.20;
Merged minoura_x68k_bus_h branch.
 1.1 30-Jan-1999  minoura branches: 1.1.2;
file dmacvar.h was initially added on branch minoura_x68k_bus_h.
 1.1.2.2 02-Feb-1999  minoura Arg for Interrupt handlers.
 1.1.2.1 30-Jan-1999  minoura Added DMAC driver.
 1.2.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.32.1 29-Apr-2005  kent sync with -current
 1.4.24.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.24.1 24-Jan-2005  skrll Sync with HEAD.
 1.4.8.2 02-May-2001  minoura Disable array chain mode by default, since it is unused by any of
the current devices.
Add more flexibility in the API.
 1.4.8.1 02-May-2001  minoura file dmacvar.h was added on branch nathanw_sa on 2001-05-02 12:48:25 +0000
 1.7.78.2 04-May-2009  yamt sync with head.
 1.7.78.1 16-May-2008  yamt sync with head.
 1.7.76.1 18-May-2008  yamt sync with head.
 1.7.74.2 29-Jun-2008  mjf Sync with HEAD.
 1.7.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.8.4.1 27-Jun-2008  simonb Sync with head.
 1.8.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.10.76.1 23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #290):
sys/arch/x68k/dev/dmacvar.h: revision 1.11-1.12 via patch
sys/arch/x68k/dev/intio_dmac.c: revision 1.36-1.37 via patch
sys/arch/x68k/dev/fd.c: revision 1.120 via patch
sys/arch/x68k/dev/vs.c: revision 1.45-1.46 via patch
Use dmac_prepare_xfer().
From Y.Sugahara.
--
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
--
Fix a Continue Operation.
Patch from Y.Sugahara.
 1.10.60.1 28-Aug-2017  skrll Sync with HEAD
 1.10.40.1 03-Dec-2017  jdolecek update from HEAD
 1.4 19-Oct-2002  isaki Not used anywhere.
 1.3 22-Aug-1998  minoura branches: 1.3.32;
Eliminated vm_offset_t and vm_size_t.
 1.2 12-Oct-1997  oki Added prototypes.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.32.1 11-Nov-2002  nathanw Catch up to -current
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.20 26-May-2022  tsutsui KNF a bit.
 1.19 26-Sep-2021  thorpej Driver "kqfilter" entry points return an error code, so if an invalid
filter is requested, return EINVAL rather than 1.
 1.18 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.17 19-Dec-2020  thorpej Use sel{record,remove}_knote().
 1.16 23-May-2020  ad branches: 1.16.2;
Move proc_lock into the data segment. It was dynamically allocated because
at the time we had mutex_obj_alloc() but not __cacheline_aligned.
 1.15 25-Oct-2017  maya 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.14 21-Mar-2014  tsutsui Replace tsleep(9)/wakeup(9) with condvar(9) as practice.

Also replace malloc(9) with kmem_alloc(9).
Pevent more possible races.

Tested on both console and Xserver on X68030.
 1.13 01-Mar-2008  rmind branches: 1.13.38; 1.13.48; 1.13.54;
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.12 04-Mar-2007  christos branches: 1.12.20; 1.12.36; 1.12.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 18-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify.
 1.9 07-Aug-2003  agc branches: 1.9.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 15-Jul-2003  lukem rcsid
 1.7 26-Nov-2002  christos branches: 1.7.6;
si_ -> sel_
 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 27-Dec-2001  wiz bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.4 27-Nov-1996  oki branches: 1.4.44; 1.4.48;
renamed variable in ev_poll(), compile again.
 1.3 23-Nov-1996  oki Implement poll(2).
 1.2 29-May-1996  oki added missing splx(s). pointed out by thorpej.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.4;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.4.1 29-May-1996  oki pull up version 1.2 from the main branch.
 1.4.48.3 11-Dec-2002  thorpej Sync with HEAD.
 1.4.48.2 11-Nov-2002  nathanw Catch up to -current
 1.4.48.1 08-Jan-2002  nathanw Catch up to -current.
 1.4.44.4 02-Oct-2002  jdolecek do not need the (void *) cast for kn_hook anymore
 1.4.44.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.44.2 12-Sep-2001  thorpej Fix a past'o.
 1.4.44.1 09-Sep-2001  thorpej Add kqueue support (not yet compiled).
 1.7.6.5 04-Feb-2005  skrll Adapt to branch.
 1.7.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.3 17-Mar-2008  yamt sync with head.
 1.10.8.2 03-Sep-2007  yamt sync with head.
 1.10.8.1 21-Jun-2006  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.12.36.1 24-Mar-2008  keiichi sync with head.
 1.12.20.1 23-Mar-2008  matt sync with HEAD
 1.13.54.1 18-May-2014  rmind sync with head
 1.13.48.2 03-Dec-2017  jdolecek update from HEAD
 1.13.48.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.13.38.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.16.2.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.10 21-Mar-2014  tsutsui Replace tsleep(9)/wakeup(9) with condvar(9) as practice.

Also replace malloc(9) with kmem_alloc(9).
Pevent more possible races.

Tested on both console and Xserver on X68030.
 1.9 15-Aug-2012  tsutsui branches: 1.9.2; 1.9.4;
Make sure to take proc_lock mutex on calling psignal(9) in EV_WAKEUP() macro
as sys/dev/sun/event_var.h does.
Fixes immediate KASSERT(mutex_owned(proc_lock)) panic during running Xserver
on DIAGNOSTIC kernel.

Should be pulled up to netbsd-6.
 1.8 01-Mar-2008  rmind branches: 1.8.38; 1.8.44;
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.7 04-Mar-2007  christos branches: 1.7.20; 1.7.36; 1.7.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.6 11-Dec-2005  christos branches: 1.6.26;
merge ktrace-lwp.
 1.5 18-Jan-2005  chs branches: 1.5.8;
de-__P, remove register, ansify.
 1.4 07-Aug-2003  agc branches: 1.4.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.3 23-Oct-2002  jdolecek branches: 1.3.6;
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.2 10-Oct-1997  oki branches: 1.2.32; 1.2.36;
Add missing prototype.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.36.1 11-Nov-2002  nathanw Catch up to -current
 1.2.32.1 09-Sep-2001  thorpej Add kqueue support (not yet compiled).
 1.3.6.5 04-Feb-2005  skrll Adapt to branch.
 1.3.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.3.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.4.8.1 29-Apr-2005  kent sync with -current
 1.5.8.3 17-Mar-2008  yamt sync with head.
 1.5.8.2 03-Sep-2007  yamt sync with head.
 1.5.8.1 21-Jun-2006  yamt sync with head.
 1.6.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.7.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.7.36.1 24-Mar-2008  keiichi sync with head.
 1.7.20.1 23-Mar-2008  matt sync with HEAD
 1.8.44.1 16-Aug-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #504):
sys/arch/x68k/dev/event_var.h: revision 1.9
Make sure to take proc_lock mutex on calling psignal(9) in EV_WAKEUP() macro
as sys/dev/sun/event_var.h does.
Fixes immediate KASSERT(mutex_owned(proc_lock)) panic during running Xserver
on DIAGNOSTIC kernel.
Should be pulled up to netbsd-6.
 1.8.38.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.38.1 30-Oct-2012  yamt sync with head
 1.9.4.1 18-May-2014  rmind sync with head
 1.9.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.129 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.128 17-Dec-2023  andvar s/FD_DEBUG/FDDEBUG/ for consistency.
 1.127 26-May-2022  tsutsui Make local functions and variable static.
 1.126 23-May-2022  tsutsui Remove unused variables.
 1.125 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.124 24-Apr-2021  thorpej branches: 1.124.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.123 10-Nov-2019  chs branches: 1.123.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.122 08-Feb-2019  mrg make *fd*.c's fd_dev_to_type() always a static inline. some
have it as a const, and have code to copy the defaults to
modify them before using them, but that probably requires a
real test to feel confident in changing.
 1.121 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

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

HOWEVER! Some subsystems have

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

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

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

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

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

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

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.120 11-Aug-2017  isaki branches: 1.120.2; 1.120.4;
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
 1.119 12-Jan-2017  isaki branches: 1.119.8;
Fix the possibility of off-by-one on the grammer. Reported by coypu.
Currently it never happens because type is (minor number % 7) and
the arraycount of fd_types[] is 8. I.e., it is a dead code...
However, when the capacity of the FDTYPE() changes or the arraycount
of fd_types[] changes, this correction will be effective.
 1.118 11-Jul-2015  kamil branches: 1.118.2;
Improve spelling: regsiter -> register

This change is non-functional.

Approved by <riastradh>, <pgoyette>
 1.117 26-Apr-2015  mlelstv Use C99-style initializers for struct dkdriver.
 1.116 13-Apr-2015  riastradh MD rnd.h cleanups. Please let me know if I broke anything!
 1.115 02-Jan-2015  christos We have three sets of DTYPE_ constants in the kernel:
altq Drop Type
disklabel Disk Type
file Descriptor Type
(not to mention constants that contain the string DTYPE).
Let's make them two, by changing the disklabel one to be DisK TYPE since the
other disklabel constants seem to do that. Not many userland programs use
these constants (and the ones that they do are mostly in ifdefs). They will
be fixed shortly.
 1.114 02-Jan-2015  christos restore part decl.
 1.113 01-Jan-2015  christos declare error
 1.112 31-Dec-2014  christos make more drivers use disk_ioctl, and add a dev parameter to it so that
we can merge the "easy" disklabel ioctls to it. Ultimately all this will
go do dk_ioctl once all the drivers have been converted.
 1.111 10-Aug-2014  tls branches: 1.111.4;
Merge tls-earlyentropy branch into HEAD.
 1.110 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.109 25-Jul-2014  dholland Add d_discard to all struct bdevsw instances I could find.

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

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.106 24-May-2013  christos branches: 1.106.2;
kill bogus inline
 1.105 14-Oct-2012  tsutsui KNF and space nits
 1.104 14-Oct-2012  tsutsui Add floppy format support. Mostly taken from sys/dev/isa/fd.c.

Tested both fdNa (1232KB, 1024bytes/sector, 8sectors/track) and
fdNc (1200KB, 512bytes/sector, 15sectors/track) format on X68030
using fdformat(1).

Finally we can prepare NetBSD/x68k install floppies without Human68k
(except actual initial bootstrap).
 1.103 14-Oct-2012  tsutsui Terminate DMAC and call bus_dmamap_unload(9) properly in all FDC xfer
error paths, as sys/dev/isa/fd.c does. Fixes unexpected DMAC errors
(and possible VM panic due to un-unloaded dmamap) on the first floppy
access after read/write errors.
 1.102 14-Oct-2012  tsutsui Before probing floppy drives, call NE7CMD_SENSEI and fdcresult()
to drain possible pending FDC interrupts. Taken from sys/dev/isa/fd.c.
Hopefully might fix occasional fd drive probe failure (but not confirmed).
 1.101 15-May-2012  tsutsui branches: 1.101.2;
- check bus_space_map(9) return value
- use BUS_SPACE_MAP_SHIFTED_ODD for clarify
- define and use proper macro instead of magic
 1.100 13-May-2012  tsutsui KNF and cosmetics. No binary change.
 1.99 13-May-2012  tsutsui - use <sys/bus.h> rather than <machine/bus.h>
- no need to include uvm_extern.h
- include "ioconf.h" for struct cfdriver foo_cd
 1.98 12-May-2012  tsutsui Explicitly specify a proper FDC data register address for HD63450 DMAC
to avoid confusion.

Previous one (fdc->sc_addr + fddata) wasn't a right address for
the FDC's data register but one for the command register by accident,
but FDC ignores A0 address input (connected to A1 of x68k address bus)
during DMA xfer (i.e. when DACK is asserted) so it happened to work
as expected on the real X680x0 hardware, but caused trouble on emulators.

The inconsistency was found by Y.Sugahara during debugging XM6i emulator
(and it will be fixed in the next release).
FDC behavior during DMA is confirmed by uPD72068 hardware application note.

XXX: There is no proper MI API to specify DMA address for DMA controller
(like MC68450) to access devices mapped to memory space by bus_space(9).
 1.97 06-May-2012  tsutsui Make x68k's floppy driver actually work with proper bounce buffer xfer ops
on machines with extended high memories:

- dev/fd.c:
- add missing bus_dmamap_sync(9) POSTREAD/POSTWRITE ops

- x68k/machdep.c:
- update avail_end variable (which is used to check DMA'able memory range
in intio.c) properly per probed extended memory regions

The problem was found during debugging XM6i's FDC emulation by
Y.Sugahara, isaki@, and me.

Should be pulled up to netbsd-6.
 1.96 02-Feb-2012  tls branches: 1.96.2;
Entropy-pool implementation move and cleanup.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Manual pages for the new kernel interfaces are forthcoming.
 1.94 10-Apr-2011  tsutsui branches: 1.94.4;
Fix hangup on the first floppy access since 2008.
Problem was reported by isaki@.

On X680x0 (and most other machines other than ISA FDC),
the ready line from FDD is connected to FDC and fdc driver can
be notified of the ready state after fd_set_motor() by interrupts.
In this case no need to use callout(9) to wait the FDD motor stabilized,
and the callout(9) method used in ISA fdc(4) driver rather caused
infinite unhandled interrupts since callout(9) was no longer invoked
during interrupt storm after vmlocking2 merge, I guess.

Should be pulled up to netbsd-5.
 1.93 06-Jun-2010  mrg branches: 1.93.2;
fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.92 18-Jan-2009  isaki branches: 1.92.4; 1.92.6;
Clean up header files.
 1.91 13-Jan-2009  yamt g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.90 10-Jan-2009  isaki Clean up messages.
- fdcintr: remove duplicated status message.
- fdioctl: make it easy to track ioctl.
 1.89 10-Jan-2009  isaki fdc->sc_dev is not necessary.
 1.88 18-Dec-2008  isaki Make it compilable again.
 1.87 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.86 05-Dec-2008  isaki Use TAILQ_* macros.
 1.85 29-Jun-2008  isaki branches: 1.85.2; 1.85.4; 1.85.6;
Make it compilable even if FDDEBUG was defined.
 1.84 25-Jun-2008  isaki Link to device_t. I had forgotten it in previous commit.
 1.83 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.82 14-Jun-2008  isaki Fix compile errors.
 1.81 13-Jun-2008  cegger use device_lookup_private to get softc
 1.80 28-Apr-2008  martin branches: 1.80.2; 1.80.4;
Remove clause 3 and 4 from TNF licenses
 1.79 17-Oct-2007  garbled branches: 1.79.16; 1.79.18; 1.79.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.78 08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.77 29-Jul-2007  ad branches: 1.77.4; 1.77.6; 1.77.8;
It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
 1.76 09-Jul-2007  ad branches: 1.76.2; 1.76.4;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.75 20-May-2007  isaki Make it compilable with FDDEBUG.
 1.74 12-May-2007  isaki Clean up white spaces and tabs.
 1.73 11-Mar-2007  isaki branches: 1.73.2; 1.73.8;
white space, indent and KNF.
 1.72 05-Mar-2007  he branches: 1.72.2;
Cast to char* before doing pointer arithmetic.
 1.71 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.70 14-Apr-2006  blymn branches: 1.70.14;
Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
 1.69 28-Mar-2006  thorpej Use device_unit().
 1.68 23-Feb-2006  thorpej branches: 1.68.2; 1.68.4; 1.68.6;
Use device_parent().
 1.67 24-Dec-2005  perry branches: 1.67.2; 1.67.4; 1.67.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.66 11-Dec-2005  christos merge ktrace-lwp.
 1.65 15-Oct-2005  yamt - change the way to specify a bufq strategy. (by string rather than by number)
- rather than embedding bufq_state in driver softc,
have a pointer to the former.
- move bufq related functions from kern/subr_disk.c to kern/subr_bufq.c.
- rename method to strategy for consistency.
- move some definitions which don't need to be exposed to the rest of kernel
from sys/bufq.h to sys/bufq_impl.h.
(is it better to move it to kern/ or somewhere?)
- fix some obvious breakage in dev/qbus/ts.c. (not tested)
 1.64 12-Jun-2005  he branches: 1.64.2;
Sprinkle some consts to allow this to compile with -Wcast-qual.
 1.63 18-Jan-2005  chs de-__P, remove register, ansify.
 1.62 28-Oct-2004  yamt branches: 1.62.4;
move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.61 08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.60 15-Nov-2003  isaki make it compilable even if FDDEBUG was defined.
 1.59 01-Nov-2003  jdolecek fix several places where variables might be used uninitialized
 1.58 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.57 15-Jul-2003  lukem rcsid
 1.56 18-Jun-2003  drochner branches: 1.56.2;
don't #include <sys/dkstat.h> where it is (appearently) unused
 1.55 03-May-2003  wiz DMA, not dma nor Dma.
 1.54 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.53 02-Feb-2003  isaki Fix printf format for DIAGNOSTIC, in the wake of daddr_t having changed.
Use PRId64, instead of %lld.
 1.52 25-Jan-2003  isaki Make it compilable with 64bit daddr_t.
 1.51 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.50 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.49 20-Oct-2002  isaki Remove unbalanced parenthesis in debug message.
 1.48 13-Oct-2002  isaki Style fixes.
 1.47 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.46 01-Oct-2002  thorpej Missed one use of CFATTACH_DECL().
 1.45 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.44 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.43 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.42 01-Aug-2002  hannken Convert to new device buffer queue interface.

Approved by: NISHIMURA Takeshi <nsmrtks@netbsd.org>
 1.41 31-Jul-2002  isaki Fix compile warnings in debug code.
 1.40 27-Dec-2001  wiz branches: 1.40.8;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.39 19-Dec-2001  minoura Implement bus_dmamap_sync properly.
dma_cachectl is now used only for DMAC array chain.
 1.38 25-Nov-2001  minoura Avoid using array chaining mode of DMAC.
 1.37 08-Jul-2001  wiz branches: 1.37.2; 1.37.4; 1.37.8;
Correct various misspellings of 'transfer' and inflected forms.
 1.36 02-May-2001  minoura Do not use constants, but macros.
 1.35 29-Jun-2000  mrg branches: 1.35.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.34 18-Apr-2000  minoura Explicitly include opt_m680x0.h.
 1.33 07-Apr-2000  thorpej Use separate callouts for motor-on and motor-off. Fixes a condition
where the floppy driver would wedge because a motor-on timeout would
be cancelled by another I/O operation cancelling a motor-off timeout.

From enami tsugutomo <enami@sm.sony.co.jp>.
 1.32 27-Mar-2000  minoura Make this compile (typo in callout change).
 1.31 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.30 07-Feb-2000  thorpej Fix a bug in disksort_*() which caused non-optimal ordering when multiple
active partitions were on a single spindle. Add a b_rawblkno member to
struct buf which contains the non-partition-relative block number to sort
by.
 1.29 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.28 24-Mar-1999  minoura branches: 1.28.8; 1.28.14;
Shut up gcc -Wall.
 1.27 24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.26 18-Mar-1999  minoura Correct rnd_attach_source args.
 1.25 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.24 08-Feb-1999  bouyer Change DIOCEJECT to do what's needed to eject a device before the eject
command (unlock for sd and cd) if no other partitions are open, return
EBUSY otherwise. DIOCEJECT will have the old semantic if its argument is not
0. The old ioctl has been renamed to ODIOCEJECT for binary compatibility.
 1.23 22-Aug-1998  minoura branches: 1.23.6;
Eliminated vm_offset_t and vm_size_t.
 1.22 15-Aug-1998  mycroft Assign copyrights to TNF.
 1.21 15-Aug-1998  mycroft Make copyright notices with my name consistent.
 1.20 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.19 04-Jul-1998  jonathan defopt DDB.
 1.18 30-Jun-1998  msaitoh sync with -current after a long silence
 1.17 24-May-1998  is Back out the defopt for M680?0. As pointed out to me, this breaks ports which
dont use the M680?0 the way Amiga, Atari, Mac68k, and X68k do. I must have
missed this in the past discussion about this project.
 1.16 23-May-1998  is Move M680[2346]0 to opt_m68kcpu.h.
XXX Some explicit dependencies could be removed now from the individual
arch/$ARCH/conf/Makefile.$ARCH files, but this is still to be done.
 1.15 12-Jan-1998  thorpej Update for changes to config.
 1.14 12-Oct-1997  oki Added prototype.
 1.13 10-Oct-1997  oki Fdopen --> fdopen
 1.12 17-Jul-1997  jtk branches: 1.12.2;
use locator defines in "locators.h" to index cf_loc[]
 1.11 02-Apr-1997  oki Add bits[64] declaration
 1.10 05-Feb-1997  oki Use bitmask_snprintf (from i386)
 1.9 31-Jan-1997  thorpej Use new machine-independent mountroothook code.
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.5 11-Aug-1996  oki drive 2 (or 3) couldn't access with drive 0 (or 1). fixed this.
 1.4 08-Jul-1996  oki move wait for insert system floppy to mountroot_hook stuff
 1.3 05-Jun-1996  oki fixed compiler error at kvtop().
 1.2 21-May-1996  oki branches: 1.2.2;
Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.2.3 16-Aug-1996  jtc Pulled up from rev 1.5 by request from oki
 1.2.2.2 08-Jul-1996  jtc Pulled up from rev 1.4 by request from Masaru Oki
 1.2.2.1 05-Jun-1996  oki pull up from the trunk:
>fixed compiler error at kvtop().
 1.12.2.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.6.5 14-Mar-1999  minoura Mis-sync.
 1.23.6.4 14-Mar-1999  minoura Sync.
 1.23.6.3 13-Feb-1999  minoura Use BUS_SPACE_MAP_SHIFTED.
Flush the data cache for the transfer buffer.
Handle INTIOCF_{INTR,DMA,DMAINTR}_DEFAULT cases.
 1.23.6.2 10-Feb-1999  minoura Sync with other ports'(i386,sparc) fd.c.
Use dma_cachectl.
note: still unstable especially on soft err.
 1.23.6.1 02-Feb-1999  minoura fdc at intio.
 1.28.14.1 21-Dec-1999  wrstuden Initial commit of recent changes to make DEV_BSIZE go away.

Runs on i386, needs work on other arch's. Main kernel routines should be
fine, but a number of the stand programs need help.

cd, fd, ccd, wd, and sd have been updated. sd has been tested with non-512
byte block devices. vnd, raidframe, and lfs need work.

Non 2**n block support is automatic for LKM's and conditional for kernels
on "options NON_PO2_BLOCKS".
 1.28.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.35.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.37.8.8 03-Jan-2003  thorpej Sync with HEAD.
 1.37.8.7 11-Nov-2002  nathanw Catch up to -current
 1.37.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.37.8.5 17-Sep-2002  nathanw Catch up to -current.
 1.37.8.4 13-Aug-2002  nathanw Catch up to -current.
 1.37.8.3 01-Aug-2002  nathanw Catch up to -current.
 1.37.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.37.8.1 08-Jul-2001  nathanw file fd.c was added on branch nathanw_sa on 2002-01-08 00:28:38 +0000
 1.37.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.37.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.37.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.37.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.40.8.2 31-Aug-2002  gehenna catch up with -current.
 1.40.8.1 17-May-2002  gehenna Add device switch.
 1.56.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.56.2.6 04-Feb-2005  skrll Adapt to branch.
 1.56.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.56.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.56.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.56.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.56.2.1 03-Aug-2004  skrll Sync with HEAD
 1.62.4.1 29-Apr-2005  kent sync with -current
 1.64.2.3 27-Oct-2007  yamt sync with head.
 1.64.2.2 03-Sep-2007  yamt sync with head.
 1.64.2.1 21-Jun-2006  yamt sync with head.
 1.67.6.1 22-Apr-2006  simonb Sync with head.
 1.67.4.1 09-Sep-2006  rpaulo sync with head
 1.67.2.1 01-Mar-2006  yamt sync with head.
 1.68.6.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.68.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.68.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.68.2.2 24-May-2006  yamt sync with head.
 1.68.2.1 01-Apr-2006  yamt sync with head.
 1.70.14.2 17-May-2007  yamt sync with head.
 1.70.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.72.2.5 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.72.2.4 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.72.2.3 15-Jul-2007  ad Sync with head.
 1.72.2.2 27-May-2007  ad Sync with head.
 1.72.2.1 13-Mar-2007  ad Sync with head.
 1.73.8.3 16-Oct-2007  garbled Sync with HEAD
 1.73.8.2 03-Oct-2007  garbled Sync with HEAD
 1.73.8.1 22-May-2007  matt Update to HEAD.
 1.73.2.1 11-Jul-2007  mjf Sync with head.
 1.76.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.76.2.1 07-Aug-2007  matt Sync with HEAD.
 1.77.8.1 14-Oct-2007  yamt sync with head.
 1.77.6.1 06-Nov-2007  matt sync with HEAD
 1.77.4.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.79.20.3 11-Aug-2010  yamt sync with head.
 1.79.20.2 04-May-2009  yamt sync with head.
 1.79.20.1 16-May-2008  yamt sync with head.
 1.79.18.2 17-Jun-2008  yamt sync with head.
 1.79.18.1 18-May-2008  yamt sync with head.
 1.79.16.4 17-Jan-2009  mjf Sync with HEAD.
 1.79.16.3 02-Jul-2008  mjf Sync with HEAD.
 1.79.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.79.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.80.4.3 03-Jul-2008  simonb Sync with head.
 1.80.4.2 27-Jun-2008  simonb Sync with head.
 1.80.4.1 18-Jun-2008  simonb Sync with head.
 1.80.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.80.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.85.6.1 20-May-2011  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1617):
sys/arch/x68k/dev/fd.c: revision 1.94 via patch
Fix hangup on the first floppy access since 2008.
Problem was reported by isaki@.
On X680x0 (and most other machines other than ISA FDC),
the ready line from FDD is connected to FDC and fdc driver can
be notified of the ready state after fd_set_motor() by interrupts.
In this case no need to use callout(9) to wait the FDD motor stabilized,
and the callout(9) method used in ISA fdc(4) driver rather caused
infinite unhandled interrupts since callout(9) was no longer invoked
during interrupt storm after vmlocking2 merge, I guess.
Should be pulled up to netbsd-5.
 1.85.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.85.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.92.6.2 21-Apr-2011  rmind sync with head
 1.92.6.1 03-Jul-2010  rmind sync with head
 1.92.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.93.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.94.4.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.94.4.3 30-Oct-2012  yamt sync with head
 1.94.4.2 23-May-2012  yamt sync with head.
 1.94.4.1 17-Apr-2012  yamt sync with head
 1.95.2.2 02-Jun-2012  mrg sync to latest -current.
 1.95.2.1 18-Feb-2012  mrg merge to -current.
 1.96.2.2 18-Nov-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #646):
sys/arch/x68k/dev/intio_dmac.c: revision 1.34
sys/arch/x68k/dev/fd.c: revision 1.100
sys/arch/x68k/dev/fd.c: revision 1.101
sys/arch/x68k/dev/fd.c: revision 1.102
sys/arch/x68k/dev/fd.c: revision 1.103
sys/arch/x68k/dev/fd.c: revision 1.104
sys/arch/x68k/dev/fd.c: revision 1.105
sys/arch/x68k/dev/fd.c: revision 1.98
sys/arch/x68k/dev/fd.c: revision 1.99
sys/arch/x68k/dev/fdreg.h: revision 1.5
sys/arch/x68k/dev/fdreg.h: revision 1.6
Explicitly specify a proper FDC data register address for HD63450 DMAC
to avoid confusion.
Previous one (fdc->sc_addr + fddata) wasn't a right address for
the FDC's data register but one for the command register by accident,
but FDC ignores A0 address input (connected to A1 of x68k address bus)
during DMA xfer (i.e. when DACK is asserted) so it happened to work
as expected on the real X680x0 hardware, but caused trouble on emulators.
The inconsistency was found by Y.Sugahara during debugging XM6i emulator
(and it will be fixed in the next release).
FDC behavior during DMA is confirmed by uPD72068 hardware application note.
XXX: There is no proper MI API to specify DMA address for DMA controller
(like MC68450) to access devices mapped to memory space by bus_space(9).
- use <sys/bus.h> rather than <machine/bus.h>
- no need to include uvm_extern.h
- include "ioconf.h" for struct cfdriver foo_cd
KNF and cosmetics. No binary change.
- check bus_space_map(9) return value
- use BUS_SPACE_MAP_SHIFTED_ODD for clarify
- define and use proper macro instead of magic
To abort DMA in dmac_abort_xfer(), set DMAC_CCR_SAB (software abort)
rather than DMAC_CCR_HLT (halt operation).
DMAC_CCR_HLT doesn't abort DMA xfers but only suspends DMA ops
(i.e. clearing HLT bit will resume DMA xfers), so previously
DMAC error always occurs on the next DMA xfer ops after
dmac_abort_xfer() is called.
Also suppress DMAC error messages in dmac_error() if it's caused
by software abort command because it can happen during normal
audio play/record DMA ops in vs(4) driver.
Before probing floppy drives, call NE7CMD_SENSEI and fdcresult()
to drain possible pending FDC interrupts. Taken from sys/dev/isa/fd.c.
Hopefully might fix occasional fd drive probe failure (but not confirmed).
Terminate DMAC and call bus_dmamap_unload(9) properly in all FDC xfer
error paths, as sys/dev/isa/fd.c does. Fixes unexpected DMAC errors
(and possible VM panic due to un-unloaded dmamap) on the first floppy
access after read/write errors.
Add floppy format support. Mostly taken from sys/dev/isa/fd.c.
Tested both fdNa (1232KB, 1024bytes/sector, 8sectors/track) and
fdNc (1200KB, 512bytes/sector, 15sectors/track) format on X68030
using fdformat(1).
Finally we can prepare NetBSD/x68k install floppies without Human68k
(except actual initial bootstrap).
KNF and space nits
 1.96.2.1 09-May-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #236):
sys/arch/x68k/x68k/machdep.c: revision 1.182
sys/arch/x68k/dev/fd.c: revision 1.97
Make x68k's floppy driver actually work with proper bounce buffer xfer ops
on machines with extended high memories:
- dev/fd.c:
- add missing bus_dmamap_sync(9) POSTREAD/POSTWRITE ops
- x68k/machdep.c:
- update avail_end variable (which is used to check DMA'able memory range
in intio.c) properly per probed extended memory regions
The problem was found during debugging XM6i's FDC emulation by
Y.Sugahara, isaki@, and me.
Should be pulled up to netbsd-6.
 1.101.2.4 03-Dec-2017  jdolecek update from HEAD
 1.101.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.101.2.2 23-Jun-2013  tls resync from head
 1.101.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.106.2.1 18-May-2014  rmind sync with head
 1.108.2.2 10-Aug-2014  tls Rebase.
 1.108.2.1 07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

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

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

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.111.4.5 28-Aug-2017  skrll Sync with HEAD
 1.111.4.4 05-Feb-2017  skrll Sync with HEAD
 1.111.4.3 22-Sep-2015  skrll Sync with HEAD
 1.111.4.2 06-Jun-2015  skrll Sync with HEAD
 1.111.4.1 06-Apr-2015  skrll Sync with HEAD
 1.118.2.1 20-Mar-2017  pgoyette Sync with HEAD
 1.119.8.1 23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #290):
sys/arch/x68k/dev/dmacvar.h: revision 1.11-1.12 via patch
sys/arch/x68k/dev/intio_dmac.c: revision 1.36-1.37 via patch
sys/arch/x68k/dev/fd.c: revision 1.120 via patch
sys/arch/x68k/dev/vs.c: revision 1.45-1.46 via patch
Use dmac_prepare_xfer().
From Y.Sugahara.
--
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
--
Fix a Continue Operation.
Patch from Y.Sugahara.
 1.120.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.120.4.1 10-Jun-2019  christos Sync with HEAD
 1.120.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.123.10.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.124.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.6 14-Oct-2012  tsutsui Add floppy format support. Mostly taken from sys/dev/isa/fd.c.

Tested both fdNa (1232KB, 1024bytes/sector, 8sectors/track) and
fdNc (1200KB, 512bytes/sector, 15sectors/track) format on X68030
using fdformat(1).

Finally we can prepare NetBSD/x68k install floppies without Human68k
(except actual initial bootstrap).
 1.5 15-May-2012  tsutsui branches: 1.5.2;
- check bus_space_map(9) return value
- use BUS_SPACE_MAP_SHIFTED_ODD for clarify
- define and use proper macro instead of magic
 1.4 11-Dec-2005  christos branches: 1.4.112; 1.4.116; 1.4.118;
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 16-Mar-1999  minoura branches: 1.2.42;
Merged minoura_x68k_bus_h branch.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.3 13-Feb-1999  minoura Use BUS_SPACE_MAP_SHIFTED.
Flush the data cache for the transfer buffer.
Handle INTIOCF_{INTR,DMA,DMAINTR}_DEFAULT cases.
 1.1.1.1.24.2 10-Feb-1999  minoura Sync with other ports'(i386,sparc) fd.c.
Use dma_cachectl.
note: still unstable especially on soft err.
 1.1.1.1.24.1 02-Feb-1999  minoura fdc at intio.
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.4.118.1 18-Nov-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #646):
sys/arch/x68k/dev/intio_dmac.c: revision 1.34
sys/arch/x68k/dev/fd.c: revision 1.100
sys/arch/x68k/dev/fd.c: revision 1.101
sys/arch/x68k/dev/fd.c: revision 1.102
sys/arch/x68k/dev/fd.c: revision 1.103
sys/arch/x68k/dev/fd.c: revision 1.104
sys/arch/x68k/dev/fd.c: revision 1.105
sys/arch/x68k/dev/fd.c: revision 1.98
sys/arch/x68k/dev/fd.c: revision 1.99
sys/arch/x68k/dev/fdreg.h: revision 1.5
sys/arch/x68k/dev/fdreg.h: revision 1.6
Explicitly specify a proper FDC data register address for HD63450 DMAC
to avoid confusion.
Previous one (fdc->sc_addr + fddata) wasn't a right address for
the FDC's data register but one for the command register by accident,
but FDC ignores A0 address input (connected to A1 of x68k address bus)
during DMA xfer (i.e. when DACK is asserted) so it happened to work
as expected on the real X680x0 hardware, but caused trouble on emulators.
The inconsistency was found by Y.Sugahara during debugging XM6i emulator
(and it will be fixed in the next release).
FDC behavior during DMA is confirmed by uPD72068 hardware application note.
XXX: There is no proper MI API to specify DMA address for DMA controller
(like MC68450) to access devices mapped to memory space by bus_space(9).
- use <sys/bus.h> rather than <machine/bus.h>
- no need to include uvm_extern.h
- include "ioconf.h" for struct cfdriver foo_cd
KNF and cosmetics. No binary change.
- check bus_space_map(9) return value
- use BUS_SPACE_MAP_SHIFTED_ODD for clarify
- define and use proper macro instead of magic
To abort DMA in dmac_abort_xfer(), set DMAC_CCR_SAB (software abort)
rather than DMAC_CCR_HLT (halt operation).
DMAC_CCR_HLT doesn't abort DMA xfers but only suspends DMA ops
(i.e. clearing HLT bit will resume DMA xfers), so previously
DMAC error always occurs on the next DMA xfer ops after
dmac_abort_xfer() is called.
Also suppress DMAC error messages in dmac_error() if it's caused
by software abort command because it can happen during normal
audio play/record DMA ops in vs(4) driver.
Before probing floppy drives, call NE7CMD_SENSEI and fdcresult()
to drain possible pending FDC interrupts. Taken from sys/dev/isa/fd.c.
Hopefully might fix occasional fd drive probe failure (but not confirmed).
Terminate DMAC and call bus_dmamap_unload(9) properly in all FDC xfer
error paths, as sys/dev/isa/fd.c does. Fixes unexpected DMAC errors
(and possible VM panic due to un-unloaded dmamap) on the first floppy
access after read/write errors.
Add floppy format support. Mostly taken from sys/dev/isa/fd.c.
Tested both fdNa (1232KB, 1024bytes/sector, 8sectors/track) and
fdNc (1200KB, 512bytes/sector, 15sectors/track) format on X68030
using fdformat(1).
Finally we can prepare NetBSD/x68k install floppies without Human68k
(except actual initial bootstrap).
KNF and space nits
 1.4.116.1 02-Jun-2012  mrg sync to latest -current.
 1.4.112.2 30-Oct-2012  yamt sync with head
 1.4.112.1 23-May-2012  yamt sync with head.
 1.5.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.47 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.46 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.45 14-Dec-2014  chs add a new "fo_mmap" fileops method to allow use of arbitrary uvm_objects for
mappings of file objects. move vnode-specific details of mmap()ing a vnode
from uvm_mmap() to the new vnode-specific vn_mmap(). add new uvm_mmap_dev()
and uvm_mmap_anon() convenience functions for mapping character devices
and anonymous memory, and replace all other calls to uvm_mmap() with those.
use the new fileop in drm2 so that libdrm can use mmap() to map things
like on other platforms (instead of the ioctl that we have used so far).
 1.44 25-Jul-2014  dholland branches: 1.44.2; 1.44.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.43 16-Mar-2014  dholland branches: 1.43.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.42 31-Jan-2014  tsutsui Fix build botched in previous.

Christos, please at least compile before commit per the guideline.
 1.41 26-Jan-2014  christos kill VM_DEFAULT_ADDRESS use.
 1.40 08-Feb-2011  rmind branches: 1.40.4; 1.40.14; 1.40.18;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.39 09-Jan-2010  isaki branches: 1.39.4; 1.39.6; 1.39.8;
Make compile with DEBUG.
 1.38 18-Jan-2009  isaki Clean up header files.
 1.37 17-Jan-2009  isaki Split device_t/softc, use aprint*().
 1.36 14-Jun-2008  isaki branches: 1.36.4;
Fix compile errors.
 1.35 13-Jun-2008  cegger use device_lookup_private to get softc
 1.34 30-Jan-2008  tsutsui branches: 1.34.6; 1.34.8; 1.34.10; 1.34.12; 1.34.14;
Fix for v_specinfo removal.
 1.33 04-Mar-2007  christos branches: 1.33.20; 1.33.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.32 28-Mar-2006  thorpej branches: 1.32.14;
Use device_unit().
 1.31 11-Dec-2005  christos branches: 1.31.4; 1.31.6; 1.31.8; 1.31.10; 1.31.12;
merge ktrace-lwp.
 1.30 18-Jan-2005  chs branches: 1.30.8;
de-__P, remove register, ansify.
 1.29 25-Jan-2004  minoura branches: 1.29.8;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.28 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.27 15-Jul-2003  lukem rcsid
 1.26 24-Feb-2003  atatat branches: 1.26.2;
Cast VM_DEFAULT_ADDRESS() to a caddr_t.
 1.25 20-Feb-2003  atatat Introduce "top down" memory management for mmap()ed allocations. This
means that the dynamic linker gets mapped in at the top of available
user virtual memory (typically just below the stack), shared libraries
get mapped downwards from that point, and calls to mmap() that don't
specify a preferred address will get mapped in below those.

This means that the heap and the mmap()ed allocations will grow
towards each other, allowing one or the other to grow larger than
before. Previously, the heap was limited to MAXDSIZ by the placement
of the dynamic linker (and the process's rlimits) and the space
available to mmap was hobbled by this reservation.

This is currently only enabled via an *option* for the i386 platform
(though other platforms are expected to follow). Add "options
USE_TOPDOWN_VM" to your kernel config file, rerun config, and rebuild
your kernel to take advantage of this.

Note that the pmap_prefer() interface has not yet been modified to
play nicely with this, so those platforms require a bit more work
(most notably the sparc) before they can use this new memory
arrangement.

This change also introduces a VM_DEFAULT_ADDRESS() macro that picks
the appropriate default address based on the size of the allocation or
the size of the process's text segment accordingly. Several drivers
and the SYSV SHM address assignment were changed to use this instead
of each one picking their own "default".
 1.24 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.23 10-Oct-2002  jdolecek replace the somewhat strange poll routine with standard nopoll() (a.k.a
seltrue())
 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 27-Dec-2001  wiz branches: 1.21.8;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.20 15-Mar-2001  chs branches: 1.20.2; 1.20.4; 1.20.8;
eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.19 29-Jun-2000  mrg branches: 1.19.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.18 26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.17 26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.16 27-Jun-1999  minoura branches: 1.16.2; 1.16.12;
include sys/resourcevar.h to be compiled.
 1.15 18-Jun-1999  thorpej Add the guts of mlockall(MCL_FUTURE). This requires that a process's
"memlock" resource limit to uvm_mmap(). Update all calls accordingly.
 1.14 05-May-1999  minoura Shut up gcc -Wall.
 1.13 24-Mar-1999  mrg branches: 1.13.4;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.12 11-Oct-1998  chuck remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)
 1.11 22-Aug-1998  minoura Eliminated vm_offset_t and vm_size_t.
 1.10 06-Aug-1998  minoura Moved grfioctl.h and iteioctl.h to the public include directory.
 1.9 30-Jun-1998  msaitoh sync with -current after a long silence
 1.8 25-Jun-1998  thorpej defopt COMPAT_HPUX
 1.7 12-Jan-1998  thorpej Update for changes to config.
 1.6 12-Oct-1997  oki branches: 1.6.2;
Added prototypes.
 1.5 23-Nov-1996  oki branches: 1.5.10;
Implement poll(2).
 1.4 13-Oct-1996  christos backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.5.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.1 13-Oct-1998  cgd pull up something resembling the changes in rev 1.9, via patch. (minoura)
 1.13.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.13.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.16.12.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.16.2.2 27-Mar-2001  bouyer Sync with HEAD.
 1.16.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.19.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.20.8.7 11-Nov-2002  nathanw Catch up to -current
 1.20.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.20.8.5 17-Sep-2002  nathanw Catch up to -current.
 1.20.8.4 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.20.8.3 08-Jan-2002  nathanw Catch up to -current.
 1.20.8.2 18-Nov-2001  scw MD Scheduler Activation bits for X68k.
Compile-tested only.
 1.20.8.1 15-Mar-2001  scw file grf.c was added on branch nathanw_sa on 2001-11-18 18:44:17 +0000
 1.20.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.20.2.4 10-Oct-2002  jdolecek use nokqfilter (or seltrue_kqfilter()) for drivers which provide poll
routine very similar to seltrue(); the poll routines would be cleaned
up on trunk
 1.20.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.20.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.1 12-Sep-2001  thorpej Add noop kqueue entry point.
 1.21.8.1 17-May-2002  gehenna Add device switch.
 1.26.2.5 04-Feb-2005  skrll Adapt to branch.
 1.26.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.26.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.26.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.26.2.1 03-Aug-2004  skrll Sync with HEAD
 1.29.8.1 29-Apr-2005  kent sync with -current
 1.30.8.3 04-Feb-2008  yamt sync with head.
 1.30.8.2 03-Sep-2007  yamt sync with head.
 1.30.8.1 21-Jun-2006  yamt sync with head.
 1.31.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.31.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.31.8.1 01-Apr-2006  yamt sync with head.
 1.31.6.1 22-Apr-2006  simonb Sync with head.
 1.31.4.1 09-Sep-2006  rpaulo sync with head
 1.32.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.33.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.33.20.1 23-Mar-2008  matt sync with HEAD
 1.34.14.1 18-Jun-2008  simonb Sync with head.
 1.34.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.34.10.2 11-Mar-2010  yamt sync with head
 1.34.10.1 04-May-2009  yamt sync with head.
 1.34.8.1 17-Jun-2008  yamt sync with head.
 1.34.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.34.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.36.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.39.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.39.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.4.1 05-Mar-2011  rmind sync with head
 1.40.18.1 18-May-2014  rmind sync with head
 1.40.14.2 03-Dec-2017  jdolecek update from HEAD
 1.40.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.40.4.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.43.2.1 10-Aug-2014  tls Rebase.
 1.44.4.1 06-Apr-2015  skrll Sync with HEAD
 1.44.2.1 31-Dec-2014  snj Pull up following revision(s) (requested by chs in ticket #363):
common/lib/libprop/prop_kern.c: revision 1.18
sys/arch/mac68k/dev/grf_compat.c: revision 1.27
sys/arch/x68k/dev/grf.c: revision 1.45
sys/external/bsd/drm/dist/bsd-core/drm_bufs.c: revision 1.12
sys/external/bsd/drm2/drm/drm_drv.c: revision 1.12
sys/external/bsd/drm2/drm/drm_vm.c: revision 1.6
sys/external/bsd/drm2/include/linux/mm.h: revision 1.4
sys/kern/vfs_vnops.c: revision 1.192 via patch
sys/rump/librump/rumpkern/vm.c: revision 1.160
sys/sys/file.h: revision 1.78 via patch
sys/uvm/uvm_device.c: revision 1.64
sys/uvm/uvm_device.h: revision 1.13
sys/uvm/uvm_extern.h: revision 1.192
sys/uvm/uvm_mmap.c: revision 1.150 via patch
add a new "fo_mmap" fileops method to allow use of arbitrary uvm_objects for
mappings of file objects. move vnode-specific details of mmap()ing a vnode
from uvm_mmap() to the new vnode-specific vn_mmap(). add new uvm_mmap_dev()
and uvm_mmap_anon() convenience functions for mapping character devices
and anonymous memory, and replace all other calls to uvm_mmap() with those.
use the new fileop in drm2 so that libdrm can use mmap() to map things
like on other platforms (instead of the ioctl that we have used so far).
 1.11 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.10 18-Jan-2009  isaki branches: 1.10.6; 1.10.8; 1.10.10;
Clean up header files.
 1.9 04-Mar-2007  christos branches: 1.9.44; 1.9.52;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.8 11-Dec-2005  christos branches: 1.8.26;
merge ktrace-lwp.
 1.7 25-Jan-2004  minoura branches: 1.7.16;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.6 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.5 15-Jul-2003  lukem rcsid
 1.4 24-Mar-1999  minoura branches: 1.4.42;
Shut up gcc -Wall.
 1.3 06-Aug-1998  minoura Moved grfioctl.h and iteioctl.h to the public include directory.
 1.2 12-Oct-1997  oki Added prototype.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.42.1 03-Aug-2004  skrll Sync with HEAD
 1.7.16.1 03-Sep-2007  yamt sync with head.
 1.8.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.9.44.1 04-May-2009  yamt sync with head.
 1.10.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.10.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.10.6.1 05-Mar-2011  rmind sync with head
 1.15 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.14 18-Jan-2009  isaki branches: 1.14.6; 1.14.8; 1.14.10;
Clean up header files.
 1.13 31-Dec-2007  ad branches: 1.13.10; 1.13.18;
Remove COMPAT_HPUX.
 1.12 04-Mar-2007  christos branches: 1.12.20; 1.12.26; 1.12.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 18-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify.
 1.9 25-Jan-2004  minoura branches: 1.9.8;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 15-Jul-2003  lukem rcsid
 1.6 27-Dec-2001  wiz branches: 1.6.16;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.5 06-Aug-1998  minoura branches: 1.5.28; 1.5.32;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.4 25-Jun-1998  thorpej defopt COMPAT_HPUX
 1.3 12-Oct-1997  oki Added prototypes.
 1.2 20-May-1996  oki branches: 1.2.12;
fixed gcc -Wall warnings.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.32.1 08-Jan-2002  nathanw Catch up to -current.
 1.5.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.16.4 24-Jan-2005  skrll Sync with HEAD.
 1.6.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.16.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.2 21-Jan-2008  yamt sync with head
 1.10.8.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.12.20.1 09-Jan-2008  matt sync with HEAD
 1.13.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.10.1 04-May-2009  yamt sync with head.
 1.14.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.14.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.6.1 05-Mar-2011  rmind sync with head
 1.35 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.34 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.33 24-Apr-2021  thorpej branches: 1.33.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.32 27-Oct-2012  chs branches: 1.32.52;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.31 13-Oct-2012  tsutsui Normalize autoconf(9) function arg names (parent, self, and aux)
for clarification. from chs@.
 1.30 08-Feb-2011  rmind branches: 1.30.4; 1.30.14;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.29 17-Jan-2009  isaki branches: 1.29.6; 1.29.8; 1.29.10;
Split device_t/softc, use aprint*().
 1.28 17-Jan-2009  isaki Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.27 04-Mar-2007  christos branches: 1.27.40; 1.27.44; 1.27.52;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 29-Mar-2006  thorpej branches: 1.26.14;
Use device_cfdata().
 1.25 11-Dec-2005  christos branches: 1.25.4; 1.25.6; 1.25.8; 1.25.10; 1.25.12;
merge ktrace-lwp.
 1.24 26-Aug-2005  drochner s/locdesc_t/int/g
 1.23 30-Jun-2005  drochner branches: 1.23.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.22 13-Jun-2005  he Add __UNVOLATILE() to an assignment with a cast before passing pointer
to a function.
 1.21 18-Jan-2005  chs use a new "addr" locator for grf instead of the unit to match the instance
to the hardware. use a new "grfaddr" locator to match ites to their grfs,
instead of requiring that their unit numbers be the same.
 1.20 18-Jan-2005  chs de-__P, remove register, ansify.
 1.19 25-Jan-2004  minoura branches: 1.19.8;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.18 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.17 15-Jul-2003  lukem rcsid
 1.16 01-Jan-2003  thorpej branches: 1.16.2;
Use aprint_normal() for cfprint routines.
 1.15 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.14 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 16-Mar-1999  minoura branches: 1.12.22; 1.12.26;
Merged minoura_x68k_bus_h branch.
 1.11 06-Aug-1998  minoura branches: 1.11.6;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.10 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.9 12-Jan-1998  thorpej Update for changes to config.
 1.8 12-Oct-1997  oki Added prototype.
 1.7 19-Jan-1997  oki branches: 1.7.8;
Fixed compile error with last commit of iodevice.h
 1.6 09-Dec-1996  oki Use config_search() instead of config_scan(),
by Chris G Demetriou, tested by me.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.7.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.12.26.2 03-Jan-2003  thorpej Sync with HEAD.
 1.12.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.12.22.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.16.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.16.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.23.2.2 03-Sep-2007  yamt sync with head.
 1.23.2.1 21-Jun-2006  yamt sync with head.
 1.25.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.25.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.25.8.1 01-Apr-2006  yamt sync with head.
 1.25.6.1 22-Apr-2006  simonb Sync with head.
 1.25.4.1 09-Sep-2006  rpaulo sync with head
 1.26.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.27.44.1 04-May-2009  yamt sync with head.
 1.27.40.1 17-Jan-2009  mjf Sync with HEAD.
 1.29.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.29.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.6.1 05-Mar-2011  rmind sync with head
 1.30.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30.4.1 30-Oct-2012  yamt sync with head
 1.32.52.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.32.52.3 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.32.52.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.32.52.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.33.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.15 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.14 18-Jan-2009  isaki branches: 1.14.6; 1.14.8; 1.14.10;
Clean up header files.
 1.13 31-Dec-2007  ad branches: 1.13.10; 1.13.18;
Remove COMPAT_HPUX.
 1.12 04-Mar-2007  christos branches: 1.12.20; 1.12.26; 1.12.32;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 11-Dec-2005  christos branches: 1.11.26;
merge ktrace-lwp.
 1.10 18-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify.
 1.9 25-Jan-2004  minoura branches: 1.9.8;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.8 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.7 15-Jul-2003  lukem rcsid
 1.6 27-Dec-2001  wiz branches: 1.6.16;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.5 06-Aug-1998  minoura branches: 1.5.28; 1.5.32;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.4 25-Jun-1998  thorpej defopt COMPAT_HPUX
 1.3 12-Oct-1997  oki Added prototypes.
 1.2 20-May-1996  oki branches: 1.2.12;
fixed gcc -Wall warnings.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.32.1 08-Jan-2002  nathanw Catch up to -current.
 1.5.28.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.16.4 24-Jan-2005  skrll Sync with HEAD.
 1.6.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.16.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.2 21-Jan-2008  yamt sync with head
 1.10.8.1 03-Sep-2007  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.32.1 02-Jan-2008  bouyer Sync with HEAD
 1.12.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.12.20.1 09-Jan-2008  matt sync with HEAD
 1.13.18.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.10.1 04-May-2009  yamt sync with head.
 1.14.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.14.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.14.6.1 05-Mar-2011  rmind sync with head
 1.2 06-Aug-1998  minoura Moved grfioctl.h and iteioctl.h to the public include directory.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.12 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.11 17-Jan-2009  isaki branches: 1.11.6; 1.11.8; 1.11.10;
Split device_t/softc, use aprint*().
 1.10 04-Mar-2007  christos branches: 1.10.40; 1.10.44; 1.10.52;
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 13-Jun-2005  he branches: 1.8.2;
Make this build with -Wcast-qual by adding a few consts.
 1.7 18-Jan-2005  chs use a new "addr" locator for grf instead of the unit to match the instance
to the hardware. use a new "grfaddr" locator to match ites to their grfs,
instead of requiring that their unit numbers be the same.
 1.6 18-Jan-2005  chs de-__P, remove register, ansify.
 1.5 25-Jan-2004  minoura branches: 1.5.8;
Remove COMPAT_HPUX support. It did not work for a long time,
and I do not think emulating frame buffer devices is useful.
KNF.
 1.4 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.3 09-Oct-1997  oki branches: 1.3.52;
Oops, fixed error in previous commit.
 1.2 09-Oct-1997  oki Added prototype.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.52.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.52.4 24-Jan-2005  skrll Sync with HEAD.
 1.3.52.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.52.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.52.1 03-Aug-2004  skrll Sync with HEAD
 1.5.8.1 29-Apr-2005  kent sync with -current
 1.8.2.1 03-Sep-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.10.44.1 04-May-2009  yamt sync with head.
 1.10.40.1 17-Jan-2009  mjf Sync with HEAD.
 1.11.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.11.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.11.6.1 05-Mar-2011  rmind sync with head
 1.11 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.10 28-Feb-1999  explorer Update to slightly altered rnd_attach_source() api
 1.9 04-Aug-1998  minoura branches: 1.9.4; 1.9.6;
__BROKEN_INDIRECT_CONFIG fixes.
 1.8 05-Jul-1998  jonathan defopt NS, NSIP.
 1.7 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.6 12-Jan-1998  thorpej Update for changes to config.
 1.5 17-Oct-1997  oki Use rnd.h and #if NRND > 0.
 1.4 13-Oct-1996  christos branches: 1.4.6;
backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.4.6.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.4.6.1 04-Mar-1997  is Convert to new ARP code.
 1.9.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.9.4.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.20 06-Jan-2024  isaki White space cleanup.
 1.19 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.18 20-May-2015  ozaki-r branches: 1.18.10; 1.18.16;
Remove leftover use of AF_NS and NS option

Unnecessary NETISR_NS is also removed.
 1.17 16-Oct-2011  isaki branches: 1.17.12; 1.17.30;
Switch to 2-clause license.
 1.16 03-Mar-2010  tsutsui Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.

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

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

See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
 1.15 19-Jan-2010  pooka branches: 1.15.2;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

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

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.14 28-Nov-2009  isaki Correct return value of ne_*_match().
It's attach priority, not ne2000 model.
 1.13 18-Jan-2009  isaki Delete 10 years old #if 0'd comments in intio.c, locore.s.
According to the old comment, the interrupt handler via intiotrap
should set his interrupt level again, but it's not right. And
don't set it again by interrupt hander.
 1.12 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.11 12-Mar-2008  tsutsui branches: 1.11.4; 1.11.12; 1.11.14;
Sync with MI NE2000 changes:
> Split device_t and softc for the NE2000 Ethernet chip and all its variants
> and attachments. Use device_t accessors, correct types, and ANSIfy when
> appropriate.
 1.10 11-Dec-2005  christos branches: 1.10.50; 1.10.70; 1.10.74;
merge ktrace-lwp.
 1.9 13-Jun-2005  he branches: 1.9.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.8 13-Feb-2004  wiz RealTek -> Realtek.
 1.7 07-Sep-2003  isaki Remove an advertising clause.
 1.6 15-Jul-2003  lukem rcsid
 1.5 02-Oct-2002  thorpej branches: 1.5.6;
Add trailing ; to CFATTACH_DECL.
 1.4 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 14-Jan-2002  isaki Add another address, vector configuration of Nereid ethernet.
 1.1 11-Nov-2001  isaki branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
Support an ethernet part of Nereid.
Nereid is the board of ethernet/USB/memory for X68k
developed by X-PowerStation, a japanese X68k circle.
See http://xps.jp/ but only written in japanese.
 1.1.8.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.1.8.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.8.1 11-Nov-2001  thorpej file if_ne_intio.c was added on branch kqueue on 2002-01-10 19:50:19 +0000
 1.1.6.4 18-Oct-2002  nathanw Catch up to -current.
 1.1.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.1.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.1.6.1 11-Nov-2001  nathanw file if_ne_intio.c was added on branch nathanw_sa on 2002-01-08 00:28:39 +0000
 1.1.4.2 06-Jan-2002  he Pull up revision 1.1 (new, via patch, requested by isaki):
Support the Ethernet part of Nereid (ether/USB/memory board).
 1.1.4.1 11-Nov-2001  he file if_ne_intio.c was added on branch netbsd-1-5 on 2002-01-06 20:12:53 +0000
 1.1.2.2 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.1.2.1 11-Nov-2001  thorpej file if_ne_intio.c was added on branch thorpej-mips-cache on 2001-11-12 21:17:43 +0000
 1.5.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.2.1 17-Mar-2008  yamt sync with head.
 1.10.74.2 17-Jan-2009  mjf Sync with HEAD.
 1.10.74.1 03-Apr-2008  mjf Sync with HEAD.
 1.10.70.1 24-Mar-2008  keiichi sync with head.
 1.10.50.1 23-Mar-2008  matt sync with HEAD
 1.11.14.1 20-Nov-2010  riz Pull up following revision(s) (requested by tsutsui in ticket #1367):
sys/dev/ic/ne2000var.h: revision 1.25
sys/arch/atari/conf/MILAN.in: revision 1.24
sys/arch/atari/conf/MILAN.in: revision 1.25
sys/dev/ic/ne2000.c: revision 1.71
sys/dev/ic/ne2000.c: revision 1.72
sys/arch/atari/dev/if_ne_mb.c: revision 1.1
sys/arch/atari/dev/if_ne_mb.c: revision 1.2
sys/arch/atari/conf/MILAN-PCIIDE: revision 1.69
sys/arch/atari/conf/HADES.in: revision 1.10
sys/arch/atari/conf/HADES.in: revision 1.11
sys/arch/x68k/dev/if_ne_neptune.c: revision 1.20
sys/dev/isa/if_ne_isa.c: revision 1.27
sys/arch/atari/atari/autoconf.c: revision 1.57
sys/dev/ic/ne2000.c: revision 1.62
sys/dev/isapnp/if_ne_isapnp.c: revision 1.27
sys/arch/atari/conf/files.atari: revision 1.117
sys/arch/atari/conf/HADES: revision 1.88
sys/arch/atari/conf/GENERIC.in: revision 1.85
sys/dev/ic/ne2000.c: revision 1.65
sys/dev/ic/ne2000.c: revision 1.66
sys/dev/ic/ne2000.c: revision 1.68
sys/arch/atari/conf/MILAN-ISAIDE: revision 1.65
distrib/notes/atari/hardware: revision 1.24
sys/conf/files: revision 1.980
sys/dev/ic/ne2000var.h: revision 1.21
sys/arch/x68k/dev/if_ne_intio.c: revision 1.16
sys/dev/ic/dp8390.c: revision 1.74
sys/dev/ic/dp8390.c: revision 1.75
Added NE2000 with 8bit bus width support.
reviewd by tsutsui@ at tech-kern ML.
Fix a wrong calculation bug around RX ring buffer memory address
slipped in about sixteen years ago. Fortunately, it had been working
for ages because some devices used address zero and other devices
ignored wrong higher bits.
Tested on we(4) (SMC Elite Ultra) and ne(4) (NE2000 compatible
named UL0001) on ISA.
Note FreeBSD also uses the same correct value in their ed(4) driver.
Now dp8390_config() calculates mem_ring correctly so
no longer need to override it in ne2000_attach().
Use roundup2() in <sys/param.h> rather than a conditional.
Also fix a wrong mem_ring calculation in dp8390_ipkdb_attach().
Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.
* move RTL8019 probe and attach code from each bus attachment
to MI ne2000_detect() and ne2000_attach()
* change a method for backend and attachment to specify 8 bit mode
to use a new sc->sc_quirk member, instead of sc->sc_dmawidth
* handle more NE2000 8 bit mode specific settings, including
bus_space(9) access width and available size of buffer memory
* add a function to detect NE2000 8 bit mode
(disabled by default, but enalbed by options NE2000_DETECT_8BIT
to avoid possible regression on various ISA clones)
* fix ipkdb attachment accordingly (untested)
Tested on two NE2000 ISA variants (RTL8019AS and another clone named UL0001)
in both 8 bit and 16 bit mode on i386. "Looks good" from nonaka@.
See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
No need to override mem_ring value in ne2000_ipkdb_attach()
since a wrong calculation in dp8390_ipkdb_attach() was fixed.
Don't warn about DMA timeout during probe.
Add support for the EtherNEC.
The EtherNEC is yet another user designed device for Atari machines,
an NE2000 based ISA board connected to Atari's ROM cartridge slot with
simple but ingenious interface and cartridge port adapter, and
it's the most available network solution for the old Atari machines.
See following pages for more details about EtherNEC:
http://hardware.atari.org/ether/
http://home.arcor.de/thomas.redelberger/prj/atari/etherne/
http://www.freemint.org/ethernec/ethernec.html
Also note EtherNEC.
Use callout_schedule(9) rather than callout_reset(9) on polling
as callout(9) man says.
Remove EtherNEC from HADES and MILAN.
They have ISA so no one will bother to connect ISA NE2000 via EtherNEC.
Regen from HADES.in rev 1.11 and MILAN.in rev 1.25:
Remove EtherNEC from HADES and MILAN.
They have ISA so no one will bother to connect ISA NE2000 via EtherNEC.
 1.11.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.11.4.2 11-Mar-2010  yamt sync with head
 1.11.4.1 04-May-2009  yamt sync with head.
 1.15.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.17.30.1 06-Jun-2015  skrll Sync with HEAD
 1.17.12.1 03-Dec-2017  jdolecek update from HEAD
 1.18.16.1 25-Jun-2018  pgoyette Sync with HEAD
 1.18.10.1 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #938):
sys/arch/acorn32/podulebus/if_ie.c: revision 1.41
sys/arch/amiga/dev/if_es.c: revision 1.58
sys/arch/amiga/dev/if_qn.c: revision 1.45
sys/arch/arm/at91/at91emac.c: revision 1.20
sys/arch/arm/ep93xx/epe.c: revision 1.37
sys/arch/emips/ebus/if_le_ebus.c: revision 1.14
sys/arch/emips/ebus/if_le_ebus.c: revision 1.15
sys/arch/mac68k/dev/if_mc.c: revision 1.46
sys/arch/macppc/dev/am79c950.c: revision 1.39
sys/arch/newsmips/apbus/if_sn.c: revision 1.40
sys/arch/next68k/dev/mb8795.c: revision 1.59
sys/arch/playstation2/dev/if_smap.c: revision 1.25
sys/arch/playstation2/dev/if_smap.c: revision 1.26
sys/arch/sun2/dev/if_ec.c: revision 1.28
sys/arch/sun3/dev/if_ie.c: revision 1.63
sys/arch/x68k/dev/if_ne_intio.c: revision 1.19
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.75
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.63
sys/dev/bi/if_ni.c: revision 1.45
sys/dev/cadence/if_cemac.c: revision 1.12
sys/dev/ic/am7990.c: revision 1.78
sys/dev/ic/am79900.c: revision 1.27
sys/dev/ic/an.c: revision 1.67
sys/dev/ic/cs89x0.c: revision 1.40
sys/dev/ic/dm9000.c: revision 1.13
sys/dev/ic/dm9000.c: revision 1.14
sys/dev/ic/dp8390.c: revision 1.88
sys/dev/ic/elink3.c: revision 1.141
sys/dev/ic/elinkxl.c: revision 1.122
sys/dev/ic/hme.c: revision 1.98
sys/dev/ic/i82586.c: revision 1.77
sys/dev/ic/lance.c: revision 1.53
sys/dev/ic/mb86950.c: revision 1.27
sys/dev/ic/mb86960.c: revision 1.86
sys/dev/ic/mtd803.c: revision 1.34
sys/dev/ic/pdq_ifsubr.c: revision 1.59
sys/dev/ic/rrunner.c: revision 1.86
sys/dev/ic/seeq8005.c: revision 1.58
sys/dev/ic/sgec.c: revision 1.47
sys/dev/ic/smc90cx6.c: revision 1.72
sys/dev/ic/smc91cxx.c: revision 1.96
sys/dev/ic/tropic.c: revision 1.49
sys/dev/ic/wi.c: revision 1.245
sys/dev/isa/if_eg.c: revision 1.93
sys/dev/isa/if_el.c: revision 1.95
sys/dev/isa/if_iy.c: revision 1.101
sys/dev/ofw/ofnet.c: revision 1.58
sys/dev/pci/if_alc.c: revision 1.27
sys/dev/pci/if_de.c: revision 1.152
sys/dev/pci/if_fpa.c: revision 1.61
sys/dev/pci/if_jme.c: revision 1.34
sys/dev/pci/if_tl.c: revision 1.108
sys/dev/pci/if_vte.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe.h: revision 1.50
sys/dev/pcmcia/if_cnw.c: revision 1.62
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.17
sys/dev/pcmcia/if_ray.c: revision 1.89
sys/dev/pcmcia/if_xi.c: revision 1.81
sys/dev/pcmcia/mhzc.c: revision 1.51
sys/dev/pcmcia/xirc.c: revision 1.34
sys/dev/qbus/if_de.c: revision 1.33
sys/dev/qbus/if_qe.c: revision 1.78
sys/dev/qbus/if_qt.c: revision 1.22
sys/dev/sbus/be.c: revision 1.87
sys/dev/sbus/qe.c: revision 1.68
sys/dev/scsipi/if_se.c: revision 1.96
sys/dev/usb/if_atu.c: revision 1.59
sys/net/if_l2tp.c: revision 1.28 via patch
sys/net/if_ppp.c: revision 1.160
It's not required to include net/bpfdesc.h. Remove it.
--
Simplify like other drivers. NULL check of ifp->if_bpf is done in
bpf_mtap(), so it's not required to do it here.
--
Remove duplicated inclusion of net/bpf.h.
--
Remove duplicated inclusion of net/bpf.h.
--
Simplify bpf_mtap() call. No functional change.
 1.21 20-May-2015  ozaki-r Remove leftover use of AF_NS and NS option

Unnecessary NETISR_NS is also removed.
 1.20 03-Mar-2010  tsutsui branches: 1.20.20; 1.20.38;
Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.

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

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

See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
 1.19 19-Jan-2010  pooka branches: 1.19.2;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

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

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.18 28-Nov-2009  isaki Correct return value of ne_*_match().
It's attach priority, not ne2000 model.
 1.17 18-Jan-2009  isaki Delete 10 years old #if 0'd comments in intio.c, locore.s.
According to the old comment, the interrupt handler via intiotrap
should set his interrupt level again, but it's not right. And
don't set it again by interrupt hander.
 1.16 09-May-2008  tsutsui branches: 1.16.6; 1.16.8;
CFATTACH_DECL() -> CFATTACH_DECL_NEW(), botched in rev 1.14.
 1.15 28-Apr-2008  martin branches: 1.15.2;
Remove clause 3 and 4 from TNF licenses
 1.14 12-Mar-2008  tsutsui branches: 1.14.2; 1.14.4;
Sync with MI NE2000 changes:
> Split device_t and softc for the NE2000 Ethernet chip and all its variants
> and attachments. Use device_t accessors, correct types, and ANSIfy when
> appropriate.
 1.13 17-Oct-2007  garbled branches: 1.13.12; 1.13.16;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.12 12-May-2007  isaki branches: 1.12.10;
Clean up white spaces and tabs.
 1.11 11-Dec-2005  christos branches: 1.11.26; 1.11.30; 1.11.32; 1.11.38;
merge ktrace-lwp.
 1.10 18-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify.
 1.9 13-Feb-2004  wiz branches: 1.9.8;
RealTek -> Realtek.
 1.8 15-Jul-2003  lukem rcsid
 1.7 02-Oct-2002  thorpej branches: 1.7.6;
Add trailing ; to CFATTACH_DECL.
 1.6 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.5 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.4 21-Feb-2001  minoura branches: 1.4.4; 1.4.8;
Make this compile again.
 1.3 12-Feb-2001  thorpej Adjust the way that media is initialized on DP8390-compatible
chips. The dp8390_softc now has media_init and media_fini
function pointers that do the work.
 1.2 16-Mar-1999  minoura branches: 1.2.8;
Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file if_ne_neptune.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.2.8.1 12-Mar-2001  bouyer Sync with HEAD.
 1.4.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.4.4.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.7.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.2 17-Mar-2008  yamt sync with head.
 1.10.8.1 03-Sep-2007  yamt sync with head.
 1.11.38.1 22-May-2007  matt Update to HEAD.
 1.11.32.1 11-Jul-2007  mjf Sync with head.
 1.11.30.1 27-May-2007  ad Sync with head.
 1.11.26.1 17-May-2007  yamt sync with head.
 1.12.10.2 23-Mar-2008  matt sync with HEAD
 1.12.10.1 06-Nov-2007  matt sync with HEAD
 1.13.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.13.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.12.1 24-Mar-2008  keiichi sync with head.
 1.14.4.3 11-Mar-2010  yamt sync with head
 1.14.4.2 04-May-2009  yamt sync with head.
 1.14.4.1 16-May-2008  yamt sync with head.
 1.14.2.1 18-May-2008  yamt sync with head.
 1.15.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.16.8.1 20-Nov-2010  riz Pull up following revision(s) (requested by tsutsui in ticket #1367):
sys/dev/ic/ne2000var.h: revision 1.25
sys/arch/atari/conf/MILAN.in: revision 1.24
sys/arch/atari/conf/MILAN.in: revision 1.25
sys/dev/ic/ne2000.c: revision 1.71
sys/dev/ic/ne2000.c: revision 1.72
sys/arch/atari/dev/if_ne_mb.c: revision 1.1
sys/arch/atari/dev/if_ne_mb.c: revision 1.2
sys/arch/atari/conf/MILAN-PCIIDE: revision 1.69
sys/arch/atari/conf/HADES.in: revision 1.10
sys/arch/atari/conf/HADES.in: revision 1.11
sys/arch/x68k/dev/if_ne_neptune.c: revision 1.20
sys/dev/isa/if_ne_isa.c: revision 1.27
sys/arch/atari/atari/autoconf.c: revision 1.57
sys/dev/ic/ne2000.c: revision 1.62
sys/dev/isapnp/if_ne_isapnp.c: revision 1.27
sys/arch/atari/conf/files.atari: revision 1.117
sys/arch/atari/conf/HADES: revision 1.88
sys/arch/atari/conf/GENERIC.in: revision 1.85
sys/dev/ic/ne2000.c: revision 1.65
sys/dev/ic/ne2000.c: revision 1.66
sys/dev/ic/ne2000.c: revision 1.68
sys/arch/atari/conf/MILAN-ISAIDE: revision 1.65
distrib/notes/atari/hardware: revision 1.24
sys/conf/files: revision 1.980
sys/dev/ic/ne2000var.h: revision 1.21
sys/arch/x68k/dev/if_ne_intio.c: revision 1.16
sys/dev/ic/dp8390.c: revision 1.74
sys/dev/ic/dp8390.c: revision 1.75
Added NE2000 with 8bit bus width support.
reviewd by tsutsui@ at tech-kern ML.
Fix a wrong calculation bug around RX ring buffer memory address
slipped in about sixteen years ago. Fortunately, it had been working
for ages because some devices used address zero and other devices
ignored wrong higher bits.
Tested on we(4) (SMC Elite Ultra) and ne(4) (NE2000 compatible
named UL0001) on ISA.
Note FreeBSD also uses the same correct value in their ed(4) driver.
Now dp8390_config() calculates mem_ring correctly so
no longer need to override it in ne2000_attach().
Use roundup2() in <sys/param.h> rather than a conditional.
Also fix a wrong mem_ring calculation in dp8390_ipkdb_attach().
Put several fixes to ne(4) driver for better 8 bit mode support,
especially on RTL8019AS which is also used for non-ISA local bus of
embedded controllers and some m68k machines like atari and x68k.
* move RTL8019 probe and attach code from each bus attachment
to MI ne2000_detect() and ne2000_attach()
* change a method for backend and attachment to specify 8 bit mode
to use a new sc->sc_quirk member, instead of sc->sc_dmawidth
* handle more NE2000 8 bit mode specific settings, including
bus_space(9) access width and available size of buffer memory
* add a function to detect NE2000 8 bit mode
(disabled by default, but enalbed by options NE2000_DETECT_8BIT
to avoid possible regression on various ISA clones)
* fix ipkdb attachment accordingly (untested)
Tested on two NE2000 ISA variants (RTL8019AS and another clone named UL0001)
in both 8 bit and 16 bit mode on i386. "Looks good" from nonaka@.
See my post on tech-kern for details:
http://mail-index.NetBSD.org/tech-kern/2010/02/26/msg007423.html
No need to override mem_ring value in ne2000_ipkdb_attach()
since a wrong calculation in dp8390_ipkdb_attach() was fixed.
Don't warn about DMA timeout during probe.
Add support for the EtherNEC.
The EtherNEC is yet another user designed device for Atari machines,
an NE2000 based ISA board connected to Atari's ROM cartridge slot with
simple but ingenious interface and cartridge port adapter, and
it's the most available network solution for the old Atari machines.
See following pages for more details about EtherNEC:
http://hardware.atari.org/ether/
http://home.arcor.de/thomas.redelberger/prj/atari/etherne/
http://www.freemint.org/ethernec/ethernec.html
Also note EtherNEC.
Use callout_schedule(9) rather than callout_reset(9) on polling
as callout(9) man says.
Remove EtherNEC from HADES and MILAN.
They have ISA so no one will bother to connect ISA NE2000 via EtherNEC.
Regen from HADES.in rev 1.11 and MILAN.in rev 1.25:
Remove EtherNEC from HADES and MILAN.
They have ISA so no one will bother to connect ISA NE2000 via EtherNEC.
 1.16.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.20.38.1 06-Jun-2015  skrll Sync with HEAD
 1.20.20.1 03-Dec-2017  jdolecek update from HEAD
 1.9 27-Nov-1999  minoura Remove ether+ driver. Requested by msaitoh.
 1.8 18-May-1999  thorpej branches: 1.8.2; 1.8.8;
Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.7 25-Mar-1999  thorpej branches: 1.7.4;
Use ETHER_*_LEN constants from <net/if_ether.h> instead of defining them
ourselves.
 1.6 05-Jul-1998  jonathan branches: 1.6.6;
defopt NS, NSIP.
 1.5 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.4 13-Oct-1996  christos branches: 1.4.6;
backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 07-May-1996  thorpej Changed struct ifnet to have a pointer to the softc of the underlying
device and a printable "external name" (name + unit number), thus eliminating
if_name and if_unit. Updated interface to (*if_watchdog)() and (*if_reset)()
to take a struct ifnet *, rather than a unit number.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.4.6.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.4.6.1 04-Mar-1997  is Convert to new ARP code.
 1.6.6.1 11-Dec-1998  kenh The beginnings of interface detach support. Still some bugs, but mostly
works for me.

This work was originally by Bill Studenmund, and cleaned up by me.
 1.7.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.8.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3 27-Nov-1999  minoura Remove ether+ driver. Requested by msaitoh.
 1.2 13-Oct-1997  lukem branches: 1.2.18; 1.2.24;
rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.24.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.18.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.52 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.51 17-Dec-2021  skrll Correct copypaste comment grammar.
 1.50 17-Dec-2021  skrll Trailing whitespace
 1.49 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.48 24-Apr-2021  thorpej branches: 1.48.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.47 14-Jun-2020  chs branches: 1.47.4;
replace EX_NOWAIT with EX_WAITOK in device attach methods.
remove checks for failures that can no longer occur.
 1.46 10-Nov-2019  chs in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.45 31-May-2016  dholland branches: 1.45.18;
fix flagrantly wrong indent
 1.44 26-Feb-2016  christos PR/50859: David Binderman: Remove redundant code.
 1.43 27-Jan-2012  para branches: 1.43.6; 1.43.24;
converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.42 18-Jan-2009  isaki branches: 1.42.14; 1.42.18;
- malloc() + memset(0) -> malloc(M_ZERO).
- remove temporary variable.
 1.41 18-Jan-2009  isaki Delete 10 years old #if 0'd comments in intio.c, locore.s.
According to the old comment, the interrupt handler via intiotrap
should set his interrupt level again, but it's not right. And
don't set it again by interrupt hander.
 1.40 18-Jan-2009  isaki Clean up header files.
 1.39 17-Jan-2009  isaki Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.38 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.37 25-Jun-2008  isaki branches: 1.37.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.36 23-Jun-2008  isaki Make intio_intr_establish() use evcnt(9),
instead of dynamic allocation of intrnames/intrcnt.
 1.35 10-May-2008  martin branches: 1.35.2;
Minor typo in license
 1.34 28-Apr-2008  martin branches: 1.34.2;
Remove clause 3 and 4 from TNF licenses
 1.33 17-Oct-2007  garbled branches: 1.33.16; 1.33.18; 1.33.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.32 12-May-2007  isaki branches: 1.32.10;
Clean up white spaces and tabs.
 1.31 11-Mar-2007  isaki branches: 1.31.2; 1.31.8;
white space, indent and KNF.
 1.30 05-Mar-2007  he branches: 1.30.2;
Cast to char* before doing pointer arithmetic.
 1.29 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28 11-Dec-2005  christos branches: 1.28.26;
merge ktrace-lwp.
 1.27 26-Aug-2005  drochner s/locdesc_t/int/g
 1.26 30-Jun-2005  drochner branches: 1.26.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.25 18-Jan-2005  chs de-__P, remove register, ansify.
 1.24 13-Dec-2004  chs branches: 1.24.2;
for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.23 04-Jan-2004  wiz Spell controller with two ls. Inspired by miod@openbsd.
 1.22 01-Nov-2003  jdolecek the storagesize parameter of extent_create() is a size_t, not a pointer
 1.21 05-Oct-2003  nsmrtks print PC in stray interrupt
 1.20 15-Jul-2003  lukem rcsid
 1.19 03-May-2003  wiz branches: 1.19.2;
DMA, not dma nor Dma.
 1.18 01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.17 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.16 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.15 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.12 27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.11 27-Dec-2001  wiz bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.10 11-Nov-2001  isaki Support BUS_SPACE_MAP_SHIFTED_EVEN for bus_space_map().
Now BUS_SPACE_MAP_SHIFTED means BUS_SPACE_MAP_SHIFTED_ODD.
It is needed for Nereid Ethernet.
 1.9 26-Aug-2001  mrg branches: 1.9.4; 1.9.6;
remove bogus comment. noted by Tetsuya Isaki <isaki@par.odn.ne.jp> in private email.
 1.8 29-Jun-2000  mrg branches: 1.8.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.7 16-Jan-2000  minoura branches: 1.7.4;
Minor cleanups & corrections.
 1.6 05-May-1999  minoura branches: 1.6.2;
Add missing ia_size argument.
 1.5 24-Mar-1999  minoura branches: 1.5.2; 1.5.4; 1.5.6;
Shut up gcc -Wall.
 1.4 22-Mar-1999  minoura Use intio_debug flag variable.
 1.3 18-Mar-1999  minoura Shut up gcc -Wall
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file intio.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.8 14-Mar-1999  minoura Use a single (inline) function instead of refering the bus_space switch.
 1.1.2.7 12-Mar-1999  minoura Gather interrupt statics.
 1.1.2.6 13-Feb-1999  minoura Implemented BUS_SPACE_MAP_SHIFTED.
Some of the devices are mapped only on the odd addresses for hardware
simplicity. To share drivers with other platforms, this should be
made transparent through the bus_space layer.
 1.1.2.5 02-Feb-1999  minoura I/O controler support.
 1.1.2.4 31-Jan-1999  minoura Attach arg dmaintr.
 1.1.2.3 30-Jan-1999  minoura Added DMAC driver.
 1.1.2.2 27-Dec-1998  minoura Match device names.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.5.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.5.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 21-Jun-1999  perry pullup 1.5->1.6 (minoura)
 1.6.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.7.4.1 06-Jan-2002  he Pull up revision 1.10 (requested by isaki):
Support mapping devices with BUS_SPACE_MAP_SHIFTED_EVEN.
 1.8.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.8.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.9.6.4 03-Jan-2003  thorpej Sync with HEAD.
 1.9.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.9.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.9.6.1 26-Aug-2001  nathanw file intio.c was added on branch nathanw_sa on 2002-01-08 00:28:39 +0000
 1.9.4.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.19.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.19.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.19.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.19.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.2.1 29-Apr-2005  kent sync with -current
 1.26.2.2 03-Sep-2007  yamt sync with head.
 1.26.2.1 21-Jun-2006  yamt sync with head.
 1.28.26.2 17-May-2007  yamt sync with head.
 1.28.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.30.2.2 27-May-2007  ad Sync with head.
 1.30.2.1 13-Mar-2007  ad Sync with head.
 1.31.8.1 22-May-2007  matt Update to HEAD.
 1.31.2.1 11-Jul-2007  mjf Sync with head.
 1.32.10.1 06-Nov-2007  matt sync with HEAD
 1.33.20.2 04-May-2009  yamt sync with head.
 1.33.20.1 16-May-2008  yamt sync with head.
 1.33.18.1 18-May-2008  yamt sync with head.
 1.33.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.33.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.33.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.34.2.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.34.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.2.1 27-Jun-2008  simonb Sync with head.
 1.37.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.42.18.1 18-Feb-2012  mrg merge to -current.
 1.42.14.1 17-Apr-2012  yamt sync with head
 1.43.24.2 09-Jul-2016  skrll Sync with HEAD
 1.43.24.1 19-Mar-2016  skrll Sync with HEAD
 1.43.6.1 03-Dec-2017  jdolecek update from HEAD
 1.45.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.47.4.6 05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.47.4.5 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.47.4.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.47.4.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.47.4.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.47.4.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.48.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.40 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.39 17-Dec-2023  andvar Remove accidentally added i in previous commit..
 1.38 17-Dec-2023  andvar Fix DMAC_ARRAYCHAIN enabled build:
pass dmac->sc_dev instead of undefined self in dmac_start_xfer_offset().
remove unused chan/ch variables in dmac_program_arraychain().
initialize c to zero in dmac_start_xfer_offset() and add check that is bigger
than 0 before calling dma_cachectl() to fix potentially uninitialized error
(seems to be false positive though).
 1.37 11-Aug-2017  isaki Fix a Continue Operation.
Patch from Y.Sugahara.
 1.36 11-Aug-2017  isaki Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
 1.35 26-Mar-2014  christos branches: 1.35.6; 1.35.22;
kill sprintf, fix unused.
 1.34 14-Oct-2012  tsutsui branches: 1.34.2;
To abort DMA in dmac_abort_xfer(), set DMAC_CCR_SAB (software abort)
rather than DMAC_CCR_HLT (halt operation).

DMAC_CCR_HLT doesn't abort DMA xfers but only suspends DMA ops
(i.e. clearing HLT bit will resume DMA xfers), so previously
DMAC error always occurs on the next DMA xfer ops after
dmac_abort_xfer() is called.

Also suppress DMAC error messages in dmac_error() if it's caused
by software abort command because it can happen during normal
audio play/record DMA ops in vs(4) driver.
 1.33 06-Jun-2010  mrg branches: 1.33.8; 1.33.14; 1.33.18;
fix PR 6724 - convert m68k options to defflag's. this means that
M680[12346] are now available from opt_m68k_arch.h. FPSP meantioned
in the PR has already been fixed, and i could not find any more.

i built these kernels to ensure i did not break their builds:

amiga: GENERIC DRACO
atari: HADES FALCON MILAN-PCIIDE
mac68k: GENERIC
sun2: GENERIC
sun3: GENERIC GENERIC3X
cesfic: attempted GENERIC, does not build due to lack of machine/bus.h
hp300: GENERIC
luna68k: GENERIC
mvme68k: GENERIC
news68k: GENERIC
next68k: GENERIC
x68k: GENERIC
 1.32 29-Nov-2008  isaki branches: 1.32.6; 1.32.8;
Rename variables to avoid confusing. forgotten in previous commit.
 1.31 25-Jun-2008  isaki branches: 1.31.2; 1.31.4;
Split device_t/softc for dmac_*_xfer().
Rename some variables to avoid confusing.
 1.30 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.29 23-Jun-2008  isaki Make intio_intr_establish() use evcnt(9),
instead of dynamic allocation of intrnames/intrcnt.
 1.28 28-Apr-2008  martin branches: 1.28.2; 1.28.4;
Remove clause 3 and 4 from TNF licenses
 1.27 17-Oct-2007  garbled branches: 1.27.16; 1.27.18; 1.27.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.26 12-May-2007  isaki branches: 1.26.10;
Clean up white spaces and tabs.
 1.25 11-Mar-2007  isaki branches: 1.25.2; 1.25.8;
white space, indent and KNF.
 1.24 04-Mar-2007  christos branches: 1.24.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 11-Dec-2005  christos branches: 1.23.26;
merge ktrace-lwp.
 1.22 12-Jun-2005  he branches: 1.22.2;
Change the `name' argument of dmac_alloc_channel to const char*, so that
a string constant can be used without generating a warning.
 1.21 18-Jan-2005  chs de-__P, remove register, ansify.
 1.20 13-Dec-2004  chs branches: 1.20.2;
for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.19 15-Jul-2003  lukem rcsid
 1.18 13-Oct-2002  isaki branches: 1.18.6;
Clean up debug code.
 1.17 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.16 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 04-Aug-2002  isaki Fix printf format in DIAGNOSTIC.
 1.13 03-Aug-2002  isaki Fix compile warnings in debug code.
 1.12 25-Nov-2001  minoura branches: 1.12.8;
Remove unused variables.
Correct printf format strings.
 1.11 27-May-2001  minoura branches: 1.11.2; 1.11.8;
Reset dx_nextoff and dx_nextsize before transfer.
 1.10 22-May-2001  minoura Reset the status register after abort.
 1.9 02-May-2001  minoura Disable array chain mode by default, since it is unused by any of
the current devices.
Add more flexibility in the API.
 1.8 30-Apr-2001  minoura Correct memory leak.
Use single block transfer when appropriate.
 1.7 29-Jun-2000  mrg branches: 1.7.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 18-Apr-2000  minoura Explicitly include opt_m680x0.h.
 1.5 08-Jul-1999  thorpej branches: 1.5.2;
Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.4 24-Mar-1999  minoura branches: 1.4.4;
Shut up gcc -Wall.
 1.3 18-Mar-1999  minoura G/C.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 30-Jan-1999  minoura branches: 1.1.2;
file intio_dmac.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.4 13-Feb-1999  minoura Use the cycle steal with hold mode instead of the cycle steal without hold mode.
Handle INTIOCF_ADDR_DEFAULT case.
 1.1.2.3 10-Feb-1999  minoura Use dma_cachectl.
Add some debugging code.
 1.1.2.2 02-Feb-1999  minoura Arg for Interrupt handlers.
Specify device physical address instead of virtual for dmac_start_xfer.
 1.1.2.1 30-Jan-1999  minoura Added DMAC driver.
 1.4.4.1 02-Aug-1999  thorpej Update from trunk.
 1.5.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.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.11.8.3 13-Aug-2002  nathanw Catch up to -current.
 1.11.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.11.8.1 27-May-2001  nathanw file intio_dmac.c was added on branch nathanw_sa on 2002-01-08 00:28:39 +0000
 1.11.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.12.8.1 31-Aug-2002  gehenna catch up with -current.
 1.18.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.18.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.18.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.6.1 03-Aug-2004  skrll Sync with HEAD
 1.20.2.1 29-Apr-2005  kent sync with -current
 1.22.2.1 03-Sep-2007  yamt sync with head.
 1.23.26.2 17-May-2007  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.2.2 27-May-2007  ad Sync with head.
 1.24.2.1 13-Mar-2007  ad Sync with head.
 1.25.8.1 22-May-2007  matt Update to HEAD.
 1.25.2.1 11-Jul-2007  mjf Sync with head.
 1.26.10.1 06-Nov-2007  matt sync with HEAD
 1.27.20.3 11-Aug-2010  yamt sync with head.
 1.27.20.2 04-May-2009  yamt sync with head.
 1.27.20.1 16-May-2008  yamt sync with head.
 1.27.18.1 18-May-2008  yamt sync with head.
 1.27.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.27.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.27.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.4.1 27-Jun-2008  simonb Sync with head.
 1.28.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.31.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.31.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.32.8.1 03-Jul-2010  rmind sync with head
 1.32.6.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.33.18.3 03-Dec-2017  jdolecek update from HEAD
 1.33.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.14.1 18-Nov-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #646):
sys/arch/x68k/dev/intio_dmac.c: revision 1.34
sys/arch/x68k/dev/fd.c: revision 1.100
sys/arch/x68k/dev/fd.c: revision 1.101
sys/arch/x68k/dev/fd.c: revision 1.102
sys/arch/x68k/dev/fd.c: revision 1.103
sys/arch/x68k/dev/fd.c: revision 1.104
sys/arch/x68k/dev/fd.c: revision 1.105
sys/arch/x68k/dev/fd.c: revision 1.98
sys/arch/x68k/dev/fd.c: revision 1.99
sys/arch/x68k/dev/fdreg.h: revision 1.5
sys/arch/x68k/dev/fdreg.h: revision 1.6
Explicitly specify a proper FDC data register address for HD63450 DMAC
to avoid confusion.
Previous one (fdc->sc_addr + fddata) wasn't a right address for
the FDC's data register but one for the command register by accident,
but FDC ignores A0 address input (connected to A1 of x68k address bus)
during DMA xfer (i.e. when DACK is asserted) so it happened to work
as expected on the real X680x0 hardware, but caused trouble on emulators.
The inconsistency was found by Y.Sugahara during debugging XM6i emulator
(and it will be fixed in the next release).
FDC behavior during DMA is confirmed by uPD72068 hardware application note.
XXX: There is no proper MI API to specify DMA address for DMA controller
(like MC68450) to access devices mapped to memory space by bus_space(9).
- use <sys/bus.h> rather than <machine/bus.h>
- no need to include uvm_extern.h
- include "ioconf.h" for struct cfdriver foo_cd
KNF and cosmetics. No binary change.
- check bus_space_map(9) return value
- use BUS_SPACE_MAP_SHIFTED_ODD for clarify
- define and use proper macro instead of magic
To abort DMA in dmac_abort_xfer(), set DMAC_CCR_SAB (software abort)
rather than DMAC_CCR_HLT (halt operation).
DMAC_CCR_HLT doesn't abort DMA xfers but only suspends DMA ops
(i.e. clearing HLT bit will resume DMA xfers), so previously
DMAC error always occurs on the next DMA xfer ops after
dmac_abort_xfer() is called.
Also suppress DMAC error messages in dmac_error() if it's caused
by software abort command because it can happen during normal
audio play/record DMA ops in vs(4) driver.
Before probing floppy drives, call NE7CMD_SENSEI and fdcresult()
to drain possible pending FDC interrupts. Taken from sys/dev/isa/fd.c.
Hopefully might fix occasional fd drive probe failure (but not confirmed).
Terminate DMAC and call bus_dmamap_unload(9) properly in all FDC xfer
error paths, as sys/dev/isa/fd.c does. Fixes unexpected DMAC errors
(and possible VM panic due to un-unloaded dmamap) on the first floppy
access after read/write errors.
Add floppy format support. Mostly taken from sys/dev/isa/fd.c.
Tested both fdNa (1232KB, 1024bytes/sector, 8sectors/track) and
fdNc (1200KB, 512bytes/sector, 15sectors/track) format on X68030
using fdformat(1).
Finally we can prepare NetBSD/x68k install floppies without Human68k
(except actual initial bootstrap).
KNF and space nits
 1.33.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.33.8.1 30-Oct-2012  yamt sync with head
 1.34.2.1 18-May-2014  rmind sync with head
 1.35.22.1 23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #290):
sys/arch/x68k/dev/dmacvar.h: revision 1.11-1.12 via patch
sys/arch/x68k/dev/intio_dmac.c: revision 1.36-1.37 via patch
sys/arch/x68k/dev/fd.c: revision 1.120 via patch
sys/arch/x68k/dev/vs.c: revision 1.45-1.46 via patch
Use dmac_prepare_xfer().
From Y.Sugahara.
--
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
--
Fix a Continue Operation.
Patch from Y.Sugahara.
 1.35.6.1 28-Aug-2017  skrll Sync with HEAD
 1.15 15-Dec-2019  tsutsui Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.14 22-Jan-2013  isaki branches: 1.14.38; 1.14.42;
Detect emulators (and display it on dmesg).
 1.13 18-Dec-2008  isaki branches: 1.13.14; 1.13.24;
Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.12 18-Dec-2008  isaki Move external decl. of intiobase: dev/intiovar.h -> include/cpu.h
Move definition of intiobase: x68k/pmap_bootstrap.c -> x68k/locore.s
These synchronize code with other m68k ports.
 1.11 25-Jun-2008  isaki branches: 1.11.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.10 23-Jun-2008  isaki Make intio_intr_establish() use evcnt(9),
instead of dynamic allocation of intrnames/intrcnt.
 1.9 17-Oct-2007  garbled branches: 1.9.16; 1.9.20; 1.9.22; 1.9.24;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.8 12-May-2007  isaki branches: 1.8.10;
Clean up white spaces and tabs.
 1.7 11-Dec-2005  christos branches: 1.7.26; 1.7.30; 1.7.32; 1.7.38;
merge ktrace-lwp.
 1.6 18-Jan-2005  chs branches: 1.6.8;
de-__P, remove register, ansify.
 1.5 04-Jan-2004  wiz branches: 1.5.8;
Spell controller with two ls. Inspired by miod@openbsd.
 1.4 29-Sep-2002  isaki branches: 1.4.6;
const-ify ia_name. It makes intio.c compilable.
 1.3 16-Jan-2000  minoura branches: 1.3.8; 1.3.12;
Minor cleanups & corrections.
 1.2 16-Mar-1999  minoura branches: 1.2.8;
Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file intiovar.h was initially added on branch minoura_x68k_bus_h.
 1.1.2.5 02-Feb-1999  minoura I/O controler support.
 1.1.2.4 31-Jan-1999  minoura Attach arg dmaintr.
 1.1.2.3 30-Jan-1999  minoura Added DMAC driver.
 1.1.2.2 27-Dec-1998  minoura Match device names.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.3.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.6.4 24-Jan-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.8.1 29-Apr-2005  kent sync with -current
 1.6.8.1 03-Sep-2007  yamt sync with head.
 1.7.38.1 22-May-2007  matt Update to HEAD.
 1.7.32.1 11-Jul-2007  mjf Sync with head.
 1.7.30.1 27-May-2007  ad Sync with head.
 1.7.26.1 17-May-2007  yamt sync with head.
 1.8.10.1 06-Nov-2007  matt sync with HEAD
 1.9.24.1 27-Jun-2008  simonb Sync with head.
 1.9.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.9.20.1 04-May-2009  yamt sync with head.
 1.9.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.16.1 29-Jun-2008  mjf Sync with HEAD.
 1.11.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.13.24.1 25-Feb-2013  tls resync with head
 1.13.14.1 23-Jan-2013  yamt sync with head
 1.14.42.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.14.38.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.72 05-Oct-2024  isaki x68k: Add SIXEL graphics sequence support.
- The palette definition is fixed to the same color as the text (currently,
it's RGB 8 colors). Any palette definition sent will be ignored.
- Aspect ratio and bg color mode is not supported (yet).
- An OR mode is supported. This is proposed by Y.Sugahara in this
implementation and then the mlterm also supports it. It's an advantageous
way for the multi plane color VRAM.
- ITE_SIXEL kernel option is added and is disabled by default for now.

It was first written by me in 2014 and has been demonstrated in Open Source
Conference Hiroshima every year since then. In this year, it's also
demonstrated on real X68030 at Japan NetBSD Users Group booth in OSC 2024
Hiroshima, last week.
https://x.com/OSC_official/status/1841381234804498608
It's useful for showing and explaining about the possibility of NetBSD and
old machines for younger (than X68030) engineers or students.
 1.71 07-Jan-2024  isaki branches: 1.71.2;
TAB/space/indent cleanup.
 1.70 25-Jun-2022  tsutsui Fix more unintended diffs from a wrong branch.
 1.69 25-Jun-2022  tsutsui Add a minimum box drawing character support for x68k ite(4).

This is for proper appearance of menus in sysinst(8) with TERM=vt220.
Discussed on port-x68k@ etc.

There was "why not all G0/G1/G2/G3" comment, but terminfo and curses
with TERM=vt220 only require "ESC ( <F>" against G0 for DEC special
graphics (including box drawing characters) by smacs/rmacs/acsc.
I hope other various unimplemented ISO/IEC 2022 specifications will
be motivated per further visible demends.
 1.68 28-May-2022  andvar fix various typos, mainly in comments.
 1.67 26-May-2022  tsutsui Remove duplicated function declarations.
 1.66 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.65 29-Mar-2022  riastradh x68k/ite(4): Include <sys/device_impl.h> to abuse autoconf internals.
 1.64 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

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

HOWEVER! Some subsystems have

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

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

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

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

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

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

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.63 25-Jul-2014  dholland branches: 1.63.26; 1.63.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.62 26-Mar-2014  christos branches: 1.62.2;
kill sprintf, fix unused.
 1.61 16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.60 10-Oct-2012  tsutsui branches: 1.60.2;
Fix device_t/softc split bothces. From Chuck Silvers' patch posted on
current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
and several more fixes by me.

Not sure if these are fatal (at least 6.0_RC2 works without thise fixes),
but needs more investigation.
 1.59 24-Apr-2011  rmind branches: 1.59.4; 1.59.14;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.58 08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.57 17-Jan-2009  isaki branches: 1.57.6; 1.57.8; 1.57.10;
Split device_t/softc, use aprint*().
 1.56 17-Jan-2009  isaki Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.55 13-Jun-2008  cegger branches: 1.55.4;
use device_lookup_private to get softc
 1.54 24-Feb-2008  isaki branches: 1.54.2; 1.54.4; 1.54.6; 1.54.8;
G/C unused variables and macros.
 1.53 19-Nov-2007  ad branches: 1.53.10; 1.53.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.52 18-Oct-2007  joerg branches: 1.52.2;
Initialise the callbacks for tty.t_rstrt_ch in ttymalloc
as all drivers but Sun/SPARC's kd.c use the same arguments.
Separate callout_reset into callout_schedule and the initial
callout_setfunc using that.
 1.51 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.50 12-May-2007  isaki branches: 1.50.8; 1.50.10; 1.50.14;
Clean up white spaces and tabs.
 1.49 11-Mar-2007  isaki branches: 1.49.2; 1.49.8;
white space, indent and KNF.
 1.48 04-Mar-2007  christos branches: 1.48.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.47 01-Oct-2006  elad branches: 1.47.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.46 23-Jul-2006  ad branches: 1.46.4; 1.46.6;
Use the LWP cached credentials where sane.
 1.45 14-May-2006  elad integrate kauth.
 1.44 28-Mar-2006  thorpej Use device_unit().
 1.43 24-Dec-2005  perry branches: 1.43.4; 1.43.6; 1.43.8; 1.43.10; 1.43.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.42 11-Dec-2005  christos merge ktrace-lwp.
 1.41 06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.40 12-Jun-2005  he branches: 1.40.2;
Change the last arg of ite_sendstr() to const char*, so that this builds
under -Wcast-qual. Also rename a local variable to build with -Wshadow.
 1.39 18-Jan-2005  chs use a new "addr" locator for grf instead of the unit to match the instance
to the hardware. use a new "grfaddr" locator to match ites to their grfs,
instead of requiring that their unit numbers be the same.
 1.38 18-Jan-2005  chs de-__P, remove register, ansify.
 1.37 23-Apr-2004  simonb branches: 1.37.4;
s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
 1.36 01-Nov-2003  jdolecek g/c local index() routine and switch to (libkern's) strchr()
 1.35 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.34 15-Jul-2003  lukem rcsid
 1.33 23-Oct-2002  jdolecek branches: 1.33.6;
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.32 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.31 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.30 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.29 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.28 17-Mar-2002  atatat branches: 1.28.4;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.27 27-Dec-2001  wiz bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.26 21-Oct-2001  isaki branches: 1.26.4;
Change 3 glyphs according to SRAM flags (0xed0059),
when ITELOADFONT ioctl is issued.
 1.25 02-May-2001  scw branches: 1.25.2; 1.25.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.24 13-Nov-2000  minoura branches: 1.24.2;
New line discipline.
 1.23 02-Nov-2000  eeh Adapt to new line discipline scheme.
 1.22 25-May-2000  itohy Fix the problem where pressing a key at
scsibus0: waiting 2 seconds for devices to settle...
message during boot crashes the system.
This is because ite_filter() is called before init(8) opens the console.
 1.21 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.20 27-Jun-1999  minoura branches: 1.20.2;
Restore scroll registers after X server exits.
 1.19 05-May-1999  minoura Shut up gcc -Wall.
 1.18 05-May-1999  minoura Move config_console to ensure that it is always called.
 1.17 30-Mar-1999  minoura branches: 1.17.2; 1.17.4; 1.17.6;
defopt EXTENDED_MEMORY and ITE_KERNEL_ATTR.
 1.16 24-Mar-1999  minoura G/c amiga's key repeat handler.
 1.15 22-Mar-1999  minoura Check unit.
This bug seems to be introduced on merging the bus.h patches.
 1.14 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.13 06-Aug-1998  minoura branches: 1.13.6;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.12 05-Aug-1998  minoura Fixed stray pointer access reported by Yasufumi Itoh.
 1.11 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.10 30-Jun-1998  msaitoh sync with -current after a long silence
 1.9 12-Jan-1998  thorpej Update for changes to config.
 1.8 12-Oct-1997  oki branches: 1.8.2;
Added prototypes.
 1.7 26-Jan-1997  oki branches: 1.7.8;
Rename in_xxxx to tv_xxxx (Use new ite_tv.c)
 1.6 13-Oct-1996  christos backout previous kprintf change
 1.5 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.4 17-Jul-1996  oki XXX grf has some routines call ite function directly.
XXX check whether grf has no associated ite. fixed PR/2626.
 1.3 05-Jun-1996  oki add tty_attach(tp);
 1.2 21-May-1996  oki branches: 1.2.2;
Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.2.2 17-Jul-1996  jtc Pulled up from rev 1.4 by request from Masaru Oki
 1.2.2.1 05-Jun-1996  oki pull up tty_attach() changes from trunk
 1.7.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.1 13-Oct-1998  cgd pull up some (but not all) changes from 1.10 and 1.12, via patch. (minoura)
 1.13.6.2 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.13.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.17.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.17.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.17.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.2.2 02-Jul-1999  perry pullup 1.19->1.20 (minoura): Restore scroll registers after X server exits
 1.17.2.1 22-Jun-1999  perry pullup 1.17->1.18 (minoura)
 1.20.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.20.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.24.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.25.4.2 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.25.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.25.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.25.2.3 24-Jun-2002  jdolecek add dummy itestop(), so that we can use cdev_tty_init() in conf.c
 1.25.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.4.6 11-Nov-2002  nathanw Catch up to -current
 1.26.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.26.4.4 17-Sep-2002  nathanw Catch up to -current.
 1.26.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.26.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.26.4.1 21-Oct-2001  nathanw file ite.c was added on branch nathanw_sa on 2002-01-08 00:28:40 +0000
 1.28.4.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.33.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.6.5 04-Feb-2005  skrll Adapt to branch.
 1.33.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.33.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.33.6.1 03-Aug-2004  skrll Sync with HEAD
 1.37.4.1 29-Apr-2005  kent sync with -current
 1.40.2.6 27-Feb-2008  yamt sync with head.
 1.40.2.5 07-Dec-2007  yamt sync with head
 1.40.2.4 27-Oct-2007  yamt sync with head.
 1.40.2.3 03-Sep-2007  yamt sync with head.
 1.40.2.2 30-Dec-2006  yamt sync with head.
 1.40.2.1 21-Jun-2006  yamt sync with head.
 1.43.12.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.43.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.43.10.4 13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.43.10.3 19-Apr-2006  elad sync with head - hopefully this will work
 1.43.10.2 10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.43.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.43.8.3 11-Aug-2006  yamt sync with head
 1.43.8.2 24-May-2006  yamt sync with head.
 1.43.8.1 01-Apr-2006  yamt sync with head.
 1.43.6.2 01-Jun-2006  kardel Sync with head.
 1.43.6.1 22-Apr-2006  simonb Sync with head.
 1.43.4.1 09-Sep-2006  rpaulo sync with head
 1.46.6.1 22-Oct-2006  yamt sync with head
 1.46.4.1 18-Nov-2006  ad Sync with head.
 1.47.4.2 17-May-2007  yamt sync with head.
 1.47.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.48.2.4 03-Dec-2007  ad Sync with HEAD.
 1.48.2.3 23-Oct-2007  ad Sync with head.
 1.48.2.2 27-May-2007  ad Sync with head.
 1.48.2.1 13-Mar-2007  ad Sync with head.
 1.49.8.1 22-May-2007  matt Update to HEAD.
 1.49.2.1 11-Jul-2007  mjf Sync with head.
 1.50.14.2 21-Nov-2007  bouyer Sync with HEAD
 1.50.14.1 25-Oct-2007  bouyer Sync with HEAD.
 1.50.10.3 23-Mar-2008  matt sync with HEAD
 1.50.10.2 09-Jan-2008  matt sync with HEAD
 1.50.10.1 06-Nov-2007  matt sync with HEAD
 1.50.8.2 21-Nov-2007  joerg Sync with HEAD.
 1.50.8.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.52.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.53.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.53.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.53.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.53.10.1 24-Mar-2008  keiichi sync with head.
 1.54.8.1 18-Jun-2008  simonb Sync with head.
 1.54.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.54.4.1 04-May-2009  yamt sync with head.
 1.54.2.1 17-Jun-2008  yamt sync with head.
 1.55.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.57.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.57.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.57.6.2 31-May-2011  rmind sync with head
 1.57.6.1 05-Mar-2011  rmind sync with head
 1.59.14.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.59.4.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.59.4.1 30-Oct-2012  yamt sync with head
 1.60.2.1 18-May-2014  rmind sync with head
 1.62.2.1 10-Aug-2014  tls Rebase.
 1.63.28.1 10-Jun-2019  christos Sync with HEAD
 1.63.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.71.2.1 02-Aug-2025  perseant Sync with HEAD
 1.5 26-Jan-1997  oki Use new ite_tv scheme, this file no longer used.
 1.4 18-Jan-1997  oki Use ip->isw intead of itesw. Remove unused extern itesw[].
 1.3 13-Oct-1996  christos backout previous kprintf change
 1.2 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.21 05-Oct-2024  isaki x68k: Add SIXEL graphics sequence support.
- The palette definition is fixed to the same color as the text (currently,
it's RGB 8 colors). Any palette definition sent will be ignored.
- Aspect ratio and bg color mode is not supported (yet).
- An OR mode is supported. This is proposed by Y.Sugahara in this
implementation and then the mlterm also supports it. It's an advantageous
way for the multi plane color VRAM.
- ITE_SIXEL kernel option is added and is disabled by default for now.

It was first written by me in 2014 and has been demonstrated in Open Source
Conference Hiroshima every year since then. In this year, it's also
demonstrated on real X68030 at Japan NetBSD Users Group booth in OSC 2024
Hiroshima, last week.
https://x.com/OSC_official/status/1841381234804498608
It's useful for showing and explaining about the possibility of NetBSD and
old machines for younger (than X68030) engineers or students.
 1.20 07-Jan-2024  isaki branches: 1.20.2;
TAB/space/indent cleanup.
 1.19 25-Jun-2022  tsutsui Restore EUC-JP support broken since rev 1.16.

I committed a wrong branch in the previous and it included wip version:
https://mail-index.netbsd.org/source-changes-d/2022/06/25/msg013708.html
This version is based on a fix from isaki@ and also confirmed me.
 1.18 25-Jun-2022  tsutsui Add a minimum box drawing character support for x68k ite(4).

This is for proper appearance of menus in sysinst(8) with TERM=vt220.
Discussed on port-x68k@ etc.

There was "why not all G0/G1/G2/G3" comment, but terminfo and curses
with TERM=vt220 only require "ESC ( <F>" against G0 for DEC special
graphics (including box drawing characters) by smacs/rmacs/acsc.
I hope other various unimplemented ISO/IEC 2022 specifications will
be motivated per further visible demends.
 1.17 08-Feb-2018  dholland Typos.
 1.16 28-Apr-2013  isaki Fix a kernel panic by printf(1).
The 2nd byte of ISO-2022-JP must be 0x21-0x7e. Especially,
the character code less than 0x2121 causes SEGV, because a
font address points outside of the CGROM.
Reported by tsutsui@. Should be pulled up to netbsd-6.
 1.15 11-Mar-2007  isaki branches: 1.15.76; 1.15.82; 1.15.86; 1.15.88;
Remove an extra white space.
 1.14 24-Dec-2005  perry branches: 1.14.26; 1.14.30;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 13-Jun-2005  he branches: 1.12.2;
Make this build with -Wcast-qual and -Wshadow by adding one
__UNVOLATILE() and adding a number of volatile to variable declarations
and renaming a local variable.
 1.11 18-Jan-2005  chs de-__P, remove register, ansify.
 1.10 15-Jul-2003  lukem branches: 1.10.8;
rcsid
 1.9 27-Dec-2001  wiz branches: 1.9.16;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.8 21-Oct-2001  isaki branches: 1.8.4;
Change 3 glyphs according to SRAM flags (0xed0059),
when ITELOADFONT ioctl is issued.
 1.7 27-Jun-1999  minoura branches: 1.7.16;
Restore scroll registers after X server exits.
 1.6 16-Mar-1999  minoura branches: 1.6.2; 1.6.4; 1.6.6;
Merged minoura_x68k_bus_h branch.
 1.5 06-Aug-1998  minoura branches: 1.5.6;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.4 12-Oct-1997  oki Added prototype.
 1.3 03-Feb-1997  oki branches: 1.3.8;
Oops, correct value in previous commit
 1.2 03-Feb-1997  oki - tv_kfont[] size fix.
- silly speed hack.
 1.1 26-Jan-1997  oki rewriteten ITE lower routine for x68k Text-Vram frame buffer.
 1.3.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.6.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.6.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.6.2.1 02-Jul-1999  perry pullup 1.6->1.7 (minoura): Restore scroll registers after X server exits
 1.7.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.4.1 21-Oct-2001  nathanw file ite_tv.c was added on branch nathanw_sa on 2002-01-08 00:28:40 +0000
 1.9.16.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.16.4 24-Jan-2005  skrll Sync with HEAD.
 1.9.16.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.16.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.16.1 03-Aug-2004  skrll Sync with HEAD
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.12.2.2 03-Sep-2007  yamt sync with head.
 1.12.2.1 21-Jun-2006  yamt sync with head.
 1.14.30.1 13-Mar-2007  ad Sync with head.
 1.14.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.88.1 29-Apr-2013  riz Pull up following revision(s) (requested by isaki in ticket #881):
sys/arch/x68k/dev/ite_tv.c: revision 1.16
Fix a kernel panic by printf(1).
The 2nd byte of ISO-2022-JP must be 0x21-0x7e. Especially,
the character code less than 0x2121 causes SEGV, because a
font address points outside of the CGROM.
Reported by tsutsui@. Should be pulled up to netbsd-6.
 1.15.86.1 23-Jun-2013  tls resync from head
 1.15.82.1 29-Apr-2013  riz Pull up following revision(s) (requested by isaki in ticket #881):
sys/arch/x68k/dev/ite_tv.c: revision 1.16
Fix a kernel panic by printf(1).
The 2nd byte of ISO-2022-JP must be 0x21-0x7e. Especially,
the character code less than 0x2121 causes SEGV, because a
font address points outside of the CGROM.
Reported by tsutsui@. Should be pulled up to netbsd-6.
 1.15.76.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.20.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 06-Aug-1998  minoura Moved grfioctl.h and iteioctl.h to the public include directory.
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18 05-Oct-2024  isaki x68k: Add SIXEL graphics sequence support.
- The palette definition is fixed to the same color as the text (currently,
it's RGB 8 colors). Any palette definition sent will be ignored.
- Aspect ratio and bg color mode is not supported (yet).
- An OR mode is supported. This is proposed by Y.Sugahara in this
implementation and then the mlterm also supports it. It's an advantageous
way for the multi plane color VRAM.
- ITE_SIXEL kernel option is added and is disabled by default for now.

It was first written by me in 2014 and has been demonstrated in Open Source
Conference Hiroshima every year since then. In this year, it's also
demonstrated on real X68030 at Japan NetBSD Users Group booth in OSC 2024
Hiroshima, last week.
https://x.com/OSC_official/status/1841381234804498608
It's useful for showing and explaining about the possibility of NetBSD and
old machines for younger (than X68030) engineers or students.
 1.17 07-Jan-2024  isaki branches: 1.17.2;
TAB/space/indent cleanup.
 1.16 25-Jun-2022  tsutsui Add a minimum box drawing character support for x68k ite(4).

This is for proper appearance of menus in sysinst(8) with TERM=vt220.
Discussed on port-x68k@ etc.

There was "why not all G0/G1/G2/G3" comment, but terminfo and curses
with TERM=vt220 only require "ESC ( <F>" against G0 for DEC special
graphics (including box drawing characters) by smacs/rmacs/acsc.
I hope other various unimplemented ISO/IEC 2022 specifications will
be motivated per further visible demends.
 1.15 10-Oct-2012  tsutsui Fix device_t/softc split bothces. From Chuck Silvers' patch posted on
current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
and several more fixes by me.

Not sure if these are fatal (at least 6.0_RC2 works without thise fixes),
but needs more investigation.
 1.14 08-Feb-2011  rmind branches: 1.14.4; 1.14.14;
Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.13 17-Oct-2007  garbled branches: 1.13.42; 1.13.48; 1.13.50;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.12 12-May-2007  isaki branches: 1.12.10;
Clean up white spaces and tabs.
 1.11 11-Dec-2005  christos branches: 1.11.26; 1.11.30; 1.11.32; 1.11.38;
merge ktrace-lwp.
 1.10 18-Jan-2005  chs branches: 1.10.8;
de-__P, remove register, ansify.
 1.9 07-Aug-2003  agc branches: 1.9.8;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.8 06-Sep-2002  gehenna branches: 1.8.6;
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 27-Dec-2001  wiz branches: 1.7.8;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.6 21-Oct-2001  isaki branches: 1.6.4;
Change 3 glyphs according to SRAM flags (0xed0059),
when ITELOADFONT ioctl is issued.
 1.5 24-Mar-1999  minoura branches: 1.5.20; 1.5.22;
G/c amiga's key repeat handler.
 1.4 03-Sep-1998  minoura Eliminated meaningless ITEKANJI.
 1.3 03-Feb-1997  oki Correct prototype
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.5.22.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.5.20.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.6.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.6.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.4.1 21-Oct-2001  nathanw file itevar.h was added on branch nathanw_sa on 2002-01-08 00:28:40 +0000
 1.7.8.1 19-May-2002  gehenna Remove unnecessary prototype.
 1.8.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.8.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.8.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.8.6.1 03-Aug-2004  skrll Sync with HEAD
 1.9.8.1 29-Apr-2005  kent sync with -current
 1.10.8.1 03-Sep-2007  yamt sync with head.
 1.11.38.1 22-May-2007  matt Update to HEAD.
 1.11.32.1 11-Jul-2007  mjf Sync with head.
 1.11.30.1 27-May-2007  ad Sync with head.
 1.11.26.1 17-May-2007  yamt sync with head.
 1.12.10.1 06-Nov-2007  matt sync with HEAD
 1.13.50.1 17-Feb-2011  bouyer Sync with HEAD
 1.13.48.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.42.1 05-Mar-2011  rmind sync with head
 1.14.14.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.14.4.1 30-Oct-2012  yamt sync with head
 1.17.2.1 02-Aug-2025  perseant Sync with HEAD
 1.43 25-Jun-2022  tsutsui Add rnd(9) entropy source from keyboard.
 1.42 24-Jun-2022  tsutsui Make local functions static.
 1.41 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 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 21-Mar-2014  tsutsui branches: 1.39.2;
Replace tsleep(9)/wakeup(9) with condvar(9) as practice.

Also replace malloc(9) with kmem_alloc(9).
Pevent more possible races.

Tested on both console and Xserver on X68030.
 1.38 16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.37 23-Oct-2011  tsutsui branches: 1.37.2; 1.37.12; 1.37.16;
Calling psignal(9) (via EV_WAKEUP()) in interrupt handlers
could cause mutex error panic, so defer it via softint(9).
This should fix panic on heavy key strokes during running Xserver.

Should be pulled up to netbsd-5.

XXX: amiga and atari might have the similar problem?
 1.36 17-Jan-2009  isaki Use firm_gettime() (in dev/sun/vuid_event.h) to adapt
changes in chiristos-time_t.
 1.35 25-Jun-2008  isaki branches: 1.35.4; 1.35.6;
Split device_t/softc. Use aprint*() and device_xname().
 1.34 13-Jun-2008  cegger use device_lookup_private to get softc
 1.33 03-Dec-2007  ad branches: 1.33.14; 1.33.16; 1.33.18; 1.33.20; 1.33.22;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.32 17-Oct-2007  garbled branches: 1.32.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.31 12-May-2007  isaki branches: 1.31.8; 1.31.10;
Clean up white spaces and tabs.
 1.30 29-Apr-2007  msaitoh branches: 1.30.2;
fix typos
 1.29 11-Mar-2007  isaki branches: 1.29.2;
white space, indent and KNF.
 1.28 04-Mar-2007  christos branches: 1.28.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27 04-Mar-2007  tsutsui Add MI softintr(9) support for x68k with common m68k/softintr.c.
Tested by isaki@ and Yasushi Oshima.

XXX: x68k/dev/com.c should be rewritten to use MI com(4).
 1.26 24-Jan-2007  hubertf branches: 1.26.2;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.25 08-Jan-2007  isaki Bring back the comment which was lost at rev1.22 .
 1.24 18-Sep-2006  gdamore Convert references to "time" to calls to "getmicrotime()", needed for
conversion to timecounters.
 1.23 11-Dec-2005  christos branches: 1.23.20; 1.23.22;
merge ktrace-lwp.
 1.22 18-Jan-2005  chs branches: 1.22.8;
de-__P, remove register, ansify.
 1.21 13-Dec-2004  chs branches: 1.21.2;
for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.20 28-Sep-2003  cl x68k has sc_events and not k_events in struct kbd_softc
 1.19 21-Sep-2003  jdolecek 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.18 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.17 15-Jul-2003  lukem rcsid
 1.16 23-Oct-2002  jdolecek branches: 1.16.6;
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.15 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.14 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 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.11 12-Jun-2001  wiz branches: 1.11.2; 1.11.4; 1.11.8; 1.11.16;
receive, not recieve
 1.10 25-May-2000  itohy branches: 1.10.6;
Treat receiver overrun of MFP (clear the error).
Although the keyboard hardware seems to be designed to avoid
overrun, the errors sometimes occur.
 1.9 03-Dec-1999  itohy Add a dummy read just after enabling receiver interrupt.
If the receiver already has datum, no further arrival of
data is possible and no interrupts will occur.
This change fixes problem that pressing key during boot
may sometimes disable the keyboard.

Remove unreferenced variable "in" in kbdcngetc().
 1.8 24-Mar-1999  minoura branches: 1.8.8; 1.8.14;
Shut up gcc -Wall.
 1.7 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.6 09-Oct-1997  oki branches: 1.6.10;
Added missing prototype.
 1.5 23-Nov-1996  oki branches: 1.5.10;
Implement poll(2).
 1.4 13-Oct-1996  christos backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.5.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.10.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.8.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.10.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.16.1 17-May-2002  gehenna Add device switch.
 1.11.8.4 11-Nov-2002  nathanw Catch up to -current
 1.11.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.11.8.2 17-Sep-2002  nathanw Catch up to -current.
 1.11.8.1 12-Jun-2001  nathanw file kbd.c was added on branch nathanw_sa on 2002-09-17 21:18:47 +0000
 1.11.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.11.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.11.2.1 09-Sep-2001  thorpej Add kqueue support (not yet compiled).
 1.16.6.6 04-Feb-2005  skrll Adapt to branch.
 1.16.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.16.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.21.2.1 29-Apr-2005  kent sync with -current
 1.22.8.5 07-Dec-2007  yamt sync with head
 1.22.8.4 03-Sep-2007  yamt sync with head.
 1.22.8.3 26-Feb-2007  yamt sync with head.
 1.22.8.2 30-Dec-2006  yamt sync with head.
 1.22.8.1 21-Jun-2006  yamt sync with head.
 1.23.22.1 22-Oct-2006  yamt sync with head
 1.23.20.3 01-Feb-2007  ad Sync with head.
 1.23.20.2 12-Jan-2007  ad Sync with head.
 1.23.20.1 18-Nov-2006  ad Sync with head.
 1.26.2.3 17-May-2007  yamt sync with head.
 1.26.2.2 07-May-2007  yamt sync with head.
 1.26.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.28.2.3 03-Dec-2007  ad Sync with HEAD.
 1.28.2.2 27-May-2007  ad Sync with head.
 1.28.2.1 13-Mar-2007  ad Sync with head.
 1.29.2.1 11-Jul-2007  mjf Sync with head.
 1.30.2.1 22-May-2007  matt Update to HEAD.
 1.31.10.2 09-Jan-2008  matt sync with HEAD
 1.31.10.1 06-Nov-2007  matt sync with HEAD
 1.31.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.32.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.33.22.2 27-Jun-2008  simonb Sync with head.
 1.33.22.1 18-Jun-2008  simonb Sync with head.
 1.33.20.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.33.20.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.33.18.1 04-May-2009  yamt sync with head.
 1.33.16.1 17-Jun-2008  yamt sync with head.
 1.33.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.33.14.1 29-Jun-2008  mjf Sync with HEAD.
 1.35.6.1 17-Mar-2012  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1732):
sys/arch/x68k/dev/kbd.c: revision 1.37
Calling psignal(9) (via EV_WAKEUP()) in interrupt handlers
could cause mutex error panic, so defer it via softint(9).
This should fix panic on heavy key strokes during running Xserver.
Should be pulled up to netbsd-5.
XXX: amiga and atari might have the similar problem?
 1.35.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.37.16.1 18-May-2014  rmind sync with head
 1.37.12.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.37.2.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.9 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.8 26-May-2022  tsutsui Make readonly keymap data const.
 1.7 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.6 12-May-2007  isaki branches: 1.6.10;
Clean up white spaces and tabs.
 1.5 11-Dec-2005  christos branches: 1.5.26; 1.5.30; 1.5.32; 1.5.38;
merge ktrace-lwp.
 1.4 15-Jul-2003  lukem branches: 1.4.16;
rcsid
 1.3 24-Mar-1999  minoura branches: 1.3.42;
Add function keys mapping.
 1.2 05-Jan-1998  perry RCSID Police.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.3.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.42.1 03-Aug-2004  skrll Sync with HEAD
 1.4.16.1 03-Sep-2007  yamt sync with head.
 1.5.38.1 22-May-2007  matt Update to HEAD.
 1.5.32.1 11-Jul-2007  mjf Sync with head.
 1.5.30.1 27-May-2007  ad Sync with head.
 1.5.26.1 17-May-2007  yamt sync with head.
 1.6.10.1 06-Nov-2007  matt sync with HEAD
 1.6 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.5 26-May-2022  tsutsui Make readonly keymap data const.
 1.4 17-Oct-2007  garbled Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.3 12-May-2007  isaki branches: 1.3.10;
Clean up white spaces and tabs.
 1.2 05-Jan-1998  perry branches: 1.2.66; 1.2.104; 1.2.108; 1.2.110; 1.2.116;
RCSID Police.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.116.1 22-May-2007  matt Update to HEAD.
 1.2.110.1 11-Jul-2007  mjf Sync with head.
 1.2.108.1 27-May-2007  ad Sync with head.
 1.2.104.1 17-May-2007  yamt sync with head.
 1.2.66.1 03-Sep-2007  yamt sync with head.
 1.3.10.1 06-Nov-2007  matt sync with HEAD
 1.5 26-May-2022  tsutsui Make readonly keymap data const.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 12-May-2004  minoura Populate kbdmap-related definitions to the userland.
Also g/c unused ioctls.
Pointed out by he.
 1.2 05-Jan-1998  perry branches: 1.2.50;
RCSID Police.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.50.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.50.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.50.1 03-Aug-2004  skrll Sync with HEAD
 1.2 26-Jan-1997  oki Use new ite_tv scheme, this file no longer used.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 04-Jan-2004  wiz Spell controller with two ls. Inspired by miod@openbsd.
 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 16-Mar-1999  minoura branches: 1.2.42;
Merged minoura_x68k_bus_h branch.
 1.1 19-Oct-1997  oki branches: 1.1.10;
Support of MK-HA1 Mach-2 SCSI adaptor.
 1.1.10.1 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.2.42.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.42.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.42.1 03-Aug-2004  skrll Sync with HEAD
 1.5 10-May-2008  isaki Make it retire, because no one refers.
arch/x68k/dev/spc.c includes <dev/ic/mb89352reg.h> instead of
this, since 1999.
 1.4 11-Dec-2005  christos branches: 1.4.74; 1.4.76; 1.4.78; 1.4.80;
merge ktrace-lwp.
 1.3 04-Jan-2004  wiz Spell controller with two ls. Inspired by miod@openbsd.
 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 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.4.80.2 23-Jun-2008  wrstuden Remove files removed on branch. Updating using patch has its
drawbacks. :-)
 1.4.80.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.78.1 16-May-2008  yamt sync with head.
 1.4.76.1 17-Jun-2008  yamt fix merge botches
 1.4.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.4 24-Nov-2000  minoura Use MI md_root.c.
 1.3 09-Apr-1999  minoura branches: 1.3.2;
Fix the startup message.
attach_hook is now called without "mdX: " prefix.
 1.2 17-Mar-1999  sommerfe branches: 1.2.2;
defopt MINIROOTSIZE
 1.1 19-Oct-1997  oki for ramdisk kernel
 1.2.2.1 10-Apr-1999  minoura branches: 1.2.2.1.2;
Pull-up 1.3 from trunk.
 1.2.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 08-Dec-2000  bouyer Sync with HEAD.
 1.32 06-Jan-2024  isaki x68k: Make _delay() argument to microseconds.
'<< 8' is just a magnification factor and should not be visible
from the outside.
 1.31 06-Jan-2024  isaki Remove a duplicated extern declaration.
 1.30 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.29 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.28 24-Apr-2021  thorpej branches: 1.28.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.27 15-Dec-2019  tsutsui branches: 1.27.10;
Remove clause 3 and 4 leftovers from TNF licenses in more sources.

Confirmed by martin@ in PR/54760.
 1.26 26-Mar-2014  christos branches: 1.26.30; 1.26.34;
kill sprintf, fix unused.
 1.25 05-May-2011  tsutsui branches: 1.25.4; 1.25.14; 1.25.18;
Add a comment for the previous change.
 1.24 04-May-2011  tsutsui Don't call mfp_init() in mfp_attach().
It's already called from early mfp_config_console() via config_console()
and reinitializing MFP could sometimes cause silent hang.
 1.23 17-Jan-2009  isaki branches: 1.23.6; 1.23.8;
Split device_t/softc, use aprint*().
 1.22 17-Jan-2009  isaki Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.21 31-Dec-2008  isaki Search all of mfp(4)'s children automatically, instead of
attaching hard-coded children. mfp(4) was trying to attach
pow(4) though pow(4) was a pseudo-device for a long time.
 1.20 18-Dec-2008  isaki Remove intr_reset(), which has disabled device interrupt just
after start in locore.s. Initializing interrupt should be done
by each device driver.
 1.19 11-Mar-2007  isaki branches: 1.19.38; 1.19.42; 1.19.50;
white space, indent and KNF.
 1.18 11-Mar-2007  isaki Remove an extra white space.
 1.17 24-Dec-2005  perry branches: 1.17.26; 1.17.30;
bare asm -> __asm
 1.16 11-Dec-2005  christos merge ktrace-lwp.
 1.15 13-Jun-2005  he branches: 1.15.2;
Make this compile by adding __UNCONST() when calling config_found() or
similar functions with a text constant as the second argument.
 1.14 18-Jan-2005  chs de-__P, remove register, ansify.
 1.13 17-Jan-2005  minoura mfp_attach() is called twice (console init & real config).
 1.12 13-Dec-2004  chs branches: 1.12.2;
for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.11 04-Jan-2004  wiz Spell controller with two ls. Inspired by miod@openbsd.
 1.10 15-Jul-2003  lukem rcsid
 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 12-Jun-2001  wiz branches: 1.6.2; 1.6.8;
receive, not recieve
 1.5 16-Jan-2000  minoura branches: 1.5.6;
Minor cleanups & corrections.
 1.4 05-May-1999  minoura branches: 1.4.2;
Use mvme68k-derived delay routine.
Now that we support various models, the old constant-loop delay routine
may cause problems.
 1.3 18-Mar-1999  minoura branches: 1.3.2; 1.3.4; 1.3.6;
G/C.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file mfp.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.4 13-Feb-1999  minoura Handle INTIOCF_ADDR_DEFAULT case.
 1.1.2.3 27-Dec-1998  minoura Better address map handling.
 1.1.2.2 27-Dec-1998  minoura Match device names.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.3.6.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.3.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.2.1 24-Jun-1999  perry pullup 1.3->1.4 (minoura): Use mvme68k-derived delay() routine
 1.4.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.6.8.1 12-Jun-2001  nathanw file mfp.c was added on branch nathanw_sa on 2002-10-18 02:40:46 +0000
 1.6.2.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.9.6.4 18-Dec-2004  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.12.2.1 29-Apr-2005  kent sync with -current
 1.15.2.2 03-Sep-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.17.30.1 13-Mar-2007  ad Sync with head.
 1.17.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.50.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.42.1 04-May-2009  yamt sync with head.
 1.19.38.1 17-Jan-2009  mjf Sync with HEAD.
 1.23.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.23.6.1 31-May-2011  rmind sync with head
 1.25.18.1 18-May-2014  rmind sync with head
 1.25.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.4.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.26.34.1 18-Dec-2019  martin Pull up following revision(s) (requested by tsutsui in ticket #570):

sys/compat/netbsd32/netbsd32_compat_50_sysv.c: revision 1.3
sys/dev/raidframe/rf_compat50.h: revision 1.6
sys/arch/emips/emips/bus_space.c: revision 1.3
sys/compat/net/if.h: revision 1.5
sys/arch/emips/stand/common/bootinfo.c: revision 1.2
sys/compat/common/sysv_msg_50.c: revision 1.5
sys/compat/common/kern_time_30.c: revision 1.8
sys/arch/emips/stand/common/bootinfo.h: revision 1.2
sys/arch/ia64/include/bus.h: revision 1.4
sys/arch/ia64/ia64/bus_space.c: revision 1.2
sys/compat/common/sysv_shm_50.c: revision 1.5
sys/dev/ic/adw.h: revision 1.15
sys/compat/common/uipc_syscalls_50.c: revision 1.10
sys/arch/emips/ebus/flash_ebus.c: revision 1.22
sys/dev/ic/adv.h: revision 1.15
sys/dev/ic/adwmcode.c: revision 1.18
sys/dev/ic/advlib.c: revision 1.29
sys/arch/hpcarm/include/kloader.h: revision 1.3
sys/dev/usb/uberry.c: revision 1.16
sys/compat/common/sysv_sem_50.c: revision 1.5
sys/compat/netbsd32/netbsd32_compat_50.c: revision 1.43
sys/dev/ic/advlib.h: revision 1.21
sys/dev/ic/adv.c: revision 1.50
sys/compat/netinet6/in6_var.h: revision 1.5
sys/arch/hpc/stand/hpcboot/arm/arm_sa1100_asm.asm: revision 1.2
sys/arch/emips/include/loadfile_machdep.h: revision 1.3
sys/arch/emips/stand/common/prom_iface.c: revision 1.7
sys/dev/ic/adw.c: revision 1.56
sys/dev/ic/adwmcode.h: revision 1.12
sys/dev/ic/advmcode.c: revision 1.10
sys/arch/emips/ebus/ace_ebus.c: revision 1.22
sys/compat/netbsd32/netbsd32_compat_60.c: revision 1.5
sys/dev/raidframe/rf_compat50.c: revision 1.13
sys/arch/x68k/dev/intiovar.h: revision 1.15
sys/dev/usb/uipad.c: revision 1.8
sys/arch/zaurus/include/kloader.h: revision 1.3
sys/arch/emips/stand/common/bootxx.c: revision 1.2
sys/dev/ic/adwlib.h: revision 1.23
sys/dev/ic/adwlib.c: revision 1.44
sys/compat/netbsd32/netbsd32_compat_16.c: revision 1.3
sys/arch/amigappc/include/intr.h: revision 1.27
sys/arch/x68k/dev/mfp.c: revision 1.27
sys/arch/arm/at91/at91dbgu.c: revision 1.17
sys/dev/ic/advmcode.h: revision 1.7
sys/compat/ultrix/ultrix_exec.h: revision 1.7
sys/compat/common/vfs_syscalls_50.c: revision 1.24
sys/arch/mips/cavium/octeon_dma.c: revision 1.3
sys/arch/hpc/stand/hpcboot/arm/arm_pxa2x0_asm.asm: revision 1.2

Remove clause 3 and 4 from TNF licenses.
Ok'ed by martin@ in PR/54760.

Remove clause 3 and 4 leftovers from TNF licenses in more sources.
Confirmed by martin@ in PR/54760.
 1.26.30.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.27.10.6 05-Apr-2021  thorpej Treat config_probe() as if it were a boolean function; don't compare
return value > 0... except for the odd balls, which are now really easy
to spot.
 1.27.10.5 05-Apr-2021  thorpej config_match() -> config_probe() for the straight-forward indirect config
cases. There are still a few odd balls using config_match() which should
be sorted out later.
 1.27.10.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.27.10.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.27.10.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.27.10.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.28.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.9 07-Nov-2009  snj Drop 3rd and 4th clauses on this TNF-copyrighted file.
 1.8 17-Jan-2009  isaki Split device_t/softc, use aprint*().
 1.7 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.6 14-Dec-2008  isaki Use mfp_{set,clear}_*() macros to purge macros by the name of 'mfp'.
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.78; 1.5.86;
merge ktrace-lwp.
 1.4 18-Jan-2005  chs de-__P, remove register, ansify.
 1.3 12-Jun-2001  wiz branches: 1.3.8; 1.3.24; 1.3.32;
receive, not recieve
 1.2 16-Mar-1999  minoura branches: 1.2.20;
Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file mfp.h was initially added on branch minoura_x68k_bus_h.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.2.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.32.1 29-Apr-2005  kent sync with -current
 1.3.24.1 24-Jan-2005  skrll Sync with HEAD.
 1.3.8.2 12-Jun-2001  wiz receive, not recieve
 1.3.8.1 12-Jun-2001  wiz file mfp.h was added on branch nathanw_sa on 2001-06-12 15:17:22 +0000
 1.5.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.5.78.2 11-Mar-2010  yamt sync with head
 1.5.78.1 04-May-2009  yamt sync with head.
 1.5.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.62 08-Sep-2024  rillig s/effect/affect/ in a few places
 1.61 07-Jan-2024  isaki branches: 1.61.2;
TAB/space/indent cleanup.
 1.60 17-Dec-2023  andvar Pass periph_target from xs->xs_periph, since periph is not defined.

Fixes SPC_DEBUG build option.
 1.59 05-Dec-2023  andvar s/pregress/progress/ in panic message.
 1.58 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.57 04-May-2022  andvar fix various typos in comments and log messages.
 1.56 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.55 24-Apr-2021  thorpej branches: 1.55.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.54 26-Mar-2014  christos branches: 1.54.44;
kill sprintf, fix unused.
 1.53 10-Oct-2012  tsutsui branches: 1.53.2;
Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html

Should be pulled up to netbsd-6.
 1.52 23-Nov-2009  rmind branches: 1.52.12; 1.52.18; 1.52.22;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.51 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.50 05-Dec-2008  isaki Use TAILQ_* macros.
 1.49 29-Nov-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
Not tested. I don't have its hardware and no response in port-x68k.
 1.48 13-Jun-2008  cegger branches: 1.48.2; 1.48.4;
use device_lookup_private to get softc
 1.47 28-Apr-2008  martin branches: 1.47.2; 1.47.4;
Remove clause 3 and 4 from TNF licenses
 1.46 17-Oct-2007  garbled branches: 1.46.16; 1.46.18; 1.46.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.45 12-May-2007  isaki branches: 1.45.10;
Clean up white spaces and tabs.
 1.44 11-Mar-2007  isaki branches: 1.44.2; 1.44.8;
white space, indent and KNF.
 1.43 04-Mar-2007  christos branches: 1.43.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 08-Jan-2007  isaki branches: 1.42.2;
Bring back the comment which was lost at rev1.35 .
 1.41 08-Mar-2006  lukem branches: 1.41.10;
Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.40 23-Feb-2006  thorpej branches: 1.40.2; 1.40.4;
Use device_parent().
 1.39 24-Dec-2005  perry branches: 1.39.2; 1.39.4; 1.39.6;
bare asm -> __asm
 1.38 26-Nov-2005  tsutsui Fix typo (FALLTHOUGH -> FALLTHROUGH). From Jeff Ito.
 1.37 13-Jun-2005  he branches: 1.37.2; 1.37.8;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.36 21-Feb-2005  thorpej Part 1 of a cleanup pass over the SCSI subsystem. The aim is to name
everything "scsi_*", since we really are talking about the SCSI command
set, ATAPI transport not withstanding. Improve the names of many structures,
and prepend "SCSI_" onto all SCSI command opcodes. Place items described
by the SCSI Primary Commands document into scsi_spc.h.
 1.35 18-Jan-2005  chs branches: 1.35.2;
de-__P, remove register, ansify.
 1.34 15-Jul-2003  lukem branches: 1.34.8;
rcsid
 1.33 03-May-2003  wiz branches: 1.33.2;
DMA, not dma nor Dma.
 1.32 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.31 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.30 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.29 30-May-2002  thorpej Statements must follow labels.
 1.28 05-Apr-2002  bouyer branches: 1.28.2;
Implement mstohz() as discussed on tech-kern, and use it in SCSI drivers
to convert xs->timeout to callout() parameter.
 1.27 27-Dec-2001  wiz bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.26 19-Dec-2001  minoura Implement bus_dmamap_sync properly.
dma_cachectl is now used only for DMAC array chain.
 1.25 04-Dec-2001  minoura Ooops, previous commit removed an important line unintentionally.
 1.24 25-Nov-2001  minoura Remove unused variables.
Correct printf format strings.
 1.23 04-Nov-2001  tsutsui branches: 1.23.2;
Use common macro to check message length.
 1.22 25-Apr-2001  bouyer branches: 1.22.2; 1.22.6;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.21 16-Jun-2000  minoura branches: 1.21.4;
Print newline while attach.
 1.20 30-Apr-2000  minoura branches: 1.20.2;
Revert 1.18 change.
Hopefully this is a temporary fix; something might be missing in
the SCSI negotiation.
 1.19 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.18 18-Nov-1999  minoura Do not reset SCSI bus.
 1.17 30-Sep-1999  thorpej branches: 1.17.2; 1.17.8;
Update for SCSIPI changes.
 1.16 18-Apr-1999  minoura Do not memcpy to the bouncebuffer in datain.
 1.15 24-Mar-1999  minoura branches: 1.15.2;
Shut up gcc -Wall.
 1.14 22-Mar-1999  minoura Use bus_dma(9) for DMA bouncing.
The code is dirty. It should be rewritten in the future.
 1.13 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.12 07-Feb-1999  minoura Issue SCSI reset on initialize.
Clean unused mha_reset.
 1.11 05-Dec-1998  mjacob branches: 1.11.4;
Update HBAs to incorporate the new max_lun property.
 1.10 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.9 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

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

Inspired by PR #6090, from Matt Jacob.
 1.8 09-Sep-1998  minoura Make device probe/attach sessions to be executed at splhigh.
mha driver used interrupt driven I/O.
 1.7 22-Aug-1998  minoura Eliminated vm_offset_t and vm_size_t.
 1.6 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.5 04-Jul-1998  jonathan defopt DDB.
 1.4 30-Jun-1998  msaitoh sync with -current after a long silence
 1.3 12-Jan-1998  thorpej Update for changes to config.
 1.2 19-Oct-1997  oki branches: 1.2.2;
Test device is configured in interrput handler.
 1.1 19-Oct-1997  oki Support of MK-HA1 Mach-2 SCSI adaptor.
 1.2.2.1 13-Oct-1998  cgd pull up rev 1.4 from trunk (via patch). (minoura)
 1.11.4.4 14-Mar-1999  minoura Sync.
 1.11.4.3 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.11.4.2 30-Jan-1999  minoura Added DMAC driver.
 1.11.4.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.15.2.1 19-Apr-1999  cjs branches: 1.15.2.1.2;
Pull up to HEAD 1.16, per MINOURA Makoto <minoura@netbsd.org>.
 1.15.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.17.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.2.3 29-Mar-2001  bouyer Test-compile on i386
 1.17.2.2 27-Mar-2001  bouyer Convert to thorpej_scsipi (untested).
 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.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.21.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.22.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.22.2.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.22.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.22.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.23.2.5 18-Oct-2002  nathanw Catch up to -current.
 1.23.2.4 20-Jun-2002  nathanw Catch up to -current.
 1.23.2.3 17-Apr-2002  nathanw Catch up to -current.
 1.23.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.23.2.1 04-Nov-2001  nathanw file mha.c was added on branch nathanw_sa on 2002-01-08 00:28:40 +0000
 1.28.2.1 15-Jul-2002  gehenna catch up with -current.
 1.33.2.7 11-Dec-2005  christos Sync with head.
 1.33.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.5 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.33.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.33.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.33.2.1 03-Aug-2004  skrll Sync with HEAD
 1.34.8.1 29-Apr-2005  kent sync with -current
 1.35.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.37.8.1 29-Nov-2005  yamt sync with head.
 1.37.2.3 03-Sep-2007  yamt sync with head.
 1.37.2.2 26-Feb-2007  yamt sync with head.
 1.37.2.1 21-Jun-2006  yamt sync with head.
 1.39.6.1 22-Apr-2006  simonb Sync with head.
 1.39.4.1 09-Sep-2006  rpaulo sync with head
 1.39.2.1 01-Mar-2006  yamt sync with head.
 1.40.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.40.2.1 13-Mar-2006  yamt sync with head.
 1.41.10.1 12-Jan-2007  ad Sync with head.
 1.42.2.2 17-May-2007  yamt sync with head.
 1.42.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.43.2.2 27-May-2007  ad Sync with head.
 1.43.2.1 13-Mar-2007  ad Sync with head.
 1.44.8.1 22-May-2007  matt Update to HEAD.
 1.44.2.1 11-Jul-2007  mjf Sync with head.
 1.45.10.1 06-Nov-2007  matt sync with HEAD
 1.46.20.3 11-Mar-2010  yamt sync with head
 1.46.20.2 04-May-2009  yamt sync with head.
 1.46.20.1 16-May-2008  yamt sync with head.
 1.46.18.2 17-Jun-2008  yamt sync with head.
 1.46.18.1 18-May-2008  yamt sync with head.
 1.46.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.46.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.46.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.47.4.1 18-Jun-2008  simonb Sync with head.
 1.47.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.48.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.48.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.52.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.52.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.52.18.1 17-Oct-2012  riz Pull up following revision(s) (requested by tsutsui in ticket #601):
sys/arch/x68k/dev/mha.c: revision 1.53
Fix device_t/softc split botches that could be fatal. From
Chuck Silvers' patch posted current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
Should be pulled up to netbsd-6.
 1.52.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.52.12.1 30-Oct-2012  yamt sync with head
 1.53.2.1 18-May-2014  rmind sync with head
 1.54.44.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.55.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.61.2.1 02-Aug-2025  perseant Sync with HEAD
 1.12 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.11 01-Jan-2022  andvar fix typos in comments, mainly basicly -> basically.
 1.10 29-Jul-2012  matt Another failed typedef fixed.
 1.9 29-Nov-2008  isaki branches: 1.9.16;
Split device_t/softc. Use aprint*() and device_xname().
Not tested. I don't have its hardware and no response in port-x68k.
 1.8 04-Mar-2007  christos branches: 1.8.40; 1.8.44; 1.8.50; 1.8.52;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 11-Dec-2005  christos branches: 1.7.26;
merge ktrace-lwp.
 1.6 07-Dec-2004  thorpej branches: 1.6.10;
Use "struct scsipi_command" in internal command structures so that
we have enough space for 16-byte CDBs.
 1.5 25-Apr-2001  bouyer branches: 1.5.8; 1.5.24;
Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.4 22-Mar-1999  minoura branches: 1.4.8; 1.4.20;
Use bus_dma(9) for DMA bouncing.
The code is dirty. It should be rewritten in the future.
 1.3 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.2 19-Nov-1998  thorpej branches: 1.2.4;
Adapt to the new scsipi_adapter interface.
 1.1 19-Oct-1997  oki Support of MK-HA1 Mach-2 SCSI adaptor.
 1.2.4.1 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.4.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.8.1 27-Mar-2001  bouyer Convert to thorpej_scsipi (untested).
 1.5.24.1 18-Dec-2004  skrll Sync with HEAD.
 1.5.8.2 25-Apr-2001  bouyer Pull up the thorpej_scsipi branch to main branch.
This is a completely rewritten scsipi_xfer execution engine, and the
associated changes to HBA drivers. Overview of changes & features:
- All xfers are queued in the mid-layer, rather than doing so in an
ad-hoc fashion in individual adapter drivers.
- Adapter/channel resource management in the mid-layer, avoids even trying
to start running an xfer if the adapter/channel doesn't have the resources.
- Better communication between the mid-layer and the adapters.
- Asynchronous event notification mechanism from adapter to mid-layer and
peripherals.
- Better peripheral queue management: freeze/thaw, sorted requeueing during
recovery, etc.
- Clean separation of peripherals, adapters, and adapter channels (no more
scsipi_link).
- Kernel thread for each scsipi_channel makes error recovery much easier
(no more dealing with interrupt context when recovering from an error).
- Mid-layer support for tagged queueing: commands can have the tag type
set explicitly, tag IDs are allocated in the mid-layer (thus eliminating
the need to use buggy tag ID allocation schemes in many adapter drivers).
- support for QUEUE FULL and CHECK CONDITION status in mid-layer; the command
will be requeued, or a REQUEST SENSE will be sent as appropriate.

Just before the merge syssrc has been tagged with thorpej_scsipi_beforemerge
 1.5.8.1 25-Apr-2001  bouyer file mhavar.h was added on branch nathanw_sa on 2001-04-25 17:53:27 +0000
 1.6.10.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.8.50.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.8.44.1 04-May-2009  yamt sync with head.
 1.8.40.1 17-Jan-2009  mjf Sync with HEAD.
 1.9.16.1 30-Oct-2012  yamt sync with head
 1.42 24-May-2024  andvar s/borad/board/ in comments.
 1.41 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.40 23-May-2022  tsutsui Remove unused variables.
 1.39 23-May-2022  tsutsui Make local functions and variable static.
 1.38 23-May-2022  tsutsui Fix a wrong comment about mouse buttons, probably derived from Inside X68000.
 1.37 23-May-2022  tsutsui Add comments why delta Y of mouse input is inverted.
 1.36 24-Apr-2021  tsutsui Tidy up callout(9) implementation to handle mouse packets.

- define and use proper macro to specify ticks
- use callout_schedule(9) rather than callout_reset(9) to restart timer

No functional changes.
 1.35 07-Feb-2021  tsutsui Remove dumb middle button emulation code from the ms(4) driver.

Also fix leftover comments (derived from the original Sun's "firm_event"
implementation as seen in sys/dev/sun/ms.c) to sync with reality on x68k.

The current implementation the ms(4) driver just checks whether
two (left/right) buttons are changed in the same packet.
This means it cannot handle a release event correctly if two
buttons pressed simultaneously are released in the different timing.

The middle button emulation should be handled in application layer
as other Xservers do, and I'll import Emulate3Buttons support for the
X68k Xorg based monolithic server.

See my post on port-x68k@ for details:
https://mail-index.netbsd.org/port-x68k/2021/02/05/msg000074.html
 1.34 25-Jul-2014  dholland branches: 1.34.40;
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 26-Mar-2014  christos branches: 1.33.2;
kill sprintf, fix unused.
 1.32 21-Mar-2014  tsutsui Replace tsleep(9)/wakeup(9) with condvar(9) as practice.

Also replace malloc(9) with kmem_alloc(9).
Pevent more possible races.

Tested on both console and Xserver on X68030.
 1.31 16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.30 17-Jan-2009  isaki branches: 1.30.14; 1.30.24; 1.30.28;
Use firm_gettime() (in dev/sun/vuid_event.h) to adapt
changes in chiristos-time_t.
 1.29 25-Jun-2008  isaki branches: 1.29.4;
struct cfdata -> cfdata_t.
 1.28 20-Apr-2008  tsutsui branches: 1.28.2; 1.28.4; 1.28.6;
Split device_t/softc, as following its parents zsc(4). Spotted by isaki@.
 1.27 17-Oct-2007  garbled branches: 1.27.16; 1.27.18;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.26 09-Jul-2007  ad branches: 1.26.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.25 11-Mar-2007  isaki branches: 1.25.2; 1.25.8;
white space, indent and KNF.
 1.24 04-Mar-2007  christos branches: 1.24.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.23 18-Sep-2006  gdamore branches: 1.23.4;
Convert references to "time" to calls to "getmicrotime()", needed for
conversion to timecounters.
 1.22 29-Mar-2006  thorpej branches: 1.22.8; 1.22.10;
Use device_cfdata().
 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 18-Jan-2005  chs branches: 1.20.8;
de-__P, remove register, ansify.
 1.19 21-Sep-2003  jdolecek branches: 1.19.8;
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.18 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.17 15-Jul-2003  lukem rcsid
 1.16 23-Oct-2002  jdolecek branches: 1.16.6;
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.15 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.14 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 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.11 25-Nov-2001  minoura branches: 1.11.8;
Remove unused variables.
Correct printf format strings.
 1.10 23-Mar-2000  thorpej branches: 1.10.6; 1.10.8; 1.10.12;
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.9 14-Jan-2000  itohy Change the implementation of ms(4) polling to use timeout(9) software
interrupt in order to eliminate glitches on MPU interrupt levels.
I don't know whether this is a good solution, but it does work.
 1.8 24-Mar-1999  minoura branches: 1.8.2; 1.8.8;
Shut up gcc -Wall.
 1.7 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.6 03-Feb-1999  mycroft Catch up with a change to the stint interface.
 1.5 05-Aug-1998  minoura branches: 1.5.6;
Switched to MI zs driver.
 1.4 12-Oct-1997  oki branches: 1.4.2;
Add prototype.
 1.3 23-Nov-1996  oki branches: 1.3.10;
Implement poll(2).
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.3.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.1 05-Feb-1999  cgd pull up patch to make mouse optional. Previously it was mandatory
because some mouse-related functions were referenced from other files.
Never committed to trunk because -current uses MI zs driver. (minoura)
 1.5.6.2 14-Mar-1999  minoura Sync.
 1.5.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.8.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.2.1 15-Jan-2000  he Pull up revision 1.9 (requested by itohy):
Change the implementation of ms(4) polling to use timeout(9)
software timer, and change the clock interrupt handler not to
lower interrupt level, in order to eliminate glitches on MPU
interrupt levels.
 1.10.12.4 11-Nov-2002  nathanw Catch up to -current
 1.10.12.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.12.2 17-Sep-2002  nathanw Catch up to -current.
 1.10.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.10.8.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.8.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.10.8.1 09-Sep-2001  thorpej Add kqueue support (not yet compiled).
 1.10.6.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.11.8.1 17-May-2002  gehenna Add device switch.
 1.16.6.5 04-Feb-2005  skrll Adapt to branch.
 1.16.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.16.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.16.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.16.6.1 03-Aug-2004  skrll Sync with HEAD
 1.19.8.1 29-Apr-2005  kent sync with -current
 1.20.8.3 03-Sep-2007  yamt sync with head.
 1.20.8.2 30-Dec-2006  yamt sync with head.
 1.20.8.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 - hopefully this will work
 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.22.10.1 22-Oct-2006  yamt sync with head
 1.22.8.1 18-Nov-2006  ad Sync with head.
 1.23.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.2.2 15-Jul-2007  ad Sync with head.
 1.24.2.1 13-Mar-2007  ad Sync with head.
 1.25.8.1 03-Oct-2007  garbled Sync with HEAD
 1.25.2.1 11-Jul-2007  mjf Sync with head.
 1.26.10.1 06-Nov-2007  matt sync with HEAD
 1.27.18.1 18-May-2008  yamt sync with head.
 1.27.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.27.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.27.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.6.1 27-Jun-2008  simonb Sync with head.
 1.28.4.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.28.2.1 04-May-2009  yamt sync with head.
 1.29.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.30.28.1 18-May-2014  rmind sync with head
 1.30.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.30.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.33.2.1 10-Aug-2014  tls Rebase.
 1.34.40.1 03-Apr-2021  thorpej Sync with HEAD.
 1.23 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.22 24-Apr-2021  thorpej branches: 1.22.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.21 10-Nov-2019  chs branches: 1.21.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.20 26-Mar-2014  christos branches: 1.20.30;
kill sprintf, fix unused.
 1.19 18-Dec-2008  isaki branches: 1.19.14; 1.19.24; 1.19.28;
Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.18 25-Jun-2008  isaki branches: 1.18.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.17 04-May-2008  martin branches: 1.17.2; 1.17.4;
Move to standard TNF 2 clause license
 1.16 11-Mar-2007  isaki branches: 1.16.38; 1.16.40; 1.16.42;
white space, indent and KNF.
 1.15 11-Dec-2005  christos branches: 1.15.26; 1.15.30;
merge ktrace-lwp.
 1.14 26-Aug-2005  drochner s/locdesc_t/int/g
 1.13 30-Jun-2005  drochner branches: 1.13.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.12 13-Jun-2005  he Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.11 18-Jan-2005  chs de-__P, remove register, ansify.
 1.10 15-Jul-2003  lukem branches: 1.10.8;
rcsid
 1.9 01-Jan-2003  thorpej branches: 1.9.2;
Use aprint_normal() for cfprint routines.
 1.8 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.7 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.6 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.5 27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.4 16-Jan-2000  minoura branches: 1.4.8; 1.4.12;
Minor cleanups & corrections.
 1.3 24-Mar-1999  minoura branches: 1.3.8;
Shut up gcc -Wall.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file neptune.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.6 14-Mar-1999  minoura Use a single (inline) function instead of refering the bus_space switch.
 1.1.2.5 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.1.2.4 13-Feb-1999  minoura Use BUS_SPACE_MAP_SHIFTED.
 1.1.2.3 28-Dec-1998  minoura Free i/o map when the NIC is not found.
 1.1.2.2 27-Dec-1998  minoura Match device names.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.3.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.12.2 03-Jan-2003  thorpej Sync with HEAD.
 1.4.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.4.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.9.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.9.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.9.2.1 03-Aug-2004  skrll Sync with HEAD
 1.10.8.1 29-Apr-2005  kent sync with -current
 1.13.2.2 03-Sep-2007  yamt sync with head.
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.15.30.1 13-Mar-2007  ad Sync with head.
 1.15.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.42.2 04-May-2009  yamt sync with head.
 1.16.42.1 16-May-2008  yamt sync with head.
 1.16.40.1 18-May-2008  yamt sync with head.
 1.16.38.3 17-Jan-2009  mjf Sync with HEAD.
 1.16.38.2 29-Jun-2008  mjf Sync with HEAD.
 1.16.38.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.1 27-Jun-2008  simonb Sync with head.
 1.17.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.28.1 18-May-2014  rmind sync with head
 1.19.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.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.20.30.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.21.10.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.21.10.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.21.10.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.22.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.4 04-May-2008  martin branches: 1.4.2; 1.4.4;
Move to standard TNF 2 clause license
 1.3 24-Mar-1999  minoura branches: 1.3.144; 1.3.146; 1.3.148;
Shut up gcc -Wall.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 23-Dec-1998  minoura branches: 1.1.2;
file neptunevar.h was initially added on branch minoura_x68k_bus_h.
 1.1.2.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.3.148.2 04-May-2009  yamt sync with head.
 1.3.148.1 16-May-2008  yamt sync with head.
 1.3.146.1 18-May-2008  yamt sync with head.
 1.3.144.2 29-Jun-2008  mjf Sync with HEAD.
 1.3.144.1 02-Jun-2008  mjf Sync with HEAD.
 1.4.4.1 27-Jun-2008  simonb Sync with head.
 1.4.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.20 26-Mar-2014  christos kill sprintf, fix unused.
 1.19 25-Jun-2008  isaki branches: 1.19.30; 1.19.40; 1.19.46;
Split device_t/softc. Use aprint*() and device_xname().
 1.18 11-Mar-2007  isaki branches: 1.18.38; 1.18.42; 1.18.44; 1.18.46;
white space, indent and KNF.
 1.17 11-Mar-2007  isaki Remove an extra white space.
 1.16 28-Mar-2006  thorpej branches: 1.16.14; 1.16.18;
Use device_unit().
 1.15 24-Dec-2005  perry branches: 1.15.4; 1.15.6; 1.15.8; 1.15.10; 1.15.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 18-Jan-2005  chs branches: 1.13.8;
de-__P, remove register, ansify.
 1.12 08-May-2004  minoura branches: 1.12.4;
An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.11 15-Jul-2003  lukem rcsid
 1.10 02-Oct-2002  thorpej branches: 1.10.6;
Add trailing ; to CFATTACH_DECL.
 1.9 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 27-Dec-2001  wiz bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.6 02-May-2001  minoura branches: 1.6.2; 1.6.4; 1.6.8;
X68k built-in voice synthesizer.
 1.5 24-Mar-1999  minoura branches: 1.5.20;
Shut up gcc -Wall.
 1.4 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.3 12-Oct-1997  oki branches: 1.3.10;
Added prototypes.
 1.2 21-May-1996  oki branches: 1.2.12;
Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.10.3 13-Feb-1999  minoura Use BUS_SPACE_MAP_SHIFTED.
 1.3.10.2 02-Feb-1999  minoura Message change.
 1.3.10.1 31-Jan-1999  minoura opm at intio.
 1.5.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.6.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.6.8.1 02-May-2001  nathanw file opm.c was added on branch nathanw_sa on 2002-01-08 00:28:41 +0000
 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.10.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.12.4.1 29-Apr-2005  kent sync with -current
 1.13.8.2 03-Sep-2007  yamt sync with head.
 1.13.8.1 21-Jun-2006  yamt sync with head.
 1.15.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.15.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.15.8.1 01-Apr-2006  yamt sync with head.
 1.15.6.1 22-Apr-2006  simonb Sync with head.
 1.15.4.1 09-Sep-2006  rpaulo sync with head
 1.16.18.1 13-Mar-2007  ad Sync with head.
 1.16.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.46.1 27-Jun-2008  simonb Sync with head.
 1.18.44.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.42.1 04-May-2009  yamt sync with head.
 1.18.38.1 29-Jun-2008  mjf Sync with HEAD.
 1.19.46.1 18-May-2014  rmind sync with head
 1.19.40.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.30.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.28 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.27 22-Aug-2015  christos branches: 1.27.18;
fix include filename.
 1.26 20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.25 25-Jul-2014  dholland branches: 1.25.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.24 16-Mar-2014  dholland branches: 1.24.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.23 18-Jan-2009  isaki branches: 1.23.14; 1.23.24; 1.23.28;
- malloc() + memset(0) -> malloc(M_ZERO).
- remove temporary variable.
 1.22 18-Jan-2009  isaki Clean up header files.
 1.21 17-Oct-2007  garbled branches: 1.21.20; 1.21.28;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.20 09-Jul-2007  ad branches: 1.20.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.19 12-May-2007  isaki Clean up white spaces and tabs.
 1.18 11-Mar-2007  isaki branches: 1.18.2; 1.18.8;
Include appropriate header file.
 1.17 11-Mar-2007  isaki white space, indent and KNF.
 1.16 11-Mar-2007  isaki Remove an extra white space.
 1.15 04-Mar-2007  christos branches: 1.15.2;
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 18-Jan-2005  chs branches: 1.13.8;
de-__P, remove register, ansify.
 1.12 08-May-2004  minoura branches: 1.12.4;
An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.11 15-Jul-2003  lukem rcsid
 1.10 23-Oct-2002  jdolecek branches: 1.10.6;
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 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 27-Dec-2001  wiz branches: 1.8.8;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.7 23-Mar-2000  thorpej branches: 1.7.6; 1.7.8; 1.7.12;
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.6 24-Mar-1999  minoura branches: 1.6.8;
Shut up gcc -Wall.
 1.5 12-Oct-1997  oki Added prototype.
 1.4 13-Oct-1996  christos branches: 1.4.10;
backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.4.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.12.3 11-Nov-2002  nathanw Catch up to -current
 1.7.12.2 17-Sep-2002  nathanw Catch up to -current.
 1.7.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.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.7.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.6.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.8.8.1 17-May-2002  gehenna Add device switch.
 1.10.6.5 04-Feb-2005  skrll Adapt to branch.
 1.10.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.12.4.1 29-Apr-2005  kent sync with -current
 1.13.8.2 03-Sep-2007  yamt sync with head.
 1.13.8.1 21-Jun-2006  yamt sync with head.
 1.14.26.2 17-May-2007  yamt sync with head.
 1.14.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.2.3 15-Jul-2007  ad Sync with head.
 1.15.2.2 27-May-2007  ad Sync with head.
 1.15.2.1 13-Mar-2007  ad Sync with head.
 1.18.8.2 03-Oct-2007  garbled Sync with HEAD
 1.18.8.1 22-May-2007  matt Update to HEAD.
 1.18.2.1 11-Jul-2007  mjf Sync with head.
 1.20.10.1 06-Nov-2007  matt sync with HEAD
 1.21.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.21.20.1 04-May-2009  yamt sync with head.
 1.23.28.1 18-May-2014  rmind sync with head
 1.23.24.2 03-Dec-2017  jdolecek update from HEAD
 1.23.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.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.24.2.1 10-Aug-2014  tls Rebase.
 1.25.4.1 22-Sep-2015  skrll Sync with HEAD
 1.27.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.66;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.66.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.1.1.66.2 18-Sep-2004  skrll Sync with HEAD.
 1.1.1.1.66.1 03-Aug-2004  skrll Sync with HEAD
 1.5 11-Dec-2005  christos merge ktrace-lwp.
 1.4 08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.3 02-May-2001  minoura branches: 1.3.8; 1.3.24;
X68k built-in voice synthesizer.
 1.2 16-Mar-1999  minoura branches: 1.2.20;
Merged minoura_x68k_bus_h branch.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.2 13-Feb-1999  minoura Use BUS_SPACE_MAP_SHIFTED.
 1.1.1.1.24.1 31-Jan-1999  minoura opm at intio.
 1.2.20.1 21-Jun-2001  nathanw Catch up to -current.
 1.3.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.3.24.1 03-Aug-2004  skrll Sync with HEAD
 1.3.8.2 02-May-2001  minoura X68k built-in voice synthesizer.
 1.3.8.1 02-May-2001  minoura file opmreg.h was added on branch nathanw_sa on 2001-05-02 13:00:21 +0000
 1.3 11-Dec-2005  christos merge ktrace-lwp.
 1.2 18-Jan-2005  chs de-__P, remove register, ansify.
 1.1 08-May-2004  minoura branches: 1.1.2; 1.1.6;
An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.1.6.1 29-Apr-2005  kent sync with -current
 1.1.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.1.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.1.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.1.2.2 03-Aug-2004  skrll Sync with HEAD
 1.1.2.1 08-May-2004  skrll file opmvar.h was added on branch ktrace-lwp on 2004-08-03 10:42:47 +0000
 1.45 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.44 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.43 03-Sep-2018  riastradh Rename min/max -> uimin/uimax for better honesty.

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

HOWEVER! Some subsystems have

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

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

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

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

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

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

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate. But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all. (Who knows, maybe in some cases integer
truncation is actually intended!)
 1.42 25-Jul-2014  dholland branches: 1.42.26; 1.42.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.41 26-Mar-2014  christos branches: 1.41.2;
kill sprintf, fix unused.
 1.40 16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.39 13-Oct-2012  tsutsui branches: 1.39.2;
Normalize autoconf(9) function arg names (parent, self, and aux)
for clarification. from chs@.
 1.38 09-Jan-2010  isaki branches: 1.38.12; 1.38.22;
Make compile with DEBUG.
 1.37 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.36 08-Jun-2008  tsutsui branches: 1.36.2;
Use device_private() and device_lookup_private() to get softc.
 1.35 17-Oct-2007  garbled branches: 1.35.16; 1.35.18; 1.35.20; 1.35.22;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.34 14-Jul-2007  isaki branches: 1.34.10;
Make it compilable after the merge of some vmlocking branch.
OK'ed by ad@.
 1.33 14-Jul-2007  ad - Restore com.c 1.45, par.c 1.31. They were trashed due to file system
corruption on my machine.
- Adjust to match callout_init signature change.
 1.32 09-Jul-2007  ad Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.31 12-May-2007  isaki Clean up white spaces and tabs.
 1.30 11-Mar-2007  isaki branches: 1.30.2; 1.30.8;
Include appropriate header file.
 1.29 11-Mar-2007  isaki white space, indent and KNF.
 1.28 11-Mar-2007  isaki Remove an extra white space.
 1.27 04-Mar-2007  christos branches: 1.27.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.26 16-Feb-2007  ad branches: 1.26.2;
More spllowersoftclock() fallout.
 1.25 28-Mar-2006  thorpej Use device_unit().
 1.24 11-Dec-2005  christos branches: 1.24.4; 1.24.6; 1.24.8; 1.24.10; 1.24.12;
merge ktrace-lwp.
 1.23 18-Jan-2005  chs branches: 1.23.8;
de-__P, remove register, ansify.
 1.22 13-Dec-2004  chs branches: 1.22.2;
for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.21 01-Nov-2003  jdolecek shutup one bogus -Wunitialized warning, and fix one correct

XXX parrw() routine looks like not actually correct for transfers
XXX larger than sc_burst - someone with the hardware should check & fix this
 1.20 01-Nov-2003  jdolecek drop register qualifiers
 1.19 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.18 15-Jul-2003  lukem rcsid
 1.17 23-Oct-2002  jdolecek branches: 1.17.6;
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.16 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.15 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 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.12 11-Jun-2000  minoura branches: 1.12.4; 1.12.6; 1.12.10; 1.12.18;
G/C of unused interrupt stubs, and other cleanups.
 1.11 27-Mar-2000  minoura branches: 1.11.2;
Move par under intio.
 1.10 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.9 05-Aug-1999  thorpej branches: 1.9.2;
Change the semantics of splsoftclock() to be like other spl*() functions,
that is priority is rasied. Add a new spllowersoftclock() to provide the
atomic drop-to-softclock semantics that the old splsoftclock() provided,
and update calls accordingly.

This fixes a problem with using the "rnd" pseudo-device from within
interrupt context to extract random data (e.g. from within the softnet
interrupt) where doing so would incorrectly unblock interrupts (causing
all sorts of lossage).

XXX 4 platforms do not have priority-raising capability: newsmips, sparc,
XXX sparc64, and VAX. This platforms still have this bug until their
XXX spl*() functions are fixed.
 1.8 05-May-1999  minoura Shut up gcc -Wall.
 1.7 07-Aug-1998  minoura branches: 1.7.10;
Moved parioctl.h to the system header directory.
 1.6 12-Jan-1998  thorpej Update for changes to config.
 1.5 12-Oct-1997  oki Added prototype.
 1.4 13-Oct-1996  christos branches: 1.4.10;
backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 21-May-1996  oki Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.4.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.9.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.11.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.12.18.1 17-May-2002  gehenna Add device switch.
 1.12.10.3 11-Nov-2002  nathanw Catch up to -current
 1.12.10.2 18-Oct-2002  nathanw Catch up to -current.
 1.12.10.1 17-Sep-2002  nathanw Catch up to -current.
 1.12.6.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.12.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.17.6.6 04-Feb-2005  skrll Adapt to branch.
 1.17.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.17.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.17.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.17.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.17.6.1 03-Aug-2004  skrll Sync with HEAD
 1.22.2.1 29-Apr-2005  kent sync with -current
 1.23.8.3 03-Sep-2007  yamt sync with head.
 1.23.8.2 26-Feb-2007  yamt sync with head.
 1.23.8.1 21-Jun-2006  yamt sync with head.
 1.24.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.24.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.24.8.1 01-Apr-2006  yamt sync with head.
 1.24.6.1 22-Apr-2006  simonb Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.26.2.2 17-May-2007  yamt sync with head.
 1.26.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.27.2.3 15-Jul-2007  ad Sync with head.
 1.27.2.2 27-May-2007  ad Sync with head.
 1.27.2.1 13-Mar-2007  ad Sync with head.
 1.30.8.2 03-Oct-2007  garbled Sync with HEAD
 1.30.8.1 22-May-2007  matt Update to HEAD.
 1.30.2.1 11-Jul-2007  mjf Sync with head.
 1.34.10.1 06-Nov-2007  matt sync with HEAD
 1.35.22.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.35.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.35.20.2 11-Mar-2010  yamt sync with head
 1.35.20.1 04-May-2009  yamt sync with head.
 1.35.18.1 17-Jun-2008  yamt sync with head.
 1.35.16.1 29-Jun-2008  mjf Sync with HEAD.
 1.36.2.1 27-Jun-2008  simonb Sync with head.
 1.38.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.38.12.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.38.12.1 30-Oct-2012  yamt sync with head
 1.39.2.1 18-May-2014  rmind sync with head
 1.41.2.1 10-Aug-2014  tls Rebase.
 1.42.28.1 10-Jun-2019  christos Sync with HEAD
 1.42.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.3 07-Aug-1998  minoura Moved parioctl.h to the system header directory.
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24 19-Nov-2011  isaki Obsolete pow(4) and rtcalarm(8). Discussed in port-x68k@.
Probably the combination of pow(4) ioctl and rtcalarm(8) does
not work for a long time, and nobody uses them.
I'll rewrite a part about power switch handler as a new device.
 1.23 18-Jan-2009  isaki branches: 1.23.14;
Delete 10 years old #if 0'd comments in intio.c, locore.s.
According to the old comment, the interrupt handler via intiotrap
should set his interrupt level again, but it's not right. And
don't set it again by interrupt hander.
 1.22 20-Dec-2008  isaki x68k pow(4) now uses MI sysmon_pswitch framework. suggested by tsutsui@.
- Make MD poffd(8) retire, and use MI powerd(8) instead of it.
- Make /dev/pow1 retire, because nobody holds /dev/pow0 any longer.
Use /dev/pow0 for pow(4) ioctl.
- POWIOCSSIGNAL ioctl which is for poffd(8) is also obsoleted.
 1.21 20-Dec-2008  isaki Make pow(4) a hardware device.
Now pow(4) uses intio_intr_establish() which is a common interrupt
routine, but not powtrap which is a device specific routine.
 1.20 14-Dec-2008  isaki Use intio_set_*() macros to purge macros by the name of sysport, ioctlr.
 1.19 14-Dec-2008  isaki Use mfp_{set,clear}_*() macros to purge macros by the name of 'mfp'.
 1.18 13-Dec-2008  isaki Fix a broken 'Front power switch' signal.
Use softint(9), instead of using psignal(9) in
hardware interrupt. Thanks to soda-san.
 1.17 11-Mar-2007  isaki branches: 1.17.38; 1.17.42; 1.17.50;
white space, indent and KNF.
 1.16 11-Mar-2007  isaki Remove an extra white space.
 1.15 04-Mar-2007  christos branches: 1.15.2;
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 13-Jun-2005  he branches: 1.13.2;
Add volatile to a cast to make this build with -Wcast-qual.
 1.12 18-Jan-2005  chs de-__P, remove register, ansify.
 1.11 15-Jul-2003  lukem branches: 1.11.8;
rcsid
 1.10 23-Oct-2002  jdolecek branches: 1.10.6;
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 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 20-Feb-2000  minoura branches: 1.8.6; 1.8.8; 1.8.12; 1.8.20;
According to Takeshi Nakayama <tn@catvmics.ne.jp>,
POW_ALARMSW seems always 1 on some models (at least XVI).
 1.7 04-Aug-1998  minoura branches: 1.7.14;
RB_POWERDOWN is now supported.
Check if the power switch is open (off) in the shutdown_hook,
and try removing the power in cpu_reboot.
poffd default action is now shutdown -p.
 1.6 12-Oct-1997  oki Added prototype.
 1.5 03-Feb-1997  oki branches: 1.5.8;
Remove #include <string.h>
 1.4 13-Oct-1996  christos backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 15-May-1996  oki fixed gcc -Wall warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.5.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.8.20.1 17-May-2002  gehenna Add device switch.
 1.8.12.2 11-Nov-2002  nathanw Catch up to -current
 1.8.12.1 17-Sep-2002  nathanw Catch up to -current.
 1.8.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.8.6.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.10.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.6.5 04-Feb-2005  skrll Adapt to branch.
 1.10.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.10.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1 03-Aug-2004  skrll Sync with HEAD
 1.11.8.1 29-Apr-2005  kent sync with -current
 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.2.1 13-Mar-2007  ad Sync with head.
 1.17.50.1 19-Jan-2009  skrll Sync with HEAD.
 1.17.42.1 04-May-2009  yamt sync with head.
 1.17.38.1 17-Jan-2009  mjf Sync with HEAD.
 1.23.14.1 17-Apr-2012  yamt sync with head
 1.4 16-Jul-2022  isaki The system should halt if the powerdown fails.
On X680x0 hardware, front power button is an alternate switch.
If the power button is left on, the power will not turn off.
In addition, with this change, power_switch_is_off in powsw.c is
no longer necessary.
 1.3 16-Jul-2022  isaki Style fixes.
 1.2 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.1 27-Nov-2011  isaki branches: 1.1.6;
Add powsw(4) for x68k power switch. It substitutes for a part about
power switch handler of pow(4) deleted before.
Benefits than pow(4):
- separate a front switch (= powsw0) and an EXPWON line (= powsw1)
completely. Only powsw0 is enabled in GENERIC by default.
- prevent chattering in some hardware individuals.
thank you for a report and a test: Yasushi Oshima and Y.Sugahara.
 1.1.6.2 17-Apr-2012  yamt sync with head
 1.1.6.1 27-Nov-2011  yamt file powsw.c was added on branch yamt-pagecache on 2012-04-17 00:07:02 +0000
 1.5 19-Nov-2011  isaki Obsolete pow(4) and rtcalarm(8). Discussed in port-x68k@.
Probably the combination of pow(4) ioctl and rtcalarm(8) does
not work for a long time, and nobody uses them.
I'll rewrite a part about power switch handler as a new device.
 1.4 20-Dec-2008  isaki branches: 1.4.14;
x68k pow(4) now uses MI sysmon_pswitch framework. suggested by tsutsui@.
- Make MD poffd(8) retire, and use MI powerd(8) instead of it.
- Make /dev/pow1 retire, because nobody holds /dev/pow0 any longer.
Use /dev/pow0 for pow(4) ioctl.
- POWIOCSSIGNAL ioctl which is for poffd(8) is also obsoleted.
 1.3 13-Dec-2008  isaki Fix a broken 'Front power switch' signal.
Use softint(9), instead of using psignal(9) in
hardware interrupt. Thanks to soda-san.
 1.2 05-Jan-1998  perry branches: 1.2.152; 1.2.156; 1.2.164;
RCSID Police.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.164.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.156.1 04-May-2009  yamt sync with head.
 1.2.152.1 17-Jan-2009  mjf Sync with HEAD.
 1.4.14.1 17-Apr-2012  yamt sync with head
 1.26 07-Sep-2025  thorpej Change todr_chip_handle::cookie -> todr_chip_handle::todr_dev, and
make it a device_t. Upcoming functional changes will require the
device_t associated with a TODR device.

Change todr_chip_handle::bus_cookie -> todr_chip_handle::todr_devaux.
Nothing was using the old field, but I decided to keep it around just
in cause something needs it in the future.

And with these largely mechanical yet semantically meaningful changes,
thus spake the Oracle: "Welcome to NetBSD 11.99.2."
 1.25 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.24 26-Mar-2014  christos kill sprintf, fix unused.
 1.23 03-Jan-2009  isaki branches: 1.23.14; 1.23.24; 1.23.28;
rtclockinit() and range_test*() were removed in rtclock.c,v 1.19.
 1.22 25-Jun-2008  isaki branches: 1.22.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.21 11-Mar-2007  isaki branches: 1.21.38; 1.21.42; 1.21.44; 1.21.46;
white space, indent and KNF.
 1.20 11-Mar-2007  isaki Remove an extra white space.
 1.19 14-Sep-2006  gdamore branches: 1.19.6; 1.19.10;
Converted x68k to todr. Compile tested only, but it has a low probably
of breaking anything.
 1.18 11-Dec-2005  christos branches: 1.18.8; 1.18.20;
merge ktrace-lwp.
 1.17 18-Jan-2005  chs branches: 1.17.8;
de-__P, remove register, ansify.
 1.16 13-Dec-2004  chs branches: 1.16.2;
for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.15 15-Jul-2003  lukem rcsid
 1.14 02-Oct-2002  thorpej branches: 1.14.6;
Add trailing ; to CFATTACH_DECL.
 1.13 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 14-May-2002  matt Eliminate commons (including many used ones). Clean up variable references.
 1.10 26-May-2001  minoura branches: 1.10.2; 1.10.8;
Honor rtc_offset.
 1.9 15-Jan-2001  itohy branches: 1.9.2;
Make it compile with "options DIAGNOSTIC" (patch from minoura).
 1.8 11-Jan-2001  minoura Use MI clock_subr.c.
 1.7 09-Jan-2001  minoura Do not range_test() unless DIAGNOSTIC.
Suggested by Tetsuya Isaki <isaki@v6.ipc.hiroshima-u.ac.jp>.
 1.6 04-Jan-2001  minoura Correct `Year 2001 problem'.
Pointed out by Okamoto Kohichi <GHG03305@nifty.ne.jp> and
URA Hiroshi <ura@hiru.aoba.yokohama.jp>.
 1.5 24-Mar-1999  minoura branches: 1.5.2; 1.5.8; 1.5.18;
Shut up gcc -Wall.
 1.4 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.3 12-Oct-1997  oki branches: 1.3.10;
Added prototypes.
 1.2 15-Jan-1997  perry branches: 1.2.8;
Eliminate obsolete TIMEZONE and DST options.
Eliminate obsolete global kernel variable "struct timezone tz"
Add RTC_OFFSET option
Add global kernel variable rtc_offset, which is initialized by
RTC_OFFSET at kernel compile time.
on i386, x68k, mac68k, pc532 and arm32, RTC_OFFSET indicates how many
minutes west (east) of GMT the hardware RTC runs. Defaults to 0.
Places where tz variable was used to indicate this in the past have
been replaced with rtc_offset.
Add sysctl interface to rtc_offset.
Kill obsolete DST_* macros in sys/time.h
gettimeofday now always returns zeroed timezone if zone is requested.
settimeofday now ignores and logs attempts to set non-existant kernel
timezone.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.2;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.2.1 18-Jan-1997  thorpej Update from trunk.
 1.2.8.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.10.2 27-Dec-1998  minoura Match device names.
 1.3.10.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.5.18.1 25-Jan-2001  jhawk Pull up revision 1.6 (requested by minoura):
Correct errant year 2001 bounds check.
 1.5.8.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.5.8.1 05-Jan-2001  bouyer Sync with HEAD
 1.5.2.1 21-Jan-2001  he Pull up revision 1.6 (requested by minoura):
Correct ``Year 2001 problem''.
 1.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.10.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.10.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.10.8.1 26-May-2001  nathanw file rtclock.c was added on branch nathanw_sa on 2002-06-20 03:42:32 +0000
 1.10.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.10.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.14.6.4 18-Dec-2004  skrll Sync with HEAD.
 1.14.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.6.1 03-Aug-2004  skrll Sync with HEAD
 1.16.2.1 29-Apr-2005  kent sync with -current
 1.17.8.2 03-Sep-2007  yamt sync with head.
 1.17.8.1 30-Dec-2006  yamt sync with head.
 1.18.20.1 18-Nov-2006  ad Sync with head.
 1.18.8.1 14-Sep-2006  yamt sync with head.
 1.19.10.1 13-Mar-2007  ad Sync with head.
 1.19.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.46.1 27-Jun-2008  simonb Sync with head.
 1.21.44.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.21.42.1 04-May-2009  yamt sync with head.
 1.21.38.2 17-Jan-2009  mjf Sync with HEAD.
 1.21.38.1 29-Jun-2008  mjf Sync with HEAD.
 1.22.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.28.1 18-May-2014  rmind sync with head
 1.23.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.23.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.12 21-Aug-2021  andvar s/helt/held+s/eroneously/erroneously/+s/splitted/split/+s/recommented/recommended/
 1.11 03-Jan-2009  isaki rtclockinit() and range_test*() were removed in rtclock.c,v 1.19.
 1.10 25-Jun-2008  isaki branches: 1.10.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.9 04-Mar-2007  isaki branches: 1.9.40; 1.9.44; 1.9.46; 1.9.48;
Delete old prototypes.
 1.8 14-Sep-2006  gdamore branches: 1.8.6;
Converted x68k to todr. Compile tested only, but it has a low probably
of breaking anything.
 1.7 11-Dec-2005  christos branches: 1.7.8; 1.7.20;
merge ktrace-lwp.
 1.6 18-Jan-2005  chs branches: 1.6.8;
de-__P, remove register, ansify.
 1.5 14-May-2002  matt branches: 1.5.10; 1.5.18;
Eliminate commons (including many used ones). Clean up variable references.
 1.4 15-Jan-2001  itohy branches: 1.4.4; 1.4.8;
Make it compile with "options DIAGNOSTIC" (patch from minoura).
 1.3 11-Jan-2001  minoura Use MI clock_subr.c.
 1.2 16-Mar-1999  minoura branches: 1.2.8;
Merged minoura_x68k_bus_h branch.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.24;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.24.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.2.8.1 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.4.8.1 20-Jun-2002  nathanw Catch up to -current.
 1.4.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.18.1 29-Apr-2005  kent sync with -current
 1.5.10.1 24-Jan-2005  skrll Sync with HEAD.
 1.6.8.2 03-Sep-2007  yamt sync with head.
 1.6.8.1 30-Dec-2006  yamt sync with head.
 1.7.20.1 18-Nov-2006  ad Sync with head.
 1.7.8.1 14-Sep-2006  yamt sync with head.
 1.8.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.48.1 27-Jun-2008  simonb Sync with head.
 1.9.46.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.9.44.1 04-May-2009  yamt sync with head.
 1.9.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.40.1 29-Jun-2008  mjf Sync with HEAD.
 1.10.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.22 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.21 24-Apr-2021  thorpej branches: 1.21.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.20 26-Mar-2014  christos branches: 1.20.44;
kill sprintf, fix unused.
 1.19 18-Dec-2008  isaki branches: 1.19.14; 1.19.24; 1.19.28;
Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.18 25-Jun-2008  isaki branches: 1.18.4;
Split device_t/softc. Use aprint*() and device_xname().
 1.17 04-May-2008  martin branches: 1.17.2; 1.17.4;
Move to standard TNF 2 clause license
 1.16 11-Mar-2007  isaki branches: 1.16.38; 1.16.40; 1.16.42;
white space, indent and KNF.
 1.15 11-Mar-2007  isaki Remove an extra white space.
 1.14 11-Dec-2005  christos branches: 1.14.26; 1.14.30;
merge ktrace-lwp.
 1.13 30-Jun-2005  drochner branches: 1.13.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.12 13-Jun-2005  he Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.11 18-Jan-2005  chs de-__P, remove register, ansify.
 1.10 15-Jul-2003  lukem branches: 1.10.8;
rcsid
 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 16-Jan-2000  minoura branches: 1.6.8; 1.6.12;
Minor cleanups & corrections.
 1.5 22-Apr-1999  minoura branches: 1.5.2;
I deleted a necessary line by mistake.
 1.4 22-Apr-1999  minoura Bus error occurred on such machines without the SCSI ROM.
Insert badaddr() check before read the ROM.
 1.3 24-Mar-1999  minoura branches: 1.3.2;
Shut up gcc -Wall.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 14-Mar-1999  minoura branches: 1.1.2;
file scsirom.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.1 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.3.2.2 22-Apr-1999  perry branches: 1.3.2.2.2;
pullup 1.4->1.5 (minoura)
 1.3.2.1 22-Apr-1999  perry pullup 1.3->1.4 (minoura)
 1.3.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.6.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.6.8.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.9.6.4 24-Jan-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.8.1 29-Apr-2005  kent sync with -current
 1.13.2.1 03-Sep-2007  yamt sync with head.
 1.14.30.1 13-Mar-2007  ad Sync with head.
 1.14.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.16.42.2 04-May-2009  yamt sync with head.
 1.16.42.1 16-May-2008  yamt sync with head.
 1.16.40.1 18-May-2008  yamt sync with head.
 1.16.38.3 17-Jan-2009  mjf Sync with HEAD.
 1.16.38.2 29-Jun-2008  mjf Sync with HEAD.
 1.16.38.1 02-Jun-2008  mjf Sync with HEAD.
 1.17.4.1 27-Jun-2008  simonb Sync with head.
 1.17.2.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.18.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.19.28.1 18-May-2014  rmind sync with head
 1.19.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.19.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.20.44.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.20.44.2 21-Mar-2021  thorpej CFARG_IATTR usage audit:

If a device carries only one interface attribute, there is no need
to specify it when calling config_search(); that specification is
meant only to disambiguate which interface attribute (which is a
proxy for "what kind of attach args are being used") is having
children attached. cfparent_match() will take care of ensuring that
any potential children can attach to one of the parent's iterface
attributes, and if the parent only carries one, no disambiguation is
necessary.
 1.20.44.1 20-Mar-2021  thorpej The proliferation if config_search_*() and config_found_*() combinations
is a little absurd, so begin to tidy this up:

- Introduce a new cfarg_t enumerated type, that defines the types of
tag-value variadic arguments that can be passed to the various
config_*() functions (CFARG_SUBMATCH, CFARG_IATTR, and CFARG_LOCATORS,
for now, plus a CFARG_EOL sentinel).
- Collapse config_search_*() into config_search() that takes these
variadic arguments.
- Convert all call sites of config_search_*() to the new signature.
Noticed several incorrect usages along the way, which will be
audited in a future commit.
 1.21.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.7 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.6 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.5 11-Dec-2005  christos branches: 1.5.74; 1.5.78; 1.5.80; 1.5.82;
merge ktrace-lwp.
 1.4 18-Jan-2005  chs de-__P, remove register, ansify.
 1.3 16-Jan-2000  minoura branches: 1.3.28; 1.3.36;
Minor cleanups & corrections.
 1.2 16-Mar-1999  minoura branches: 1.2.8;
Merged minoura_x68k_bus_h branch.
 1.1 14-Mar-1999  minoura branches: 1.1.2;
file scsiromvar.h was initially added on branch minoura_x68k_bus_h.
 1.1.2.1 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.2.8.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.3.36.1 29-Apr-2005  kent sync with -current
 1.3.28.1 24-Jan-2005  skrll Sync with HEAD.
 1.5.82.1 27-Jun-2008  simonb Sync with head.
 1.5.80.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.78.1 04-May-2009  yamt sync with head.
 1.5.74.1 29-Jun-2008  mjf Sync with HEAD.
 1.2 19-Oct-2002  isaki Not used anywhere.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.50;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.50.1 11-Nov-2002  nathanw Catch up to -current
 1.16 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.15 23-Apr-2016  skrll Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
 1.14 24-Jul-2010  isaki branches: 1.14.18; 1.14.34; 1.14.36; 1.14.40;
Probe not only Nereid Ctrl port but also SL811HS/T port.
 1.13 08-May-2010  isaki Correct rev1.11.
Fix panic reported by Yasushi Oshima.
 1.12 18-Dec-2008  isaki branches: 1.12.4; 1.12.6;
Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.11 23-May-2008  isaki branches: 1.11.6;
Catch up with device_t/device_xname changes on MI USB part.
 1.10 28-Apr-2008  martin branches: 1.10.2;
Remove clause 3 and 4 from TNF licenses
 1.9 17-Oct-2007  garbled branches: 1.9.16; 1.9.18; 1.9.20;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.8 15-Aug-2007  kiyohara branches: 1.8.2;
Replace to Matthew Orgass's slhci(4).
http://mail-index.netbsd.org/tech-kern/2007/06/26/0001.html
 1.7 11-Dec-2005  christos branches: 1.7.30; 1.7.38; 1.7.42; 1.7.46; 1.7.50;
merge ktrace-lwp.
 1.6 13-Jun-2005  he branches: 1.6.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.5 15-Jul-2003  lukem rcsid
 1.4 02-Oct-2002  thorpej branches: 1.4.6;
Add trailing ; to CFATTACH_DECL.
 1.3 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 11-Aug-2002  isaki branches: 1.1.2; 1.1.4; 1.1.6;
Add driver for ScanLogic SL811HS/T USB Host Controller.
XXX It's experimental code yet.

For x68k: USB part of Nereid USB/Ethernet/memory board
For ISA: ISA USB Host board from Morphy planning
 1.1.6.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 11-Aug-2002  jdolecek file slhci_intio.c was added on branch kqueue on 2002-09-06 08:42:41 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 11-Aug-2002  gehenna file slhci_intio.c was added on branch gehenna-devsw on 2002-08-31 14:52:54 +0000
 1.1.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 11-Aug-2002  nathanw file slhci_intio.c was added on branch nathanw_sa on 2002-08-13 02:19:09 +0000
 1.4.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.6.1 03-Aug-2004  skrll Sync with HEAD
 1.6.2.1 03-Sep-2007  yamt sync with head.
 1.7.50.1 16-Aug-2007  jmcneill Sync with HEAD.
 1.7.46.1 15-Aug-2007  skrll Sync with HEAD.
 1.7.42.1 22-May-2007  itohy Overhaul of USB stack, mostly DMA related

This applies to NetBSD 4.99.13 (March 1, 2007)

usbdi(9) interface is based on FreeBSD version, excluding
- removal of portability code

Patch most NetBSD changes, excluding
- DMA memory "reserve", since we don't need contiguous buffers any longer
- volatiles in DMA structure, since it should not be needed
with proper bus_dmamap_sync(9)s

DMA/non-DMA memory management overhaul
- Move all DMA related code to usb_mem.[ch]
(add usb_alloc_buffer_dma(), usb_free_buffer_dma(), etc.).
XXX Should usb_mem.[ch] be renamed as usb_mem_dma.[ch] ?
- Add corresponding non-DMA code to usb_mem_nodma.[ch] .
Currently just use malloc(9).
- Above files are conditionally used by config framework (added
attributes to conf/files and dev/usb/files.usb).
- Add diagnostic panics when resource allocation is requested
on interrupt context.
- Change memory allocations (that require context) from NOWAIT to WAITOK.

Allocate DMA/non-DMA buffer per host interface, not globally.
advantage: Buffers can be freed on detaching host interface.
Activity of a host interface does not affect others.
disadvantages: It possibly consumes more memory.

API changes
- usbd_alloc_xfer() is changed:
old: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev);
new: usbd_xfer_handle usbd_alloc_xfer(usbd_device_handle dev,
usbd_pipe_handle pipe);
- pipe argument of usbd_setup_*xfer() are now unused
XXX the pipe argument should be removed?
- add mapping APIs
- async request will be processed as a task (kernel thread context),
and delayed to some extent
- usbdivar.h: struct usbd_xfer: renamed a member "allocbuf" to "hcbuffer"
(mapped/allocated/refered buffer for HCI driver)
- usb_port.h: change usb_proc_ptr from struct ptoc * to struct lwp *
- usb_port.h: add usb_sigproc_ptr for psignal(9) (struct proc *)
- usb.h: add UE_MAXPKTSZ(ep) and UE_MAXPKTSZ_MASK macros for USB 2.0

changes to USB device drivers
- atu, aue, axe, cdce, cue, kue, rum, udav, upl, ural, url,
uaudio, ubt, ucom, ugen, uhidev, uirda, ulpt, umidi, urio,
uscanner, ustir, utoppy:
* catch up API change of usbd_alloc_xfer()
- umass, usscanner:
* catch up API change of usbd_alloc_xfer()
* eliminate memory copy for large transfer

ohci
- free resources on detach
- add lots of bus_dmamap_sync() operations
- simplify the code of loading std chain
- rewrite code of looking up TD/ITD from DMA addr by using allocation chunk
- add workaround for CMD Tech 670 and 673 chipsets
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

slhci
- allocate xfer and slhci_xfer at once, and simplify relevant code
- add slhci_detach()
- remove second arg of slhci_attach() since it is the same as the first arg.
- add support for "mapping" (no, it doesn't map since it doesn't do DMA)
buffer and mbuf
- add pcmcia frontend
- NOT TESTED, missing hardware

ehci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf
- done only simple test

uhci
- add lots of bus_dmamap_sync() operations, possibly too many
- make sure resources are not allocated in interrupt context
- add support for mapping buffer and mbuf

To do
- review, test, debug
- rewrite network drivers to utilize usbd_map_buffer_mbuf()
- rewrite uaudio(4) to eliminate memcpy
- "pipe" argument of usbd_setup_*xfer() should eventually be removed
 1.7.38.1 03-Oct-2007  garbled Sync with HEAD
 1.7.30.1 20-Aug-2007  ad Sync with HEAD.
 1.8.2.1 06-Nov-2007  matt sync with HEAD
 1.9.20.3 11-Aug-2010  yamt sync with head.
 1.9.20.2 04-May-2009  yamt sync with head.
 1.9.20.1 16-May-2008  yamt sync with head.
 1.9.18.2 04-Jun-2008  yamt sync with head
 1.9.18.1 18-May-2008  yamt sync with head.
 1.9.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.9.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.10.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.11.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.12.6.2 05-Mar-2011  rmind sync with head
 1.12.6.1 30-May-2010  rmind sync with head
 1.12.4.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.14.40.1 06-Sep-2016  skrll First pass at netbsd-7 updated with USB code from HEAD
 1.14.36.1 03-Dec-2014  skrll The grand renaming of structure members.

No functional change.
 1.14.34.1 05-Apr-2017  snj Pull up following revision(s) (requested by skrll in ticket #1395):
share/man/man4/axe.4: netbsd-7-nhusb
share/man/man4/axen.4: netbsd-7-nhusb
share/man/man4/cdce.4: netbsd-7-nhusb
share/man/man4/uaudio.4: netbsd-7-nhusb
share/man/man4/ucom.4: netbsd-7-nhusb
share/man/man4/uep.4: netbsd-7-nhusb
share/man/man4/urtw.4: netbsd-7-nhusb
share/man/man4/usb.4: netbsd-7-nhusb
share/man/man4/uyap.4: netbsd-7-nhusb
share/man/man4/xhci.4: netbsd-7-nhusb
share/man/man9/usbdi.9: netbsd-7-nhusb
sys/arch/amd64/conf/ALL: netbsd-7-nhusb
sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
sys/arch/i386/conf/ALL: netbsd-7-nhusb
sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
sys/conf/files: netbsd-7-nhusb
sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
sys/dev/ic/sl811hs.c: netbsd-7-nhusb
sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
sys/dev/usb/TODO: netbsd-7-nhusb
sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
sys/dev/usb/auvitek.c: netbsd-7-nhusb
sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
sys/dev/usb/ehci.c: netbsd-7-nhusb
sys/dev/usb/ehcireg.h: netbsd-7-nhusb
sys/dev/usb/ehcivar.h: netbsd-7-nhusb
sys/dev/usb/emdtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
sys/dev/usb/ezload.c: netbsd-7-nhusb
sys/dev/usb/ezload.h: netbsd-7-nhusb
sys/dev/usb/files.usb: netbsd-7-nhusb
sys/dev/usb/hid.c: netbsd-7-nhusb
sys/dev/usb/hid.h: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
sys/dev/usb/if_atu.c: netbsd-7-nhusb
sys/dev/usb/if_atureg.h: netbsd-7-nhusb
sys/dev/usb/if_aue.c: netbsd-7-nhusb
sys/dev/usb/if_auereg.h: netbsd-7-nhusb
sys/dev/usb/if_axe.c: netbsd-7-nhusb
sys/dev/usb/if_axen.c: netbsd-7-nhusb
sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
sys/dev/usb/if_axereg.h: netbsd-7-nhusb
sys/dev/usb/if_cdce.c: netbsd-7-nhusb
sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
sys/dev/usb/if_cue.c: netbsd-7-nhusb
sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
sys/dev/usb/if_kue.c: netbsd-7-nhusb
sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
sys/dev/usb/if_otus.c: netbsd-7-nhusb
sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
sys/dev/usb/if_rum.c: netbsd-7-nhusb
sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
sys/dev/usb/if_run.c: netbsd-7-nhusb
sys/dev/usb/if_runvar.h: netbsd-7-nhusb
sys/dev/usb/if_smsc.c: netbsd-7-nhusb
sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
sys/dev/usb/if_udav.c: netbsd-7-nhusb
sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
sys/dev/usb/if_upgt.c: netbsd-7-nhusb
sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
sys/dev/usb/if_upl.c: netbsd-7-nhusb
sys/dev/usb/if_ural.c: netbsd-7-nhusb
sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
sys/dev/usb/if_url.c: netbsd-7-nhusb
sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
sys/dev/usb/if_urndis.c: netbsd-7-nhusb
sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtw.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
sys/dev/usb/if_zyd.c: netbsd-7-nhusb
sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
sys/dev/usb/irmce.c: netbsd-7-nhusb
sys/dev/usb/moscom.c: netbsd-7-nhusb
sys/dev/usb/motg.c: netbsd-7-nhusb
sys/dev/usb/motgvar.h: netbsd-7-nhusb
sys/dev/usb/ohci.c: netbsd-7-nhusb
sys/dev/usb/ohcireg.h: netbsd-7-nhusb
sys/dev/usb/ohcivar.h: netbsd-7-nhusb
sys/dev/usb/pseye.c: netbsd-7-nhusb
sys/dev/usb/slurm.c: netbsd-7-nhusb
sys/dev/usb/stuirda.c: netbsd-7-nhusb
sys/dev/usb/u3g.c: netbsd-7-nhusb
sys/dev/usb/uark.c: netbsd-7-nhusb
sys/dev/usb/uatp.c: netbsd-7-nhusb
sys/dev/usb/uaudio.c: netbsd-7-nhusb
sys/dev/usb/uberry.c: netbsd-7-nhusb
sys/dev/usb/ubsa.c: netbsd-7-nhusb
sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
sys/dev/usb/ubsavar.h: netbsd-7-nhusb
sys/dev/usb/ubt.c: netbsd-7-nhusb
sys/dev/usb/uchcom.c: netbsd-7-nhusb
sys/dev/usb/ucom.c: netbsd-7-nhusb
sys/dev/usb/ucomvar.h: netbsd-7-nhusb
sys/dev/usb/ucycom.c: netbsd-7-nhusb
sys/dev/usb/udl.c: netbsd-7-nhusb
sys/dev/usb/udl.h: netbsd-7-nhusb
sys/dev/usb/udsbr.c: netbsd-7-nhusb
sys/dev/usb/udsir.c: netbsd-7-nhusb
sys/dev/usb/uep.c: netbsd-7-nhusb
sys/dev/usb/uftdi.c: netbsd-7-nhusb
sys/dev/usb/uftdireg.h: netbsd-7-nhusb
sys/dev/usb/ugen.c: netbsd-7-nhusb
sys/dev/usb/ugensa.c: netbsd-7-nhusb
sys/dev/usb/uhci.c: netbsd-7-nhusb
sys/dev/usb/uhcireg.h: netbsd-7-nhusb
sys/dev/usb/uhcivar.h: netbsd-7-nhusb
sys/dev/usb/uhid.c: netbsd-7-nhusb
sys/dev/usb/uhidev.c: netbsd-7-nhusb
sys/dev/usb/uhidev.h: netbsd-7-nhusb
sys/dev/usb/uhmodem.c: netbsd-7-nhusb
sys/dev/usb/uhso.c: netbsd-7-nhusb
sys/dev/usb/uhub.c: netbsd-7-nhusb
sys/dev/usb/uipad.c: netbsd-7-nhusb
sys/dev/usb/uipaq.c: netbsd-7-nhusb
sys/dev/usb/uirda.c: netbsd-7-nhusb
sys/dev/usb/uirdavar.h: netbsd-7-nhusb
sys/dev/usb/ukbd.c: netbsd-7-nhusb
sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.c: netbsd-7-nhusb
sys/dev/usb/ukyopon.h: netbsd-7-nhusb
sys/dev/usb/ulpt.c: netbsd-7-nhusb
sys/dev/usb/umass.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
sys/dev/usb/umassvar.h: netbsd-7-nhusb
sys/dev/usb/umcs.c: netbsd-7-nhusb
sys/dev/usb/umct.c: netbsd-7-nhusb
sys/dev/usb/umidi.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
sys/dev/usb/umodem.c: netbsd-7-nhusb
sys/dev/usb/umodem_common.c: netbsd-7-nhusb
sys/dev/usb/umodemvar.h: netbsd-7-nhusb
sys/dev/usb/ums.c: netbsd-7-nhusb
sys/dev/usb/uplcom.c: netbsd-7-nhusb
sys/dev/usb/urio.c: netbsd-7-nhusb
sys/dev/usb/urio.h: netbsd-7-nhusb
sys/dev/usb/usb.c: netbsd-7-nhusb
sys/dev/usb/usb.h: netbsd-7-nhusb
sys/dev/usb/usb_mem.c: netbsd-7-nhusb
sys/dev/usb/usb_mem.h: netbsd-7-nhusb
sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
sys/dev/usb/usb_subr.c: netbsd-7-nhusb
sys/dev/usb/usbdevices.config: netbsd-7-nhusb
sys/dev/usb/usbdevs: netbsd-7-nhusb
sys/dev/usb/usbdevs.h: netbsd-7-nhusb
sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
sys/dev/usb/usbdi.c: netbsd-7-nhusb
sys/dev/usb/usbdi.h: netbsd-7-nhusb
sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
sys/dev/usb/usbdivar.h: netbsd-7-nhusb
sys/dev/usb/usbhid.h: netbsd-7-nhusb
sys/dev/usb/usbhist.h: netbsd-7-nhusb
sys/dev/usb/usbroothub.c: netbsd-7-nhusb
sys/dev/usb/usbroothub.h: netbsd-7-nhusb
sys/dev/usb/usbroothub_subr.c: delete
sys/dev/usb/usbroothub_subr.h: delete
sys/dev/usb/uscanner.c: netbsd-7-nhusb
sys/dev/usb/uslsa.c: netbsd-7-nhusb
sys/dev/usb/usscanner.c: netbsd-7-nhusb
sys/dev/usb/ustir.c: netbsd-7-nhusb
sys/dev/usb/uthum.c: netbsd-7-nhusb
sys/dev/usb/utoppy.c: netbsd-7-nhusb
sys/dev/usb/uts.c: netbsd-7-nhusb
sys/dev/usb/uvideo.c: netbsd-7-nhusb
sys/dev/usb/uvisor.c: netbsd-7-nhusb
sys/dev/usb/uvscom.c: netbsd-7-nhusb
sys/dev/usb/uyap.c: netbsd-7-nhusb
sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
sys/dev/usb/uyurex.c: netbsd-7-nhusb
sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
sys/dev/usb/xhci.c: netbsd-7-nhusb
sys/dev/usb/xhcireg.h: netbsd-7-nhusb
sys/dev/usb/xhcivar.h: netbsd-7-nhusb
sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
sys/external/bsd/drm2/include/linux/err.h: delete
sys/external/bsd/drm2/include/linux/workqueue.h: delete
sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
sys/external/bsd/drm2/linux/linux_work.c: delete
sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
sys/sys/mbuf.h: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
- kern/48308
- uhub status notification improvements
- umass(4) probe fix (applied to HEAD already)
- ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
This gives the callback a chance of running when another softint handler
at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
the network stack.
- kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
softnet_lock held across usb xfr
- kern/50491 - unkillable wait in usbd_transfer while using usmsc0
on raspberry pi 2
- kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)
 1.14.18.1 03-Dec-2017  jdolecek update from HEAD
 1.2 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.1 11-Aug-2002  isaki branches: 1.1.2; 1.1.4; 1.1.6; 1.1.114; 1.1.116; 1.1.118;
Add driver for ScanLogic SL811HS/T USB Host Controller.
XXX It's experimental code yet.

For x68k: USB part of Nereid USB/Ethernet/memory board
For ISA: ISA USB Host board from Morphy planning
 1.1.118.1 16-May-2008  yamt sync with head.
 1.1.116.1 18-May-2008  yamt sync with head.
 1.1.114.1 02-Jun-2008  mjf Sync with HEAD.
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 11-Aug-2002  jdolecek file slhci_intio_var.h was added on branch kqueue on 2002-09-06 08:42:42 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 11-Aug-2002  gehenna file slhci_intio_var.h was added on branch gehenna-devsw on 2002-08-31 14:52:54 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 11-Aug-2002  nathanw file slhci_intio_var.h was added on branch nathanw_sa on 2002-08-13 02:19:10 +0000
 1.35 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.34 28-Apr-2008  martin branches: 1.34.8;
Remove clause 3 and 4 from TNF licenses
 1.33 31-Mar-2008  tsutsui branches: 1.33.2; 1.33.4;
Split softc/device_t for spc(4) and misc related cleanup.
 1.32 11-Mar-2007  isaki branches: 1.32.38;
white space, indent and KNF.
 1.31 11-Mar-2007  isaki Remove an extra white space.
 1.30 23-Feb-2006  thorpej branches: 1.30.20; 1.30.24;
Use device_parent().
 1.29 11-Dec-2005  christos branches: 1.29.2; 1.29.4; 1.29.6;
merge ktrace-lwp.
 1.28 13-Jun-2005  he branches: 1.28.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.27 18-Jan-2005  chs de-__P, remove register, ansify.
 1.26 15-Jul-2003  lukem branches: 1.26.8;
rcsid
 1.25 05-Jul-2003  tsutsui Rename some MI mb89352 functions for consistency:
spcintr() -> spc_intr()
spcattach() -> spc_attach()
 1.24 02-Oct-2002  thorpej branches: 1.24.6;
Add trailing ; to CFATTACH_DECL.
 1.23 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.22 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.21 24-Mar-1999  minoura branches: 1.21.22; 1.21.26;
Shut up gcc -Wall.
 1.20 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.19 05-Dec-1998  mjacob branches: 1.19.4;
Update HBAs to incorporate the new max_lun property.
 1.18 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.17 10-Oct-1998  thorpej Garbage-collect the open_target_lu and close_target_lu entry points from
struct scsipi_adapter; they were not used.

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

Inspired by PR #6090, from Matt Jacob.
 1.16 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.15 04-Jul-1998  jonathan defopt DDB.
 1.14 30-Jun-1998  msaitoh sync with -current after a long silence
 1.13 12-Jan-1998  thorpej Update for changes to config.
 1.12 19-Oct-1997  oki branches: 1.12.2;
Test device is configured in interrput handler.
 1.11 09-Oct-1997  oki Added missing prototype.
 1.10 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.9 10-Dec-1996  thorpej branches: 1.9.8; 1.9.10;
Fill in sc_link.max_target
 1.8 13-Oct-1996  christos backout previous kprintf change
 1.7 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.6 08-Sep-1996  oki delete unused prototype.
 1.5 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.4 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.3 12-Jun-1996  oki fixed sometimes hang up bug at boot time.
 1.2 21-May-1996  oki branches: 1.2.2;
Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.2.1 12-Jun-1996  oki from trunk: fixed sometimes hang up bug at boot time.
 1.9.10.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.10.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.8.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.12.2.1 13-Oct-1998  cgd pull up rev 1.14 from trunk (via patch). (minoura)
 1.19.4.4 14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.19.4.3 12-Mar-1999  minoura Call spc_find from attach routine.
 1.19.4.2 13-Feb-1999  minoura Use MI version of SPC driver.
 1.19.4.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.21.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.21.22.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.24.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.24.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.6.1 03-Aug-2004  skrll Sync with HEAD
 1.26.8.1 29-Apr-2005  kent sync with -current
 1.28.2.2 03-Sep-2007  yamt sync with head.
 1.28.2.1 21-Jun-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.29.2.1 01-Mar-2006  yamt sync with head.
 1.30.24.1 13-Mar-2007  ad Sync with head.
 1.30.20.1 12-Mar-2007  rmind Sync with HEAD.
 1.32.38.3 17-Jan-2009  mjf Sync with HEAD.
 1.32.38.2 02-Jun-2008  mjf Sync with HEAD.
 1.32.38.1 03-Apr-2008  mjf Sync with HEAD.
 1.33.4.2 04-May-2009  yamt sync with head.
 1.33.4.1 16-May-2008  yamt sync with head.
 1.33.2.1 18-May-2008  yamt sync with head.
 1.34.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.23 27-Jan-2025  andvar s/probeing/probing/ in comments.
 1.22 07-Jan-2024  isaki branches: 1.22.2;
TAB/space/indent cleanup.
 1.21 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.20 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.19 16-Mar-2014  dholland branches: 1.19.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.18 21-Dec-2008  isaki branches: 1.18.14; 1.18.24; 1.18.28;
Make sram(4) a hardware device.
# I wrote this in 2001 :-)
 1.17 14-Dec-2008  isaki Use intio_set_*() macros to purge macros by the name of sysport, ioctlr.
 1.16 11-Mar-2007  isaki branches: 1.16.38; 1.16.42; 1.16.50;
white space, indent and KNF.
 1.15 11-Mar-2007  isaki Remove an extra white space.
 1.14 04-Mar-2007  christos branches: 1.14.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.13 29-Oct-2006  he branches: 1.13.4;
Work around the propagation of volatile-ness from struct to struct members.

OK'ed by nsmrtks.
 1.12 11-Dec-2005  christos branches: 1.12.20; 1.12.22;
merge ktrace-lwp.
 1.11 18-Jan-2005  chs branches: 1.11.8;
de-__P, remove register, ansify.
 1.10 15-Jul-2003  lukem branches: 1.10.8;
rcsid
 1.9 23-Oct-2002  jdolecek branches: 1.9.6;
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 27-Dec-2001  wiz branches: 1.7.8;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.6 15-Jun-1999  minoura branches: 1.6.14; 1.6.16; 1.6.20;
Check file open mode at ioctl.
Add debug option SRAM_DEBUG_DONTDOIT.
 1.5 10-Oct-1997  oki branches: 1.5.12; 1.5.14; 1.5.16;
Add prototypes.
 1.4 13-Oct-1996  christos branches: 1.4.10;
backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 12-May-1996  oki fixed for gcc -Wall warning.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.4.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5.16.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.5.14.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.12.1 24-Jun-1999  perry pullup 1.5->1.6 (minoura)
 1.6.20.3 11-Nov-2002  nathanw Catch up to -current
 1.6.20.2 17-Sep-2002  nathanw Catch up to -current.
 1.6.20.1 08-Jan-2002  nathanw Catch up to -current.
 1.6.16.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.16.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.6.14.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.7.8.2 08-Jun-2002  gehenna fix compiler warning.
 1.7.8.1 17-May-2002  gehenna Add device switch.
 1.9.6.5 04-Feb-2005  skrll Adapt to branch.
 1.9.6.4 24-Jan-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.8.1 29-Apr-2005  kent sync with -current
 1.11.8.3 03-Sep-2007  yamt sync with head.
 1.11.8.2 30-Dec-2006  yamt sync with head.
 1.11.8.1 21-Jun-2006  yamt sync with head.
 1.12.22.1 10-Dec-2006  yamt sync with head.
 1.12.20.1 18-Nov-2006  ad Sync with head.
 1.13.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.14.2.1 13-Mar-2007  ad Sync with head.
 1.16.50.1 19-Jan-2009  skrll Sync with HEAD.
 1.16.42.1 04-May-2009  yamt sync with head.
 1.16.38.1 17-Jan-2009  mjf Sync with HEAD.
 1.18.28.1 18-May-2014  rmind sync with head
 1.18.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.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.19.2.1 10-Aug-2014  tls Rebase.
 1.22.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 21-Dec-2008  isaki Make sram(4) a hardware device.
# I wrote this in 2001 :-)
 1.2 23-Jun-1999  minoura branches: 1.2.138; 1.2.142; 1.2.150;
I forgot to commit this.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.26; 1.1.1.1.28; 1.1.1.1.30;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.30.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.1.1.1.28.1 01-Jul-1999  thorpej Sync w/ -current.
 1.1.1.1.26.1 24-Jun-1999  perry pullup 1.1->1.2 (minoura)
 1.2.150.1 19-Jan-2009  skrll Sync with HEAD.
 1.2.142.1 04-May-2009  yamt sync with head.
 1.2.138.1 17-Jan-2009  mjf Sync with HEAD.
 1.56 26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.55 21-Aug-2021  andvar s/recoding/recording/ in comments where it didn't actually mean recoding.
 1.54 06-Feb-2021  isaki Remove an unused variable.
 1.53 06-Feb-2021  isaki Remove sc_active flag. sc_[pr]intr can be used instead of it.
 1.52 08-Jun-2019  isaki branches: 1.52.10;
Clean get_props().
- Make get_props() return AUDIO_PROP_{PLAYBACK,CAPTURE} properly.
This eliminates need for audio.c to take care of such (old)
drivers which don't return both of PLAYBACK and CAPTURE.
- All get_props() doesn't need to return AUDIO_PROP_MMAP.
It is handled in the audio layer now.
 1.51 08-May-2019  isaki Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.50 16-Mar-2019  isaki branches: 1.50.2;
Use C99 style struct initializer to audio_hw_if.
 1.49 30-Sep-2017  isaki branches: 1.49.4;
Avoid magic numbers and give appropriate names.
 1.48 02-Sep-2017  isaki - Finally MI audio supports 4bit precision format without null_filter hack!
- Fix reusing play/rec argument as local variables. It is in/out parameter.
 1.47 02-Sep-2017  isaki - Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method. trigger method is not suitable for
x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running. This solves the noise.
From Y.Sugahara.
- Cache dmac xfer.
 1.46 11-Aug-2017  isaki Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
 1.45 11-Aug-2017  isaki Use dmac_prepare_xfer().
From Y.Sugahara.
 1.44 05-Aug-2017  isaki Merge prate and rrate. These can not be separated.
 1.43 05-Aug-2017  isaki vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me. So vs(4) uses local conversion to/from
ADPCM instead of it. But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
 1.42 05-Aug-2017  isaki Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).
 1.41 31-Jul-2017  isaki Update confused vs_set_params().
play and rec are identical but pfil and rfil are independent.
XXX I introduce VS_USE_PREC8 option for debugging purposes
temporarily. I'll remove it if the problem is solved.
 1.40 29-Jul-2017  nat Audio vchan auto config works again due to the use of a null_filter.

Tested and confirmed working by isaki@.
 1.39 09-Jul-2017  isaki Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary. The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.

For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.
 1.38 25-Jun-2017  isaki Avoid panic when the device is closed when not playing.
 1.37 01-Jun-2017  chs branches: 1.37.2;
remove checks for failure after memory allocation calls that cannot fail:

kmem_alloc() with KM_SLEEP
kmem_zalloc() with KM_SLEEP
percpu_alloc()
pserialize_create()
psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.
 1.36 26-Mar-2014  christos branches: 1.36.6;
kill sprintf, fix unused.
 1.35 23-Nov-2011  jmcneill branches: 1.35.8; 1.35.12;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

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

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

Welcome to 5.99.57.
 1.34 16-Oct-2011  isaki branches: 1.34.2; 1.34.4;
Switch to 2-clause license.
 1.33 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.32 11-Mar-2007  isaki branches: 1.32.38; 1.32.42; 1.32.44; 1.32.46;
white space, indent and KNF.
 1.31 04-Mar-2007  christos branches: 1.31.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.30 11-Dec-2005  christos branches: 1.30.26;
merge ktrace-lwp.
 1.29 13-Jun-2005  he branches: 1.29.2;
Make this build with -Wcast-qual by adding a few consts.
 1.28 15-Jan-2005  kent ansify and KNF
 1.27 10-Jan-2005  kent merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

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

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

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

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

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

* all of audio HW drivers follow audio_hw_if and ac97 changes
 1.26 13-Dec-2004  chs for drivers that support only one instance, use a global variable to ensure
that only one instance is configured rather than requiring that its
unit number be zero.
 1.25 29-Oct-2004  yamt branches: 1.25.2;
constify audio_hw_if, midi_hw_if, and radio_hw_if.
 1.24 08-May-2004  minoura An unexported header file was #included from an exported header file.
Introduce <machine/opmreg.h> and move some definitions useful to
userland progs.
 1.23 07-Sep-2003  isaki Remove an advertising clause.
 1.22 15-Jul-2003  lukem rcsid
 1.21 01-Feb-2003  thorpej branches: 1.21.2;
Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant. Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
 1.20 24-Nov-2002  isaki Fix typo. s/cfdata/cfdriver/
 1.19 13-Oct-2002  isaki Style fixes.
 1.18 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.17 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.16 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.15 07-Apr-2002  isaki Support slinear8, slinear16_le, slinear16_be.
 1.14 02-Apr-2002  isaki initialize codec variables every open().
 1.13 26-Mar-2002  isaki set factor=1/2 even if recording.
 1.12 16-Mar-2002  isaki Fix mis-increment bug in converter msm6258_ulinear8_to_adpcm().
This fix needs factor_denom.
 1.11 25-Nov-2001  minoura Remove unused variables.
Correct printf format strings.
 1.10 13-Nov-2001  isaki Rewrite vs_query_encoding() using array.
 1.9 13-Nov-2001  isaki Clean up debug messages. Separate it two debug levels.
 1.8 03-Oct-2001  augustss branches: 1.8.4;
Add a new optional method, dev_ioctl, to the audio hardware driver interface.
It is called when an unrecognized ioctl() is performed on a device,
thus allowing ioctl()s that frob the hardware driver (like loading
microcode).
 1.7 28-May-2001  minoura branches: 1.7.2; 1.7.4; 1.7.6;
Cleanup. Addresses port-x68k/13051.
 1.6 27-May-2001  minoura Add missing line in recording. Copy & paste error...
 1.5 22-May-2001  minoura Correct ring buffer handling in recording. From Isaki-san.
 1.4 15-May-2001  minoura Missings from the previous commit.
From Izaki-san.
 1.3 07-May-2001  minoura Encoding ulinear and mulaw are both software emulated.
From Isaki-san.
 1.2 03-May-2001  minoura Correct playing mu-law and linear.
 1.1 02-May-2001  minoura X68k built-in voice synthesizer.
 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.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.7.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.7.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.7.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.8.4.6 11-Dec-2002  thorpej Sync with HEAD.
 1.8.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.8.4.4 17-Apr-2002  nathanw Catch up to -current.
 1.8.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.8.4.1 03-Oct-2001  nathanw file vs.c was added on branch nathanw_sa on 2002-01-08 00:28:42 +0000
 1.21.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.21.2.5 18-Dec-2004  skrll Sync with HEAD.
 1.21.2.4 02-Nov-2004  skrll Sync with HEAD.
 1.21.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.2.1 03-Jan-2005  kent adopt the filter pipeline framework
 1.29.2.1 03-Sep-2007  yamt sync with head.
 1.30.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.31.2.1 13-Mar-2007  ad Sync with head.
 1.32.46.1 27-Jun-2008  simonb Sync with head.
 1.32.44.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.42.1 04-May-2009  yamt sync with head.
 1.32.38.1 29-Jun-2008  mjf Sync with HEAD.
 1.34.4.2 22-Nov-2011  jmcneill get rid of unused 'powerstate' callback in audio_hw_if
 1.34.4.1 20-Nov-2011  jmcneill adapt to audiomp api changes
 1.34.2.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.34.2.1 17-Apr-2012  yamt sync with head
 1.35.12.1 18-May-2014  rmind sync with head
 1.35.8.2 03-Dec-2017  jdolecek update from HEAD
 1.35.8.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.6.1 28-Aug-2017  skrll Sync with HEAD
 1.37.2.2 23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #172):
sys/arch/x68k/dev/vs.c: 1.38-1.39, 1.41-1.44, 1.47-1.48 via patch
sys/arch/x68k/dev/vsvar.h: 1.12-1.15 via patch
Avoid panic when the device is closed when not playing.
Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary. The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.
For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.
Update confused vs_set_params().
play and rec are identical but pfil and rfil are independent.
XXX I introduce VS_USE_PREC8 option for debugging purposes
temporarily. I'll remove it if the problem is solved.
Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).
vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me. So vs(4) uses local conversion to/from
ADPCM instead of it. But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
Merge prate and rrate. These can not be separated.
- Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method. trigger method is not suitable for
x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running. This solves the noise.
From Y.Sugahara.
- Cache dmac xfer.
- Finally MI audio supports 4bit precision format without null_filter hack!
- Fix reusing play/rec argument as local variables. It is in/out parameter.
 1.37.2.1 23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #290):
sys/arch/x68k/dev/dmacvar.h: revision 1.11-1.12 via patch
sys/arch/x68k/dev/intio_dmac.c: revision 1.36-1.37 via patch
sys/arch/x68k/dev/fd.c: revision 1.120 via patch
sys/arch/x68k/dev/vs.c: revision 1.45-1.46 via patch
Use dmac_prepare_xfer().
From Y.Sugahara.
--
Allow dmac_alloc_channel() to specify DCR and OCR.
FDC uses 'Cycle Steal Mode with Hold' but ADPCM
should use 'Cycle Steal Mode without Hold' on x68k.
From Y.Suhagara and it was found by XM6i.
--
Fix a Continue Operation.
Patch from Y.Sugahara.
 1.49.4.1 10-Jun-2019  christos Sync with HEAD
 1.50.2.2 04-May-2019  isaki Move dev/audio_if.h -> dev/audio/audio_if.h
 1.50.2.1 21-Apr-2019  isaki Adapt to audio2.
 1.52.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.20 07-Jan-2024  isaki TAB/space/indent cleanup.
 1.19 06-Feb-2021  isaki Remove an unused variable.
 1.18 06-Feb-2021  isaki Remove sc_active flag. sc_[pr]intr can be used instead of it.
 1.17 08-May-2019  isaki branches: 1.17.10;
Merge isaki-audio2 branch, the overhaul of audio subsystem.
- Interrupt-oriented system rather than thread-oriented.
- Improve stability, quality and performance.
- Split playback and record cleanly. Improve halfduplex support.
- Many bugs are fixed including deadlocks, resource leaks, abuses, etc.
- Simplify audio filter mechanism. The encoding/channels/frequency
conversions are completely handled in the upper layer. So the hard-
ware driver only converts its hardware encoding (if necessary).
- audio_hw_if changes:
- Obsoletes query_encoding and add query_format instead.
- Obsoletes set_params and add set_format instead.
- Remove drain, setfd, mappage.
- The call sequences are changed.
- ioctl AUDIO_GETFD/SETFD, AUDIO_GETCHAN/SETCHAN are obsoleted.
- ioctl AUDIO_{QUERY,GET,SET}FORMAT are introduced.
- cleanup config attributes: au*conv and mulaw.
- All hardware drivers should follow it (I've done as much as possible).

Some file paths are changed:
- dev/audio.c -> dev/audio/audio.c (rewritten)
- dev/audiovar.h -> dev/audio/audiovar.h
- dev/audio_dai.h -> dev/audio/audio_dai.h
- dev/audio_if.h -> dev/audio/audio_if.h
- dev/audiobell.c -> dev/audio/audiobell.c
- dev/audiobellvar.h -> dev/audio/audiobellvar.h
- dev/mulaw.[ch] -> dev/audio/mulaw.[ch] + dev/audio/alaw.c
 1.16 30-Sep-2017  isaki branches: 1.16.4; 1.16.6;
Avoid magic numbers and give appropriate names.
 1.15 02-Sep-2017  isaki - Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method. trigger method is not suitable for
x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running. This solves the noise.
From Y.Sugahara.
- Cache dmac xfer.
 1.14 05-Aug-2017  isaki Merge prate and rrate. These can not be separated.
 1.13 05-Aug-2017  isaki vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me. So vs(4) uses local conversion to/from
ADPCM instead of it. But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
 1.12 25-Jun-2017  isaki Avoid panic when the device is closed when not playing.
 1.11 23-Nov-2011  jmcneill branches: 1.11.8; 1.11.26; 1.11.42;
Merge jmcneill-audiomp3 branch, which is derived from ad-audiomp2. From
the original ad-audiomp branch notes:

Add MP locking to the audio drivers.

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

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

Welcome to 5.99.57.
 1.10 16-Oct-2011  isaki branches: 1.10.2; 1.10.4;
Switch to 2-clause license.
 1.9 25-Jun-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
 1.8 04-Mar-2007  christos branches: 1.8.40; 1.8.44; 1.8.46; 1.8.48;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.7 11-Dec-2005  christos branches: 1.7.26; 1.7.28;
merge ktrace-lwp.
 1.6 15-Jan-2005  kent branches: 1.6.10;
ansify and KNF
 1.5 10-Jan-2005  kent merge kent-audio1 branch, which introduces audio filter pipeline to the MI
audio framework


Summary of changes:

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

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

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

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

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

* all of audio HW drivers follow audio_hw_if and ac97 changes
 1.4 31-Oct-2004  he branches: 1.4.2;
Follow up on the constification of audio_hw_if, to fix build
problem for vs.c.
 1.3 07-Sep-2003  isaki Remove an advertising clause.
 1.2 03-May-2001  minoura branches: 1.2.2; 1.2.10; 1.2.26;
Correct playing mu-law and linear.
 1.1 02-May-2001  minoura X68k built-in voice synthesizer.
 1.2.26.5 17-Jan-2005  skrll Sync with HEAD.
 1.2.26.4 02-Nov-2004  skrll Sync with HEAD.
 1.2.26.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.26.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.26.1 03-Aug-2004  skrll Sync with HEAD
 1.2.10.2 03-May-2001  minoura Correct playing mu-law and linear.
 1.2.10.1 03-May-2001  minoura file vsvar.h was added on branch nathanw_sa on 2001-05-03 02:09:13 +0000
 1.2.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.2.1 03-Jan-2005  kent adopt the filter pipeline framework
 1.6.10.1 03-Sep-2007  yamt sync with head.
 1.7.28.1 27-Feb-2007  ad Add MP locking for audio drivers.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.48.1 27-Jun-2008  simonb Sync with head.
 1.8.46.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.8.44.1 04-May-2009  yamt sync with head.
 1.8.40.1 29-Jun-2008  mjf Sync with HEAD.
 1.10.4.1 20-Nov-2011  jmcneill adapt to audiomp api changes
 1.10.2.1 17-Apr-2012  yamt sync with head
 1.11.42.1 23-Sep-2017  snj Pull up following revision(s) (requested by isaki in ticket #172):
sys/arch/x68k/dev/vs.c: 1.38-1.39, 1.41-1.44, 1.47-1.48 via patch
sys/arch/x68k/dev/vsvar.h: 1.12-1.15 via patch
Avoid panic when the device is closed when not playing.
Catch up vs_set_params() to recent MI audio (after in-kernel mixer).
Before that, MD part had to support all encodings I'd like to support,
but currently it's no longer necessary. The hardware is
4bit/1ch/15.6kHz ADPCM but it behaves as 16bit/1ch/16.0kHz PCM.
For audio.c < 1.362, the device attach succeeded and playback is
still working.
For audio.c >= 1.363, the device attach fails again.
It does not work yet but I commit it for milestone.
Update confused vs_set_params().
play and rec are identical but pfil and rfil are independent.
XXX I introduce VS_USE_PREC8 option for debugging purposes
temporarily. I'll remove it if the problem is solved.
Remove temporary VS_USE_PREC8 option.
vs(4) now supports slinear16be and slinear8 (but now work yet).
vs(4) became to able to play audio again.
At the moment the encoding conversion using set_params() does
not seem to work for me. So vs(4) uses local conversion to/from
ADPCM instead of it. But this should be a temporary work.
XXX The playback quality is very poor compared to before...
XXX Recording is not tested.
Merge prate and rrate. These can not be separated.
- Revert temporary local conversion introduced at rev 1.43.
- But does not revert to trigger method. trigger method is not suitable for
x68k ADPCM+DMA mechanism.
- Don't (re)start ADPCM when DMA is running. This solves the noise.
From Y.Sugahara.
- Cache dmac xfer.
- Finally MI audio supports 4bit precision format without null_filter hack!
- Fix reusing play/rec argument as local variables. It is in/out parameter.
 1.11.26.1 28-Aug-2017  skrll Sync with HEAD
 1.11.8.1 03-Dec-2017  jdolecek update from HEAD
 1.16.6.1 21-Apr-2019  isaki Adapt to audio2.
 1.16.4.1 10-Jun-2019  christos Sync with HEAD
 1.17.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.18 26-Mar-2014  christos kill sprintf, fix unused.
 1.17 31-Dec-2008  isaki branches: 1.17.14; 1.17.24; 1.17.28;
struct device * -> device_t.
 1.16 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.15 29-Nov-2008  isaki Split device_t/softc. Use aprint*() and device_xname().
Not tested. I cannot test now...
 1.14 28-Apr-2008  martin branches: 1.14.6; 1.14.8;
Remove clause 3 and 4 from TNF licenses
 1.13 11-Mar-2007  isaki branches: 1.13.38; 1.13.40; 1.13.42;
white space, indent and KNF.
 1.12 11-Mar-2007  isaki Remove an extra white space.
 1.11 29-Mar-2006  thorpej branches: 1.11.14; 1.11.18;
Use device_cfdata().
 1.10 11-Dec-2005  christos branches: 1.10.4; 1.10.6; 1.10.8; 1.10.10; 1.10.12;
merge ktrace-lwp.
 1.9 13-Jun-2005  he branches: 1.9.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.8 18-Jan-2005  chs de-__P, remove register, ansify.
 1.7 15-Jul-2003  lukem branches: 1.7.8;
rcsid
 1.6 02-Oct-2002  thorpej branches: 1.6.6;
Add trailing ; to CFATTACH_DECL.
 1.5 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3 24-Mar-1999  minoura branches: 1.3.22; 1.3.26;
Shut up gcc -Wall.
 1.2 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.1 27-Dec-1998  minoura branches: 1.1.2;
file xel.c was initially added on branch minoura_x68k_bus_h.
 1.1.2.2 31-Jan-1999  minoura Improve xel probe.
 1.1.2.1 27-Dec-1998  minoura Xellent30 driver.
 1.3.26.1 18-Oct-2002  nathanw Catch up to -current.
 1.3.22.1 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.6.6.4 24-Jan-2005  skrll Sync with HEAD.
 1.6.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.6.1 03-Aug-2004  skrll Sync with HEAD
 1.7.8.1 29-Apr-2005  kent sync with -current
 1.9.2.2 03-Sep-2007  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.10.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.10.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.10.8.1 01-Apr-2006  yamt sync with head.
 1.10.6.1 22-Apr-2006  simonb Sync with head.
 1.10.4.1 09-Sep-2006  rpaulo sync with head
 1.11.18.1 13-Mar-2007  ad Sync with head.
 1.11.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.42.2 04-May-2009  yamt sync with head.
 1.13.42.1 16-May-2008  yamt sync with head.
 1.13.40.1 18-May-2008  yamt sync with head.
 1.13.38.2 17-Jan-2009  mjf Sync with HEAD.
 1.13.38.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.14.6.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.17.28.1 18-May-2014  rmind sync with head
 1.17.24.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.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.48 26-May-2022  tsutsui Make a readonly array const.
 1.47 11-Sep-2021  andvar Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
 1.46 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.45 24-Apr-2021  thorpej branches: 1.45.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.44 05-Aug-2016  isaki branches: 1.44.30;
Revert a part of previous commit.
If addr is not specified as "zsc0 at intio0" in kernel config
(though it's not right of course), it will cause a panic.
intio_map_allocate_region() should be called after address check.
 1.43 31-May-2016  dholland branches: 1.43.2;
PR 50759 David Binderman: fix out of bounds array access.

If we don't find one of the expected device addresses, reject the
match, but do it by checking whether the loop matched something rather
than by testing an array entry that might be one past the end.

Note: I have also moved the test to be with the loop; since the call
to intio_map_allocate_region had gotten placed in between them, I've
moved it to go before rather than after them as (a) it doesn't
interact with the loop itself and (b) this seems like the best choice
given the history as it was deliberately added before the original
test.

I have not tried running this, not having an x68k, but as best I can
tell by reading the intio code it seems like it should be harmless
even if it's not really correct.
 1.42 26-Mar-2014  christos branches: 1.42.6;
fix unused, missing splx.
 1.41 01-May-2011  tsutsui branches: 1.41.4; 1.41.14; 1.41.18;
Reset ZS chip properly in zscninit() so that zscngetc() works
even before zsc is attached during configure.
(i.e. make userconf(4) work on serial console)
 1.40 31-Dec-2008  isaki branches: 1.40.6; 1.40.8;
struct device * -> device_t.
 1.39 18-Dec-2008  isaki Sync with other m68k ports.
- Remove PHYS_IODEV, PHYS_INTIODEV. These are real copy of INTIOBASE.
- Define IIOV() (and IIOP()) and use it, rather than INTIO_ADDR().
 1.38 28-Apr-2008  martin branches: 1.38.8;
Remove clause 3 and 4 from TNF licenses
 1.37 27-Apr-2008  isaki branches: 1.37.2;
Make it compile without zstty.
 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 03-Dec-2007  ad branches: 1.35.14;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.34 09-Nov-2007  ad Call zs_lock_init() to set up the chanstate's lock.
 1.33 17-Oct-2007  garbled branches: 1.33.2;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.32 12-May-2007  isaki branches: 1.32.8; 1.32.10; 1.32.14;
Clean up white spaces and tabs.
 1.31 11-Mar-2007  isaki branches: 1.31.2; 1.31.8;
white space, indent and KNF.
 1.30 04-Mar-2007  tsutsui branches: 1.30.2;
Add MI softintr(9) support for x68k with common m68k/softintr.c.
Tested by isaki@ and Yasushi Oshima.

XXX: x68k/dev/com.c should be rewritten to use MI com(4).
 1.29 28-Mar-2006  thorpej branches: 1.29.14;
Use device_unit().
 1.28 11-Dec-2005  christos branches: 1.28.4; 1.28.6; 1.28.8; 1.28.10; 1.28.12;
merge ktrace-lwp.
 1.27 13-Jun-2005  he branches: 1.27.2;
Change the signature of badaddr() and badbaddr() from taking a caddr_t
to taking a volatile void*. This gets rid of a number of casts to make
this compile under -Wcast-qual.
Add some volatiles and consts in other places to make this build under
-Wcast-qual.
Also rename a few variables to make this build under -Wshadow.
Also get rid of duplicated declarations of badaddr() and badbaddr()
in machdep.c, they're already there from <machine/cpu.h>.
 1.26 18-Jan-2005  chs de-__P, remove register, ansify.
 1.25 15-Jul-2003  lukem branches: 1.25.8;
rcsid
 1.24 28-Jan-2003  pk branches: 1.24.2;
Provide locking required by the interrupt handlers running at IPL_SERIAL.
 1.23 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.22 02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.21 01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.20 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.19 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.18 27-Dec-2001  wiz branches: 1.18.8;
bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.17 27-Mar-1999  wrstuden branches: 1.17.20; 1.17.22; 1.17.26;
Add pps support. Only enable pps if CLOCAL & !MDMBUF.
 1.16 24-Mar-1999  minoura Shut up gcc -Wall.
 1.15 16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.14 11-Feb-1999  mycroft Minor cleanup.
Make the initializer for BAUDLO depend on PCLK directly; it was incorrect on
some ports where PCLK is not 4.9152MHz.
XXX Is the default value actually used?
 1.13 03-Feb-1999  mycroft Don't set DCD_IE in the frontends. KGDB doesn't even use DCD, and the tty
frontends get it from zsparam() anyway.
 1.12 05-Aug-1998  minoura branches: 1.12.6;
Switched to MI zs driver.
 1.11 04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.10 04-Jul-1998  jonathan defopt DDB.
 1.9 30-Jun-1998  msaitoh sync with -current after a long silence
 1.8 12-Jan-1998  thorpej Update for changes to config.
 1.7 12-Oct-1997  oki branches: 1.7.2;
Added prototypes.
 1.6 13-Oct-1996  christos branches: 1.6.10;
backout previous kprintf change
 1.5 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.4 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.3 05-Jun-1996  oki add tty_attach(tp);
 1.2 12-May-1996  oki branches: 1.2.4;
x68k mouse has no hardware flow control.
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.4.1 05-Jun-1996  oki pull up tty_attach() changes from trunk
 1.6.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.2.1 05-Feb-1999  cgd pull up patch to make mouse optional. Previously it was mandatory
because some mouse-related functions were referenced from other files.
Never committed to trunk because -current uses MI zs driver. (minoura)
 1.12.6.4 14-Mar-1999  minoura Sync.
 1.12.6.3 27-Dec-1998  minoura Better address map handling.
 1.12.6.2 27-Dec-1998  minoura Match device names.
 1.12.6.1 23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.17.26.4 03-Jan-2003  thorpej Sync with HEAD.
 1.17.26.3 18-Oct-2002  nathanw Catch up to -current.
 1.17.26.2 17-Sep-2002  nathanw Catch up to -current.
 1.17.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.17.22.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.17.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.20.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.18.8.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.24.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.4 24-Jan-2005  skrll Sync with HEAD.
 1.24.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.8.1 29-Apr-2005  kent sync with -current
 1.27.2.4 07-Dec-2007  yamt sync with head
 1.27.2.3 15-Nov-2007  yamt sync with head.
 1.27.2.2 03-Sep-2007  yamt sync with head.
 1.27.2.1 21-Jun-2006  yamt sync with head.
 1.28.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.28.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.28.8.1 01-Apr-2006  yamt sync with head.
 1.28.6.1 22-Apr-2006  simonb Sync with head.
 1.28.4.1 09-Sep-2006  rpaulo sync with head
 1.29.14.2 17-May-2007  yamt sync with head.
 1.29.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.30.2.3 03-Dec-2007  ad Sync with HEAD.
 1.30.2.2 27-May-2007  ad Sync with head.
 1.30.2.1 13-Mar-2007  ad Sync with head.
 1.31.8.1 22-May-2007  matt Update to HEAD.
 1.31.2.1 11-Jul-2007  mjf Sync with head.
 1.32.14.1 13-Nov-2007  bouyer Sync with HEAD
 1.32.10.2 09-Jan-2008  matt sync with HEAD
 1.32.10.1 06-Nov-2007  matt sync with HEAD
 1.32.8.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.32.8.1 11-Nov-2007  joerg Sync with HEAD.
 1.33.2.2 08-Dec-2007  mjf Sync with HEAD.
 1.33.2.1 19-Nov-2007  mjf Sync with HEAD.
 1.35.14.3 17-Jan-2009  mjf Sync with HEAD.
 1.35.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.35.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.36.2.1 18-May-2008  yamt sync with head.
 1.37.2.2 04-May-2009  yamt sync with head.
 1.37.2.1 16-May-2008  yamt sync with head.
 1.38.8.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.40.6.1 31-May-2011  rmind sync with head
 1.41.18.1 18-May-2014  rmind sync with head
 1.41.14.2 03-Dec-2017  jdolecek update from HEAD
 1.41.14.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.41.4.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.42.6.2 05-Oct-2016  skrll Sync with HEAD
 1.42.6.1 09-Jul-2016  skrll Sync with HEAD
 1.43.2.1 06-Aug-2016  pgoyette Sync with HEAD
 1.44.30.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.45.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 05-Aug-1998  minoura Switched to MI zs driver.
 1.2 13-Oct-1997  lukem rcsid fascism
 1.1 05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1 05-May-1996  oki branches: 1.1.1.1.12;
NetBSD/x68k, by Masaru Oki.
 1.1.1.1.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.

RSS XML Feed