Home | History | Annotate | only in /src/sys/arch/mac68k
History log of /src/sys/arch/mac68k
RevisionDateAuthorComments
 1.10 25-Oct-2008  apb Use ${TOOL_SED} instead if plain sed in Makefiles.
 1.9 25-Feb-2007  dyoung branches: 1.9.42; 1.9.46; 1.9.52;
Make the mac68k 'tags' target work.
 1.8 06-Jan-2003  lukem branches: 1.8.18; 1.8.56;
Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

The previous method of finding KERNOBJDIR when using BSDOBJDIR by
referencing _SRC_TOP_OBJ_ from another directory was extremely
fragile due to the depth first tree walk by <bsd.subdir.mk>, and
the caching of _SRC_TOP_OBJ_ (with MAKEOVERRIDES) which would be
empty on the *first* pass to create fresh objdirs.

This change requires adding sys/arch/*/compile/Makefile to create
the objdir in that directory, and descending into arch/*/compile
from arch/*/Makefile. Remove the now-unnecessary .keep_me files
whilst here.

Per lengthy discussion with Andrew Brown.
 1.7 03-Apr-2001  jhawk branches: 1.7.8;
Remove gratuitous setting of SYSDIR;
it is set in sys/kern/Make.tags.inc
 1.6 15-Nov-1998  perry branches: 1.6.12; 1.6.24;
(mostly) fix kernel tags support. from Frederick Bruckman in pr-6445.
 1.5 12-Jun-1998  cgd Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.4 11-Oct-1997  mycroft Make these closer to working.
 1.3 27-Mar-1996  scottr branches: 1.3.12;
Remove bogus reference to BSDSRCDIR here; still doesn't work, though.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 02-Jul-1994  briggs Scam from amiga and update a little for the current tree. May need some
more work.
 1.3.12.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.24.1 09-Apr-2001  nathanw Catch up with -current.
 1.6.12.1 21-Apr-2001  bouyer Sync with HEAD
 1.7.8.2 07-Jan-2003  thorpej Sync with HEAD.
 1.7.8.1 03-Apr-2001  thorpej file Makefile was added on branch nathanw_sa on 2003-01-07 21:11:53 +0000
 1.8.56.1 27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.8.18.1 26-Feb-2007  yamt sync with head.
 1.9.52.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.9.46.1 04-May-2009  yamt sync with head.
 1.9.42.1 17-Jan-2009  mjf Sync with HEAD.
 1.3 06-Jan-2003  lukem Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

The previous method of finding KERNOBJDIR when using BSDOBJDIR by
referencing _SRC_TOP_OBJ_ from another directory was extremely
fragile due to the depth first tree walk by <bsd.subdir.mk>, and
the caching of _SRC_TOP_OBJ_ (with MAKEOVERRIDES) which would be
empty on the *first* pass to create fresh objdirs.

This change requires adding sys/arch/*/compile/Makefile to create
the objdir in that directory, and descending into arch/*/compile
from arch/*/Makefile. Remove the now-unnecessary .keep_me files
whilst here.

Per lengthy discussion with Andrew Brown.
 1.2 26-Oct-1994  cgd branches: 1.2.52;
new RCS ID format.
 1.1 30-Sep-1993  cgd delete bogus kernel files/binaries, and add a .keep_me
 1.2.52.1 07-Jan-2003  thorpej Sync with HEAD.
 1.1 06-Jan-2003  lukem branches: 1.1.2;
Rework how KERNOBJDIR functions; now it's always determined with
cd ${KERNSRCDIR}/${KERNARCHDIR}/compile && ${PRINTOBJDIR}
This is far simpler than the previous system, and more robust with
objdirs built via BSDOBJDIR.

The previous method of finding KERNOBJDIR when using BSDOBJDIR by
referencing _SRC_TOP_OBJ_ from another directory was extremely
fragile due to the depth first tree walk by <bsd.subdir.mk>, and
the caching of _SRC_TOP_OBJ_ (with MAKEOVERRIDES) which would be
empty on the *first* pass to create fresh objdirs.

This change requires adding sys/arch/*/compile/Makefile to create
the objdir in that directory, and descending into arch/*/compile
from arch/*/Makefile. Remove the now-unnecessary .keep_me files
whilst here.

Per lengthy discussion with Andrew Brown.
 1.1.2.2 07-Jan-2003  thorpej Sync with HEAD.
 1.1.2.1 06-Jan-2003  thorpej file Makefile was added on branch nathanw_sa on 2003-01-07 21:11:54 +0000
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.7 01-Feb-1995  mycroft Clean up deleted files.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 20-Oct-1994  briggs Before I forget...
 1.4 21-Jul-1994  briggs Make ALLEN a copy of GENERIC. Disable FPSP in GENERIC.
 1.3 27-Feb-1994  briggs branches: 1.3.2;
Disable SCSIDEBUG and make COMPAT_NOMID an option (defined).
 1.2 02-Dec-1993  briggs Migrate to new MACHINE definition (mac -> mac68k).
 1.1 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
 1.3.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.1 13-Mar-2024  nat Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.1 13-Mar-2024  nat Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.239 03-Apr-2025  nat Add pbbat(4)

Now it is possible to monitor the PowerBook 1xx AC adaptors and battery via
envsys(4).
 1.238 29-Jan-2024  christos branches: 1.238.2;
PR/57889: Ricardo Branco: ext2fs does not have user immutable and append
file flags, only system ones. Restrict those to the superuser. Before
the behavior was controlled by EXT2FS_SYSTEM_FLAGS. Make that behavior the
default.
 1.237 12-Feb-2023  abs Add optoion GENERIC.local include to the end of ~all GENERIC configs

This excludes atari, sgimips, evbmips, evbppc, evbsh3, and hpcarm
all of which have somewhat specific kernel config file layouts
 1.236 22-Dec-2022  nat Driver for DaynaPORT SCSI/Link (dse.4).

Written by Hiroshi Noguchi, of which an updated version was posted to
port-mac68k in 2001.

Attachments were added to kernel configs for platforms that already had
the Cabletron (se.4) driver added, although other platorms may benefit.

Reviewed on tech-net by Izumi Tsutsui.
 1.235 07-Aug-2022  simonb UFS/LFS dirhash:
- Enable UFS_DIRHASH if the architecture or kernel model specific config
file can use 128MB of RAM or more.
- Remove experimental tag from UFS_DIRHASH; it's been with RUMP kernel
and by a number of NetBSD developers for years.
- Add LFS_DIRHASH if LFS was enabled.
- Be somewhat consistent with FS options order.
 1.234 26-Feb-2021  rin Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
 1.233 21-Jan-2021  nia add a commented out compat_ossaudio wherever there's compat_linux

requested by mrg
 1.232 27-Sep-2020  roy branches: 1.232.2;
vether: Add to kernel configurations

It's only enabled if the kernel enabled bridge AND tap.
Otherwise it's commented out.
 1.231 10-Aug-2020  rin Add -fno-omit-frame-pointer to m68k kernels with DDB for backtraces.
-omit-frame-pointer is enabled for -O1 and higher for GCC8 by default.
 1.230 01-Aug-2020  maxv Remove references to BRIDGE_IPF, it is now compiled in by default.
 1.229 19-Jan-2020  thorpej Remove the strip(4) - Starmode Radio IP - pseudo-device driver. It is
long since obsolete.
 1.228 26-Apr-2019  sevan branches: 1.228.2; 1.228.4;
Enable BUFQ_PRIOCSCAN, CARP, Veriexec by default in GENERIC kernel configs.
On ports without a GENERIC kernel config enable in individul files, e.g evbmips.
Omit on:
atari, dreamcast, emips, epoc32, evbppc/VIRTEX*, ia64, luna68x, mvme68k,
mvmeppc, playstation2, riscv, sun2, sun3, x68k, zaurus due to resource
constraints or port infancy.
 1.227 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.226 01-Aug-2018  maxv Unreference IPF/PF from all the config files, and enable NPF instead when
wanted. This also fixes some inconsistencies I saw in several files (eg
IPF options while IPF was not compiled, IPF+PF enabled by default, etc).
 1.225 23-Jan-2018  sevan branches: 1.225.2; 1.225.4;
Alternate buffer queue strategies no longer considered experimental, update
description.

Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.224 14-Sep-2017  mrg clean up COMPAT_* options for native netbsd code:
- new series of files that are useful for saying "i want everything
since netbsd 1.4", etc.
- use the fact COMPAT_* options have future dependancies to remove
many redundant options.

removes about 3000 lines total across kernel configuration files.
tested about 30 random kernels in the changed list.
 1.223 13-Sep-2017  sevan Remove support for VERIFIED_EXEC_FP_RMD160, VERIFIED_EXEC_FP_SHA1, and VERIFIED_EXEC_FP_MD5 options.
These algorithms are either broken or on their way to being broken.

Discussed on tech-security
http://mail-index.netbsd.org/tech-security/2017/08/21/msg000936.html

ok riastradh
 1.222 29-Jul-2017  maxv Remove TCP_COMPAT_42 from the config files. Pass 3.
 1.221 08-Aug-2015  maxv branches: 1.221.10;
Remove KMEMSTATS.
 1.220 16-Nov-2014  manu branches: 1.220.2;
Remove unused extended attributes kernel options

As Masao Uebayashi pointed to me, UFS_EXTATTR_AUTOSTART, LFS_EXTATTR_AUTOSTART
and UFS_EXTATTR_AUTOCREATE are not used anywhere in the code. Remove them
as they have been obsolete for a long time:
UFS_EXTATTR_AUTOSTART was replaced by mount -o extattr
LFS_EXTATTR_AUTOSTART was created to match obsolete UFS_EXTATTR_AUTOSTART
UFS_EXTATTR_AUTOCREATE was replaced by sysctl vfs.ffs.extattr_autocreate
 1.219 12-Nov-2014  manu Support for UFS1 extended attributes in GENERIC and GENERIC-like kernels

This change just brings UFS1 extended attribute *support* in the kernel,
extended attributes are not enabled unless three conditions are met:
1) filesystem is UFS1 (newfs -O1)
2) .attribute/system and .attribute/user directories are created at fs root
3) filesystem is mounted with -o extattr

Some GENERIC kernels are obviously memory constrained, the extended
attributes options were not enabled for them, but just added commented out.
(kernel were considered memory constrained if QUOTA option was disabled)
 1.218 23-Aug-2014  dholland Systematize (and in many cases, fix) the comments on options COMPAT_NN.

There are quite a few configs that are missing some COMPAT_NN options
in ways that don't make sense; this should probably get cleaned up
too, but for the time being I've not added or removed anything.
 1.217 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.216 05-Jul-2014  tsutsui branches: 1.216.2;
Use COPTS="-O2 -fno-reorder-blocks" as defined in sys.mk for userland.

Compile tests only.
 1.215 16-Jul-2013  jklos branches: 1.215.4;
Added DJMEMCMAX option for recognizing 128 meg SIMMs in Centris and Quadra
610, 650 and 800 systems. From Rob Braun,
http://synack.net/~bbraun/netbsdmac2.html
 1.214 30-Jun-2013  rmind G/C PFIL_HOOKS from the kernel configs.
 1.213 05-Jun-2013  christos branches: 1.213.2;
remove obsolete networking options
 1.212 27-Apr-2013  christos the bogus number police
 1.211 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.210 02-Mar-2013  christos Under FAST_IPSEC, IPSEC_ESP is mandatory; GC it.
 1.209 01-Mar-2013  joerg Retire OSI network stack. OK core@
 1.208 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.207 17-Aug-2012  abs branches: 1.207.2;
Update all kernel configs mentioning WSEMUL_* but not already including
WSDISPLAY_COMPAT_USL using the following rules:
- If WSEMUL_ is commented out, add commented out out WSDISPLAY_COMPAT_USL
- If INSTALL or obviously memory constrained, add WSDISPLAY_DEFAULTSCREENS=1
and commented out WSDISPLAY_COMPAT_USL
- Otherwise add WSDISPLAY_COMPAT_USL

Some of the INSTALL configs for larger memory machines are probably suitable
for adding WSDISPLAY_COMPAT_USL.

Now wsconscfg(8) should be able to switch VTs when expected.

Implemented after no objection from tech-kern to the following:

On 5 June 2012 09:47, David Brownlee <abs@absd.org> wrote:
> wsconscfg(8) requires WSDISPLAY_COMPAT_USL in order to switch virtual
> terminals.
>
> Except when in an exceptionally memory or space constrained
> environment (INSTALL being the obvious case), is there any reason why
> all GENERIC and GENERIC-like kernels which have wscons enabled
> shouldn't also have WSDISPLAY_COMPAT_USL?
 1.206 10-Mar-2012  joerg P1003_1B_SEMAPHORE is no longer optional.
 1.205 31-Jan-2012  hauke Employ the two free 16 bit timers of the Hurdler Centronics Parallel
Interface card's Z8536 CIO for Timecounter support.

Builds, should work, but not testable yet because of pmap breakage.
 1.204 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.203 22-Nov-2011  tls branches: 1.203.2;

The rnd pseudo-device is not really optional, because it is in the same
source file as the entropy-pool code itself. Move it to std. This
will be cleaned up more when I split the sources up as they should be.

This fixes build breaks on several ports. Thanks to Havard Eidnes for
pointing them out.
 1.202 03-Oct-2011  hauke branches: 1.202.2;
Add the MI software watchdog to GENERIC (not to SMALLRAM, as usual).
 1.201 30-Jun-2011  wiz dependant -> dependent
 1.200 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.199 24-Nov-2010  hauke branches: 1.199.2; 1.199.4;
Consistency in commenting COMPAT_nn options.
 1.198 23-Nov-2010  hannken Remove unused count from pseudo-device md.
 1.197 08-May-2010  mrg enable IPFILTER_COMPAT in all kernels that have ipfilter already.
canonicalise several of the ipf option segments in various files
(this mostly means adding commented out IPFILTER_DEFAULT_BLOCK,
or adding commented or uncommented IPFILTER_LOG or IPFILTER_LOOKUP
option statements.)

i built about 20 of these kernels to check, but not all of them.
 1.196 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.195 05-Dec-2009  pooka branches: 1.195.2; 1.195.4;
Remove the portalfs kernel file system driver. Replace mount_portal(8)
with a version based on puffs. User functionality remains the same.
 1.194 24-Jan-2009  mrg add COMPAT_50 to all the configs with COMPAT_40.
 1.193 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

Proposed on tech-kern@.
 1.192 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.191 10-Aug-2008  tls branches: 1.191.2;
Add accept filters to GENERIC kernels where they exist.
 1.190 31-Jul-2008  simonb Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.189 30-May-2008  tsutsui branches: 1.189.4;
Add options COMPAT_40 to files which have options COMPAT_30.
 1.188 28-May-2008  hauke Add LOCKDEBUG option, commented out, so that people know it's there.
 1.187 22-May-2008  hauke Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.186 31-Dec-2007  ad branches: 1.186.6; 1.186.8; 1.186.10; 1.186.12;
Remove systrace. Ok core@.
 1.185 04-Nov-2007  xtraeme branches: 1.185.2; 1.185.8;
Remove System V semaphores and share memory options to set the limits:
SEMMNI, SEMMNS, SEMUME and SHMMAXPGS.

They can be tweaked via sysctl now. Ports that were setting values on
them weren't touched, I only removed the ones that were commented out.
 1.184 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.183 26-Aug-2007  jmmv branches: 1.183.2; 1.183.6;
Enable tmpfs.
 1.182 06-Aug-2007  adrianp Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.181 04-Jun-2007  martin branches: 1.181.2; 1.181.4; 1.181.8;
Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.180 02-Jun-2007  tsutsui Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.179 06-Mar-2007  dillo branches: 1.179.2; 1.179.4; 1.179.10;
Complete rename of hfsp to hfs, requested by thorpej.
 1.178 05-Mar-2007  dillo Add file-system HFSP (commented out) to GENERIC kernels of ports
on which Mac OS runs.
 1.177 11-Nov-2006  jmmv branches: 1.177.2; 1.177.4; 1.177.8;
Remove tmpfs's experimental status. OK'ed by core@.
 1.176 26-Aug-2006  christos branches: 1.176.2; 1.176.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.175 26-Aug-2006  tsutsui Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.174 12-Aug-2006  christos Disable SYSTRACE by default on all kernels (discussed with core)
 1.173 28-Jun-2006  liamjfoy branches: 1.173.2;
Add CARP to GENERIC kernel configs. CARP is not enabled by default.

ok: christos
 1.172 28-Mar-2006  pavel branches: 1.172.4;
Add stf to all kernel configs which have INET6 and gif, except the INSTALL
ones and those for specific machines of developers. PR 32304.

OK'ed by rpaulo.

N.B. stf is a cloning device, so it still must be enabled by
"ifconfig stf0 create".
 1.171 05-Feb-2006  cube branches: 1.171.2; 1.171.4; 1.171.6;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.170 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.169 02-Feb-2006  reinoud branches: 1.169.2;
Add commented out UDF file-system entry in all GENERIC configurations.
 1.168 20-Dec-2005  thorpej branches: 1.168.2; 1.168.4;
Remove the tablet line discipline.
 1.167 09-Dec-2005  elad Add (commented out) Veriexec options and pseudo-device to GENERIC kernels,
and remove the i386 GENERIC_VERIEXEC config.
 1.166 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.165 10-Sep-2005  jmmv Initial addition of tmpfs, an efficient memory file-system. This project
was developed as part of Google's Summer of Code 2005 program. This
change adds the kernel code, the mount_tmpfs utility, a regression test
suite and does all other related changes to integrate these.

The file-system is still *experimental*. Therefore, it is disabled by
default in all kernels. However, as typically done, a commented-out
entry is added in them to ease its setup.

Note that I haven't commited the required mountd(8) changes to be able
to export tmpfs file-systems because NFS support is still very unstable
and because, before enabling it, I'd like to do some other changes.

OK'ed by my project mentor, William Studenmund (wrstuden@).
 1.164 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.163 19-Aug-2005  christos 64 bit inode changes.
 1.162 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.161 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.160 17-Jul-2005  hubertf Add support for reading cloop2 compressed filesystem image,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
 1.159 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.158 25-Jun-2005  rpaulo branches: 1.158.2;
Add file-system PTYFS (commented out) so that people know its existence.

Ok'ed by Christos Zoulas and Hubert Feyrer.
 1.157 09-Jun-2005  tsutsui - Rename options NEW_BUFQ_STRATEGY -> options BUFQ_READPRIO.
(still commented out)
- Add (also commented out) options BUFQ_PRIOCSCAN.

Suggested by perry and soda on tech-kern.
Please refer options(4) for details for these options.
 1.156 25-Feb-2005  simonb branches: 1.156.2;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.155 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.154 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.153 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.152 28-Jan-2005  rumble Sprinkle options UFS_DIRHASH on GENERIC kernels. It's presently
commented out and labeled experimental pending further review and
testing.
 1.151 19-Jan-2005  chs branches: 1.151.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.150 17-Jan-2005  cube Add tap(4) support to a random^Wcarefully chosen set of kernel configs.
All those kernels have a line for both tun and bridge, and if either is
commented out, tap is commented out also. With the exception of i386's
GENERIC_TINY.

XXX: we _need_ some way of making this more simple.
 1.149 10-Nov-2004  christos branches: 1.149.4;
Add COMPAT_BSDPTY on all the kernels that have COMPAT options.
 1.148 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.147 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.146 28-Jun-2004  bouyer Add options P1003_1B_SEMAPHORE
to all GENERIC-like kernel config files where SYSV* options were already
present (commented out if the SYSV* options are commented out).
Fix lib/25897 and lib/25898.
 1.145 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.144 22-Jun-2004  itojun have pf and pflog pseudo-device (commented out).
reviewed by matt, perry, christos
 1.143 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.142 16-Jun-2004  christos Add pseudo-device ptm on all the generic flavored kernels.
 1.141 18-Oct-2003  lukem branches: 1.141.2;
Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.140 08-Oct-2003  bouyer Add atabus.
 1.139 22-Sep-2003  cl add COMPAT_15/COMPAT_16
 1.138 26-Apr-2003  ragge branches: 1.138.2;
Add pseudo-device ksyms.
 1.137 10-Apr-2003  christos Bye Bye UCONSOLE
 1.136 27-Feb-2003  perseant Make BRIDGE_IPF an option, and document it. Add it (commented) to GENERIC.
Let brconfig tell whether the bridge is using the ipfilter hook, or not.
 1.135 22-Nov-2002  wiz Fix typo (responsiness -> responsiveness).
 1.134 18-Oct-2002  junyoung Add NEW_BUFQ_STRATEGY (disabled by default).
 1.133 14-Oct-2002  elric Added commented out cgd(4)s to GENERIC configs.
 1.132 06-Oct-2002  provos add SYSTRACE; approved perry.
 1.131 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.130 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.129 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.128 19-Jun-2002  itojun netdock* - ethernet driver for Asante NetDock/Newer Ether MicroDock.
by Daishi Kato <daishi@axlight.com>
test/stabilization by Takeo Kuwata <tkuwata@virus.kyoto-u.ac.jp>
 1.127 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.126 27-Apr-2002  shiba branches: 1.126.2; 1.126.4;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.125 25-Apr-2002  atatat Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.124 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.123 25-Mar-2002  shiba Switch mac68k to ELF. Now the default executable binaries are ELF.

Approved by Scott,briggs,fredb,wormey
 1.122 06-Feb-2002  fredb Forgot one -- `options COMPAT_15'.
 1.121 06-Feb-2002  fredb Update the GENERIC and GENERICSBC kernels to conform to current fashion:

- - Disable `options DIAGNOSTIC' by default, as the checks are reported to
be not really cheap.
- - Add `options COMPAT_AOUT_M68K', commented out, in preparation for ELF.
- - Remove `options EXEC_ELF32' from the kernel config. You can't just
build an ELF kernel -- you need to update your toolchain, and then,
once you go ELF, it's not an option, so it needs to go in std.mac68k,
as on the other m68k ports.
- - Comment out `options COMPAT_SUNOS'. This hasn't been reported to work
for a long time, so it's not very useful in GENERIC.
- - Enable `options IPFILTER_LOG', to go along with the `options GATEWAY'
and `pseudo-device ipfilter' motif.
 1.120 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.119 19-Jan-2002  oster Add new RF_* options for RAIDframe bits that are no longer built by default.

While we're here, enable RAIDframe (and RAID_AUTOCONFIG) by default for
architectures that I'm comfortable can deal with it being on by default.

Also: bump the number of 'raid' devices from 4 to 8, since 4 seems to
be insufficient in practise.
 1.118 28-Dec-2001  martin Add PPPoE to all generic kernels that should be able to use it.
XXX TODO: do this for INSTALL kernels too, add sysinst support and make the
XXX needed binaries available on the ramdisk root fs.
 1.117 14-Dec-2001  gmcgarry Add a blurb to the top of all GENERIC files. This serves three purposes:
- to clarify some terminology
- to clarify the intention of the GENERIC file
- to cross-reference some useful man pages
 1.116 23-Nov-2001  atatat The bridge(4) pseudo-device no longer requires the port to
__HAVE_GENERIC_SOFT_INTERRUPTS, so add it back to all GENERIC configs.
 1.115 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.114 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.113 01-Sep-2001  atatat branches: 1.113.6;
Comment out bridge pseudo devices from ports that don't
__HAVE_GENERIC_SOFT_INTERRUPTS. bridge(4) doesn't compile there.
 1.112 01-Sep-2001  atatat Add bridge pseudo devices to GENERIC configs
 1.111 08-Jul-2001  abs branches: 1.111.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.110 30-Jun-2001  darcy Add System V semaphore resource limits to each GENERIC file that has an
option for System V semaphores. It appears that there are no overrides
in the code and each file has the following added.

options SYSVSEM # System V semaphores
+#options SEMMNI=10 # number of semaphore identifiers
+#options SEMMNS=60 # number of semaphores in system
+#options SEMUME=10 # max number of undo entries per process
+#options SEMMNU=30 # number of undo structures in system
options SYSVSHM # System V shared memory

If anyone thinks that this is incorrect for any of these files, please
correct it.

Note - the i386 port was not forgotten. It was done separately.
 1.109 19-Dec-2000  bouyer Add pseudo-device vlan
 1.108 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.107 13-Aug-2000  itojun move "options PULLDOWN_TEST" into sys/sys/mbuf.h (in #ifdef _KERNEL),
as it is no wthe default setting for everyone.

the reason we still use the name "PULLDOWN_TEST" while it is now default:
kame code sharing.
 1.106 30-Jul-2000  briggs Add SMC-based ethernet and nsphy (AsanteFAST) and ukphy (just in case).
 1.105 05-Jul-2000  sommerfeld Comment out EON ISO-over-ip tunneling pseudo-driver, and document as
broken/fragile. Unlikely to be of much use, and confuses new users
when their system crashes when they, or their dhclient stumble over
it. See kern/10500, kern/8994 for the gory details.
 1.104 30-Jun-2000  itojun add PULLDOWN_TEST for all the platforms.
XXX should be moved to somewhere else when stabilized
 1.103 22-Jun-2000  fvdl Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.102 14-Jun-2000  veego branches: 1.102.2;
Remove the obsolete config fragments for kernel crypto, because the IPsec
crypto code is now in the kernel source tree.
 1.101 11-Jun-2000  fredb Enable "rnd" pseudo-device. It's no longer experimental, and works just
fine on mac68k.
 1.100 19-Apr-2000  itojun branches: 1.100.2;
add stf pseudo interface (commented out due to possible security risks)
 1.99 31-Mar-2000  scottr Attach all displays, keyboards, and mice, not just the first
ones found.
 1.98 29-Feb-2000  simonb Do the "<space><tab>" thing with the RAID_AUTOCONFIG option.
 1.97 26-Feb-2000  oster Defopt 'RAID_AUTOCONFIG'. Adding 'options RAID_AUTOCONFIG' turns on
the component auto-detection and auto-configuration of RAID sets.
Also, add "#options RAID_AUTOCONFIG" to the GENERIC config files.
 1.96 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.95 23-Jan-2000  hubertf Add commented out "ident"-command
 1.94 20-Jan-2000  wrstuden Add overlay to kernel configs.
 1.93 24-Nov-1999  scottr Take a cue from the i386 port: Enable DHCP by default, rather than
BOOTP.
 1.92 21-Nov-1999  itojun bring in content of GENERIC.v6 into GENERIC.
remove GENERIC.v6 file (as it is part of GENERIC now).

"faith" interface is commented out by default as it is not really for
general use.
IPsec items are commented out as well, though we can enable "options IPSEC"
without export-related issue ("options IPSEC" will enable authentication
portion only). We may need to think about it again.

if you have problem compiling with INET6 on archs I do not have access to,
please contact me.

XXX what to do with arch/arm32/SHARK{,.v6}?
 1.91 15-Nov-1999  fvdl Add commented out option SOFTDEP to all GENERIC kernels.
 1.90 05-Nov-1999  fredb Add and enable Coda file system and pseudo-device vcoda. Closes PR 8625.
 1.89 29-Jul-1999  augustss branches: 1.89.2; 1.89.4; 1.89.8;
It's time to be COMPAT_14.
 1.88 20-Jul-1999  christos enable PPP_BSDCOMP, PPP_DEFLATE, PPP_FILTER, PFIL_HOOKS, IPFILTER_LOG
on the GENERIC kernels that had them commented out.
XXX: Please note, that not all the kernels have all the options defined!
 1.87 01-Jun-1999  briggs Comment out DISABLE_EXT_CACHE as it unnecessarily slows down the IIci
w/ external cache. Leave it around so the paranoid can still use it.
 1.86 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.85 05-Mar-1999  scottr branches: 1.85.2; 1.85.4; 1.85.6; 1.85.8;
Remove ADB_DEBUG; it's not fatal, but it adds a bunch of code that's
disabled by default.
 1.84 18-Feb-1999  scottr Add the IWM driver.
 1.83 15-Dec-1998  itohy Added options COMPAT_LINUX and EXEC_ELF32 as comments
to GENERIC configuration files.
 1.82 25-Nov-1998  hwr Add (commented out) 'gre' pseudo device line. Feedback is welcome.
Inspired by Klaus Klein.
 1.81 16-Nov-1998  oster Added a (commented out) configuration line for the RAIDframe device driver.
 1.80 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.79 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.78 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.77 02-Jun-1998  scottr Make the direct ADB driver default.
 1.76 27-Mar-1998  scottr Add (commented out) ALTXBUTTONS option.
 1.75 18-Mar-1998  bouyer Add commented out "options FFS_EI"
 1.74 27-Feb-1998  scottr Bump down maxusers to a reasonable value on a machine with 8MB.
 1.73 09-Jan-1998  drochner Compile in BOOTP support for diskless boot.
 1.72 01-Dec-1997  kleink Add COMPAT_13.
 1.71 26-Nov-1997  scottr Major reorganization, based largely on the i386 GENERIC. This moves all
bus and device configuration out of std.mac68k, as well.
 1.70 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.69 04-Nov-1997  briggs Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.68 20-Oct-1997  scottr branches: 1.68.2;
Enable ipfilter, and add a commented-out rnd pseudo-device line.
 1.67 23-Aug-1997  mjacob add a before tab to SCSIVERBOSE
 1.66 20-Aug-1997  mjacob add commented out reference SCSIVERBOSE option
 1.65 25-Jul-1997  scottr branches: 1.65.2;
Add NETATALK, and be pedantic with a few comments.
 1.64 07-May-1997  lukem minor whitespaco fixes
 1.63 06-May-1997  lukem be consistent with use of spaces and tabs.
 1.62 08-Apr-1997  scottr Add MRG_ADB option.
 1.61 24-Mar-1997  scottr Add se driver
 1.60 15-Mar-1997  briggs Add SONIC driver. Works on my Q700. Untested elsewhere.
 1.59 15-Mar-1997  scottr Remove obsolete MAC68K_BROKEN_VIDEO option.
 1.58 02-Mar-1997  scottr Add the MAC68K_BROKEN_VIDEO option, which is a hack that delays enabling
NuBus interrupts until an Ethernet card is attached.
XXX This should go away at some point, obviously.
 1.57 14-Feb-1997  scottr Add memory disk pseudo-device
 1.56 12-Feb-1997  scottr Move asc0 here from std.mac68k, and enable PFIL_HOOKS option so that
the if_ipl LKM can be loaded. Add some minimal driver descriptions.
 1.55 31-Jan-1997  thorpej branches: 1.55.2;
Adopt for new file system and root spec grammar.
 1.54 26-Jan-1997  scottr Forgot PFIL_HOOKS; correct this. Also, organize options less insanely.
 1.53 25-Jan-1997  scottr Add `options LKM'
 1.52 13-Jan-1997  scottr Add ipfilter (pseudo-) device.
 1.51 11-Jan-1997  mikel branches: 1.51.2;
add 'pseudo-device ccd' where necessary; PR kern/1830.
 1.50 17-Dec-1996  scottr Add sample sbc config line; format 'options' lines for consistency.
 1.49 19-Nov-1996  scottr - Move non-optional options SWAPPAGER, VNODEPAGER, and DEVPAGER to std.mac68k
- Catch up with vm/vmparam.h (remove MACHINE_NONCONTIG)
- Fix space/tab niggles in SPOT config
- MYSTERY now includes the esp driver
 1.48 11-Nov-1996  scottr Remove unused MAXFDESCS option. Closes PR 2927, noticed by Erik
Bertelsen <erik@aarhus1.uni-c.dk>.
 1.47 29-Oct-1996  briggs Add esp1 at obio?
 1.46 29-Oct-1996  briggs ncr96scsi -> esp for consistency with sparc and alpha.
 1.45 16-Oct-1996  scottr We're paranoid; disable the IIci's cache card.
 1.44 15-Oct-1996  scottr We no longer need 'options GENERIC'
 1.43 22-Sep-1996  scottr Update for recent config(8) changes.
 1.42 16-Sep-1996  scottr Add ZS_CONSOLE_ABORT
 1.41 12-Sep-1996  scottr Add ss, uk SCSI devices
 1.40 10-Sep-1996  thorpej Document COMPAT_M68K4K, but leave it disabled by default.
 1.39 26-Aug-1996  mrg add COMPAT_12.
 1.38 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device.
 1.37 19-May-1996  scottr Update for new grf attachment code.
 1.36 06-May-1996  briggs Move grf0 at obio? from std.mac68k to the config files. Not all machine
have internal video.
 1.35 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.34 08-Apr-1996  briggs Add PPP_BSDCOMP and PPP_DEFLATE options.
 1.33 12-Mar-1996  scottr Add "options M68020" so that 68851-specific code is only compiled when
we want it (we don't support the 020 without an 851 anyway). Note that
M68030 no longer implies support for 020+851.

This also allows us to compile with -m68030 iff M68020 isn't specified
in the config file.
 1.32 21-Nov-1995  briggs Get rid of obsolete time specs.
 1.31 04-Oct-1995  briggs Add a second ppp. It makes the kernel a whole 8 bytes larger on disk.
 1.30 04-Oct-1995  briggs ae0 -> ae* and add a couple of vnd devices.
 1.29 03-Oct-1995  briggs Raise number of bpfs to 12 since CAP needs a minimum of 8.
 1.28 16-Sep-1995  briggs Set timezone to 0. The booter's GMT bias should be used, instead.
 1.27 17-Jul-1995  briggs GENERIC should have options GENERIC. Duh.
 1.26 19-Jun-1995  briggs Add FPSP back.
 1.25 29-Mar-1995  briggs Nuke FPCOPROC and add FPU_EMULATE to GENERIC.
Support the above with gwr's sun3 stuff.
 1.24 11-Mar-1995  briggs Nuke NEWCONFIG. It's not used anymore at all.
 1.23 11-Mar-1995  briggs Use M68030 and M68040 instead of MC... Thanks to Luke Mewburn for
pointing out this inconsistency.
 1.22 27-Nov-1994  briggs Re-enable NFSCLIENT
 1.21 26-Oct-1994  cgd new RCS ID format.
 1.20 20-Oct-1994  briggs Before I forget...
 1.19 31-Jul-1994  lkestel Make GENERIC be MACHINE_NONCONTIG.
 1.18 21-Jul-1994  briggs Make ALLEN a copy of GENERIC. Disable FPSP in GENERIC.
 1.17 21-Jul-1994  briggs Enable DDB, CD9660, NULLFS. Add bpfilter. Slight cleanup.
 1.16 09-Jul-1994  briggs Nuke pseudo-device con.
 1.15 26-Jun-1994  briggs branches: 1.15.2;
Add mac68k_init.c and scsi96.c for 68040 macs and configure them. Not
much uses them, yet, but also added the MC68030 and MC68040 options.
 1.14 25-Jun-1994  briggs Checkpoint. GENERIC has some things disabled. Makefile updated for
vnode_if and some cleanup. copy.s added to files.
 1.13 21-Apr-1994  briggs Add fpsp option.
 1.12 15-Apr-1994  briggs Add COMPAT_09
 1.11 01-Mar-1994  briggs Add COMPAT_SUNOS--it seems to work.
 1.10 27-Feb-1994  briggs Disable SCSIDEBUG and make COMPAT_NOMID an option (defined).
 1.9 27-Feb-1994  briggs Make FPCOPROC an options option and remove it from the Makefile defines.
Also add a configuration that doesn't have it.
 1.8 23-Feb-1994  briggs Add Id string and disable NFSSERVER and NFSCLIENT until I can get to
the bottom of some panics I've seen.
 1.7 22-Feb-1994  briggs Enable several more options.
 1.6 30-Jan-1994  briggs Fixup scsi references and add ISOFS and PROCFS options. Clean up swap/root
definitions, too.
 1.5 21-Dec-1993  briggs Add Apple Ethernet to GENERIC and files. Also add asc.c to files
for sound support.
 1.4 15-Dec-1993  briggs Let's try DDB...
 1.3 02-Dec-1993  briggs Migrate to new MACHINE definition (mac -> mac68k).
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.15.2.2 11-Aug-1994  mycroft update from trunk
 1.15.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.51.2.3 30-Jan-1997  thorpej update from trunk
 1.51.2.2 18-Jan-1997  thorpej Update from trunk.
 1.51.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.55.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.65.2.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.65.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.68.2.1 05-Nov-1997  mellon Pull rev 1.69 up from trunk (scottr)
 1.85.8.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.85.6.2 02-Aug-1999  thorpej Update from trunk.
 1.85.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.85.4.5 05-Jul-2000  he Pull up revision 1.105 (requested by sommerfeld):
Comment out EON ISO-over-ip tunneling pseudo-driver, and document
as broken/fragile. Unlikely to be of much use, and confuses new
users when their system crashes when they, or their dhclient
stumble over it. See PR#10500 and PR#8994 for the gory details.
 1.85.4.4 27-Jun-2000  he Pull up revision 1.101 (requested by fredb):
Enable rnd pseudo-device in mac68k GENERIC kernel.
 1.85.4.3 03-Jun-2000  he Apply patch (requested by he):
Disable the UNION file system, to avoid a repeat of the 1.4.1
and 1.4.2 LAST_MINUTE changes. It is reportedly buggy, and can
be used by ordinary users to crash the system.
 1.85.4.2 08-Nov-1999  cgd pull up rev 1.90 from trunk (requested by scottr):
Add Coda support to NetBSD/mac68k.
 1.85.4.1 21-Jun-1999  perry pullup 1.86->1.87 (briggs): Comment out DISABLE_EXT_CACHE
 1.85.2.18 13-Feb-2000  scottr WSDISPLAY_COMPAT_ITE has been removed in favor of the ite pseudo-device.
 1.85.2.17 13-Feb-2000  scottr Development on this branch is winding down; restore the default
root file system configuration.
 1.85.2.16 13-Feb-2000  scottr Fix some whitespace botches.
 1.85.2.15 13-Feb-2000  scottr Add ite console emulation.
 1.85.2.14 13-Feb-2000  scottr Sync with main branch.
 1.85.2.13 28-Nov-1999  scottr Sync with main branch.
 1.85.2.12 23-Nov-1999  scottr Add console support for all common color depths.
 1.85.2.11 21-Nov-1999  scottr Add RCONS_16BPP to support the raster console on 16-bit displays.
 1.85.2.10 20-Nov-1999  scottr The grf pseudo-device obviates WSDISPLAY_COMPAT_GRF; translate tests on the latter to
tests against NGRF instead.
 1.85.2.9 15-Nov-1999  scottr Implement a more straightforward approach to grf emulation.
 1.85.2.8 09-Nov-1999  scottr Sync with main branch.
 1.85.2.7 01-Nov-1999  scottr Sync with main branch.
 1.85.2.6 15-Jun-1999  scottr Sync with main branch.
 1.85.2.5 16-May-1999  scottr Sync with main branch.
 1.85.2.4 11-Mar-1999  scottr Update for ite/grf compatibility
 1.85.2.3 08-Mar-1999  scottr Update for wsdisplay/wscons support.
 1.85.2.2 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.85.2.1 05-Mar-1999  scottr file GENERIC was added on branch scottr-mac68k-wscons on 1999-03-05 08:24:23 +0000
 1.89.8.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.89.8.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.89.4.1 15-Nov-1999  fvdl Sync with -current
 1.89.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.89.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.100.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.102.2.4 01-May-2001  he Pull up revision 1.109 (requested by he):
Add pseudo-device vlan.
Make sure "rnd is EXPERIMENTAL" comment is removed.
 1.102.2.3 06-Aug-2000  briggs Pullup approved by thorpej --
Add nubus-based SMC91cxx ethernet support for the mac68k.
 1.102.2.2 06-Jul-2000  sommerfeld Comment out EON ISO-over-ip tunneling pseudo-driver, and document as
broken/fragile. Unlikely to be of much use, and confuses new users
when their system crashes when they, or their dhclient stumble over
it. See kern/10500, kern/8994 for the gory details.
[pull up approved by thorpej]
 1.102.2.1 23-Jun-2000  fvdl As on the trunk, update these for the move of ffs_softdep.c into the
kernel source itself. Remove prefix construction, and add the SOFTDEP
option to GENERIC kernels.
 1.111.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.111.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.111.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.111.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.111.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.111.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.113.6.10 11-Dec-2002  thorpej Sync with HEAD.
 1.113.6.9 11-Nov-2002  nathanw Catch up to -current
 1.113.6.8 18-Oct-2002  nathanw Catch up to -current.
 1.113.6.7 01-Aug-2002  nathanw Catch up to -current.
 1.113.6.6 20-Jun-2002  nathanw Catch up to -current.
 1.113.6.5 17-Apr-2002  nathanw Catch up to -current.
 1.113.6.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.113.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.113.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.113.6.1 01-Sep-2001  nathanw file GENERIC was added on branch nathanw_sa on 2002-01-08 00:25:56 +0000
 1.126.4.2 24-Oct-2002  lukem Pull up upgrade to IPfilter 3.4.29 (requested by martti in ticket #905).
Affected files & revisions:

dist/ipf/HISTORY 1.14
dist/ipf/fils.c 1.17-1.21
dist/ipf/ipf.c 1.11-1.13
dist/ipf/ipfs.c 1.8-1.10
dist/ipf/ipft_ef.c 1.6-1.7
dist/ipf/ipft_td.c 1.6-1.7
dist/ipf/ipft_tx.c 1.7-1.8
dist/ipf/ipmon.c 1.12-1.17
dist/ipf/ipnat.c 1.11-1.12
dist/ipf/ipsend/ip_var.h 1.2
dist/ipf/ipsend/ipsend.c 1.8
dist/ipf/ipsend/iptests.c 1.5
dist/ipf/ipt.c 1.8-1.10
dist/ipf/kmem.c 1.8-1.10
dist/ipf/man/ipf.4 1.10
dist/ipf/man/ipf.5 1.8
dist/ipf/man/ipftest.1 1.3
dist/ipf/man/ipmon.8 1.10
dist/ipf/man/ipnat.5 1.9-1.10
dist/ipf/man/ipnat.8 1.4
dist/ipf/misc.c 1.7
dist/ipf/natparse.c 1.10
dist/ipf/parse.c 1.13
dist/ipf/printnat.c 1.8-1.10
dist/ipf/relay.c 1.5-1.6
dist/ipf/rules/example.9 1.2
etc/rc.d/ipnat 1.8
regress/sys/kern/ipf/Makefile 1.3-1.4
regress/sys/kern/ipf/dotest6 1.2
regress/sys/kern/ipf/expected/f13 1.1.1.2
regress/sys/kern/ipf/expected/i12 1.1.1.1
regress/sys/kern/ipf/expected/ni3 1.1.1.1
regress/sys/kern/ipf/expected/ni5 1.2
regress/sys/kern/ipf/input/f13 1.1.1.2
regress/sys/kern/ipf/input/ipv6.1 1.1.1.1
regress/sys/kern/ipf/input/ni3 1.1.1.1
regress/sys/kern/ipf/regress/i12 1.1.1.1
regress/sys/kern/ipf/regress/ipv6.1 1.1.1.1
regress/sys/kern/ipf/regress/ni3.ipf 1.1.1.1
regress/sys/kern/ipf/regress/ni3.nat 1.1.1.1
sys/arch/alpha/conf/ALPHA 1.169,1.171
sys/arch/amiga/conf/GENERIC 1.185-1.186
sys/arch/arc/conf/GENERIC 1.71-1.72
sys/arch/atari/conf/GENERIC.in 1.24-1.25
sys/arch/cats/conf/GENERIC 1.31-1.32
sys/arch/cobalt/conf/GENERIC 1.34-1.35
sys/arch/hp300/conf/GENERIC 1.83-1.84
sys/arch/i386/conf/CARDBUS 1.66-1.67
sys/arch/i386/conf/GENERIC 1.510,1.512
sys/arch/i386/conf/GENERIC_LAPTOP 1.58-1.59
sys/arch/i386/conf/GENERIC_PS2TINY 1.19-1.20
sys/arch/i386/conf/GENERIC_TINY 1.47-1.48
sys/arch/luna68k/conf/GENERIC 1.33-1.33
sys/arch/mac68k/conf/GENERIC 1.130-1.131
sys/arch/mac68k/conf/GENERICSBC 1.21-1.22
sys/arch/mac68k/conf/SMALLRAM 1.4-1.5
sys/arch/macppc/conf/GENERIC 1.142-1.143
sys/arch/mipsco/conf/GENERIC 1.21-1.22
sys/arch/mmeye/conf/GENERIC 1.44-1.45
sys/arch/news68k/conf/GENERIC 1.36-1.37
sys/arch/news68k/conf/GENERIC_TINY 1.18-1.19
sys/arch/newsmips/conf/GENERIC 1.50-1.51
sys/arch/ofppc/conf/GENERIC 1.56-1.57
sys/arch/pmax/conf/GENERIC 1.103-1.104
sys/arch/prep/conf/GENERIC 1.55-1.56
sys/arch/sbmips/conf/GENERIC 1.11-1.12
sys/arch/sgimips/conf/GENERIC 1.7-1.8
sys/arch/sparc/conf/GENERIC 1.138-1.139
sys/arch/sparc64/conf/GENERIC32 1.46-1.47
sys/arch/vax/conf/GENERIC 1.102-1.103
sys/arch/x68k/conf/ALL 1.55-1.56
sys/arch/x68k/conf/GENERIC 1.80-1.81
sys/lkm/netinet/if_ipl/mln_ipl.c 1.29
sys/netinet/fil.c 1.57-1.58
sys/netinet/ip_auth.c 1.29-1.30
sys/netinet/ip_compat.h 1.30-1.31
sys/netinet/ip_fil.c 1.81-1.86
sys/netinet/ip_fil.h 1.46-1.49
sys/netinet/ip_frag.c 1.33-1.34
sys/netinet/ip_frag.h 1.18
sys/netinet/ip_ftp_pxy.c 1.25-1.26
sys/netinet/ip_h323_pxy.c 1.5-1.6
sys/netinet/ip_log.c 1.22-1.23
sys/netinet/ip_nat.c 1.51-1.53
sys/netinet/ip_nat.h 1.27
sys/netinet/ip_netbios_pxy.c 1.4
sys/netinet/ip_proxy.c 1.35-1.36
sys/netinet/ip_proxy.h 1.18
sys/netinet/ip_state.c 1.41-1.42
sys/netinet/ip_state.h 1.23
sys/netinet/ipl.h 1.14
 1.126.4.1 01-Aug-2002  lukem Pull up revision 1.127 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.126.2.2 16-Jul-2002  gehenna catch up with -current.
 1.126.2.1 14-Jul-2002  gehenna catch up with -current.
 1.138.2.10 11-Dec-2005  christos Sync with head.
 1.138.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.138.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.138.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.138.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.138.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.138.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.138.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.138.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.138.2.1 03-Aug-2004  skrll Sync with HEAD
 1.141.2.4 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.141.2.3 15-Jul-2004  he branches: 1.141.2.3.2; 1.141.2.3.4;
Pull up revision 1.147 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.141.2.2 02-Jul-2004  he Pull up revision 1.146 (requested by bouyer in ticket #573):
Add options P1003_1B_SEMAPHORE to all GENERIC-like kernel
config files where SYSV* options were already present
(commented out if the SYSV* options are commented out).
Fixes PR#25897 and PR#25898.
 1.141.2.1 30-Jun-2004  jdc Pull up revision 1.145 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.141.2.3.4.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.141.2.3.2.1 11-Aug-2007  bouyer Pull up following revision(s) (requested by adrianp in ticket #11356):
sys/arch/acorn32/conf/GENERIC 1.80 via patch
sys/arch/amd64/conf/GENERIC 1.154 via patch
sys/arch/amiga/conf/GENERIC.in 1.61 via patch
sys/arch/arc/conf/GENERIC 1.148 via patch
sys/arch/atari/conf/GENERIC.in 1.68 via patch
sys/arch/cats/conf/GENERIC 1.116 via patch
sys/arch/hp300/conf/GENERIC 1.141 via patch
sys/arch/hp700/conf/GENERIC patch
sys/arch/i386/conf/GENERIC 1.840 via patch
sys/arch/i386/conf/GENERIC_LAPTOP 1.239 via patch
sys/arch/i386/conf/GENERIC.MPACPI patch
sys/arch/mac68k/conf/GENERIC 1.182 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x 1.68 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x 1.66 via patch
sys/arch/sparc/conf/GENERIC 1.200 via patch
sys/arch/sparc64/conf/GENERIC32 patch
sys/arch/xen/conf/GENERIC patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.149.4.1 29-Apr-2005  kent sync with -current
 1.151.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.151.2.1 12-Feb-2005  yamt sync with head.
 1.156.2.3 28-Aug-2007  ghen Pull up following revision(s) (requested by adrianp in ticket #1826):
sys/arch/hp300/conf/GENERIC: revision 1.141 via patch
sys/arch/amd64/conf/GENERIC: revision 1.154 via patch
sys/arch/cats/conf/GENERIC: revision 1.116 via patch
sys/arch/arc/conf/GENERIC: revision 1.148 via patch
sys/arch/acorn32/conf/GENERIC: revision 1.80 via patch
sys/arch/sparc/conf/GENERIC: revision 1.200 via patch
sys/arch/sparc64/conf/GENERIC: revision 1.88 via patch
sys/arch/atari/conf/GENERIC.in: revision 1.68 via patch
sys/arch/amiga/conf/GENERIC: revision 1.248 via patch
sys/arch/i386/conf/GENERIC.MPACPI: patch
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.239 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.66 via patch
sys/arch/i386/conf/GENERIC: revision 1.840 via patch
sys/arch/amiga/conf/GENERIC.in: revision 1.61 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.68 via patch
sys/arch/mac68k/conf/GENERIC: revision 1.182 via patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net&#64;
Ok'ed by core&#64;
 1.156.2.2 14-Aug-2005  riz branches: 1.156.2.2.2; 1.156.2.2.4;
Pull up revision 1.160 (requested by hubertf in ticket #625):
Add support for reading cloop2 compressed filesystem images,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
 1.156.2.1 18-Jul-2005  riz Pull up revision 1.159 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.156.2.2.4.1 28-Aug-2007  ghen Pull up following revision(s) (requested by adrianp in ticket #1826):
sys/arch/hp300/conf/GENERIC: revision 1.141 via patch
sys/arch/amd64/conf/GENERIC: revision 1.154 via patch
sys/arch/cats/conf/GENERIC: revision 1.116 via patch
sys/arch/arc/conf/GENERIC: revision 1.148 via patch
sys/arch/acorn32/conf/GENERIC: revision 1.80 via patch
sys/arch/sparc/conf/GENERIC: revision 1.200 via patch
sys/arch/sparc64/conf/GENERIC: revision 1.88 via patch
sys/arch/atari/conf/GENERIC.in: revision 1.68 via patch
sys/arch/amiga/conf/GENERIC: revision 1.248 via patch
sys/arch/i386/conf/GENERIC.MPACPI: patch
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.239 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.66 via patch
sys/arch/i386/conf/GENERIC: revision 1.840 via patch
sys/arch/amiga/conf/GENERIC.in: revision 1.61 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.68 via patch
sys/arch/mac68k/conf/GENERIC: revision 1.182 via patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.156.2.2.2.1 28-Aug-2007  ghen Pull up following revision(s) (requested by adrianp in ticket #1826):
sys/arch/hp300/conf/GENERIC: revision 1.141 via patch
sys/arch/amd64/conf/GENERIC: revision 1.154 via patch
sys/arch/cats/conf/GENERIC: revision 1.116 via patch
sys/arch/arc/conf/GENERIC: revision 1.148 via patch
sys/arch/acorn32/conf/GENERIC: revision 1.80 via patch
sys/arch/sparc/conf/GENERIC: revision 1.200 via patch
sys/arch/sparc64/conf/GENERIC: revision 1.88 via patch
sys/arch/atari/conf/GENERIC.in: revision 1.68 via patch
sys/arch/amiga/conf/GENERIC: revision 1.248 via patch
sys/arch/i386/conf/GENERIC.MPACPI: patch
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.239 via patch
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.66 via patch
sys/arch/i386/conf/GENERIC: revision 1.840 via patch
sys/arch/amiga/conf/GENERIC.in: revision 1.61 via patch
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.68 via patch
sys/arch/mac68k/conf/GENERIC: revision 1.182 via patch
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.158.2.5 21-Jan-2008  yamt sync with head
 1.158.2.4 15-Nov-2007  yamt sync with head.
 1.158.2.3 03-Sep-2007  yamt sync with head.
 1.158.2.2 30-Dec-2006  yamt sync with head.
 1.158.2.1 21-Jun-2006  yamt sync with head.
 1.168.4.1 09-Sep-2006  rpaulo sync with head
 1.168.2.1 18-Feb-2006  yamt sync with head.
 1.169.2.1 22-Apr-2006  simonb Sync with head.
 1.171.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.171.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.171.2.3 03-Sep-2006  yamt sync with head.
 1.171.2.2 11-Aug-2006  yamt sync with head
 1.171.2.1 01-Apr-2006  yamt sync with head.
 1.172.4.1 13-Jul-2006  gdamore Merge from HEAD.
 1.173.2.2 22-Sep-2006  riz Pull up following revision(s) (requested by tsutsui in ticket #170):
sys/arch/sparc64/conf/GENERIC: revision 1.63
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.55
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.54
sys/arch/next68k/conf/GENERIC: revision 1.105
sys/arch/ews4800mips/conf/GENERIC: revision 1.12
sys/arch/arc/conf/GENERIC: revision 1.142
sys/arch/sun3/conf/GENERIC3X: revision 1.91
sys/arch/amd64/conf/GENERIC: revision 1.105
sys/arch/sun2/conf/GENERIC: revision 1.58
sys/arch/amiga/conf/GENERIC.in: revision 1.55
sys/arch/mac68k/conf/GENERIC: revision 1.175
sys/arch/acorn26/conf/GENERIC: revision 1.46
sys/arch/shark/conf/GENERIC: revision 1.65
sys/arch/cesfic/conf/GENERIC: revision 1.45
sys/arch/sandpoint/conf/GENERIC: revision 1.36
sys/arch/iyonix/conf/GENERIC: revision 1.32
sys/arch/mvme68k/conf/GENERIC: revision 1.69
sys/arch/evbarm/conf/ARMADILLO210: revision 1.3
sys/arch/vax/conf/GENERIC: revision 1.154
sys/arch/mipsco/conf/GENERIC: revision 1.61
sys/arch/evbarm/conf/ARMADILLO9: revision 1.14
sys/arch/cobalt/conf/GENERIC: revision 1.103
sys/arch/ofppc/conf/GENERIC: revision 1.94
sys/arch/hp700/conf/GENERIC: revision 1.69
sys/arch/playstation2/conf/GENERIC: revision 1.8
sys/arch/dreamcast/conf/GENERIC: revision 1.73
sys/arch/news68k/conf/GENERIC: revision 1.81
sys/arch/macppc/conf/GENERIC: revision 1.234
sys/arch/hp300/conf/GENERIC: revision 1.134
sys/arch/mmeye/conf/GENERIC: revision 1.83
sys/arch/ibmnws/conf/GENERIC: revision 1.26
sys/arch/cats/conf/GENERIC: revision 1.109
sys/arch/sparc/conf/GENERIC: revision 1.191
sys/arch/pdp10/conf/GENERIC: revision 1.27
sys/arch/acorn32/conf/GENERIC: revision 1.75
sys/arch/luna68k/conf/GENERIC: revision 1.74
sys/arch/bebox/conf/GENERIC: revision 1.101
sys/arch/pmax/conf/GENERIC: revision 1.148
sys/arch/x68k/conf/GENERIC: revision 1.130
sys/arch/sun3/conf/GENERIC: revision 1.134
sys/arch/prep/conf/GENERIC: revision 1.126
sys/arch/alpha/conf/GENERIC: revision 1.293
sys/arch/newsmips/conf/GENERIC: revision 1.94
sys/arch/netwinder/conf/GENERIC: revision 1.83
sys/arch/hpcsh/conf/GENERIC: revision 1.69
sys/arch/sbmips/conf/GENERIC: revision 1.55
sys/arch/pc532/conf/GENERIC: revision 1.65
sys/arch/hpcmips/conf/GENERIC: revision 1.192
Remove obsolete #options VERIFIED_EXEC, found by grep(1).
 1.173.2.1 14-Aug-2006  tron Pull up following revision(s) (requested by elad in ticket #17):
sys/arch/sparc/conf/KRUPS: revision 1.38
sys/arch/i386/conf/XEN2_DOMU: revision 1.2
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.197
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.53
sys/arch/evbsh5/conf/SIMULATOR: revision 1.12
sys/arch/sparc/conf/MRCOFFEE: revision 1.17
sys/arch/next68k/conf/GENERIC: revision 1.104
sys/arch/i386/conf/VIRTUALPC: revision 1.44
sys/arch/ews4800mips/conf/GENERIC: revision 1.11
sys/arch/evbsh5/conf/CAYMAN: revision 1.23
sys/arch/arc/conf/GENERIC: revision 1.141
sys/arch/amd64/conf/GENERIC: revision 1.103
sys/arch/sun3/conf/GENERIC3X: revision 1.90
sys/arch/evbarm/conf/HDL_G: revision 1.3
sys/arch/sun2/conf/GENERIC: revision 1.57
sys/arch/news68k/conf/GENERIC_TINY: revision 1.51
sys/arch/evbppc/conf/EXPLORA451: revision 1.27
sys/arch/amiga/conf/GENERIC.in: revision 1.54
sys/arch/mac68k/conf/GENERIC: revision 1.174
sys/arch/acorn26/conf/GENERIC: revision 1.45
sys/arch/shark/conf/GENERIC: revision 1.64
sys/arch/cesfic/conf/GENERIC: revision 1.44
sys/arch/mvme68k/conf/GENERIC: revision 1.68
sys/arch/i386/conf/XEN2_DOM0: revision 1.4
sys/arch/atari/conf/GENERIC.in: revision 1.63
sys/arch/amiga/conf/GENERIC: revision 1.240
sys/arch/i386/conf/LAMB: revision 1.65
sys/arch/i386/conf/GENERIC: revision 1.773
sys/arch/acorn32/conf/EB7500ATX: revision 1.26
sys/arch/x68k/conf/GENERIC: revision 1.128
sys/arch/vax/conf/GENERIC: revision 1.153
sys/arch/atari/conf/ATARITT: revision 1.81
sys/arch/mipsco/conf/GENERIC: revision 1.60
sys/arch/cobalt/conf/GENERIC: revision 1.101
sys/arch/evbarm/conf/ARMADILLO9: revision 1.13
sys/arch/ofppc/conf/GENERIC: revision 1.93
sys/arch/atari/conf/MILAN-PCIIDE: revision 1.51
sys/arch/arc/conf/RPC44: revision 1.26
sys/arch/sparc64/conf/GENERIC: revision 1.59
sys/arch/i386/conf/XEN3_DOMU: revision 1.2
sys/arch/hp700/conf/GENERIC: revision 1.68
sys/arch/atari/conf/MILAN-ISAIDE: revision 1.47
sys/arch/macppc/conf/GENERIC: revision 1.231
sys/arch/dreamcast/conf/GENERIC: revision 1.72
sys/arch/news68k/conf/GENERIC: revision 1.80
sys/arch/hp300/conf/GENERIC: revision 1.133
sys/arch/mmeye/conf/GENERIC: revision 1.82
sys/arch/macppc/conf/MAMBO: revision 1.2
sys/arch/cats/conf/GENERIC: revision 1.107
sys/arch/atari/conf/FALCON: revision 1.79
sys/arch/acorn32/conf/GENERIC: revision 1.71
sys/arch/sparc/conf/GENERIC: revision 1.190
sys/arch/news68k/conf/LIBERO: revision 1.40
sys/arch/amiga/conf/DRACO: revision 1.114
sys/arch/cobalt/conf/INSTALL: revision 1.23
sys/arch/luna68k/conf/GENERIC: revision 1.73
sys/arch/bebox/conf/GENERIC: revision 1.100
sys/arch/pmax/conf/GENERIC: revision 1.147
sys/arch/amiga/conf/WSCONS: revision 1.52
sys/arch/macppc/conf/POWERMAC_G5: revision 1.2
sys/arch/alpha/conf/ALPHA: revision 1.218
sys/arch/sun3/conf/GENERIC: revision 1.133
sys/arch/prep/conf/GENERIC: revision 1.124
sys/arch/alpha/conf/GENERIC: revision 1.291
sys/arch/atari/conf/HADES: revision 1.71
sys/arch/newsmips/conf/GENERIC: revision 1.93
sys/arch/netwinder/conf/GENERIC: revision 1.82
sys/arch/hpcmips/conf/GENERIC: revision 1.190
sys/arch/amiga/conf/AMIGA: revision 1.98
sys/arch/sbmips/conf/GENERIC: revision 1.54
sys/arch/pc532/conf/GENERIC: revision 1.64
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.53
Disable SYSTRACE by default on all kernels (discussed with core)
 1.176.4.1 10-Dec-2006  yamt sync with head.
 1.176.2.1 18-Nov-2006  ad Sync with head.
 1.177.8.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.177.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.177.2.3 11-May-2009  bouyer Pull up following revision(s) (requested by hauke in ticket #1315):
sys/arch/mac68k/obio/esp.c: revision 1.51 via patch
sys/arch/mac68k/conf/GENERIC: revision 1.188
Add LOCKDEBUG option, commented out, so that people know it's there.
esp_quick_dma_go() gets called from the MI ncr53c9x_intr() handler,
which protects itself against multiple invocation with a
simple_lock. Follow the example of ncr53c9x_poll() for servicing an
interrupt that came while we run in splhigh(), and 'manually' unlock
the MI handler for calling ncr53c9x_intr().
Fixes PR mac68k/38758.
 1.177.2.2 25-Aug-2007  liamjfoy Pull up following revision(s) (requested by adrianp in ticket #820):
sys/arch/hp300/conf/GENERIC: revision 1.141
sys/arch/alpha/conf/GENERIC: revision 1.315
sys/arch/amd64/conf/GENERIC: revision 1.154
sys/arch/cats/conf/GENERIC: revision 1.116
sys/arch/arc/conf/GENERIC: revision 1.148
sys/arch/acorn32/conf/GENERIC: revision 1.80
sys/arch/sparc/conf/GENERIC: revision 1.200
sys/arch/sparc64/conf/GENERIC: revision 1.88
sys/arch/atari/conf/GENERIC.in: revision 1.68
sys/arch/amiga/conf/GENERIC: revision 1.248
sys/arch/i386/conf/GENERIC_LAPTOP: revision 1.239
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.66
sys/arch/i386/conf/GENERIC: revision 1.840
sys/arch/amiga/conf/GENERIC.in: revision 1.61
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.68
sys/arch/mac68k/conf/GENERIC: revision 1.182
Remove iso(4) from GENERIC kernels, as discussed on tech-net@
Ok'ed by core@
 1.177.2.1 05-Jun-2007  bouyer Pull up following revision(s) (requested by martin in ticket #699):
sys/arch/hpcmips/conf/GENERIC: revision 1.196
sys/arch/hp700/conf/GENERIC: revision 1.74
sys/arch/i386/conf/GENERIC: revision 1.831
sys/arch/next68k/conf/GENERIC: revision 1.108
sys/arch/alpha/conf/GENERIC: revision 1.313
sys/arch/arc/conf/GENERIC: revision 1.146
sys/arch/cats/conf/GENERIC: revision 1.115
sys/arch/ews4800mips/conf/GENERIC: revision 1.18
sys/arch/landisk/conf/GENERIC: revision 1.8 via patch
sys/arch/sparc64/conf/GENERIC: revision 1.85
sys/arch/pmax/conf/GENERIC: revision 1.152
sys/arch/iyonix/conf/GENERIC: revision 1.38 via patch
sys/arch/amiga/conf/GENERIC: revision 1.245
sys/arch/vax/conf/GENERIC: revision 1.157
sys/arch/prep/conf/GENERIC: revision 1.135
sys/arch/pc532/conf/GENERIC: revision 1.70
sys/arch/sbmips/conf/GENERIC: revision 1.61
sys/arch/mipsco/conf/GENERIC: revision 1.65
sys/arch/cobalt/conf/GENERIC: revision 1.108
sys/arch/ofppc/conf/GENERIC: revision 1.98
sys/arch/amd64/conf/GENERIC: revision 1.148
sys/arch/acorn26/conf/GENERIC: revision 1.50
sys/arch/dreamcast/conf/GENERIC: revision 1.78
sys/arch/mac68k/conf/GENERIC: revision 1.181
sys/arch/hp300/conf/GENERIC: revision 1.139
sys/arch/mmeye/conf/GENERIC: revision 1.88
sys/arch/news68k/conf/GENERIC: revision 1.88
sys/arch/mvme68k/conf/GENERIC: revision 1.71
sys/arch/acorn32/conf/GENERIC: revision 1.79
sys/arch/sparc/conf/GENERIC: revision 1.199
sys/arch/luna68k/conf/GENERIC: revision 1.78
sys/arch/bebox/conf/GENERIC: revision 1.105
sys/arch/macppc/conf/GENERIC: revision 1.256 via patch
sys/arch/x68k/conf/GENERIC: revision 1.134
sys/arch/sun3/conf/GENERIC: revision 1.138
sys/arch/newsmips/conf/GENERIC: revision 1.98
Add pseudo-device agr to all GENERIC kernels where it might make sense
(commented out in some).
 1.179.10.2 03-Oct-2007  garbled Sync with HEAD
 1.179.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.179.4.1 11-Jul-2007  mjf Sync with head.
 1.179.2.4 03-Dec-2007  ad Sync with HEAD.
 1.179.2.3 09-Oct-2007  ad Sync with head.
 1.179.2.2 20-Aug-2007  ad Sync with HEAD.
 1.179.2.1 09-Jun-2007  ad Sync with head.
 1.181.8.3 04-Nov-2007  jmcneill Sync with HEAD.
 1.181.8.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.181.8.1 09-Aug-2007  jmcneill Sync with HEAD.
 1.181.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.181.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.181.2.1 07-Aug-2007  matt Sync with HEAD.
 1.183.6.1 13-Nov-2007  bouyer Sync with HEAD
 1.183.2.2 09-Jan-2008  matt sync with HEAD
 1.183.2.1 06-Nov-2007  matt sync with HEAD
 1.185.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.185.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.186.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.186.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.186.10.3 11-Aug-2010  yamt sync with head.
 1.186.10.2 11-Mar-2010  yamt sync with head
 1.186.10.1 04-May-2009  yamt sync with head.
 1.186.8.1 04-Jun-2008  yamt sync with head
 1.186.6.3 17-Jan-2009  mjf Sync with HEAD.
 1.186.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.186.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.189.4.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.189.4.1 19-Oct-2008  haad Sync with HEAD.
 1.191.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.191.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.195.4.3 21-Apr-2011  rmind sync with head
 1.195.4.2 05-Mar-2011  rmind sync with head
 1.195.4.1 30-May-2010  rmind sync with head
 1.195.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.195.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.199.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.199.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.202.2.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.202.2.2 30-Oct-2012  yamt sync with head
 1.202.2.1 17-Apr-2012  yamt sync with head
 1.203.2.2 11-Mar-2012  mrg sync to latest -current
 1.203.2.1 18-Feb-2012  mrg merge to -current.
 1.207.2.4 03-Dec-2017  jdolecek update from HEAD
 1.207.2.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.207.2.2 23-Jun-2013  tls resync from head
 1.207.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.213.2.1 28-Aug-2013  rmind sync with head
 1.215.4.1 10-Aug-2014  tls Rebase.
 1.216.2.2 18-Nov-2014  snj Pull up following revision(s) (requested by manu in ticket #251):
sys/arch/acorn26/conf/GENERIC: revision 1.81
sys/arch/acorn32/conf/GENERIC: revision 1.116
sys/arch/alpha/conf/GENERIC: revision 1.362
sys/arch/amd64/conf/ALL: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.404
sys/arch/amd64/conf/XEN3_DOM0: revision 1.112
sys/arch/amd64/conf/XEN3_DOMU: revision 1.60
sys/arch/amiga/conf/GENERIC.in: revision 1.129
sys/arch/amiga/conf/GENERIC: revision 1.311
sys/arch/amigappc/conf/GENERIC: revision 1.24
sys/arch/arc/conf/GENERIC: revision 1.184
sys/arch/bebox/conf/GENERIC: revision 1.145
sys/arch/cats/conf/GENERIC: revision 1.155
sys/arch/cesfic/conf/GENERIC: revision 1.65
sys/arch/cobalt/conf/GENERIC: revision 1.147
sys/arch/dreamcast/conf/GENERIC: revision 1.121
sys/arch/emips/conf/GENERIC: revision 1.15
sys/arch/epoc32/conf/GENERIC: revision 1.8
sys/arch/ews4800mips/conf/GENERIC: revision 1.51
sys/arch/hp300/conf/GENERIC: revision 1.190
sys/arch/hpcmips/conf/GENERIC: revision 1.229
sys/arch/hpcsh/conf/GENERIC: revision 1.106
sys/arch/hppa/conf/GENERIC: revision 1.6
sys/arch/i386/conf/ALL: revision 1.389
sys/arch/i386/conf/GENERIC: revision 1.1118
sys/arch/i386/conf/XEN3_DOM0: revision 1.93
sys/arch/i386/conf/XEN3_DOMU: revision 1.65
sys/arch/ibmnws/conf/GENERIC: revision 1.46
sys/arch/iyonix/conf/GENERIC: revision 1.88
sys/arch/landisk/conf/GENERIC: revision 1.45
sys/arch/luna68k/conf/GENERIC: revision 1.119
sys/arch/mac68k/conf/GENERIC: revision 1.220
sys/arch/macppc/conf/GENERIC: revision 1.320
sys/arch/macppc/conf/MAMBO: revision 1.24
sys/arch/macppc/conf/POWERMAC_G5: revision 1.25
sys/arch/mipsco/conf/GENERIC: revision 1.88
sys/arch/mmeye/conf/GENERIC: revision 1.120
sys/arch/mvme68k/conf/GENERIC: revision 1.94
sys/arch/mvmeppc/conf/GENERIC: revision 1.24
sys/arch/netwinder/conf/GENERIC: revision 1.126
sys/arch/news68k/conf/GENERIC: revision 1.125
sys/arch/newsmips/conf/GENERIC: revision 1.129
sys/arch/next68k/conf/GENERIC: revision 1.139
sys/arch/ofppc/conf/GENERIC: revision 1.157
sys/arch/pmax/conf/GENERIC64: revision 1.21
sys/arch/pmax/conf/GENERIC: revision 1.185
sys/arch/prep/conf/GENERIC: revision 1.174
sys/arch/rs6000/conf/GENERIC: revision 1.33
sys/arch/sandpoint/conf/GENERIC: revision 1.88
sys/arch/sbmips/conf/GENERIC: revision 1.101
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.28
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.104
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.106
sys/arch/shark/conf/GENERIC: revision 1.121
sys/arch/sparc/conf/GENERIC: revision 1.248
sys/arch/sparc/conf/TADPOLE3GX: revision 1.65
sys/arch/sparc64/conf/GENERIC: revision 1.177
sys/arch/sparc64/conf/NONPLUS64: revision 1.44
sys/arch/sun2/conf/GENERIC: revision 1.94
sys/arch/sun3/conf/GENERIC: revision 1.171
sys/arch/vax/conf/GENERIC: revision 1.193
sys/arch/vax/conf/VAX780: revision 1.19
sys/arch/x68k/conf/GENERIC: revision 1.179
sys/arch/zaurus/conf/GENERIC: revision 1.65
sys/ufs/files.ufs: revision 1.38
Remove unused extended attributes kernel options

As Masao Uebayashi pointed to me, UFS_EXTATTR_AUTOSTART, LFS_EXTATTR_AUTOSTART
and UFS_EXTATTR_AUTOCREATE are not used anywhere in the code. Remove them
as they have been obsolete for a long time:
UFS_EXTATTR_AUTOSTART was replaced by mount -o extattr
LFS_EXTATTR_AUTOSTART was created to match obsolete UFS_EXTATTR_AUTOSTART
UFS_EXTATTR_AUTOCREATE was replaced by sysctl vfs.ffs.extattr_autocreate
 1.216.2.1 14-Nov-2014  martin Pull up following revision(s) (requested by manu in ticket #232):
sys/arch/next68k/conf/GENERIC: revision 1.138
sys/arch/cobalt/conf/GENERIC: revision 1.146
sys/arch/mvme68k/conf/GENERIC: revision 1.93
sys/arch/vax/conf/VAX780: revision 1.18
sys/arch/newsmips/conf/GENERIC: revision 1.128
sys/arch/luna68k/conf/GENERIC: revision 1.118
sys/arch/sbmips/conf/GENERIC: revision 1.100
sys/arch/pmax/conf/GENERIC: revision 1.184
sys/arch/alpha/conf/GENERIC: revision 1.361
sys/arch/sparc64/conf/GENERIC: revision 1.176
sys/arch/sun3/conf/GENERIC: revision 1.170
sys/arch/shark/conf/GENERIC: revision 1.120
sys/arch/landisk/conf/GENERIC: revision 1.44
sys/arch/bebox/conf/GENERIC: revision 1.144
sys/arch/sparc64/conf/NONPLUS64: revision 1.43
sys/arch/sandpoint/conf/GENERIC: revision 1.87
sys/arch/emips/conf/GENERIC: revision 1.14
sys/arch/amd64/conf/XEN3_DOM0: revision 1.111
sys/arch/dreamcast/conf/GENERIC: revision 1.120
sys/arch/cesfic/conf/GENERIC: revision 1.64
sys/arch/mmeye/conf/GENERIC: revision 1.119
sys/arch/epoc32/conf/GENERIC: revision 1.7
sys/arch/x68k/conf/GENERIC: revision 1.178
sys/arch/iyonix/conf/GENERIC: revision 1.87
sys/arch/sun2/conf/GENERIC: revision 1.93
sys/arch/ews4800mips/conf/GENERIC: revision 1.50
sys/arch/amd64/conf/XEN3_DOMU: revision 1.59
sys/arch/acorn26/conf/GENERIC: revision 1.80
sys/arch/acorn32/conf/GENERIC: revision 1.115
sys/arch/macppc/conf/POWERMAC_G5: revision 1.24
sys/arch/i386/conf/GENERIC: revision 1.1117
sys/arch/arc/conf/GENERIC: revision 1.183
sys/arch/cats/conf/GENERIC: revision 1.154
sys/arch/amiga/conf/GENERIC.in: revision 1.128
sys/arch/zaurus/conf/GENERIC: revision 1.64
sys/arch/netwinder/conf/GENERIC: revision 1.125
sys/arch/hppa/conf/GENERIC: revision 1.5
sys/arch/mvmeppc/conf/GENERIC: revision 1.23
sys/arch/macppc/conf/GENERIC: revision 1.319
sys/arch/amiga/conf/GENERIC: revision 1.310
sys/arch/pmax/conf/GENERIC64: revision 1.20
sys/arch/macppc/conf/MAMBO: revision 1.23
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.27
sys/arch/amigappc/conf/GENERIC: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.403
sys/arch/ofppc/conf/GENERIC: revision 1.156
sys/arch/mac68k/conf/GENERIC: revision 1.219
sys/arch/i386/conf/XEN3_DOMU: revision 1.64
sys/arch/mipsco/conf/GENERIC: revision 1.87
sys/arch/hp300/conf/GENERIC: revision 1.189
sys/arch/vax/conf/GENERIC: revision 1.192
sys/arch/news68k/conf/GENERIC: revision 1.124
sys/arch/ibmnws/conf/GENERIC: revision 1.45
sys/arch/hpcsh/conf/GENERIC: revision 1.105
sys/arch/sparc/conf/TADPOLE3GX: revision 1.64
sys/arch/i386/conf/XEN3_DOM0: revision 1.92
sys/arch/sparc/conf/GENERIC: revision 1.247
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.105
sys/arch/prep/conf/GENERIC: revision 1.173
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.103
sys/arch/rs6000/conf/GENERIC: revision 1.32
sys/arch/hpcmips/conf/GENERIC: revision 1.228
Support for UFS1 extended attributes in GENERIC and GENERIC-like kernels
This change just brings UFS1 extended attribute *support* in the kernel,
extended attributes are not enabled unless three conditions are met:
1) filesystem is UFS1 (newfs -O1)
2) .attribute/system and .attribute/user directories are created at fs root
3) filesystem is mounted with -o extattr
Some GENERIC kernels are obviously memory constrained, the extended
attributes options were not enabled for them, but just added commented out.
(kernel were considered memory constrained if QUOTA option was disabled)
 1.220.2.2 28-Aug-2017  skrll Sync with HEAD
 1.220.2.1 22-Sep-2015  skrll Sync with HEAD
 1.221.10.1 26-Jan-2018  martin Pull up following revision(s) (requested by sevan in ticket #510):
sys/arch/sun3/conf/GENERIC3X: revision 1.130
sys/arch/sparc64/conf/GENERIC: revision 1.203
sys/arch/news68k/conf/LIBERO: revision 1.66
sys/arch/amiga/conf/DRACO: revision 1.185
sys/arch/evbarm/conf/MV2120: revision 1.35
sys/arch/x68k/conf/GENERIC: revision 1.187
sys/arch/rs6000/conf/GENERIC: revision 1.39
sys/arch/news68k/conf/GENERIC_TINY: revision 1.86
sys/arch/i386/conf/XEN3_DOMU: revision 1.88
sys/arch/iyonix/conf/GENERIC: revision 1.97
sys/arch/evbarm64/conf/A64EMUL: revision 1.11
sys/arch/mvme68k/conf/GENERIC: revision 1.98
sys/arch/acorn32/conf/GENERIC: revision 1.124
sys/arch/i386/conf/XEN3_DOM0: revision 1.125
sys/arch/cobalt/conf/INSTALL: revision 1.65
sys/arch/macppc/conf/GENERIC_601: revision 1.16
sys/arch/hppa/conf/GENERIC: revision 1.17
sys/arch/amiga/conf/GENERIC.in: revision 1.137
sys/arch/sgimips/conf/GENERIC32_IP12: revision 1.33
sys/arch/netwinder/conf/GENERIC: revision 1.134
sys/arch/amd64/conf/XEN3_DOMU: revision 1.83
sys/arch/mac68k/conf/GENERIC: revision 1.225
sys/arch/arc/conf/RPC44: revision 1.54
sys/arch/mipsco/conf/GENERIC: revision 1.92
sys/arch/cats/conf/GENERIC: revision 1.166
sys/arch/amd64/conf/XEN3_DOM0: revision 1.145
sys/arch/amigappc/conf/GENERIC: revision 1.33
sys/arch/sun3/conf/GENERIC: revision 1.176
sys/arch/news68k/conf/GENERIC: revision 1.130
sys/arch/hpcsh/conf/GENERIC: revision 1.110
sys/arch/hp300/conf/GENERIC: revision 1.198
sys/arch/atari/conf/GENERIC.in: revision 1.115
sys/arch/sparc/conf/MRCOFFEE: revision 1.54
sys/arch/evbppc/conf/EXPLORA451: revision 1.62
sys/arch/cesfic/conf/GENERIC: revision 1.69
sys/arch/vax/conf/GENERIC: revision 1.204
sys/arch/sgimips/conf/GENERIC32_IP3x: revision 1.115
sys/arch/sgimips/conf/GENERIC32_IP2x: revision 1.112
sys/arch/sparc/conf/GENERIC: revision 1.258
sys/arch/next68k/conf/GENERIC: revision 1.145
sys/arch/evbarm/conf/MMNET_GENERIC: revision 1.34
sys/arch/prep/conf/GENERIC: revision 1.185
sys/arch/amiga/conf/INSTALL: revision 1.129
sys/arch/newsmips/conf/GENERIC: revision 1.133
sys/arch/cobalt/conf/GENERIC: revision 1.156
sys/arch/sun2/conf/GENERIC: revision 1.99
sys/arch/luna68k/conf/INSTALL: revision 1.25
sys/arch/amigappc/conf/NULL: revision 1.53
sys/arch/acorn26/conf/GENERIC: revision 1.85
sys/arch/vax/conf/VAX780: revision 1.25
sys/arch/luna68k/conf/GENERIC: revision 1.125
sys/arch/ews4800mips/conf/GENERIC: revision 1.56
sys/arch/macppc/conf/POWERMAC_G5: revision 1.29
sys/arch/arc/conf/GENERIC: revision 1.189
sys/arch/macppc/conf/MAMBO: revision 1.27
sys/arch/acorn32/conf/EB7500ATX: revision 1.64
sys/arch/pmax/conf/GENERIC: revision 1.196
sys/arch/pmax/conf/GENERIC64: revision 1.28
sys/arch/amiga/conf/GENERIC: revision 1.319
sys/arch/evbarm/conf/MPCSA_GENERIC: revision 1.55
sys/arch/macppc/conf/GENERIC: revision 1.339
sys/arch/emips/conf/GENERIC: revision 1.21
sys/arch/sandpoint/conf/GENERIC: revision 1.97
sys/arch/landisk/conf/GENERIC: revision 1.58
sys/arch/bebox/conf/GENERIC: revision 1.157
sys/arch/alpha/conf/GENERIC: revision 1.379
Alternate buffer queue strategies no longer considered experimental, update
description.
Discussed on tech-kern
http://mail-index.netbsd.org/tech-kern/2018/01/21/msg023002.html
 1.225.4.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.225.4.1 10-Jun-2019  christos Sync with HEAD
 1.225.2.2 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.225.2.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.228.4.1 25-Jan-2020  ad Sync with head.
 1.228.2.1 27-Apr-2021  martin Pull up following revision(s) (requested by rin in ticket #1256):

sys/arch/mac68k/mac68k/machdep.c: revision 1.360
sys/arch/mac68k/conf/GENERIC: revision 1.234
sys/arch/mac68k/conf/files.mac68k: revision 1.131

Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
 1.232.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.238.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3 21-Nov-1999  itojun bring in content of GENERIC.v6 into GENERIC.
remove GENERIC.v6 file (as it is part of GENERIC now).

"faith" interface is commented out by default as it is not really for
general use.
IPsec items are commented out as well, though we can enable "options IPSEC"
without export-related issue ("options IPSEC" will enable authentication
portion only). We may need to think about it again.

if you have problem compiling with INET6 on archs I do not have access to,
please contact me.

XXX what to do with arch/arm32/SHARK{,.v6}?
 1.2 09-Jul-1999  thorpej branches: 1.2.2; 1.2.6; 1.2.10;
Add examples for including the kernel crypto bits from either crypto-us
or crypto-intl, commented out, with instructions to use only one, and
adjust the prefix as necessary.
 1.1 01-Jul-1999  itojun branches: 1.1.2;
kernel configuration for IPv6/IPsec. should be in GENERIC in the future.
(source code will be committed soon)
 1.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.1.2.1 01-Jul-1999  thorpej file GENERIC.v6 was added on branch chs-ubc2 on 1999-07-01 23:09:57 +0000
 1.2.10.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.6.2 28-Nov-1999  scottr Sync with main branch.
 1.2.6.1 09-Jul-1999  scottr file GENERIC.v6 was added on branch scottr-mac68k-wscons on 1999-11-28 10:21:12 +0000
 1.2.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.57 18-Feb-2023  nat Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.
 1.56 27-Mar-2008  hauke Add explanation for the sbc flags to the kernel configurations that
use the sbc 53c80 driver. Until now, this information has lived in the
source code, only; neither sbc nor ncrscsi have a man page.

Triggered by PR port-mac68k/2921
 1.55 30-Oct-2006  hauke branches: 1.55.52;
The {GENERIC,INSTALL}SBC kernel configurations are out of sync with
the vanilla ones. They are supposed to be identical to
{GENERIC,INSTALL}, apart from the different ncr5380 driver.
Instead of re-sync'ing, use a new feature of configure and just disable
the ncrscsi driver.

(Approved by Allen Briggs)
 1.54 26-Aug-2006  christos branches: 1.54.2; 1.54.4;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.53 28-Mar-2006  pavel Add stf to all kernel configs which have INET6 and gif, except the INSTALL
ones and those for specific machines of developers. PR 32304.

OK'ed by rpaulo.

N.B. stf is a cloning device, so it still must be enabled by
"ifconfig stf0 create".
 1.52 05-Feb-2006  cube branches: 1.52.2; 1.52.4; 1.52.6;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.51 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.50 20-Dec-2005  thorpej branches: 1.50.2; 1.50.4; 1.50.6;
Remove the tablet line discipline.
 1.49 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.48 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.47 19-Aug-2005  christos 64 bit inode changes.
 1.46 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.45 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.44 17-Jul-2005  hubertf Add support for reading cloop2 compressed filesystem image,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
 1.43 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.42 25-Jun-2005  rpaulo branches: 1.42.2;
Add file-system PTYFS (commented out) so that people know its existence.

Ok'ed by Christos Zoulas and Hubert Feyrer.
 1.41 25-Feb-2005  simonb branches: 1.41.2;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.40 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.39 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.38 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.37 28-Jan-2005  rumble Sprinkle options UFS_DIRHASH on GENERIC kernels. It's presently
commented out and labeled experimental pending further review and
testing.
 1.36 19-Jan-2005  chs branches: 1.36.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.35 17-Jan-2005  cube Add tap(4) support to a random^Wcarefully chosen set of kernel configs.
All those kernels have a line for both tun and bridge, and if either is
commented out, tap is commented out also. With the exception of i386's
GENERIC_TINY.

XXX: we _need_ some way of making this more simple.
 1.34 10-Nov-2004  christos branches: 1.34.4;
Add COMPAT_BSDPTY on all the kernels that have COMPAT options.
 1.33 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.32 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.31 28-Jun-2004  bouyer Add options P1003_1B_SEMAPHORE
to all GENERIC-like kernel config files where SYSV* options were already
present (commented out if the SYSV* options are commented out).
Fix lib/25897 and lib/25898.
 1.30 26-Jun-2004  abs Add (commented out) ALTQ options to all GENERIC-like files
 1.29 18-Jun-2004  christos ptm is now mandatory, depends on pty, and can be disabled with -DNO_DEV_PTM
 1.28 16-Jun-2004  christos Add pseudo-device ptm on all the generic flavored kernels.
 1.27 18-Oct-2003  lukem branches: 1.27.2;
Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.26 08-Oct-2003  bouyer Add atabus.
 1.25 22-Sep-2003  cl add COMPAT_15/COMPAT_16
 1.24 10-Apr-2003  christos branches: 1.24.2;
Bye Bye UCONSOLE
 1.23 14-Oct-2002  elric Added commented out cgd(4)s to GENERIC configs.
 1.22 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.21 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.20 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.19 19-Jun-2002  itojun add netdock driver.
 1.18 17-Jun-2002  lukem Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.17 27-Apr-2002  shiba branches: 1.17.2; 1.17.4;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.16 25-Apr-2002  atatat Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.15 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.14 25-Mar-2002  shiba branches: 1.14.2;
Switch mac68k to ELF. Now the default executable binaries are ELF.

Approved by Scott,briggs,fredb,wormey
 1.13 06-Feb-2002  fredb Forgot one -- `options COMPAT_15'.
 1.12 06-Feb-2002  fredb Update the GENERIC and GENERICSBC kernels to conform to current fashion:

- - Disable `options DIAGNOSTIC' by default, as the checks are reported to
be not really cheap.
- - Add `options COMPAT_AOUT_M68K', commented out, in preparation for ELF.
- - Remove `options EXEC_ELF32' from the kernel config. You can't just
build an ELF kernel -- you need to update your toolchain, and then,
once you go ELF, it's not an option, so it needs to go in std.mac68k,
as on the other m68k ports.
- - Comment out `options COMPAT_SUNOS'. This hasn't been reported to work
for a long time, so it's not very useful in GENERIC.
- - Enable `options IPFILTER_LOG', to go along with the `options GATEWAY'
and `pseudo-device ipfilter' motif.
 1.11 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.10 19-Jan-2002  oster Add new RF_* options for RAIDframe bits that are no longer built by default.

While we're here, enable RAIDframe (and RAID_AUTOCONFIG) by default for
architectures that I'm comfortable can deal with it being on by default.

Also: bump the number of 'raid' devices from 4 to 8, since 4 seems to
be insufficient in practise.
 1.9 28-Dec-2001  martin Add PPPoE to all generic kernels that should be able to use it.
XXX TODO: do this for INSTALL kernels too, add sysinst support and make the
XXX needed binaries available on the ramdisk root fs.
 1.8 23-Nov-2001  atatat The bridge(4) pseudo-device no longer requires the port to
__HAVE_GENERIC_SOFT_INTERRUPTS, so add it back to all GENERIC configs.
 1.7 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.6 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.5 23-Sep-2001  fredb branches: 1.5.4;
Sync with "GENERIC".
 1.4 01-Sep-2001  atatat branches: 1.4.2;
Comment out bridge pseudo devices from ports that don't
__HAVE_GENERIC_SOFT_INTERRUPTS. bridge(4) doesn't compile there.
 1.3 01-Sep-2001  atatat Add bridge pseudo devices to GENERIC configs
 1.2 08-Jul-2001  abs branches: 1.2.2;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.1 07-Dec-2000  toddpw branches: 1.1.2;
Fix PR port-mac68k/11343
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 07-Dec-2000  bouyer file GENERICSBC was added on branch thorpej_scsipi on 2000-12-08 09:28:16 +0000
 1.2.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.2.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.2.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.4.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.5.4.8 18-Oct-2002  nathanw Catch up to -current.
 1.5.4.7 01-Aug-2002  nathanw Catch up to -current.
 1.5.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.5.4.5 17-Apr-2002  nathanw Catch up to -current.
 1.5.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.5.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.5.4.1 23-Sep-2001  nathanw file GENERICSBC was added on branch nathanw_sa on 2002-01-08 00:25:56 +0000
 1.14.2.2 03-Apr-2002  he Apply patch (new, requested by oster):
Add configurations which use the MI NCR 5380 driver, based on
GENERIC and INSTALL.
 1.14.2.1 25-Mar-2002  he file GENERICSBC was added on branch netbsd-1-5 on 2002-04-03 22:20:27 +0000
 1.17.4.2 24-Oct-2002  lukem Pull up upgrade to IPfilter 3.4.29 (requested by martti in ticket #905).
Affected files & revisions:

dist/ipf/HISTORY 1.14
dist/ipf/fils.c 1.17-1.21
dist/ipf/ipf.c 1.11-1.13
dist/ipf/ipfs.c 1.8-1.10
dist/ipf/ipft_ef.c 1.6-1.7
dist/ipf/ipft_td.c 1.6-1.7
dist/ipf/ipft_tx.c 1.7-1.8
dist/ipf/ipmon.c 1.12-1.17
dist/ipf/ipnat.c 1.11-1.12
dist/ipf/ipsend/ip_var.h 1.2
dist/ipf/ipsend/ipsend.c 1.8
dist/ipf/ipsend/iptests.c 1.5
dist/ipf/ipt.c 1.8-1.10
dist/ipf/kmem.c 1.8-1.10
dist/ipf/man/ipf.4 1.10
dist/ipf/man/ipf.5 1.8
dist/ipf/man/ipftest.1 1.3
dist/ipf/man/ipmon.8 1.10
dist/ipf/man/ipnat.5 1.9-1.10
dist/ipf/man/ipnat.8 1.4
dist/ipf/misc.c 1.7
dist/ipf/natparse.c 1.10
dist/ipf/parse.c 1.13
dist/ipf/printnat.c 1.8-1.10
dist/ipf/relay.c 1.5-1.6
dist/ipf/rules/example.9 1.2
etc/rc.d/ipnat 1.8
regress/sys/kern/ipf/Makefile 1.3-1.4
regress/sys/kern/ipf/dotest6 1.2
regress/sys/kern/ipf/expected/f13 1.1.1.2
regress/sys/kern/ipf/expected/i12 1.1.1.1
regress/sys/kern/ipf/expected/ni3 1.1.1.1
regress/sys/kern/ipf/expected/ni5 1.2
regress/sys/kern/ipf/input/f13 1.1.1.2
regress/sys/kern/ipf/input/ipv6.1 1.1.1.1
regress/sys/kern/ipf/input/ni3 1.1.1.1
regress/sys/kern/ipf/regress/i12 1.1.1.1
regress/sys/kern/ipf/regress/ipv6.1 1.1.1.1
regress/sys/kern/ipf/regress/ni3.ipf 1.1.1.1
regress/sys/kern/ipf/regress/ni3.nat 1.1.1.1
sys/arch/alpha/conf/ALPHA 1.169,1.171
sys/arch/amiga/conf/GENERIC 1.185-1.186
sys/arch/arc/conf/GENERIC 1.71-1.72
sys/arch/atari/conf/GENERIC.in 1.24-1.25
sys/arch/cats/conf/GENERIC 1.31-1.32
sys/arch/cobalt/conf/GENERIC 1.34-1.35
sys/arch/hp300/conf/GENERIC 1.83-1.84
sys/arch/i386/conf/CARDBUS 1.66-1.67
sys/arch/i386/conf/GENERIC 1.510,1.512
sys/arch/i386/conf/GENERIC_LAPTOP 1.58-1.59
sys/arch/i386/conf/GENERIC_PS2TINY 1.19-1.20
sys/arch/i386/conf/GENERIC_TINY 1.47-1.48
sys/arch/luna68k/conf/GENERIC 1.33-1.33
sys/arch/mac68k/conf/GENERIC 1.130-1.131
sys/arch/mac68k/conf/GENERICSBC 1.21-1.22
sys/arch/mac68k/conf/SMALLRAM 1.4-1.5
sys/arch/macppc/conf/GENERIC 1.142-1.143
sys/arch/mipsco/conf/GENERIC 1.21-1.22
sys/arch/mmeye/conf/GENERIC 1.44-1.45
sys/arch/news68k/conf/GENERIC 1.36-1.37
sys/arch/news68k/conf/GENERIC_TINY 1.18-1.19
sys/arch/newsmips/conf/GENERIC 1.50-1.51
sys/arch/ofppc/conf/GENERIC 1.56-1.57
sys/arch/pmax/conf/GENERIC 1.103-1.104
sys/arch/prep/conf/GENERIC 1.55-1.56
sys/arch/sbmips/conf/GENERIC 1.11-1.12
sys/arch/sgimips/conf/GENERIC 1.7-1.8
sys/arch/sparc/conf/GENERIC 1.138-1.139
sys/arch/sparc64/conf/GENERIC32 1.46-1.47
sys/arch/vax/conf/GENERIC 1.102-1.103
sys/arch/x68k/conf/ALL 1.55-1.56
sys/arch/x68k/conf/GENERIC 1.80-1.81
sys/lkm/netinet/if_ipl/mln_ipl.c 1.29
sys/netinet/fil.c 1.57-1.58
sys/netinet/ip_auth.c 1.29-1.30
sys/netinet/ip_compat.h 1.30-1.31
sys/netinet/ip_fil.c 1.81-1.86
sys/netinet/ip_fil.h 1.46-1.49
sys/netinet/ip_frag.c 1.33-1.34
sys/netinet/ip_frag.h 1.18
sys/netinet/ip_ftp_pxy.c 1.25-1.26
sys/netinet/ip_h323_pxy.c 1.5-1.6
sys/netinet/ip_log.c 1.22-1.23
sys/netinet/ip_nat.c 1.51-1.53
sys/netinet/ip_nat.h 1.27
sys/netinet/ip_netbios_pxy.c 1.4
sys/netinet/ip_proxy.c 1.35-1.36
sys/netinet/ip_proxy.h 1.18
sys/netinet/ip_state.c 1.41-1.42
sys/netinet/ip_state.h 1.23
sys/netinet/ipl.h 1.14
 1.17.4.1 01-Aug-2002  lukem Pull up revision 1.18 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.17.2.2 16-Jul-2002  gehenna catch up with -current.
 1.17.2.1 14-Jul-2002  gehenna catch up with -current.
 1.24.2.10 11-Dec-2005  christos Sync with head.
 1.24.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.24.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.24.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.24.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.24.2.4 14-Nov-2004  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.27.2.3 15-Jul-2004  he Pull up revision 1.32 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.27.2.2 02-Jul-2004  he Pull up revision 1.31 (requested by bouyer in ticket #573):
Add options P1003_1B_SEMAPHORE to all GENERIC-like kernel
config files where SYSV* options were already present
(commented out if the SYSV* options are commented out).
Fixes PR#25897 and PR#25898.
 1.27.2.1 30-Jun-2004  jdc Pull up revision 1.30 (requested by abs in ticket #567).

Add (commented out) ALTQ options to all GENERIC-like files
 1.34.4.1 29-Apr-2005  kent sync with -current
 1.36.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.36.2.1 12-Feb-2005  yamt sync with head.
 1.41.2.2 14-Aug-2005  riz Pull up revision 1.44 (requested by hubertf in ticket #625):
Add support for reading cloop2 compressed filesystem images,
enable by putting VND_COMPRESSION into kernel config file.
Written by Cliff Wright, polished up slightly by me.
 1.41.2.1 18-Jul-2005  riz Pull up revision 1.43 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.42.2.2 30-Dec-2006  yamt sync with head.
 1.42.2.1 21-Jun-2006  yamt sync with head.
 1.50.6.1 22-Apr-2006  simonb Sync with head.
 1.50.4.1 09-Sep-2006  rpaulo sync with head
 1.50.2.1 18-Feb-2006  yamt sync with head.
 1.52.6.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.52.4.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.52.2.2 03-Sep-2006  yamt sync with head.
 1.52.2.1 01-Apr-2006  yamt sync with head.
 1.54.4.1 10-Dec-2006  yamt sync with head.
 1.54.2.1 18-Nov-2006  ad Sync with head.
 1.55.52.1 03-Apr-2008  mjf Sync with HEAD.
 1.58 05-Jan-2023  tsutsui Disable (comment out) options DIAGNOSTIC in INSTALL kernels.

It has been there since the initial revision 1.1 while
it was disabled in GENERIC in revision 1.121 back in 2002:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/mac68k/conf/GENERIC#rev1.121

Briefly discussed in PR/57107, and maybe should be pulled up to
netbsd-9 and netbsd-10.
 1.57 10-Aug-2020  rin branches: 1.57.20;
Add -fno-omit-frame-pointer to m68k kernels with DDB for backtraces.
-omit-frame-pointer is enabled for -O1 and higher for GCC8 by default.
 1.56 14-Sep-2017  mrg branches: 1.56.8;
clean up COMPAT_* options for native netbsd code:
- new series of files that are useful for saying "i want everything
since netbsd 1.4", etc.
- use the fact COMPAT_* options have future dependancies to remove
many redundant options.

removes about 3000 lines total across kernel configuration files.
tested about 30 random kernels in the changed list.
 1.55 21-Aug-2015  uebayasi Add `pseudo-device ksyms' where `options DDB' is used, because
config(1)/config(5) can't handle module dependency correctly at this
moment.

(This is another proof that shared file definition (`file xxx.c a|b')
is a bad idea.)
 1.54 23-Aug-2014  dholland branches: 1.54.2;
Systematize (and in many cases, fix) the comments on options COMPAT_NN.

There are quite a few configs that are missing some COMPAT_NN options
in ways that don't make sense; this should probably get cleaned up
too, but for the time being I've not added or removed anything.
 1.53 16-Aug-2014  apb Add "options COMPAT_70" to all kernel configuration files that
already had "options COMPAT_60".
 1.52 27-Apr-2013  christos remove confusing numeric locators where they are unused.
 1.51 17-Oct-2012  apb Add "options COMPAT_60" to all kernel configuration files
that already had "options COMPAT_50".
 1.50 17-Aug-2012  abs branches: 1.50.2;
Update all kernel configs mentioning WSEMUL_* but not already including
WSDISPLAY_COMPAT_USL using the following rules:
- If WSEMUL_ is commented out, add commented out out WSDISPLAY_COMPAT_USL
- If INSTALL or obviously memory constrained, add WSDISPLAY_DEFAULTSCREENS=1
and commented out WSDISPLAY_COMPAT_USL
- Otherwise add WSDISPLAY_COMPAT_USL

Some of the INSTALL configs for larger memory machines are probably suitable
for adding WSDISPLAY_COMPAT_USL.

Now wsconscfg(8) should be able to switch VTs when expected.

Implemented after no objection from tech-kern to the following:

On 5 June 2012 09:47, David Brownlee <abs@absd.org> wrote:
> wsconscfg(8) requires WSDISPLAY_COMPAT_USL in order to switch virtual
> terminals.
>
> Except when in an exceptionally memory or space constrained
> environment (INSTALL being the obvious case), is there any reason why
> all GENERIC and GENERIC-like kernels which have wscons enabled
> shouldn't also have WSDISPLAY_COMPAT_USL?
 1.49 18-Dec-2011  dholland WABPL is no longer considered experimental (has not been for some time)
so update its comment in config files.
 1.48 22-Nov-2011  tls branches: 1.48.2;

The rnd pseudo-device is not really optional, because it is in the same
source file as the entropy-pool code itself. Move it to std. This
will be cleaned up more when I split the sources up as they should be.

This fixes build breaks on several ports. Thanks to Havard Eidnes for
pointing them out.
 1.47 24-Nov-2010  hauke branches: 1.47.8;
Catch up on COMPAT* options -- it's been a while...
 1.46 23-Nov-2010  hannken Remove unused count from pseudo-device md.
 1.45 16-Apr-2010  pooka Remove unused count (invariably "4") from pseudo-device fss.
 1.44 06-Feb-2009  jym branches: 1.44.4; 1.44.6;
Changes to MEMORY_RBFLAGS option:
- renamed to MEMORY_DISK_RBFLAGS to better fit the rest of the
MEMORY_DISK options(4)
- change default value to RB_AUTOBOOT instead of RB_SINGLE, and adapt
the config(5) files accordingly
- document this option inside options(4)

See also http://mail-index.netbsd.org/tech-kern/2008/12/25/msg003924.html

Reviewed by abs@ in private mail.
 1.43 31-Jul-2008  simonb branches: 1.43.2;
Add "options WAPBL" to standard GENERIC/INSTALL type configs.
 1.42 17-Oct-2007  garbled branches: 1.42.16; 1.42.20; 1.42.22; 1.42.26;
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.41 02-Jun-2007  tsutsui branches: 1.41.10;
Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.40 29-Dec-2006  yamt branches: 1.40.6; 1.40.8; 1.40.14;
update comments on NFS_V2_ONLY after nqnfs removal. no functional changes.
from Arnaud Lacombe.
 1.39 02-Oct-2006  chs remove MALLOC_NOINLINE, it doesn't do anything anymore.
 1.38 05-Feb-2006  cube branches: 1.38.14; 1.38.16;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.37 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.36 07-Dec-2005  tsutsui branches: 1.36.2; 1.36.4; 1.36.6;
Remove obsolete options VNODE_OP_NOINLINE.
 1.35 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.34 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.33 18-Feb-2005  dsl branches: 1.33.6;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.32 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.31 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.30 19-Jan-2005  chs branches: 1.30.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.29 10-Nov-2004  christos branches: 1.29.4;
Add COMPAT_BSDPTY to the rest of the config files.
 1.28 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.27 18-Oct-2003  lukem branches: 1.27.2;
Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.26 08-Oct-2003  bouyer Add atabus.
 1.25 22-Sep-2003  cl add COMPAT_15/COMPAT_16
 1.24 06-Sep-2003  itojun add rnd(4) device to installation media.
necessary for many purposes, including password seeding, tcp sequence number,
and more. see tech-security
 1.23 10-Apr-2003  christos branches: 1.23.2;
Bye Bye UCONSOLE
 1.22 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.21 05-Jul-2002  abs Ensure all INSTALL config files consistantly include PIPE_SOCKETPAIR,
MALLOC_NOINLINE, and VNODE_OP_NOINLINE. The exceptions are when they
include another config files that already defines the options, or if
they are for an embedded board, just define a few extra options, and
do not already define PIPE_SOCKETPAIR.
 1.20 04-Jul-2002  scottr Add support for DHCP network configuration.
 1.19 19-Jun-2002  itojun add netdock ether driver. as discussed on port-mac68k
 1.18 28-Apr-2002  wormey branches: 1.18.2; 1.18.4;
Supply missing "flags" keyword.
 1.17 27-Apr-2002  shiba Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.16 25-Apr-2002  atatat Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.15 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.14 02-Apr-2002  lukem Rename MEMORY_DISK_SIZE (formerly MINIROOTSIZE) to MEMORY_DISK_ROOT_SIZE,
which was suggested by Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> as
being more consistent with what it's controlling...
 1.13 10-Mar-2002  lukem * rename MINIROOTSIZE to MEMORY_DISK_SIZE, so that all md(4) options
are now consistently named
* fold opt_mdsize.h into opt_md.h
 1.12 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.11 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.10 02-Oct-2000  abs branches: 1.10.4; 1.10.8;
Ensure all INSTALL* kernels have two ptys, and a note explaining why:
pseudo-device pty 2 # pseudo-terminals (Sysinst needs two)
(Some installers may not be using sysinst, in which case this just reduces
the number of ptys from 16 that are not used to 2 that are not used)
For i386 conf files, no change other than comments.
 1.9 25-Sep-2000  abs Use "options<SPACE><TAB>" not "options<TAB>" - noted by simonb.
Move VNODE_OP_NOINLINE and NFS_V2_ONLY into '# Filesystem options' section.
Consistently label '# Filesystem options' and '#File systems' sections.
 1.8 25-Sep-2000  abs Ensure all INSTALL config files have (at least) COPTS="-Os", cincluding bebox
based on it working already for macppc.
Also add commented out:
#options VNODE_OP_NOINLINE # Don't inline vnode op calls
#options NFS_V2_ONLY # Exclude NFS3 and NQNFS code
as suggestions for additional savings
 1.7 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.6 31-Jul-2000  briggs We may wish to install from an SMC-based ethernet, too.
 1.5 10-Jun-2000  scottr branches: 1.5.2;
We don't need ADB debugging enabled any longer.
 1.4 14-Feb-2000  scottr branches: 1.4.2;
Update for wscons.
 1.3 29-Jul-1999  augustss branches: 1.3.2;
It's time to be COMPAT_14.
 1.2 01-Jun-1999  briggs Comment out DISABLE_EXT_CACHE as it unnecessarily slows down the IIci
w/ external cache. Leave it around so the paranoid can still use it.
 1.1 26-Mar-1999  ender branches: 1.1.2; 1.1.4; 1.1.6; 1.1.8;
NetBSD/mac68k installation kernel config
 1.1.8.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.6.2 02-Aug-1999  thorpej Update from trunk.
 1.1.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.1.4.4 01-Nov-1999  scottr Sync with main branch.
 1.1.4.3 15-Jun-1999  scottr Sync with main branch.
 1.1.4.2 16-May-1999  scottr Sync with main branch.
 1.1.4.1 26-Mar-1999  scottr file INSTALL was added on branch scottr-mac68k-wscons on 1999-05-16 22:38:08 +0000
 1.1.2.1 21-Jun-1999  perry pullup 1.1->1.2 (briggs): Comment out DISABLE_EXT_CACHE
 1.3.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.4.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.5.2.1 06-Aug-2000  briggs Pullup approved by thorpej --
Add nubus-based SMC91cxx ethernet support for the mac68k.
 1.10.8.7 18-Oct-2002  nathanw Catch up to -current.
 1.10.8.6 01-Aug-2002  nathanw Catch up to -current.
 1.10.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.10.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.10.8.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.10.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.10.4.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.4.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.10.4.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.10.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.10.4.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.10.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.18.4.1 05-Jul-2002  lukem Pull up revision 1.20 (requested by scottr in ticket #434):
Add support for DHCP network configuration.
 1.18.2.1 16-Jul-2002  gehenna catch up with -current.
 1.23.2.10 11-Dec-2005  christos Sync with head.
 1.23.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.23.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.23.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.23.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.23.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.2.1 15-Jul-2004  he Pull up revision 1.28 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.29.4.1 29-Apr-2005  kent sync with -current
 1.30.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.30.2.1 12-Feb-2005  yamt sync with head.
 1.33.6.3 03-Sep-2007  yamt sync with head.
 1.33.6.2 30-Dec-2006  yamt sync with head.
 1.33.6.1 21-Jun-2006  yamt sync with head.
 1.36.6.1 22-Apr-2006  simonb Sync with head.
 1.36.4.1 09-Sep-2006  rpaulo sync with head
 1.36.2.1 18-Feb-2006  yamt sync with head.
 1.38.16.1 22-Oct-2006  yamt sync with head
 1.38.14.2 12-Jan-2007  ad Sync with head.
 1.38.14.1 18-Nov-2006  ad Sync with head.
 1.40.14.1 26-Jun-2007  garbled Sync with HEAD.
 1.40.8.1 11-Jul-2007  mjf Sync with head.
 1.40.6.1 09-Jun-2007  ad Sync with head.
 1.41.10.1 06-Nov-2007  matt sync with HEAD
 1.42.26.1 19-Oct-2008  haad Sync with HEAD.
 1.42.22.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.42.20.2 11-Aug-2010  yamt sync with head.
 1.42.20.1 04-May-2009  yamt sync with head.
 1.42.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.43.2.1 03-Mar-2009  skrll Sync with HEAD.
 1.44.6.2 05-Mar-2011  rmind sync with head
 1.44.6.1 30-May-2010  rmind sync with head
 1.44.4.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.47.8.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.47.8.2 30-Oct-2012  yamt sync with head
 1.47.8.1 17-Apr-2012  yamt sync with head
 1.48.2.1 18-Feb-2012  mrg merge to -current.
 1.50.2.3 03-Dec-2017  jdolecek update from HEAD
 1.50.2.2 23-Jun-2013  tls resync from head
 1.50.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.54.2.1 22-Sep-2015  skrll Sync with HEAD
 1.56.8.1 07-Jan-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #1565):

sys/arch/mac68k/conf/INSTALL: revision 1.58

Disable (comment out) options DIAGNOSTIC in INSTALL kernels.

It has been there since the initial revision 1.1 while
it was disabled in GENERIC in revision 1.121 back in 2002.

Briefly discussed in PR/57107
 1.57.20.1 07-Jan-2023  martin Pull up following revision(s) (requested by tsutsui in ticket #40):

sys/arch/mac68k/conf/INSTALL: revision 1.58

Disable (comment out) options DIAGNOSTIC in INSTALL kernels.

It has been there since the initial revision 1.1 while
it was disabled in GENERIC in revision 1.121 back in 2002.

Briefly discussed in PR/57107
 1.33 18-Feb-2023  nat Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.
 1.32 27-Mar-2008  hauke Add explanation for the sbc flags to the kernel configurations that
use the sbc 53c80 driver. Until now, this information has lived in the
source code, only; neither sbc nor ncrscsi have a man page.

Triggered by PR port-mac68k/2921
 1.31 30-Oct-2006  hauke branches: 1.31.52;
The {GENERIC,INSTALL}SBC kernel configurations are out of sync with
the vanilla ones. They are supposed to be identical to
{GENERIC,INSTALL}, apart from the different ncr5380 driver.
Instead of re-sync'ing, use a new feature of configure and just disable
the ncrscsi driver.

(Approved by Allen Briggs)
 1.30 02-Oct-2006  chs remove MALLOC_NOINLINE, it doesn't do anything anymore.
 1.29 05-Feb-2006  cube branches: 1.29.14; 1.29.16;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.28 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.27 07-Dec-2005  tsutsui branches: 1.27.2; 1.27.4; 1.27.6;
Remove obsolete options VNODE_OP_NOINLINE.
 1.26 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.25 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.24 18-Feb-2005  dsl branches: 1.24.6;
Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.23 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.22 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.21 19-Jan-2005  chs branches: 1.21.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.20 10-Nov-2004  christos branches: 1.20.4;
Add COMPAT_BSDPTY to the rest of the config files.
 1.19 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.18 18-Oct-2003  lukem branches: 1.18.2;
Use one 'atabus* at ata?' instead of multiple 'atabus* at FOOide? channel ?'
Use 'atapibus* at atapi?' instead of 'atapibus* at atabus?'
 1.17 08-Oct-2003  bouyer Add atabus.
 1.16 22-Sep-2003  cl add COMPAT_15/COMPAT_16
 1.15 06-Sep-2003  itojun add rnd(4) device to installation media.
necessary for many purposes, including password seeding, tcp sequence number,
and more. see tech-security
 1.14 10-Apr-2003  christos branches: 1.14.2;
Bye Bye UCONSOLE
 1.13 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.12 05-Jul-2002  abs Ensure all INSTALL config files consistantly include PIPE_SOCKETPAIR,
MALLOC_NOINLINE, and VNODE_OP_NOINLINE. The exceptions are when they
include another config files that already defines the options, or if
they are for an embedded board, just define a few extra options, and
do not already define PIPE_SOCKETPAIR.
 1.11 04-Jul-2002  scottr Add support for DHCP network configuration.
 1.10 19-Jun-2002  itojun add netdock ether driver. as discussed on port-mac68k
 1.9 27-Apr-2002  shiba branches: 1.9.2; 1.9.4;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.8 25-Apr-2002  atatat Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.7 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.6 02-Apr-2002  lukem branches: 1.6.2;
Rename MEMORY_DISK_SIZE (formerly MINIROOTSIZE) to MEMORY_DISK_ROOT_SIZE,
which was suggested by Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> as
being more consistent with what it's controlling...
 1.5 10-Mar-2002  lukem * rename MINIROOTSIZE to MEMORY_DISK_SIZE, so that all md(4) options
are now consistently named
* fold opt_mdsize.h into opt_md.h
 1.4 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.3 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.2 23-Sep-2001  fredb branches: 1.2.4;
Nit -- this kernel is called "INSTALLSBC", not "INSTALL".
 1.1 07-Dec-2000  toddpw branches: 1.1.2; 1.1.4; 1.1.6;
Fix PR port-mac68k/11343
 1.1.6.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.1.6.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.6.3 16-Mar-2002  jdolecek Catch up with -current.
 1.1.6.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.1.6.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.1.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.1.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.1.2.1 07-Dec-2000  bouyer file INSTALLSBC was added on branch thorpej_scsipi on 2000-12-08 09:28:16 +0000
 1.2.4.8 18-Oct-2002  nathanw Catch up to -current.
 1.2.4.7 01-Aug-2002  nathanw Catch up to -current.
 1.2.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.2.4.5 17-Apr-2002  nathanw Catch up to -current.
 1.2.4.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.2.4.3 28-Feb-2002  nathanw Catch up to -current.
 1.2.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.2.4.1 23-Sep-2001  nathanw file INSTALLSBC was added on branch nathanw_sa on 2002-01-08 00:25:57 +0000
 1.6.2.2 03-Apr-2002  he Apply patch (new, requested by oster):
Add configurations which use the MI NCR 5380 driver, based on
GENERIC and INSTALL.
 1.6.2.1 02-Apr-2002  he file INSTALLSBC was added on branch netbsd-1-5 on 2002-04-03 22:20:29 +0000
 1.9.4.1 05-Jul-2002  lukem Pull up revision 1.11 (requested by scottr in ticket #434):
Add support for DHCP network configuration.
 1.9.2.1 16-Jul-2002  gehenna catch up with -current.
 1.14.2.10 11-Dec-2005  christos Sync with head.
 1.14.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.14.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.14.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.14.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.14.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.14.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.2.1 03-Aug-2004  skrll Sync with HEAD
 1.18.2.1 15-Jul-2004  he Pull up revision 1.19 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.20.4.1 29-Apr-2005  kent sync with -current
 1.21.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.2.1 12-Feb-2005  yamt sync with head.
 1.24.6.2 30-Dec-2006  yamt sync with head.
 1.24.6.1 21-Jun-2006  yamt sync with head.
 1.27.6.1 22-Apr-2006  simonb Sync with head.
 1.27.4.1 09-Sep-2006  rpaulo sync with head
 1.27.2.1 18-Feb-2006  yamt sync with head.
 1.29.16.2 10-Dec-2006  yamt sync with head.
 1.29.16.1 22-Oct-2006  yamt sync with head
 1.29.14.1 18-Nov-2006  ad Sync with head.
 1.31.52.1 03-Apr-2008  mjf Sync with HEAD.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.30 19-May-2002  scottr SMALLRAM is an effective replacement for the SPOT and MYSTERY configs,
which are IIcx and IIx machines with not much RAM, respectively.

The PUMA config is configured somewhat optimally for one of Allen's
Quadras but doesn't do anything special as compared to SMALLRAM.
 1.29 25-Apr-2002  atatat branches: 1.29.2;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.28 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.27 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.26 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.25 08-Jul-2001  abs branches: 1.25.2; 1.25.8;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.24 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.23 14-Feb-2000  scottr Update for wscons.
 1.22 29-Jul-1999  augustss branches: 1.22.2;
It's time to be COMPAT_14.
 1.21 26-Jun-1998  lukem branches: 1.21.8; 1.21.12;
remove options FIFO; it's now the default
 1.20 27-Feb-1998  scottr Bump down maxusers to a reasonable value on a machine with 8MB.
 1.19 18-Dec-1997  scottr Make these more closely resemble the old configurations.
 1.18 16-Dec-1997  scottr Update to match std.mac68k changes.
 1.17 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.16 07-Aug-1997  scottr Strip down to bare essentials for these machines.
 1.15 23-Jul-1997  scottr branches: 1.15.2;
Remove unused option MAPMEM, as suggested by Erik Bertelsen
<erik@erik-be.uni-c.dk> in PR 3896. Also, revert to MRG_ADB
(for now), disable NETATALK, and remove unused drivers.
 1.14 08-May-1997  scottr Update to current configurations.
 1.13 07-May-1997  lukem minor whitespaco fixes
 1.12 08-Apr-1997  scottr Update for current configuration, including sbc reselect mode.
 1.11 12-Feb-1997  scottr Move asc0 here from std.mac68k. Remove COMPAT_SUNOS, as it's dead weight
on this machine. Add some minimal driver descriptions.
 1.10 31-Jan-1997  thorpej branches: 1.10.2;
Adopt for new file system and root spec grammar.
 1.9 13-Jan-1997  scottr branches: 1.9.2;
Compile with -O2 (need to update COPTS so we still get -m68030)
 1.8 17-Dec-1996  scottr Take avantage of COPTS appropriately.
 1.7 19-Nov-1996  scottr - Move non-optional options SWAPPAGER, VNODEPAGER, and DEVPAGER to std.mac68k
- Catch up with vm/vmparam.h (remove MACHINE_NONCONTIG)
- Fix space/tab niggles in SPOT config
- MYSTERY now includes the esp driver
 1.6 11-Nov-1996  scottr Remove unused MAXFDESCS option. Closes PR 2927, noticed by Erik
Bertelsen <erik@aarhus1.uni-c.dk>.
 1.5 29-Oct-1996  briggs ncr96scsi -> esp for consistency with sparc and alpha.
 1.4 15-Oct-1996  scottr We no longer need 'options GENERIC'
 1.3 22-Sep-1996  scottr Update for recent config(8) changes.
 1.2 12-Sep-1996  scottr Add uk, remove ch device
 1.1 12-Sep-1996  scottr This is the development/debug machine
 1.9.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.10.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.15.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.12.1 02-Aug-1999  thorpej Update from trunk.
 1.21.8.1 01-Nov-1999  scottr Sync with main branch.
 1.22.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.25.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.25.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.25.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.25.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.25.8.1 08-Jul-2001  nathanw file MYSTERY was added on branch nathanw_sa on 2002-01-08 00:25:57 +0000
 1.25.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.25.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.1 30-May-2002  gehenna Catch up with -current.
 1.4 02-Dec-1993  mycroft Clean up deleted files.
 1.3 02-Dec-1993  briggs Update Makefile to not use stupid hack on assembly files.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.93 22-Sep-2018  rin - Determine KERN_AS automatically depending on whether OPT_MODULAR is
set or not, in the same way as libcompat.

- Specify OPT_MODULAR in the port Makefile instead of KERN_AS.

Now, KERN_AS=library is used for kernels without module(7) for all ports.

OK christos
 1.92 25-Feb-2018  mrg branches: 1.92.2; 1.92.4;
add a special rule to build m68k/fpu.c to avoid passing -msoft-float.
fixes GCC 6 kernel builds that use this file.
 1.91 06-Sep-2015  uebayasi Declare dependency on fpsp.o via newly introduced ${MD_LIBS} instead of
${MD_OBJS}.

${MD_OBJS} should be used only for objects that must be linked first (i.e.,
start code). Objects have to be compiled following common compile rules,
and have to be generated into common places (i.e., top of kernel build
directory).

${MD_LIBS} defines libraries that are built by separate makefiles, under
separate directories. `Makefile.kern.inc' doesn't know intermediate library
objects.
 1.90 21-Jan-2011  joerg branches: 1.90.14; 1.90.32;
Switch remaining platforms to modern CPP for assembler.
 1.89 18-Feb-2008  joerg branches: 1.89.32; 1.89.38; 1.89.40;
Missing assym.h dependencies.
 1.88 11-Dec-2005  christos branches: 1.88.50; 1.88.56;
merge ktrace-lwp.
 1.87 31-May-2005  christos branches: 1.87.2;
s/GENASSYM/GENASSYM_CONF/ so we can use "GENASSYM" as the program name.
 1.86 04-Jun-2004  thorpej Add the %MAKEOPTIONSAPPEND token at the end of the file, after the
common Makefile.kern.inc has been included.
 1.85 26-Nov-2002  thorpej branches: 1.85.6; 1.85.10;
The traditional C preprocessor is fixed in GCC 3.3 now, so no need
to skip -traditional-cpp for HAVE_GCC3.
 1.84 04-Jun-2002  thorpej Don't use -traditional-cpp if HAVE_GCC3.
 1.83 09-Dec-2001  atatat branches: 1.83.8;
Roll the rest of the ports over to the new MI kernel build machinery.
Any problems reported by testers have been fixed, and massive
cross-compiling of kernels has shown that any problems that remain
with actually building kernels are not related to this.
 1.82 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.81 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.80 26-Oct-2001  jmc branches: 1.80.2;
Change defaults for kernel compiles. Default all to USETOOLS?=no and have
the etc Makefile override that by putting USETOOLS into $.MAKEOVERRIDES
This way the default for kernel compiles is still to use the installed
toolchain instead of depending on $TOOLDIR. $TOOLDIR can be used by
simply adding USETOOLS=yes to the command line as usual.

Adjust each ports template to set the default no setting and also pull in
bsd.own.mk if they weren't already to ensure they'll build correctly
with the new toolchain setup.
 1.79 23-Oct-2001  thorpej branches: 1.79.2;
Set MACHINE_ARCH explicitly in Makefiles for which it is constant.
Also, since config(8) now explcitly sets MACHINE, there is no need
to do it here in the Makefile.
 1.78 29-May-2001  mrg branches: 1.78.2;
define _KERNEL_OPT as well as _KERNEL. we will use this in the future to
get kernel "opt_foo.h" headers, rather than _KERNEL && !_LKM.
 1.77 17-Dec-2000  jdolecek branches: 1.77.2;
delete obsolete comment
 1.76 09-May-2000  hubertf Add "install" target, so "make install" after building the kernel
does something useful. The target can be redefined by putting a
install-kernel-${MACHINE_NAME} target that fits your needs into
/etc/mk.conf.
 1.75 09-May-2000  thorpej HAVE_GCC28 -> HAVE_EGCS, and make it match gcc 2.9 as well. Also,
make the use of -Wno-uninitialized explicit, don't rely on a compiler
hack to do it for us.
 1.74 01-Feb-2000  tsutsui Revert STRIPPROG -> STRIP
 1.73 24-Jan-2000  tron Add "dependall" target for comfort.
 1.72 19-Jan-2000  tsutsui STRIP -> STRIPPROG
 1.71 19-Jan-2000  tsutsui Change STRIPFLAGS=-g for cross-toolchains.
 1.70 26-Jul-1999  cgd branches: 1.70.2;
be more efficient when doing the SYSTEM_LD_TAIL for -g kernels: don't
copy them just to strip them, use strip -o.
 1.69 09-Jul-1999  mrg clean up a bit after jason :)

- fix emitrules() like emitfiles() to deal with the prefix (otherwise it
would attempt to find the file in the normal base for the NORMAL_C rule).
- add emitincludes() which adds include directives for each prefix to the
$INCLUDES variable in the makefile.
- add %INCLUDES to each Makefile.arch to deal with the above.

this makes "prefix" actually work in a usable manner, and now i can move
on to fixing compiler warnings (errors) in the ESP code. :)
 1.68 15-Jan-1999  thorpej branches: 1.68.2; 1.68.6;
Some minor, mostly costmetic, changes to CPPFLAGS/CFLAGS.
 1.67 15-Jan-1999  thorpej Don't define "mc68020". Nothing uses it.
 1.66 08-Jan-1999  augustss Add -Wpointer-arith warning since `void *' arithmetic is not ANSI C.
 1.65 15-Oct-1998  drochner change handling of libkern:
-sys/lib/libkern builds as library per default (as it was documented all
the time)
-ports able to LKM set "KERN_AS=obj" explicitely in their Makefiles
(for now; should depend on actual "option LKM" or -better- functions
included for LKM use should be pulled in by a stub)
-always link libcompat before libkern - libkern stuff can be referred to
by libcompat, but not the other way
 1.64 05-Sep-1998  lukem distclean is a synonym for cleandir
 1.63 31-May-1998  thorpej Specify a non-profiling C rule.
 1.62 24-Apr-1998  scottr Pull in a few more kgdb-related bits. Getting there...
 1.61 12-Apr-1998  tv Add -Wno-main conditional on compiler being gcc 2.8 or egcs. (This adds
a HAVE_GCC28 check-variable that can now be used to add other gcc-2.8
flags in cases where they may be useful, or to remove gcc 2.7.2 "bug
workaround" flags.)
 1.60 25-Nov-1997  scottr Fix dependency generation for assembler files; closes PR 4476,
but differently since the suggested change breaks cross compiling.
 1.59 12-Nov-1997  thorpej Make sure CPP, AR, AS, and RANLIB are defined.
 1.58 12-Nov-1997  thorpej Define LORDER, NM, and TSORT here, like we do the rest of the tools.
 1.57 30-Sep-1997  christos branches: 1.57.2;
PR/4162: Chris Jones: make cleandir does not work properly; it does not
remove the object files and the .depend file in the kernel build directory.
 1.56 12-Sep-1997  mycroft Kill vestiges of Locore.c.
 1.55 24-Jul-1997  scottr branches: 1.55.2;
Remove HOSTED_* targets; define and use CPP and SIZE symbols, as inspired
by cgd's recent changes for the Alpha port.
 1.54 12-Jul-1997  leo Generate assym.h dependencies when making 'depend'.
 1.53 15-Apr-1997  scottr Use genassym.sh to facilitate cross-compiling.
 1.52 14-Mar-1997  mycroft Define the `cleankernel' target consistently with other ports.
 1.51 04-Feb-1997  perry Nuke some options GENERIC residue.
 1.50 04-Feb-1997  perry Nuke some GENERIC residue.
 1.49 01-Feb-1997  scottr Now that we can compile without warnings, enable -Werror
 1.48 25-Jan-1997  scottr `::\' => `:\' ; per recent sys/lib/*/Makefile.inc changes.
 1.47 13-Jan-1997  scottr branches: 1.47.2;
Compile kernels with -O2
 1.46 17-Dec-1996  scottr Remove -Werror for now (sigh). Somehow this slipped through several
kernel compiles without getting caught. Lame gcc optimizer bug.
 1.45 17-Dec-1996  scottr Add -Werror, remove -Wno-uninitialized.
 1.44 01-Dec-1996  jonathan * Replace explicit -O2 in CFLAGS with COPTS macro. Default COPTS?= -O2.
Lets users over-ride with makeoptions COPTS="..." in kernel config files.

Leave `mandatory' flags (like -msoft-float which on m68k enforces no
FP in kernel) in CFLAGS.
 1.43 09-Sep-1996  mycroft Move strip(1) flags into a separate variable, so that $STRIP can
be passed to subordinate make(1)s. Remove $TOUCH. Add HOSTED_CC,
HOSTED_CPPFLAGS, and HOSTED_CFLAGS, and use them when depending genassym.
 1.42 31-Aug-1996  mycroft Wrap the default definition of `S' in `.ifndef'.
 1.41 12-Aug-1996  mycroft Put into . Remove hooks for `config-dependent' and
`device-driver' flags.
 1.40 10-Aug-1996  mycroft * Add a HOSTED_C_C variable, which strips `-p', `-pg', and
`-nostdinc', and use it when building genassym.
* Use `-nostdinc' just to be sure we're self-contained.
 1.39 10-Aug-1996  mycroft * Define CWARNFLAGS and MKDEP in some moderately consistent fashion.
* Make S expand to an absolute path at compile time.
* Use `-S' rather than `-x' to remove debugging symbols.
* Garbage collect unused variables.
* Reverse a handful of port-specific changes that do not correspond to
the common build model and are not needed.
 1.38 11-May-1996  mycroft Make `make depend' work for libraries.
 1.37 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.36 29-Feb-1996  cgd Do not build vnode_if.[ch] for each kernel. Build them once, like the
various syscall sources/headers, and just compile them. From PR 2142, OK'd
by mycroft.
 1.35 26-Feb-1996  mycroft Define build programs with `?=', so they can be overridden with `makeoptions'.
 1.34 09-Feb-1996  mycroft Fix mkdep problems due to missing flags.
 1.33 03-Feb-1996  briggs O2 breaks on this port. Use -O until we can fix it.
 1.32 03-Feb-1996  mycroft Use `-traditional-cpp' when building .s and .S files.
 1.31 02-Feb-1996  mycroft Clone these, and fix many bugs.
 1.30 02-Feb-1996  mycroft Don't special-case conf.c.
 1.29 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.28 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.27 14-Jan-1996  thorpej Remove vnode_if.[ch] during a "make clean", per PR#536 from
Dan Carosone <danielce@ee.mu.oz.au>.
 1.26 01-Nov-1995  briggs Remove -fno-builtin
 1.25 10-Oct-1995  briggs Remove extra reference to LIBKERN.
 1.24 19-Sep-1995  thorpej Compile the kernel with -Werror and -fno-builtin.
 1.23 04-Jul-1995  briggs Fixup a comment.
 1.22 25-Jun-1995  briggs Stupid typo in last.
 1.21 25-Jun-1995  briggs Stupid pasto in last.
 1.20 25-Jun-1995  briggs Add libcompat.
 1.19 25-Jun-1995  briggs Fix the clean target.
 1.18 24-Jun-1995  briggs The kernel is called netbsd, not vmunix.
 1.17 16-Jun-1995  briggs Rearrange slightly.
 1.16 31-May-1995  briggs Make genassym depend on its C source.
 1.15 29-Mar-1995  briggs Nuke FPCOPROC and add FPU_EMULATE to GENERIC.
Support the above with gwr's sun3 stuff.
 1.14 23-Mar-1995  jtc Added -D_KERNEL to CFLAGS alongside each -DKERNEL.
 1.13 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.12 26-Oct-1994  cgd new RCS ID format.
 1.11 21-Jul-1994  briggs Take -nostdinc out of INCLUDES so we can get nlist.h and a.out.h for DDB.
 1.10 21-Jul-1994  briggs Put FPSP in SYSTEM_OBJS (missed this earlier, apparently, twice).
 1.9 08-Jul-1994  briggs Oops... Forgot to check in w/ FPSP support.
 1.8 25-Jun-1994  briggs branches: 1.8.2;
Checkpoint. GENERIC has some things disabled. Makefile updated for
vnode_if and some cleanup. copy.s added to files.
 1.7 13-Mar-1994  lkestel Added -I$S/arch, per amiga port. (Used by db_disasm.c.)
 1.6 27-Feb-1994  briggs Make FPCOPROC an options option and remove it from the Makefile defines.
Also add a configuration that doesn't have it.
 1.5 12-Feb-1994  briggs The booter can finally deal with ld's executables.
 1.4 30-Jan-1994  briggs Use LD=ld.dist instead of LD=ld until we get around to fixing the
bleeding booter.
 1.3 10-Jan-1994  briggs Makefile: Added -T 0 to link for kernel.
files.mac68k.newconf: Removed ddb entries.
 1.2 07-Dec-1993  briggs Add -Dmac68k as a COPTS so we can get cpu_disklabel.
 1.1 02-Dec-1993  briggs Migrate to new MACHINE definition (mac -> mac68k).
 1.8.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.47.2.1 30-Jan-1997  thorpej update from trunk
 1.55.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.55.2.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.57.2.2 26-Nov-1997  mellon Pull rev 1.60 up from trunk (scott)
 1.57.2.1 12-Nov-1997  thorpej Pull up "make sure tools are defined" changes from trunk.
 1.68.6.1 02-Aug-1999  thorpej Update from trunk.
 1.68.2.2 13-Feb-2000  scottr Sync with main branch.
 1.68.2.1 01-Nov-1999  scottr Sync with main branch.
 1.70.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.70.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.77.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.78.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.78.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.79.2.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.80.2.4 11-Dec-2002  thorpej Sync with HEAD.
 1.80.2.3 20-Jun-2002  nathanw Catch up to -current.
 1.80.2.2 08-Jan-2002  nathanw Catch up to -current.
 1.80.2.1 26-Oct-2001  nathanw file Makefile.mac68k was added on branch nathanw_sa on 2002-01-08 00:25:57 +0000
 1.83.8.1 14-Jul-2002  gehenna catch up with -current.
 1.85.10.1 06-Feb-2005  jmc Pull up patch (requested by martti in ticket #1086)
Move ipf to sys/dist/ipf and sync w. trunk
 1.85.6.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.85.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.85.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.85.6.1 03-Aug-2004  skrll Sync with HEAD
 1.87.2.1 27-Feb-2008  yamt sync with head.
 1.88.56.1 18-Feb-2008  mjf Sync with HEAD.
 1.88.50.1 23-Mar-2008  matt sync with HEAD
 1.89.40.1 08-Feb-2011  bouyer Sync with HEAD
 1.89.38.1 06-Jun-2011  jruoho Sync with HEAD.
 1.89.32.1 05-Mar-2011  rmind sync with head
 1.90.32.1 22-Sep-2015  skrll Sync with HEAD
 1.90.14.1 03-Dec-2017  jdolecek update from HEAD
 1.92.4.1 10-Jun-2019  christos Sync with HEAD
 1.92.2.1 30-Sep-2018  pgoyette Ssync with HEAD
 1.5 01-Feb-1995  mycroft Clean up deleted files.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 27-Feb-1994  briggs Disable SCSIDEBUG and make COMPAT_NOMID an option (defined).
 1.2 27-Feb-1994  briggs Make FPCOPROC an options option and remove it from the Makefile defines.
Also add a configuration that doesn't have it.
 1.1 23-Feb-1994  briggs Add a new configuration for testing NFS. Same options as GENERIC, with
the addition of NFSSERVER and NFSCLIENT.
 1.5 01-Feb-1995  mycroft Clean up deleted files.
 1.4 03-Dec-1994  briggs Same as GENERIC but w/o FPCOPROC option.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 27-Feb-1994  briggs Disable SCSIDEBUG and make COMPAT_NOMID an option (defined).
 1.1 27-Feb-1994  briggs Make FPCOPROC an options option and remove it from the Makefile defines.
Also add a configuration that doesn't have it.
 1.14 29-Oct-1996  briggs Obsolete.
 1.13 22-Sep-1996  scottr Update for recent config(8) changes.
 1.12 26-Aug-1996  mrg add COMPAT_12.
 1.11 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device.
 1.10 19-May-1996  scottr Update for new grf attachment code.
 1.9 06-May-1996  briggs Move grf0 at obio? from std.mac68k to the config files. Not all machine
have internal video.
 1.8 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7 12-Mar-1996  scottr Add "options M68020" so that 68851-specific code is only compiled when
we want it (we don't support the 020 without an 851 anyway). Note that
M68030 no longer implies support for 020+851.

This also allows us to compile with -m68030 iff M68020 isn't specified
in the config file.
 1.6 21-Nov-1995  briggs Get rid of obsolete time specs.
 1.5 16-Sep-1995  briggs Set timezone to 0. The booter's GMT bias should be used, instead.
 1.4 29-Mar-1995  briggs Nuke FPCOPROC and add FPU_EMULATE to GENERIC.
Support the above with gwr's sun3 stuff.
 1.3 11-Mar-1995  briggs Nuke NEWCONFIG. It's not used anymore at all.
 1.2 11-Mar-1995  briggs Use M68030 and M68040 instead of MC... Thanks to Luke Mewburn for
pointing out this inconsistency.
 1.1 01-Feb-1995  briggs Add a new config and remove some old ones.
 1.2 11-Feb-1996  scottr PETE was pretty useless; SPOT is my own machine, and will better
reflect the status of sbc driver configuration.
 1.1 10-Feb-1996  scottr Identical to GENERIC, but uses the `sbc' driver.
 1.36 19-May-2002  scottr SMALLRAM is an effective replacement for the SPOT and MYSTERY configs,
which are IIcx and IIx machines with not much RAM, respectively.

The PUMA config is configured somewhat optimally for one of Allen's
Quadras but doesn't do anything special as compared to SMALLRAM.
 1.35 25-Apr-2002  atatat branches: 1.35.2;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.34 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.33 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.32 08-Jul-2001  abs branches: 1.32.2; 1.32.8;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.31 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.30 14-Feb-2000  scottr Update for wscons.
 1.29 29-Jul-1999  augustss branches: 1.29.2;
It's time to be COMPAT_14.
 1.28 26-Jun-1998  lukem branches: 1.28.8; 1.28.12;
remove options FIFO; it's now the default
 1.27 05-Jan-1998  perry RCSID Police.
 1.26 18-Dec-1997  scottr Update for the NWO
 1.25 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.24 04-Nov-1997  briggs Puma will soon be looking a bit different.
 1.23 23-Jul-1997  scottr Remove unused option MAPMEM, as suggested by Erik Bertelsen
<erik@erik-be.uni-c.dk> in PR 3896.
 1.22 12-Jun-1997  mrg remove now obsolete "swap on..." lines.
 1.21 06-May-1997  lukem be consistent with use of spaces and tabs.
 1.20 12-Feb-1997  scottr Move asc0 here from std.mac68k. Add some minimal driver descriptions.
 1.19 31-Jan-1997  thorpej branches: 1.19.2;
Yet Another NFSCLIENT -> NFS. (I must be getting tired.)
 1.18 31-Jan-1997  thorpej Adopt for new file system and root spec grammar.
 1.17 19-Nov-1996  scottr branches: 1.17.2;
- Move non-optional options SWAPPAGER, VNODEPAGER, and DEVPAGER to std.mac68k
- Catch up with vm/vmparam.h (remove MACHINE_NONCONTIG)
- Fix space/tab niggles in SPOT config
- MYSTERY now includes the esp driver
 1.16 11-Nov-1996  scottr Remove unused MAXFDESCS option. Closes PR 2927, noticed by Erik
Bertelsen <erik@aarhus1.uni-c.dk>.
 1.15 22-Sep-1996  scottr Update for recent config(8) changes.
 1.14 26-Aug-1996  mrg add COMPAT_12.
 1.13 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device.
 1.12 19-May-1996  scottr Update for new grf attachment code.
 1.11 06-May-1996  briggs grf0 -> grf*
 1.10 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.9 12-Mar-1996  scottr Add "options M68020" so that 68851-specific code is only compiled when
we want it (we don't support the 020 without an 851 anyway). Note that
M68030 no longer implies support for 020+851.

This also allows us to compile with -m68030 iff M68020 isn't specified
in the config file.
 1.8 07-Mar-1996  briggs Add option to try linked commands on all devices for PUMA.
 1.7 21-Nov-1995  briggs Get rid of obsolete time specs.
 1.6 01-Nov-1995  briggs Rearrange a bit. bpfilters -> 16 and ae0/ae1 -> ae*.
 1.5 16-Sep-1995  briggs branches: 1.5.2;
Set timezone to 0. The booter's GMT bias should be used, instead.
 1.4 01-Jul-1995  briggs Take out ncr96scsi0.
 1.3 22-Jun-1995  briggs Remove DIAGNOSTIC
 1.2 19-Jun-1995  briggs Take out M68040, add a more specific swap and add vnd.
 1.1 17-May-1995  briggs Add configuration for my gateway machine.
 1.5.2.1 16-Oct-1995  briggs use ae* instead of ae0,ae1.
 1.17.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.19.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.28.12.1 02-Aug-1999  thorpej Update from trunk.
 1.28.8.1 01-Nov-1999  scottr Sync with main branch.
 1.29.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.32.8.4 20-Jun-2002  nathanw Catch up to -current.
 1.32.8.3 17-Apr-2002  nathanw Catch up to -current.
 1.32.8.2 28-Feb-2002  nathanw Catch up to -current.
 1.32.8.1 08-Jul-2001  nathanw file PUMA was added on branch nathanw_sa on 2002-02-28 04:10:35 +0000
 1.32.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.32.2.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.35.2.1 30-May-2002  gehenna Catch up with -current.
 1.14 02-Apr-2002  lukem Rename MEMORY_DISK_SIZE (formerly MINIROOTSIZE) to MEMORY_DISK_ROOT_SIZE,
which was suggested by Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> as
being more consistent with what it's controlling...
 1.13 10-Mar-2002  lukem * rename MINIROOTSIZE to MEMORY_DISK_SIZE, so that all md(4) options
are now consistently named
* fold opt_mdsize.h into opt_md.h
 1.12 06-May-1997  lukem branches: 1.12.38; 1.12.42;
be consistent with use of spaces and tabs.
 1.11 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.10 14-Feb-1997  scottr branches: 1.10.2;
Revive in simplified form; include GENERIC and enable md_root hooks.
 1.9 29-Oct-1996  briggs Obsolete.
 1.8 22-Sep-1996  scottr Update for recent config(8) changes.
 1.7 26-Aug-1996  mrg add COMPAT_12.
 1.6 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device.
 1.5 19-May-1996  scottr Update for new grf attachment code.
 1.4 06-May-1996  briggs Move grf0 at obio? from std.mac68k to the config files. Not all machine
have internal video.
 1.3 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 12-Mar-1996  scottr Add "options M68020" so that 68851-specific code is only compiled when
we want it (we don't support the 020 without an 851 anyway). Note that
M68030 no longer implies support for 020+851.

This also allows us to compile with -m68030 iff M68020 isn't specified
in the config file.
 1.1 21-Nov-1995  briggs Small RAMDISK kernel.
 1.10.2.2 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.10.2.1 14-Feb-1997  is file RAMDISK was added on branch is-newarp on 1997-03-12 15:08:22 +0000
 1.12.42.2 17-Apr-2002  nathanw Catch up to -current.
 1.12.42.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.12.38.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.12.38.1 16-Mar-2002  jdolecek Catch up with -current.
 1.44 27-Sep-2020  roy vether: Add to kernel configurations

It's only enabled if the kernel enabled bridge AND tap.
Otherwise it's commented out.
 1.43 14-Sep-2017  mrg clean up COMPAT_* options for native netbsd code:
- new series of files that are useful for saying "i want everything
since netbsd 1.4", etc.
- use the fact COMPAT_* options have future dependancies to remove
many redundant options.

removes about 3000 lines total across kernel configuration files.
tested about 30 random kernels in the changed list.
 1.42 07-Aug-2015  maxv Remove the KMEMSTATS option. It no longer exists.
 1.41 16-Aug-2014  apb branches: 1.41.2;
Add "no options COMPAT_70" to all kernel configuration files that
already had "no options COMPAT_60".
 1.40 17-Oct-2012  apb Add "no options COMPAT_60" to all kernel configuration files
that already had "no options COMPAT_50".
 1.39 03-Oct-2011  hauke branches: 1.39.2; 1.39.12;
Add the MI software watchdog to GENERIC (not to SMALLRAM, as usual).
 1.38 06-Mar-2011  bouyer merge the bouyer-quota2 branch. This adds a new on-disk format
to store disk quota usage and limits, integrated with ffs
metadata. Usage is checked by fsck_ffs (no more quotacheck)
and is covered by the WAPBL journal. Enabled with kernel
option QUOTA2 (added where QUOTA was enabled in kernel config files),
turned on with tunefs(8) on a per-filesystem
basis. mount_mfs(8) can also turn quotas on.

See http://mail-index.netbsd.org/tech-kern/2011/02/19/msg010025.html
for details.
 1.37 24-Nov-2010  hauke branches: 1.37.2; 1.37.4;
One more page in the Big Book Of Things That We Can do Without --
COMPAT* options, puffs support.
 1.36 07-Dec-2009  pooka branches: 1.36.4;
remove rest of 'no file-system PORTAL' (portalfs kernel driver was removed)
 1.35 27-Nov-2008  hauke Remove various COMPAT_ options for unsupported releases and optional
features; remove parallel printer driver.
Bring back pppoe support.
 1.34 24-Nov-2008  ad Remove softdep, pass 1. We are focused on improving journalling.

Proposed on tech-kern@.
 1.33 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.32 08-Aug-2008  hauke branches: 1.32.2;
No WAPBL (ffs journaling) for memory-strapped machines.
 1.31 27-Mar-2008  hauke branches: 1.31.4; 1.31.6; 1.31.10;
Add explanation for the sbc flags to the kernel configurations that
use the sbc 53c80 driver. Until now, this information has lived in the
source code, only; neither sbc nor ncrscsi have a man page.

Triggered by PR port-mac68k/2921
 1.30 17-Oct-2007  garbled branches: 1.30.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.29 01-Sep-2007  hauke Leverage the new config(8) options for disabling features. This way,
it is easier to keep kernel configuration files up-to-date.

While we are here, disable a few compat options - NetBSD 1.5 has been
a while.

Tested on a Macintosh SE/30 with ae(4) ethernet card.
 1.28 02-Jun-2007  tsutsui branches: 1.28.4; 1.28.8; 1.28.10;
Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.27 26-Aug-2006  christos branches: 1.27.12; 1.27.14; 1.27.20;
PR/34283: Gene ENonymous: Add IPFILTER_LOOKUP to the default kernel options
Also remove CCITT,NS,NIP
 1.26 05-Feb-2006  cube branches: 1.26.2;
Remove 'count' argument for pseudo-devices that ignore it
(vnd, bpfilter, ppp, gif, gre, tun, sl, strip, faith, stf).
 1.25 04-Feb-2006  rpaulo bpfilter doesn't accept count anymore.
 1.24 20-Dec-2005  thorpej branches: 1.24.2; 1.24.4; 1.24.6;
Remove the tablet line discipline.
 1.23 07-Dec-2005  tsutsui Adjust comments for options FFS_NO_SNAPSHOT.

XXX: This option should be mentioned in options(4).
 1.22 19-Aug-2005  christos Enable ptyfs by default on the non-install and non small/tiny/ramdisk kernels
 1.21 19-Aug-2005  christos 64 bit inode changes.
 1.20 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.19 30-Jul-2005  yamt add "options VMSWAP" to non INSTALL kernels.
 1.18 07-Jul-2005  tron Add (commented out) IPSEC_NAT_T option.
 1.17 25-Feb-2005  simonb branches: 1.17.2; 1.17.4;
Add COMPAT_20 (and COMPAT_16 in some cases) to kernel config files
that didn't have those options but had other earlier compat options.
 1.16 18-Feb-2005  dsl Invert FFS_SNAPSHOT to FFS_NO_SNAPSHOT
 1.15 11-Feb-2005  dsl Add 'option FFS_SNAPSHOT' to most of the config files.
Commented out for kernels that appear to hace space constraints.
 1.14 31-Jan-2005  hannken Add file system snapshots to kernel configs.

- Ffs internal snapshots get compiled in unconditionally.

- File system snapshot device fss(4) added to all kernel configs that
have a disk. Device is commented out on all non-GENERIC kernels.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
 1.13 19-Jan-2005  chs branches: 1.13.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.12 17-Jan-2005  cube Add tap(4) support to a random^Wcarefully chosen set of kernel configs.
All those kernels have a line for both tun and bridge, and if either is
commented out, tap is commented out also. With the exception of i386's
GENERIC_TINY.

XXX: we _need_ some way of making this more simple.
 1.11 10-Nov-2004  christos branches: 1.11.4;
Add COMPAT_BSDPTY on all the kernels that have COMPAT options.
 1.10 04-Sep-2004  manu IPv4 PIM support, based on a submission from Pavlin Radoslavov posted on
tech-net@
 1.9 15-Jul-2004  atatat Add "options SYSCTL_INCLUDE_DESCR" to a lot of configs, but commented
out in most of them.
 1.8 22-Sep-2003  cl branches: 1.8.2;
add COMPAT_15/COMPAT_16
 1.7 10-Apr-2003  christos branches: 1.7.2;
Bye Bye UCONSOLE
 1.6 21-Jan-2003  jdolecek config says nsphy and ukphy are orphaned (nothing matching 'mii?' declared)
comment them out
 1.5 25-Sep-2002  martti Add one space between "#option" and "<tab>IPFILTER_DEFAULT_BLOCK"
 1.4 20-Sep-2002  martti Added (commented out) IPFILTER_DEFAULT_BLOCK.
 1.3 18-Sep-2002  lukem enable USERCONF by default; it's small and extremely useful to have available.
 1.2 17-Jun-2002  lukem branches: 1.2.2; 1.2.4;
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.1 19-May-2002  scottr branches: 1.1.2; 1.1.4;
Example configuration for a system with a slow 68030 with limited RAM.
This was derived from the old SPOT config and is a cousin of the MYSTERY
config, both of which will be summarily executed.
 1.1.4.3 14-Jul-2002  gehenna catch up with -current.
 1.1.4.2 30-May-2002  gehenna Catch up with -current.
 1.1.4.1 19-May-2002  gehenna file SMALLRAM was added on branch gehenna-devsw on 2002-05-30 15:33:26 +0000
 1.1.2.2 24-Oct-2002  lukem Pull up upgrade to IPfilter 3.4.29 (requested by martti in ticket #905).
Affected files & revisions:

dist/ipf/HISTORY 1.14
dist/ipf/fils.c 1.17-1.21
dist/ipf/ipf.c 1.11-1.13
dist/ipf/ipfs.c 1.8-1.10
dist/ipf/ipft_ef.c 1.6-1.7
dist/ipf/ipft_td.c 1.6-1.7
dist/ipf/ipft_tx.c 1.7-1.8
dist/ipf/ipmon.c 1.12-1.17
dist/ipf/ipnat.c 1.11-1.12
dist/ipf/ipsend/ip_var.h 1.2
dist/ipf/ipsend/ipsend.c 1.8
dist/ipf/ipsend/iptests.c 1.5
dist/ipf/ipt.c 1.8-1.10
dist/ipf/kmem.c 1.8-1.10
dist/ipf/man/ipf.4 1.10
dist/ipf/man/ipf.5 1.8
dist/ipf/man/ipftest.1 1.3
dist/ipf/man/ipmon.8 1.10
dist/ipf/man/ipnat.5 1.9-1.10
dist/ipf/man/ipnat.8 1.4
dist/ipf/misc.c 1.7
dist/ipf/natparse.c 1.10
dist/ipf/parse.c 1.13
dist/ipf/printnat.c 1.8-1.10
dist/ipf/relay.c 1.5-1.6
dist/ipf/rules/example.9 1.2
etc/rc.d/ipnat 1.8
regress/sys/kern/ipf/Makefile 1.3-1.4
regress/sys/kern/ipf/dotest6 1.2
regress/sys/kern/ipf/expected/f13 1.1.1.2
regress/sys/kern/ipf/expected/i12 1.1.1.1
regress/sys/kern/ipf/expected/ni3 1.1.1.1
regress/sys/kern/ipf/expected/ni5 1.2
regress/sys/kern/ipf/input/f13 1.1.1.2
regress/sys/kern/ipf/input/ipv6.1 1.1.1.1
regress/sys/kern/ipf/input/ni3 1.1.1.1
regress/sys/kern/ipf/regress/i12 1.1.1.1
regress/sys/kern/ipf/regress/ipv6.1 1.1.1.1
regress/sys/kern/ipf/regress/ni3.ipf 1.1.1.1
regress/sys/kern/ipf/regress/ni3.nat 1.1.1.1
sys/arch/alpha/conf/ALPHA 1.169,1.171
sys/arch/amiga/conf/GENERIC 1.185-1.186
sys/arch/arc/conf/GENERIC 1.71-1.72
sys/arch/atari/conf/GENERIC.in 1.24-1.25
sys/arch/cats/conf/GENERIC 1.31-1.32
sys/arch/cobalt/conf/GENERIC 1.34-1.35
sys/arch/hp300/conf/GENERIC 1.83-1.84
sys/arch/i386/conf/CARDBUS 1.66-1.67
sys/arch/i386/conf/GENERIC 1.510,1.512
sys/arch/i386/conf/GENERIC_LAPTOP 1.58-1.59
sys/arch/i386/conf/GENERIC_PS2TINY 1.19-1.20
sys/arch/i386/conf/GENERIC_TINY 1.47-1.48
sys/arch/luna68k/conf/GENERIC 1.33-1.33
sys/arch/mac68k/conf/GENERIC 1.130-1.131
sys/arch/mac68k/conf/GENERICSBC 1.21-1.22
sys/arch/mac68k/conf/SMALLRAM 1.4-1.5
sys/arch/macppc/conf/GENERIC 1.142-1.143
sys/arch/mipsco/conf/GENERIC 1.21-1.22
sys/arch/mmeye/conf/GENERIC 1.44-1.45
sys/arch/news68k/conf/GENERIC 1.36-1.37
sys/arch/news68k/conf/GENERIC_TINY 1.18-1.19
sys/arch/newsmips/conf/GENERIC 1.50-1.51
sys/arch/ofppc/conf/GENERIC 1.56-1.57
sys/arch/pmax/conf/GENERIC 1.103-1.104
sys/arch/prep/conf/GENERIC 1.55-1.56
sys/arch/sbmips/conf/GENERIC 1.11-1.12
sys/arch/sgimips/conf/GENERIC 1.7-1.8
sys/arch/sparc/conf/GENERIC 1.138-1.139
sys/arch/sparc64/conf/GENERIC32 1.46-1.47
sys/arch/vax/conf/GENERIC 1.102-1.103
sys/arch/x68k/conf/ALL 1.55-1.56
sys/arch/x68k/conf/GENERIC 1.80-1.81
sys/lkm/netinet/if_ipl/mln_ipl.c 1.29
sys/netinet/fil.c 1.57-1.58
sys/netinet/ip_auth.c 1.29-1.30
sys/netinet/ip_compat.h 1.30-1.31
sys/netinet/ip_fil.c 1.81-1.86
sys/netinet/ip_fil.h 1.46-1.49
sys/netinet/ip_frag.c 1.33-1.34
sys/netinet/ip_frag.h 1.18
sys/netinet/ip_ftp_pxy.c 1.25-1.26
sys/netinet/ip_h323_pxy.c 1.5-1.6
sys/netinet/ip_log.c 1.22-1.23
sys/netinet/ip_nat.c 1.51-1.53
sys/netinet/ip_nat.h 1.27
sys/netinet/ip_netbios_pxy.c 1.4
sys/netinet/ip_proxy.c 1.35-1.36
sys/netinet/ip_proxy.h 1.18
sys/netinet/ip_state.c 1.41-1.42
sys/netinet/ip_state.h 1.23
sys/netinet/ipl.h 1.14
 1.1.2.1 01-Aug-2002  lukem Pull up revision 1.2 (requested by lukem in ticket #312):
Enable "pseudo-device clockctl" in all kernels, except
installation related kernels (INSTALL* and RAMDISK*).
This enables rc.conf(5) $ntpd_chroot to be used "out of the box"
 1.2.4.4 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.4.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.1 17-Jun-2002  jdolecek file SMALLRAM was added on branch kqueue on 2002-06-23 17:37:42 +0000
 1.2.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.2 20-Jun-2002  nathanw Catch up to -current.
 1.2.2.1 17-Jun-2002  nathanw file SMALLRAM was added on branch nathanw_sa on 2002-06-20 03:39:23 +0000
 1.7.2.10 11-Dec-2005  christos Sync with head.
 1.7.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.2.8 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.7.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.7.2.6 04-Feb-2005  skrll Sync with HEAD.
 1.7.2.5 24-Jan-2005  skrll Sync with HEAD.
 1.7.2.4 14-Nov-2004  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.8.2.1 15-Jul-2004  he Pull up revision 1.9 (requested by atatat in ticket #663):
Add "options SYSCTL_INCLUDE_DESCR" to a lot of configurations,
but commented out in most of them.
 1.11.4.1 29-Apr-2005  kent sync with -current
 1.13.2.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.13.2.1 12-Feb-2005  yamt sync with head.
 1.17.4.3 03-Sep-2007  yamt sync with head.
 1.17.4.2 30-Dec-2006  yamt sync with head.
 1.17.4.1 21-Jun-2006  yamt sync with head.
 1.17.2.1 18-Jul-2005  riz Pull up revision 1.18 (requested by tron in ticket #566):
Add (commented out) IPSEC_NAT_T option.
 1.24.6.1 22-Apr-2006  simonb Sync with head.
 1.24.4.1 09-Sep-2006  rpaulo sync with head
 1.24.2.1 18-Feb-2006  yamt sync with head.
 1.26.2.1 03-Sep-2006  yamt sync with head.
 1.27.20.2 03-Oct-2007  garbled Sync with HEAD
 1.27.20.1 26-Jun-2007  garbled Sync with HEAD.
 1.27.14.1 11-Jul-2007  mjf Sync with head.
 1.27.12.2 12-Oct-2007  ad Fix merge errors.
 1.27.12.1 09-Jun-2007  ad Sync with head.
 1.28.10.1 06-Nov-2007  matt sync with HEAD
 1.28.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.28.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.30.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.30.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.30.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.31.10.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.31.10.1 19-Oct-2008  haad Sync with HEAD.
 1.31.6.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.31.4.2 11-Mar-2010  yamt sync with head
 1.31.4.1 04-May-2009  yamt sync with head.
 1.32.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.4.2 21-Apr-2011  rmind sync with head
 1.36.4.1 05-Mar-2011  rmind sync with head
 1.37.4.1 08-Feb-2011  bouyer Add QUOTA2 where QUOTA is enabled (and QUOTA2 commented out where QUOTA
is commented out)
 1.37.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.39.12.2 03-Dec-2017  jdolecek update from HEAD
 1.39.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.39.2.1 30-Oct-2012  yamt sync with head
 1.41.2.1 22-Sep-2015  skrll Sync with HEAD
 1.46 19-May-2002  scottr SMALLRAM is an effective replacement for the SPOT and MYSTERY configs,
which are IIcx and IIx machines with not much RAM, respectively.

The PUMA config is configured somewhat optimally for one of Allen's
Quadras but doesn't do anything special as compared to SMALLRAM.
 1.45 25-Apr-2002  atatat branches: 1.45.2;
Add the INCLUDE_CONFIG_FILE option to all config files. In config
files that are generic (ie, GENERIC, GENERICSBC, GENERIC32, ALL, or
ALPHA), it is uncommented.
 1.44 12-Apr-2002  gmcgarry Add commented-out USERCONF option. Mainly useful for install media
and can be optionally enabled based on miniroot and ramdisk size
requirements.
 1.43 27-Jan-2002  jdolecek add options PIPE_SOCKETPAIR to individual kernel configs
the option is commented out on everything but kernels I was able
to recognize as INSTALL-like or ones for small memory machines
 1.42 20-Nov-2001  lukem - pull in opt_kgdb.h where necessary
- replace opt_kgdb_machdep.h with opt_kgdb.h
- defparam opt_kgdb.h:
KGDB_DEV KGDB_DEVNAME KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
- move from opt_ddbparam.h to opt_ddb.h:
DDB_FROMCONSOLE DDB_ONPANIC DDB_HISTORY_SIZE DDB_BREAK_CHAR SYMTAB_SPACE
- replace KGDBDEV with KGDB_DEV
- replace KGDBADDR with KGDB_DEVADDR
- replace KGDBMODE with KGDB_DEVMODE
- replace KGDBRATE with KGDB_DEVRATE
- use `9600' instead of `0x2580' for 9600 baud rate
- use correct quotes for options KGDB_DEVNAME="\"com\""
- use correct quotes for options KGDB_DEV="17*256+0"
- remove unnecessary dependancy on Makefile for kgdb_stub.o
- minor whitespace cleanup
 1.41 08-Jul-2001  abs branches: 1.41.2; 1.41.8;
Standardise TCP_COMPAT_42 as commented out, grouped with other COMPAT options,
and with the comment '4.2BSD TCP/IP bug compat. Not recommended'
Add commented out 'TCP_DEBUG # Record last TCP_NDEBUG packets with SO_DEBUG'
(All hail amiga and atari which make some attempt to automate the
multiplicity of config files...)
 1.40 24-Sep-2000  jdolecek don't specify number of ptys if >= 16 (current default initial number)
pty comments: normalize and g/c what is no longer relevant
 1.39 14-Feb-2000  scottr Update for wscons.
 1.38 29-Jul-1999  augustss branches: 1.38.2;
It's time to be COMPAT_14.
 1.37 22-Dec-1998  scottr branches: 1.37.2; 1.37.6;
Update for present reality.
 1.36 26-Jun-1998  lukem remove options FIFO; it's now the default
 1.35 24-Apr-1998  scottr Update to present reality.
 1.34 27-Feb-1998  scottr Bump down maxusers to a reasonable value on a machine with 8MB.
 1.33 18-Dec-1997  scottr Make these more closely resemble the old configurations.
 1.32 16-Dec-1997  scottr Update to match std.mac68k changes.
 1.31 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.30 07-Aug-1997  scottr Strip down to bare essentials for these machines.
 1.29 07-May-1997  lukem branches: 1.29.4;
minor whitespaco fixes
 1.28 06-May-1997  lukem be consistent with use of spaces and tabs.
 1.27 08-Apr-1997  scottr Update for current configuration, including sbc reselect mode.
 1.26 12-Feb-1997  scottr Move asc0 here from std.mac68k. Add some minimal driver descriptions.
 1.25 31-Jan-1997  thorpej branches: 1.25.2;
Adopt for new file system and root spec grammar.
 1.24 26-Jan-1997  scottr Forgot PFIL_HOOKS; correct this. Also, organize options less insanely.
 1.23 25-Jan-1997  scottr Add LKM, ipfilter
 1.22 20-Jan-1997  scottr Compile with -O2 now.
 1.21 15-Jan-1997  perry 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.20 17-Dec-1996  scottr branches: 1.20.2;
Take avantage of COPTS appropriately.
 1.19 19-Nov-1996  scottr - Move non-optional options SWAPPAGER, VNODEPAGER, and DEVPAGER to std.mac68k
- Catch up with vm/vmparam.h (remove MACHINE_NONCONTIG)
- Fix space/tab niggles in SPOT config
- MYSTERY now includes the esp driver
 1.18 11-Nov-1996  scottr Remove unused MAXFDESCS option. Closes PR 2927, noticed by Erik
Bertelsen <erik@aarhus1.uni-c.dk>.
 1.17 29-Oct-1996  briggs ncr96scsi -> esp for consistency with sparc and alpha.
 1.16 15-Oct-1996  scottr We no longer need 'options GENERIC'
 1.15 22-Sep-1996  scottr Update for recent config(8) changes.
 1.14 12-Sep-1996  scottr Add uk, remove ch device
 1.13 12-Sep-1996  scottr Update to current reality.
 1.12 26-Aug-1996  mrg add COMPAT_12.
 1.11 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device.
 1.10 20-Jun-1996  scottr SPOT is now an NFS server, too.
 1.9 11-Jun-1996  scottr Update for current reality
 1.8 20-May-1996  scottr Fix the last change; CVS apparently biffed it.
 1.7 19-May-1996  scottr Update for new grf attachment code.
 1.6 06-May-1996  briggs Move grf0 at obio? from std.mac68k to the config files. Not all machine
have internal video.
 1.5 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.4 13-Apr-1996  scottr Update makeoptions to include 881 support
 1.3 23-Mar-1996  scottr Add PPP compression options
 1.2 12-Mar-1996  scottr Add "options M68020" so that 68851-specific code is only compiled when
we want it (we don't support the 020 without an 851 anyway). Note that
M68030 no longer implies support for 020+851.

This also allows us to compile with -m68030 iff M68020 isn't specified
in the config file.
 1.1 11-Feb-1996  scottr PETE was pretty useless; SPOT is my own machine, and will better
reflect the status of sbc driver configuration.
 1.20.2.3 30-Jan-1997  thorpej update from trunk
 1.20.2.2 18-Jan-1997  thorpej Update from trunk.
 1.20.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.25.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.29.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.37.6.1 02-Aug-1999  thorpej Update from trunk.
 1.37.2.1 01-Nov-1999  scottr Sync with main branch.
 1.38.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.41.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.41.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.41.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.41.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.41.8.1 08-Jul-2001  nathanw file SPOT was added on branch nathanw_sa on 2002-01-08 00:25:57 +0000
 1.41.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.41.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.41.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.45.2.1 30-May-2002  gehenna Catch up with -current.
 1.1 26-Jul-2019  rin branches: 1.1.10;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.1.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.10.1 26-Jul-2019  martin file WSFB was added on branch phil-wifi on 2020-04-13 08:03:57 +0000
 1.3 09-Aug-2019  rin branches: 1.3.8;
Mimic macppc color/font settings, which also reduces differences b/w
color and monochrome color depths.
 1.2 02-Aug-2019  rin Add commented out GENFB_SHADOWFB option.
 1.1 26-Jul-2019  rin branches: 1.1.2;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.1.2.1 18-Aug-2019  martin Pull up following revision(s) (requested by rin in ticket #84):

sys/arch/mac68k/conf/WSFB.common: revision 1.2
sys/arch/mac68k/conf/WSFB.common: revision 1.3

Mimic macppc color/font settings, which also reduces differences b/w
color and monochrome color depths.

Add commented out GENFB_SHADOWFB option.
 1.3.8.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.3.8.1 09-Aug-2019  martin file WSFB.common was added on branch phil-wifi on 2020-04-13 08:03:57 +0000
 1.1 26-Jul-2019  rin branches: 1.1.10;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.1.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.10.1 26-Jul-2019  martin file WSFBSBC was added on branch phil-wifi on 2020-04-13 08:03:57 +0000
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2 02-Dec-1993  mycroft Clean up deleted files.
 1.1 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
 1.135 03-Apr-2025  nat Add pbbat(4)

Now it is possible to monitor the PowerBook 1xx AC adaptors and battery via
envsys(4).
 1.134 14-Sep-2024  nat Add support for the power button on the PowerBook 160/180.
 1.133 13-Mar-2024  nat branches: 1.133.2;
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.132 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.131 26-Feb-2021  rin Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
 1.130 22-Aug-2019  rin branches: 1.130.8;
G/C obsoleted
 1.129 26-Jul-2019  rin branches: 1.129.2;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.128 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.127 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.126 25-Feb-2018  mrg branches: 1.126.2; 1.126.4;
add a special rule to build m68k/fpu.c to avoid passing -msoft-float.
fixes GCC 6 kernel builds that use this file.
 1.125 15-Nov-2011  tsutsui Merge copy-and-pasted fpu_probe() function (to share it among more m68k ports).
Tested on TT030, Sun3/80, and X68030.
 1.124 12-Jun-2011  rmind branches: 1.124.2;
Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.123 06-Jun-2010  mrg branches: 1.123.6;
defflag GRF_COMPAT.
 1.122 22-May-2008  hauke branches: 1.122.18; 1.122.20;
Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.121 20-Feb-2008  drochner branches: 1.121.6; 1.121.8; 1.121.10; 1.121.12;
Since files.wscons et al. are included by ~all ports anyway, include
them in the mi "files" file, and remove include statements from md files.
These shouldn't pull in additional kernel code when not in use, so it
shouldn't do any harm except a risk of namespace collisions which
should be easy to fix.
 1.120 03-Dec-2007  ad 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.119 17-Oct-2007  garbled branches: 1.119.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.118 10-Jun-2007  tsutsui branches: 1.118.8; 1.118.10;
Switch mac68k's sn(4) Ethernet to MI SONIC driver.

Tested with Apple Ethernet CS Twisted-Pare Card on LC630 by me
and Quadra 650 on-board Ethernet by hauke@.
NuBus based cards and PowerBook variants are still untested.
 1.117 02-Jun-2007  tsutsui Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.116 08-Mar-2007  tsutsui branches: 1.116.2; 1.116.4; 1.116.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.115 11-Dec-2005  christos branches: 1.115.26;
merge ktrace-lwp.
 1.114 19-Jan-2005  chs branches: 1.114.8;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.113 14-Nov-2004  christos branches: 1.113.4;
use the common procfs_machdep.c
 1.112 05-Nov-2002  chs branches: 1.112.6;
merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.111 03-Nov-2002  chs use a merged sys_machdep.c for all the motorola-MMU m68k platforms.
 1.110 03-Nov-2002  chs merge all the m68k copies of kgdb_machdep.c.
 1.109 02-Nov-2002  chs enhance the common m68k db_memrw.c to handle read-only kernel text
and switch all the motorola-MMU m68k platforms to use it.
 1.108 20-Oct-2002  chs merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.107 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.106 19-Jun-2002  itojun netdock* - ethernet driver for Asante NetDock/Newer Ether MicroDock.
by Daishi Kato <daishi@axlight.com>
test/stabilization by Takeo Kuwata <tkuwata@virus.kyoto-u.ac.jp>
 1.105 27-Apr-2002  shiba branches: 1.105.2;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.104 16-Apr-2002  thorpej * Move the mii_bitbang attribute into dev/mii/files.mii
* Pull in dev/mii/files.mii from conf/files, rather than playing
the magic "files include order" dance in N machine-dependent
configuration definitions.
 1.103 10-Apr-2002  briggs Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.102 21-Jan-2002  jdolecek Switch to MI dev/md_root.c for archs which don't have any special
memory disk hooks (i.e. everything except atari).
 1.101 28-Nov-2001  lukem - convert usage of "defopt" to "defflag" where the relevant option does
not support a value (e.g., it's to be used as "options FOO" instead of
"options FOO=xxx"). options that take a value were converted to
defparam recently.
- minor whitespace & formatting cleanups
 1.100 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.99 20-Nov-2001  chs include COMPAT_AOUT_M68K stuff.
 1.98 18-Jun-2001  christos branches: 1.98.2; 1.98.8;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.97 17-Jan-2001  fvdl branches: 1.97.2;
Add machdep file for procfs. Currently only used for linux-style
/proc/cpuinfo (only active when procfs is mounted with -o linux).
For ports other than the i386 this currently produces an empty
string.
 1.96 30-Jul-2000  briggs Add nubus attachment for smc91cxx driver.
 1.95 27-Mar-2000  scottr branches: 1.95.4;
The declaration for esp has moved to conf/files. (Hi Charles!)
 1.94 14-Mar-2000  oster Add the RAIDframe device major to the machine-dependent config files
so that the right entries get added to dev_name2blk[]. Needed for / on RAID.
(Whoops! I missed checking these in when adding the RAID_AUTOCONFIG stuff.)
 1.93 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.92 28-Jun-1999  itojun branches: 1.92.2;
- Call ip6intr if INET6 is defined.
- remove "need-flag" for mac68k esp driver, as it is not used in anywhere
and conflicts with IPsec ESP header.

This should be the only MD change in IPv6 support, except kernel config file.
Very sorry if you have any compilation problem with it (I believe it is okay).
If your favorite arch is not included in here, please add a
call to ip6intr() from softintr handle.
 1.91 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.90 07-Jun-1999  thorpej Only declare block major numbers for devices which can be the root device.
 1.89 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.88 18-Feb-1999  scottr branches: 1.88.2; 1.88.6; 1.88.8;
Add support for the IWM driver.
 1.87 15-Dec-1998  itohy Added COMPAT_LINUX support.
 1.86 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.85 22-Oct-1998  scottr Defopt ALTXBUTTONS, DISABLE_EXT_CACHE, and ZS_CONSOLE_ABORT.
 1.84 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.83 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.82 31-May-1998  thorpej Build pmap_boostrap.o without profiling; we can't call mcount before the
mmu is enabled!
 1.81 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.80 24-Apr-1998  scottr Pull in a few more kgdb-related bits. Getting there...
 1.79 31-Mar-1998  ender Add the newly created bus_space.c so it gets compiled.
 1.78 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.77 16-Feb-1998  thorpej Remove "class" declarations, and add "devclass" declarations where
appropriate. Fix several inconsistencies between device class and
attributes. Mostly from Chris Demetriou.
 1.76 01-Feb-1998  is Amiga uses the common m68k/sig_machdep.c now. Also moved its definition from
the other 68k ports' files.${port} to arch/m68k/conf/files.m68k.
 1.75 12-Jan-1998  thorpej Update for changes to config.
 1.74 04-Nov-1997  briggs Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.73 20-Oct-1997  scottr branches: 1.73.2;
Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.72 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.71 29-Apr-1997  scottr branches: 1.71.2; 1.71.4;
Use the new 8390 driver back end.
 1.70 14-Apr-1997  scottr Direct config to create an MRG_ADB option header.
 1.69 11-Apr-1997  scottr Use common m68k sig_machdep.c, removing our local copies of these.
 1.68 09-Apr-1997  thorpej Remove redundant file directives.
 1.67 08-Apr-1997  scottr Make new ADB driver the default.
 1.66 21-Mar-1997  scottr Clean up after arp conversion; from Erik Bertelsen, closes PR 3372.
 1.65 17-Mar-1997  gwr Separate bcopy and copypage stuff from copy.s
 1.64 15-Mar-1997  briggs Add SONIC driver. Works on my Q700. Untested elsewhere.
 1.63 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.62 06-Mar-1997  briggs Undo some damage that CVS somehow let me get away with.
 1.61 01-Mar-1997  scottr Adapt to sbc driver/attachment split
 1.60 27-Feb-1997  briggs Add ncr53c9x flag to esp.
 1.59 24-Feb-1997  scottr Update to reflect ae driver/attachment code split
 1.58 13-Feb-1997  scottr Split the obio interface into two forms: optional address only for most
devices (obio_norm) or optional address, HSK, and DMA for 5380-based SCSI
controllers (obio_scsi5380). Update all obio-attached drivers
appropriately.

Also, attach fpu to mainbus, rather than obio.
 1.57 11-Feb-1997  scottr Add an addr locator to obio.
 1.56 10-Feb-1997  scottr Add needs-flag to asc driver
 1.55 21-Jan-1997  thorpej branches: 1.55.2;
"md" is declared in sys/conf/files, now.
 1.54 20-Jan-1997  scottr Minor formatting cleanup, and remove an old comment
 1.53 28-Dec-1996  pk branches: 1.53.2;
rename: ramdisk => md
 1.52 29-Oct-1996  briggs ncr96scsi -> esp for consistency with sparc and alpha.
 1.51 22-Sep-1996  scottr Update for recent config(8) changes.
 1.50 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device, instead of obio.
 1.49 19-Jun-1996  scottr Completely revamp setroot() and friends. Since Chris' version of this code
is close to how I reworked it, I pulled in the (essentially MI) NetBSD/alpha
and added the appropriate support around it.

- No need for the GENERIC kernel config option.
- NFS-mounted root and swap are supported.
- If we can't figure out where the root filesystem is from what the Booter
tells us, ask the user.
- Split the mainbus autoconfig code to a separate file.

Also, update/add copyrights as appropriate.
 1.48 19-May-1996  scottr Update for new grf attachment code.
 1.47 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.46 06-May-1996  scottr Update for renamed sbc driver files
 1.45 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.44 29-Apr-1996  scottr Remove trash left from a merge (probably really my fault).
 1.43 28-Apr-1996  briggs shuffle some and change rd to pseudo-device.
 1.42 25-Apr-1996  scottr Renamed the sbc driver files
 1.41 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.40 22-Feb-1996  gwr Add m68k/db_memrw.c
 1.39 07-Feb-1996  scottr Add sbc driver.
 1.38 02-Feb-1996  mycroft Don't special-case conf.c.
 1.37 21-Nov-1995  briggs RAMDISK stuff.
 1.36 03-Nov-1995  briggs include files.fpe instead of just fpu_emulate.c--to get the new fpe code.
 1.35 03-Sep-1995  briggs Make the new m.i. scsi driver the default.
 1.34 01-Jul-1995  briggs add needs-flag for the scsi chip interfaces.
 1.33 21-Jun-1995  briggs Add pmap_bootstrap.c and take out mac68k_init.c.
 1.32 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.31 27-Apr-1995  christos Use new files.sunos
 1.30 22-Apr-1995  christos Move sunos_machdep.c to m68k
 1.29 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.28 21-Apr-1995  briggs Get rid of old file from hp300 origins!?
 1.27 20-Apr-1995  briggs include mi scsi files file.
Change several devices from needs-count to needs-flag.
 1.26 11-Apr-1995  mellon Reference cninit.c as well as cons.c
 1.25 29-Mar-1995  briggs Nuke FPCOPROC and add FPU_EMULATE to GENERIC.
Support the above with gwr's sun3 stuff.
 1.24 11-Mar-1995  briggs Use M68030 and M68040 instead of MC... Thanks to Luke Mewburn for
pointing out this inconsistency.
 1.23 15-Feb-1995  briggs Update to add pramasm.s.
 1.22 05-Feb-1995  briggs Add major for vnd.
 1.21 25-Jan-1995  cgd add 'maxpartitions' keyword as first 'intesting' thing in the file, to
facilitate the solution of config.new's hardcoded partition number
problems.
 1.20 21-Jan-1995  briggs sunos_sysent.c -> sunos_init_sysent.c and add a few tabs for
readability.
 1.19 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.18 27-Nov-1994  briggs compat/sunos/sun_* -> compat/sunos/sunos_*
 1.17 27-Nov-1994  briggs Attempt to use sys/scsi.
 1.16 26-Oct-1994  cgd new RCS ID format.
 1.15 12-Sep-1994  briggs Give vnd a major number. Didn't work on my last attempt with it, but
this will be needed, anyway.
 1.14 21-Jul-1994  briggs Add asc as a device. Format a tad.
 1.13 09-Jul-1994  briggs Rearrange to alphabetize some. Nuke old console, add new console and
ADB code from Lawrence and Brad.
 1.12 26-Jun-1994  briggs branches: 1.12.2;
Erf. Forgot to put mac68k_init.c in alphabetically.
 1.11 26-Jun-1994  briggs Add mac68k_init.c and scsi96.c for 68040 macs and configure them. Not
much uses them, yet, but also added the MC68030 and MC68040 options.
 1.10 25-Jun-1994  briggs Checkpoint. GENERIC has some things disabled. Makefile updated for
vnode_if and some cleanup. copy.s added to files.
 1.9 27-Feb-1994  briggs Add files for compat_sunos. Shouldn't these be in sys/conf/files.newconf?
 1.8 22-Feb-1994  briggs Add fpu.c and alphabetize a bunch.
 1.7 30-Jan-1994  briggs Fix for magnum's scsi system, but referenced through arch/mac68k/scsi
as was the old stuff.
 1.6 20-Jan-1994  briggs Make uk and su look like devices. Haven't tried compiling uk. su is still
nothing.
 1.5 10-Jan-1994  briggs Makefile: Added -T 0 to link for kernel.
files.mac68k.newconf: Removed ddb entries.
 1.4 08-Jan-1994  cgd kill entries duplicated in files.m68k.newconf
 1.3 21-Dec-1993  briggs Add Apple Ethernet to GENERIC and files. Also add asc.c to files
for sound support.
 1.2 15-Dec-1993  briggs Let's try DDB...
 1.1 02-Dec-1993  briggs Migrate to new MACHINE definition (mac -> mac68k).
 1.12.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.53.2.1 30-Jan-1997  thorpej update from trunk
 1.55.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.71.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.71.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.73.2.1 05-Nov-1997  mellon Pull rev 1.74 up from trunk (scottr)
 1.88.8.2 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.88.8.1 28-Jun-1999  itojun KAME/NetBSD 1.4 SNAP kit, dated 19990628.

NOTE: this branch (kame) is used just for refernce. this may not compile
due to multiple reasons.
 1.88.6.2 01-Jul-1999  thorpej Sync w/ -current.
 1.88.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.88.2.11 13-Feb-2000  scottr WSDISPLAY_COMPAT_ITE has been removed in favor of the ite pseudo-device.
 1.88.2.10 07-Feb-2000  scottr Add ite pseudo-device.
 1.88.2.9 20-Nov-1999  scottr The grf pseudo-device obviates WSDISPLAY_COMPAT_GRF; translate tests on the latter to
tests against NGRF instead.
 1.88.2.8 15-Nov-1999  scottr Implement a more straightforward approach to grf emulation.
 1.88.2.7 01-Nov-1999  scottr Sync with main branch.
 1.88.2.6 15-Jun-1999  scottr Sync with main branch.
 1.88.2.5 22-May-1999  scottr Add support for wscons as a console, using evil trickery. To fix this
we'll have to revisit (and rip out) a bunch of things that happen before
the MMU is set up.

As a result, serial consoles now work again.
 1.88.2.4 16-May-1999  scottr Sync with main branch.
 1.88.2.3 11-Mar-1999  scottr ite/grf is dead, but wsdisplay will (at least partly) emulate them.
 1.88.2.2 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.88.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.92.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.92.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.95.4.1 06-Aug-2000  briggs Pullup approved by thorpej --
Add nubus-based SMC91cxx ethernet support for the mac68k.
 1.97.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.98.8.8 11-Nov-2002  nathanw Catch up to -current
 1.98.8.7 17-Sep-2002  nathanw Catch up to -current.
 1.98.8.6 01-Aug-2002  nathanw Catch up to -current.
 1.98.8.5 20-Jun-2002  nathanw Catch up to -current.
 1.98.8.4 17-Apr-2002  nathanw Catch up to -current.
 1.98.8.3 28-Feb-2002  nathanw Catch up to -current.
 1.98.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.98.8.1 18-Jun-2001  nathanw file files.mac68k was added on branch nathanw_sa on 2002-01-08 00:25:58 +0000
 1.98.2.5 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.98.2.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.98.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.98.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.98.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.105.2.3 16-Jul-2002  gehenna catch up with -current.
 1.105.2.2 17-May-2002  gehenna Remove old block majors list.
 1.105.2.1 16-May-2002  gehenna Include the list of block/character major numbers.
 1.112.6.2 24-Jan-2005  skrll Sync with HEAD.
 1.112.6.1 29-Nov-2004  skrll Sync with HEAD.
 1.113.4.1 29-Apr-2005  kent sync with -current
 1.114.8.3 27-Feb-2008  yamt sync with head.
 1.114.8.2 07-Dec-2007  yamt sync with head
 1.114.8.1 03-Sep-2007  yamt sync with head.
 1.115.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.116.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.116.4.1 11-Jul-2007  mjf Sync with head.
 1.116.2.3 03-Dec-2007  ad Sync with HEAD.
 1.116.2.2 15-Jul-2007  ad Sync with head.
 1.116.2.1 09-Jun-2007  ad Sync with head.
 1.118.10.3 23-Mar-2008  matt sync with HEAD
 1.118.10.2 09-Jan-2008  matt sync with HEAD
 1.118.10.1 06-Nov-2007  matt sync with HEAD
 1.118.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.119.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.121.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.121.10.2 11-Aug-2010  yamt sync with head.
 1.121.10.1 04-May-2009  yamt sync with head.
 1.121.8.1 04-Jun-2008  yamt sync with head
 1.121.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.122.20.2 03-Jul-2010  rmind sync with head
 1.122.20.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.122.18.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.123.6.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.124.2.1 17-Apr-2012  yamt sync with head
 1.126.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.126.4.1 10-Jun-2019  christos Sync with HEAD
 1.126.2.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.129.2.1 27-Apr-2021  martin Pull up following revision(s) (requested by rin in ticket #1256):

sys/arch/mac68k/mac68k/machdep.c: revision 1.360
sys/arch/mac68k/conf/GENERIC: revision 1.234
sys/arch/mac68k/conf/files.mac68k: revision 1.131

Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
 1.130.8.1 03-Apr-2021  thorpej Sync with HEAD.
 1.133.2.1 02-Aug-2025  perseant Sync with HEAD
 1.32 28-Apr-1995  cgd rename files files for new config/config.old naming
 1.31 27-Apr-1995  christos Use new files.sunos
 1.30 22-Apr-1995  christos Move sunos_machdep.c to m68k
 1.29 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.28 21-Apr-1995  briggs Get rid of old file from hp300 origins!?
 1.27 20-Apr-1995  briggs include mi scsi files file.
Change several devices from needs-count to needs-flag.
 1.26 11-Apr-1995  mellon Reference cninit.c as well as cons.c
 1.25 29-Mar-1995  briggs Nuke FPCOPROC and add FPU_EMULATE to GENERIC.
Support the above with gwr's sun3 stuff.
 1.24 11-Mar-1995  briggs Use M68030 and M68040 instead of MC... Thanks to Luke Mewburn for
pointing out this inconsistency.
 1.23 15-Feb-1995  briggs Update to add pramasm.s.
 1.22 05-Feb-1995  briggs Add major for vnd.
 1.21 25-Jan-1995  cgd add 'maxpartitions' keyword as first 'intesting' thing in the file, to
facilitate the solution of config.new's hardcoded partition number
problems.
 1.20 21-Jan-1995  briggs sunos_sysent.c -> sunos_init_sysent.c and add a few tabs for
readability.
 1.19 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.18 27-Nov-1994  briggs compat/sunos/sun_* -> compat/sunos/sunos_*
 1.17 27-Nov-1994  briggs Attempt to use sys/scsi.
 1.16 26-Oct-1994  cgd new RCS ID format.
 1.15 12-Sep-1994  briggs Give vnd a major number. Didn't work on my last attempt with it, but
this will be needed, anyway.
 1.14 21-Jul-1994  briggs Add asc as a device. Format a tad.
 1.13 09-Jul-1994  briggs Rearrange to alphabetize some. Nuke old console, add new console and
ADB code from Lawrence and Brad.
 1.12 26-Jun-1994  briggs branches: 1.12.2;
Erf. Forgot to put mac68k_init.c in alphabetically.
 1.11 26-Jun-1994  briggs Add mac68k_init.c and scsi96.c for 68040 macs and configure them. Not
much uses them, yet, but also added the MC68030 and MC68040 options.
 1.10 25-Jun-1994  briggs Checkpoint. GENERIC has some things disabled. Makefile updated for
vnode_if and some cleanup. copy.s added to files.
 1.9 27-Feb-1994  briggs Add files for compat_sunos. Shouldn't these be in sys/conf/files.newconf?
 1.8 22-Feb-1994  briggs Add fpu.c and alphabetize a bunch.
 1.7 30-Jan-1994  briggs Fix for magnum's scsi system, but referenced through arch/mac68k/scsi
as was the old stuff.
 1.6 20-Jan-1994  briggs Make uk and su look like devices. Haven't tried compiling uk. su is still
nothing.
 1.5 10-Jan-1994  briggs Makefile: Added -T 0 to link for kernel.
files.mac68k.newconf: Removed ddb entries.
 1.4 08-Jan-1994  cgd kill entries duplicated in files.m68k.newconf
 1.3 21-Dec-1993  briggs Add Apple Ethernet to GENERIC and files. Also add asc.c to files
for sound support.
 1.2 15-Dec-1993  briggs Let's try DDB...
 1.1 02-Dec-1993  briggs Migrate to new MACHINE definition (mac -> mac68k).
 1.12.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.28 13-Mar-2024  nat Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.27 04-Apr-2020  jdolecek mark nsmb major obsolete
 1.26 28-Jan-2019  dholland Systematize handling of removed drivers.

- Every driver that was removed and whose number hasn't already been
reused is now listed with a commented-out "obsolete" line.
- The format of these has been systematized. Future format changes can
probably be safely done with a script.
- This does not include a few cases of assignments that only lasted a
couple days, or stuff from before major reorgs. Some of these may
be included nonetheless, because there was a lot of ground to cover
and therefore not a lot of time to dig into history in detail.

Note that the obsolete listings do not mean the major numbers can
never be reused; that's up to portmasters and/or core. It does mean
that they won't be reused by accident, however, which in some cases
(depending on the driver, how widely used it was, its family of device
nodes, their default permissions, etc.) can be quite dangerous.

Note that some of the things now explicitly listed as obsolete are
really ancient history. My scan went back as far as when the majors
files were added. (But not before that.)
 1.25 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.24 23-Apr-2015  pgoyette branches: 1.24.16; 1.24.18;
Update device dependency information - the sysmon major device now depends on the sysmon module itself, not on the individual components.
 1.23 03-Oct-2011  hauke branches: 1.23.12; 1.23.30;
Add the MI software watchdog to GENERIC (not to SMALLRAM, as usual).
 1.22 30-Jun-2011  wiz dependant -> dependent
 1.21 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.20 22-May-2008  hauke branches: 1.20.4; 1.20.6;
Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.19 31-Dec-2007  ad branches: 1.19.6; 1.19.8; 1.19.10; 1.19.12;
Remove systrace. Ok core@.
 1.18 24-Nov-2006  wiz branches: 1.18.28; 1.18.34; 1.18.42;
s/independant/independent/, from Zafer.
 1.17 11-Dec-2005  christos branches: 1.17.20; 1.17.22;
merge ktrace-lwp.
 1.16 17-Sep-2005  yamt make VMSWAP optional again.
 1.15 31-Jul-2005  yamt revert "defflag VMSWAP" changes for now.
there seems to be far more people who don't want to edit
their kernel config files than i thought.
 1.14 30-Jul-2005  yamt defflag VMSWAP.
 1.13 10-May-2005  jdolecek branches: 1.13.2;
assign major for nsmb(4)
 1.12 10-Dec-2003  jmc Change reference at bottom from sys/dev/majors to sys/conf/majors to match
reality
 1.11 24-Oct-2003  jdolecek add major for 'ses' for archs which have the other scsi devices
 1.10 22-Oct-2003  jdolecek add wsfont major to archs which have the other wscons devices
 1.9 10-Oct-2003  jdolecek reassing majors for crypto and pf to use the newly defined MI major
range
 1.8 10-Oct-2003  jdolecek update the comment - the space for machine-dependant majors
is reduced to 0-143
follows discussion on tech-kern
 1.7 05-Oct-2003  jdolecek Add some framework for MI assignment of device majors - add sys/dev/majors
which is automatically included during kernel config, and add comments
to individual machine-dependant majors.* files to assign new MI majors
in MI file.

Range 0-191 is reserved for machine-specific assignments, range
192+ are MI assignments.

Follows recent discussion on tech-kern@
 1.6 22-Aug-2003  itojun create /dev/crypto
 1.5 27-Jul-2003  itojun reserve cdev major # for PF. ok'ed by technical-exec
 1.4 25-Apr-2003  ragge branches: 1.4.2;
Add ksyms device major.
 1.3 04-Oct-2002  elric branches: 1.3.2;
assign majors for raw and cooked cgd's.
 1.2 06-Sep-2002  gehenna branches: 1.2.2;
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.1 16-May-2002  gehenna branches: 1.1.2;
file majors.mac68k was initially added on branch gehenna-devsw.
 1.1.2.3 14-Jul-2002  gehenna catch up with -current.
 1.1.2.2 30-May-2002  gehenna Add $NetBSD$
 1.1.2.1 16-May-2002  gehenna Add the list of block/character majors.
 1.2.2.3 18-Oct-2002  nathanw Catch up to -current.
 1.2.2.2 17-Sep-2002  nathanw Catch up to -current.
 1.2.2.1 06-Sep-2002  nathanw file majors.mac68k was added on branch nathanw_sa on 2002-09-17 21:15:22 +0000
 1.3.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.1 04-Oct-2002  jdolecek file majors.mac68k was added on branch kqueue on 2002-10-10 18:33:45 +0000
 1.4.2.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.2.3 21-Jan-2008  yamt sync with head
 1.13.2.2 30-Dec-2006  yamt sync with head.
 1.13.2.1 21-Jun-2006  yamt sync with head.
 1.17.22.1 10-Dec-2006  yamt sync with head.
 1.17.20.1 12-Jan-2007  ad Sync with head.
 1.18.42.1 02-Jan-2008  bouyer Sync with HEAD
 1.18.34.1 18-Feb-2008  mjf Sync with HEAD.
 1.18.28.1 09-Jan-2008  matt sync with HEAD
 1.19.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.19.10.1 04-May-2009  yamt sync with head.
 1.19.8.1 04-Jun-2008  yamt sync with head
 1.19.6.2 17-Jan-2009  mjf Sync with HEAD.
 1.19.6.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.6.1 19-Jan-2009  skrll Sync with HEAD.
 1.20.4.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.23.30.1 06-Jun-2015  skrll Sync with HEAD
 1.23.12.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.24.18.1 10-Jun-2019  christos Sync with HEAD
 1.24.16.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.2 02-Dec-1993  mycroft Clean up deleted files.
 1.1 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
 1.31 18-Jan-2024  thorpej Make the M68K_MMU_* defines real kernel options, available in opt_m68k_arch.h.
For 68030, 68040, and 68060, infer M68K_MMU_MOTOROLA. For 68010 and 68020, it
must be an explicit option (set in std.${MACHINE} or, in the case of hp300,
inferred from the specific model option).
 1.30 19-Sep-2010  tsutsui - add m68k/conf/std.m68k, which includes common standard options for m68k,
options EXEC_ELF32, EXEC_SCRIPTS, and CPU_IN_CKSUM for md cpu_in_cksum.c
- make all m68k ports include common arch/m68k/conf/std.m68k
from MD std.${MACHINE}
 1.29 11-Dec-2005  christos branches: 1.29.78; 1.29.98; 1.29.100;
merge ktrace-lwp.
 1.28 17-Sep-2005  yamt include "conf/std".
 1.27 25-Mar-2002  shiba branches: 1.27.10; 1.27.26;
Switch mac68k to ELF. Now the default executable binaries are ELF.

Approved by Scott,briggs,fredb,wormey
 1.26 20-Nov-2001  lukem cleanup:
options SPACE TAB
makeoptions TAB
psuedo-device TAB
remove trailing whitespace
replace multiple spaces -> tabs
options "FOO" -> options FOO
options "FOO=bar" -> options FOO=bar
options "FOO=\"bar\"" -> options FOO="\"bar\""
 1.25 22-Jun-2000  fvdl branches: 1.25.4; 1.25.8;
Remove prefix construction for softdeps. Add SOFTDEP option to GENERIC.
 1.24 15-Nov-1999  fvdl branches: 1.24.4;
Add

prefix ../gnu/sys
cinclude "conf/files.softdep"
prefix

to all std.* files, so that soft dependencies can be activated using
"options SOFTDEP".
 1.23 12-Sep-1999  chs branches: 1.23.2; 1.23.8;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.22 24-Mar-1999  mrg clean up kernel/config files files for machVM lossage.
 1.21 04-May-1998  thorpej branches: 1.21.8;
Switch to UVM.
 1.20 26-Nov-1997  scottr Major reorganization, based largely on the i386 GENERIC. This moves all
bus and device configuration out of std.mac68k, as well.
 1.19 17-Nov-1997  lukem * add commented out DDB_HISTORY_SIZE=100 if DDB exists in config file
* fix up use of 'options<SPACE><TAB>'
 1.18 13-Feb-1997  scottr Attach the fpu to mainbus, not obio
 1.17 12-Feb-1997  scottr Move asc to individual kernel config files
 1.16 19-Nov-1996  scottr branches: 1.16.4;
- Move non-optional options SWAPPAGER, VNODEPAGER, and DEVPAGER to std.mac68k
- Catch up with vm/vmparam.h (remove MACHINE_NONCONTIG)
- Fix space/tab niggles in SPOT config
- MYSTERY now includes the esp driver
 1.15 11-Nov-1996  scottr Remove TIMEZONE and DST, as they default to 0 anyway
 1.14 14-Oct-1996  scottr Add EXEC_AOUT and EXEC_SCRIPT
 1.13 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device, instead of obio.
 1.12 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.11 06-May-1996  briggs Move grf0 at obio? from std.mac68k to the config files. Not all machine
have internal video.
 1.10 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.9 14-Feb-1996  briggs HZ used to be in Makefile.mac68k... It is 60 on the mac, not 100.
 1.8 21-Nov-1995  briggs Define DST and TIMEZONE
 1.7 12-Oct-1995  briggs Remove extra serial device--forgot to check this in earlier.
The serial device now handles both channels.
 1.6 29-Mar-1995  briggs branches: 1.6.2;
Nuke FPCOPROC and add FPU_EMULATE to GENERIC.
Support the above with gwr's sun3 stuff.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 21-Jul-1994  briggs Add asc0.
 1.3 09-Jul-1994  briggs Add ite0.
 1.2 08-Jan-1994  cgd branches: 1.2.2;
specify that the mac is of the m68k archtecture.
 1.1 02-Dec-1993  briggs Migrate to new MACHINE definition (mac -> mac68k).
 1.2.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.6.2.1 14-Oct-1995  briggs Get rid of ser1
 1.16.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.21.8.3 28-Nov-1999  scottr Sync with main branch.
 1.21.8.2 01-Nov-1999  scottr Sync with main branch.
 1.21.8.1 16-May-1999  scottr Sync with main branch.
 1.23.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.23.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.4.1 23-Jun-2000  fvdl As on the trunk, update these for the move of ffs_softdep.c into the
kernel source itself. Remove prefix construction, and add the SOFTDEP
option to GENERIC kernels.
 1.25.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.25.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.25.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.27.26.1 21-Jun-2006  yamt sync with head.
 1.27.10.1 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.100.1 05-Mar-2011  rmind sync with head
 1.29.98.1 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.29.78.1 09-Oct-2010  yamt sync with head
 1.4 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 08-Jul-1994  lkestel 6x10.h: shifted font over by two pixels.
keyboard.h: added constants for commonly used keys and reformatted
array so that gcc would be happy.
adbsys.c: new adb system.
bounds.h: bound-checking macros.
ite.c: new built-in mini-console.
8x14.h: no longer used by built-in console.
adb.c: replaced by adbsys.c
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs branches: 1.1.1.1.2;
The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.1.1.1.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 24-Jul-1994  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.62 18-Sep-2024  nat The delay is only required for machines with built-in floppy drives.

I doubt the vibration from an external drive on the Duos would affect adb
before it attaches.
 1.61 18-Sep-2024  nat Use attach delay only on affected machines.

It is only required for machines with built-in trackballs.

Requested by rin@.
 1.60 14-Sep-2024  nat Allow a few seconds for adb devices to settle.

The spin up of the floppy drive motor would cause a crash on my PowerBook
when adb was attached.
 1.59 07-Aug-2021  thorpej branches: 1.59.12;
Merge thorpej-cfargs2.
 1.58 24-Apr-2021  thorpej branches: 1.58.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.57 19-Oct-2018  martin branches: 1.57.14;
#ifdef DIAGNOSTIC should not cause functional differences (even if
minor or cosmetic)
 1.56 18-Oct-2014  snj branches: 1.56.18; 1.56.20;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.55 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.54 06-Jun-2011  matt branches: 1.54.2; 1.54.12;
CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
use bool when appropriate
 1.53 01-Nov-2009  snj branches: 1.53.4; 1.53.10;
Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.52 03-Apr-2008  scottr branches: 1.52.4;
Factor out ADB spin-wait timeout loop, and use it for synchronous
operations to access the PRAM RTC, etc. in the IIsi and Cuda cases.
Thanks to Martin Husemann for pointing out the flaw.

This is a slightly more thorough workaround for the issue Martin found
in PR 37611, as it affected more than just adb_read_date_time().
 1.51 03-Dec-2007  ad branches: 1.51.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.50 08-Mar-2007  tsutsui branches: 1.50.2; 1.50.18; 1.50.20; 1.50.26;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.49 24-Dec-2005  perry branches: 1.49.26;
bare asm -> __asm
 1.48 11-Dec-2005  christos merge ktrace-lwp.
 1.47 16-Jun-2005  jmc branches: 1.47.2;
Fixes for volatile problems
 1.46 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.45 15-Jul-2003  lukem __KERNEL_RCSID()
 1.44 01-Jan-2003  thorpej branches: 1.44.2;
Use aprint_normal() in cfprint routines.
 1.43 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.42 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.41 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.40 15-Nov-2000  scottr branches: 1.40.4; 1.40.8;
The Cuda-based ADB hardware has the ability to queue some commands and
return control to the main CPU before completing the ADB transaction.
Double the adb_op_sync() timeout as a result. Fixes PR 11310.
 1.39 27-Sep-2000  scottr Now that we do collision detection and assign all ADB devices to distinct
addresses, it makes sense to print the actual address of the device rather
than the original address. The latter is useful to distinguish the type
of device only, so we maintain that data internally (as we always have).

This closes PR 10557 from Dave Huang.
 1.38 19-Sep-2000  scottr Ken'ichi Ishizaka discovered that some devices, e.g. the A3 Mouse, don't
respond in the allotted time if they're told to TALK immediately after
completing a LISTEN command. Experimentation with adb_op_sync() yielded
consistent results when the timeout was increased from the documented
6900 usec to 8000 usec, so we'll make that change here.

(Accurate and complete documentation of the hardware sure would help...)
 1.37 03-Jul-2000  scottr Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.36 18-Jun-2000  scottr branches: 1.36.2;
Revert debug-related bogon that snuck in (no change in functionality).
 1.35 19-Mar-2000  scottr branches: 1.35.2;
The MRG and direct ADB drivers were inconsistent in how they worked with
a serial console; the direct driver didn't care, but the MRG driver
wouldn't probe ADB when using a serial console. Remove the check from
the MRG version of the code to resolve this difference.
 1.34 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.33 28-Nov-1999  scottr Don't use the plural form of the word "target" if there is only one!
 1.32 07-Nov-1999  scottr Garbage collect adb_initted.
 1.31 07-Nov-1999  scottr We want adb_polling set regardless of whether we're using the MRG driver.
 1.30 07-Nov-1999  scottr ite_polling -> adb_polling
 1.29 05-Nov-1999  scottr Defer ADB configuration until interrupts are (normally) enabled.
 1.28 05-Nov-1999  scottr An aesthetic change to autoconfig output to complement Colin Wood's
change to macrom.c in June.
 1.27 11-Feb-1999  ender branches: 1.27.2; 1.27.4; 1.27.10; 1.27.12; 1.27.16;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.26 26-Oct-1998  scottr Make it compile for MRG_ADB kernels.
 1.25 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.24 11-Aug-1998  briggs Patch from Takashi NAKAMURA <QZM00427@nifty.ne.jp> to support the
Contour 3-button mouse from the Contour Design Corp.
It looks like a Microspeed mouse.
 1.23 13-Apr-1998  scottr Make type explicit for egcs, from Erik Bertelsen in PR 5288.
 1.22 27-Mar-1998  scottr Don't map Opt-{1,2,3} to mouse buttons unless the ALTXBUTTONS option is
specified. (Doing so breaks German keyboards!) Fixes PR 4929.
 1.21 23-Feb-1998  scottr Mostly KNF. There's still a bunch of ugly comments and some problems
with long lines, but this is at least a big step in the right direction.
 1.20 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.19 12-Jan-1998  thorpej Update for changes to config.
 1.18 26-Nov-1997  scottr Don't attempt to open the ADB device if it hasn't been initialized.
Also, don't allow more than one instance to be configured.
 1.17 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.16 25-Jul-1997  scottr branches: 1.16.2;
Add option-{1,2,3} as an alternative to option-{,left,right} for mouse
button emulation. From SUNAGAWA Keiki <kei_sun@ba2.so-net.or.jp> in
PR 3887.
 1.15 16-Jun-1997  scottr Add support for Mouse Systems A3 mouse. From Colin Wood.
 1.14 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.13 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.12 13-Oct-1996  christos backout previous kprintf change
 1.11 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.10 14-Sep-1996  scottr - Implement poll(2)
- Convert splhigh() -> spladb()
- Guard references to adb_evq_tail and adb_evq_len!
 1.9 05-May-1996  briggs Fix typo in last.
 1.8 05-May-1996  briggs MicroSpeed mouse support from Taras Ivanenko <ivanenko@ctpa03.mit.edu>.
Also some updates to actually used #defined constants instead of numeric
constants.
 1.7 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.6 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.5 01-Nov-1995  briggs port-mac/1707: mac68k mouse drag problems with Cmd+arrow keys
from Ken Nakata <kenn@remus.rutgers.edu>
 1.4 03-Sep-1995  briggs branches: 1.4.2;
Add support for Extended Apple Mouse Protocol from
Ken Nakata <kenn@remus.rutgers.edu>.
 1.3 30-Jun-1995  briggs Option key fix from Ken Nakata (kenn@remus.rutgers.edu).
 1.2 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.4.2.1 02-Nov-1995  briggs from HEAD; patch from Ken Nakata to allow mouse movement when using keyboard
mouse buttons.
 1.16.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.27.12.1 15-Nov-1999  fvdl Sync with -current
 1.27.10.2 22-Nov-2000  bouyer Sync with HEAD.
 1.27.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.27.4.2 29-Nov-1999  he Pull up revision 1.33 (requested by scottr):
Use correct English when reporting the number of ADB target(s).
 1.27.4.1 21-Nov-1999  he Pull up revisions 1.28,1.30-1.32 (via patch, requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.27.2.4 13-Feb-2000  scottr itevar.h is gone.
 1.27.2.3 28-Nov-1999  scottr Sync with main branch.
 1.27.2.2 09-Nov-1999  scottr Sync with main branch.
 1.27.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.35.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.36.2.2 15-Nov-2000  tv Pullup 1.40 [scottr]:
The Cuda-based ADB hardware has the ability to queue some commands and
return control to the main CPU before completing the ADB transaction.
Double the adb_op_sync() timeout as a result. Fixes PR 11310.
 1.36.2.1 21-Sep-2000  scottr Pull up revs 1.37 and 1.38 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.40.8.3 03-Jan-2003  thorpej Sync with HEAD.
 1.40.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.40.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.40.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.40.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.44.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.44.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.44.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.44.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.44.2.1 03-Aug-2004  skrll Sync with HEAD
 1.47.2.3 07-Dec-2007  yamt sync with head
 1.47.2.2 03-Sep-2007  yamt sync with head.
 1.47.2.1 21-Jun-2006  yamt sync with head.
 1.49.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.50.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.50.20.1 09-Jan-2008  matt sync with HEAD
 1.50.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.50.2.1 03-Dec-2007  ad Sync with HEAD.
 1.51.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.52.4.1 11-Mar-2010  yamt sync with head
 1.53.10.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.53.4.1 12-Jun-2011  rmind sync with head
 1.54.12.2 03-Dec-2017  jdolecek update from HEAD
 1.54.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.54.2.1 30-Oct-2012  yamt sync with head
 1.56.20.1 10-Jun-2019  christos Sync with HEAD
 1.56.18.1 20-Oct-2018  pgoyette Sync with head
 1.57.14.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.58.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.59.12.1 02-Aug-2025  perseant Sync with HEAD
 1.73 14-Jun-2025  nat Increase delay when resetting adb.

This fixes intermittent device detection and no lockups when pressing the
keyboard or moving the mouse when the kernel is booting.
 1.72 05-Mar-2024  andvar branches: 1.72.2;
Remove duplicate "when" word in comments.
 1.71 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.70 09-Feb-2024  andvar s/anthing/anything/ and s/be to/too/ in comments.
 1.69 21-Sep-2023  msaitoh s/ for for / for / in comment.
 1.68 08-Jan-2019  jdolecek no need to include <machine/param.h> if <sys/param.h> already included
 1.67 18-Oct-2014  snj branches: 1.67.18; 1.67.20;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.66 25-Oct-2013  martin Mark potentially unused variable
 1.65 19-Oct-2013  martin Make sure we don't accidently pass an unsolicited packet as "ack only"
(which would dereference unitialized pointers)
 1.64 18-Oct-2013  martin Remove set but unused variables.
 1.63 04-Apr-2008  yamt branches: 1.63.38; 1.63.48; 1.63.54;
adb_read_date_time: remove an unused variable.
 1.62 03-Apr-2008  scottr Factor out ADB spin-wait timeout loop, and use it for synchronous
operations to access the PRAM RTC, etc. in the IIsi and Cuda cases.
Thanks to Martin Husemann for pointing out the flaw.

This is a slightly more thorough workaround for the issue Martin found
in PR 37611, as it affected more than just adb_read_date_time().
 1.61 01-Apr-2008  martin Add timeout to busy loops waiting for ADB command completition.
Turns the hard hang in PR port-mac68k/37611 into a warning.
 1.60 03-Dec-2007  ad branches: 1.60.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.59 17-Oct-2007  garbled branches: 1.59.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.58 09-Jul-2007  ad branches: 1.58.8; 1.58.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.57 08-Mar-2007  tsutsui branches: 1.57.2; 1.57.4; 1.57.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.56 24-Jan-2007  hubertf branches: 1.56.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.55 24-Nov-2006  wiz s/independant/independent/, from Zafer.
 1.54 21-Jun-2006  rjs branches: 1.54.4; 1.54.6;
Rename shadowing time variable.
 1.53 24-Dec-2005  perry branches: 1.53.4; 1.53.8; 1.53.16;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.52 11-Dec-2005  christos merge ktrace-lwp.
 1.51 16-Jun-2005  jmc branches: 1.51.2;
Fixes for volatile problems
 1.50 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.49 15-Jul-2003  lukem __KERNEL_RCSID()
 1.48 03-Nov-2002  shiba branches: 1.48.6;
Support internal ADB keyboard of PowerBook 190,190cs.
The keyboard works fine now. I don't confirm working internal
ADB track pad.

But an internal IDE drive is not recognized, and
an internal SCSI host controller(sbc driver) don't work yet.
 1.47 30-May-2002  thorpej - Don't use multi-line string literals.
- Statements must follow labels.
 1.46 05-Mar-2002  shiba branches: 1.46.6;
Fix up a bug which PB150 shuts down when one boots up in progress.
PB150 will work with SCSI disk. But we cannot use an internal IDE
disk yet.

Reviewed by briggs
 1.45 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.44 27-Sep-2000  scottr branches: 1.44.4; 1.44.8;
Set up ADB hardware type before making decisions based on same.
This is part of PR 9852 from Daishi Kato.
 1.43 03-Jul-2000  scottr Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.42 23-Mar-2000  thorpej branches: 1.42.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.41 19-Mar-2000  scottr Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.40 18-Mar-2000  scottr Check to make sure we get a valid handler ID in response to a TALK R3.
 1.39 07-Mar-2000  scottr Low-level drivers, like the Power Manager driver, can get us into a major
funk when they misbehave and give us unexpected results. Specifically:

- Don't assume that the first free slot is at the top of the table if
we can't find one.
- Don't increment ADBNumDevices when backfilling "holes" left by devices
that didn't respond to a TALK R3 during the initial device scan.
- Don't assume that an address reassignment worked; make sure something
responds on the new address before plowing forward.
- If after device reassignment there are no free slots, make sure to
indicate this fact.
- Failing all else, handle the situation where we run out of slots in
the device table -- which now should "never" happen -- gracefully.

While the Power Manager driver still sometimes misbehaves, it shouldn't
cause the system to crash/hang due to us walking off the end of the
device table.
 1.38 21-Feb-2000  scottr Explicitly include headers needed by iopreg.h
 1.37 21-Feb-2000  scottr Bracket disabled IIfx IOP code with #ifdef __notyet__, rather than
commenting it out or using #if 0.
 1.36 25-Dec-1999  scottr Apparently, the Mac TV is a re-packaged Performa 550. Add code to
recognize this so that Mac TV users can finally ditch the MRG_ADB option.
 1.35 10-Dec-1999  scottr An interrupt handler may change adbInCount underneath us, so qualify the declaration
with volatile. The bug didn't show its face until more agressive
optimization showed up, apparently a result of the last egcs upgrade.
(The interrupt handling changes from June have certainly also played
a part.) Thanks to Ken'ichi Ishizaka for discovering the problem.
 1.34 28-Nov-1999  scottr If there is only one ADB device, it will do us no good to avoid it
when guessing which device to poll next. Resolves PR 7407, but the
bug is a lot older than that.
 1.33 07-Nov-1999  scottr In the interrupt handlers, check adb_polling instead of
adb_initted to decide whether to handle 'recovered' interrupts
immediately.
 1.32 07-Nov-1999  scottr Oops... last rev created an unused variable. While here, clean up
adb_reinit()'s variables a bit, too.
 1.31 07-Nov-1999  scottr Convert one more buffer copy that I missed in rev 1.28.
 1.30 07-Nov-1999  scottr Always using polling for poweroff (from macppc).
 1.29 07-Nov-1999  scottr ite_polling -> adb_polling
 1.28 06-Nov-1999  scottr Convert buffer copies to memcpy().
 1.27 06-Nov-1999  scottr Add more delay in adb_reinit() (from macppc).
 1.26 06-Nov-1999  scottr branches: 1.26.2;
Don't invoke the upper half handler unless we're still
initializing the ADB bus. This fixes PR 7870.
 1.25 29-Jun-1999  briggs branches: 1.25.2; 1.25.4; 1.25.6;
Poll for serial interrupts. Return to 3000us delay instead of 4000us in init.
 1.24 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.23 15-May-1999  scottr From Yasuhiro Endoh: Performa 58x uses ADB soft poweroff.
 1.22 06-May-1999  scottr Correct two more problems of the same type as in rev 1.21: use the length
of the buffer you're copying from as the loop interator, not the length
of the buffer you're copying to. Also, rewrite print_single() with
pointer instead of array operators. Appears to correct some ADB-related
`hangs' during autoconfig.
 1.21 18-Mar-1999  scottr branches: 1.21.2;
Fix an obscure bug in send_adb_cuda() found be comparison with
the macppc version.
 1.20 11-Feb-1999  ender branches: 1.20.2;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.19 14-Nov-1998  briggs Make this compile _and_ link with DEBUG / ADB_DEBUG defined.
 1.18 14-Nov-1998  briggs Allow this to compile with DEBUG defined.
 1.17 26-Oct-1998  scottr Make it compile for MRG_ADB kernels.
 1.16 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.15 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.14 29-Mar-1998  scottr Better integration of Power Manager IC ADB driver into the direct ADB driver framework,
from Takashi Hamada. Also includes a handler for unsolicited ADB
packets.
 1.13 26-Mar-1998  scottr Add Performa 580/588 to the list of machines which have a Cuda chip.
XXX - we should really be using machine ID symbolic constants here, not
numbers.
 1.12 23-Feb-1998  scottr Rewritten II-series ADB code from John Wittkoski. Also, a whole
lotta KNF.
 1.11 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.10 09-Jan-1998  scottr Another update from John: if we're polling, e.g. in ddb, pass the
keystroke to the upper half directly.
 1.9 07-Jan-1998  scottr Update from John Wittkoski: the Color Classic and Color Classic II
have Cuda hardware, not IIsi-based.
 1.8 07-Nov-1997  scottr Update from John Wittkoski: bug fixes for Cuda support.
 1.7 04-Nov-1997  briggs remove an obsolete comment.
 1.6 11-Aug-1997  scottr branches: 1.6.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.5 21-Apr-1997  scottr branches: 1.5.4;
April 18 update from John Wittkoski, w/space vs. tab KNFing by me.
 1.4 18-Apr-1997  scottr Make sure to call adbop() on Power Manager-based machines. Noted by
Takashi Hamada, who also provided the code I based this modifcation
on.
 1.3 14-Apr-1997  scottr Use the new opt_mrg_adb.h header.
 1.2 08-Apr-1997  scottr Fix several more instances where the volatile modifier was needed.
From Allen.
 1.1 08-Apr-1997  scottr Direct-to-hardware ADB interface/driver, written by John P. Wittkoski.
 1.5.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.4.2 29-Jan-1998  mellon Pull up 1.9
 1.6.4.1 11-Nov-1997  mellon Pull rev 1.7 and 1.8 up from trunk (scottr)
 1.20.2.7 25-Dec-1999  scottr Sync with main branch.
 1.20.2.6 12-Dec-1999  scottr Sync with main branch.
 1.20.2.5 28-Nov-1999  scottr Sync with main branch.
 1.20.2.4 09-Nov-1999  scottr Sync with main branch.
 1.20.2.3 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.20.2.2 16-May-1999  scottr Sync with main branch.
 1.20.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.21.2.5 16-Dec-1999  he Pull up revision 1.35 (requested by scottr):
Make adbInCount volatile to fix problems uncovered by aggressive
optimization.
 1.21.2.4 29-Nov-1999  he Pull up revision 1.34 (requested by scottr):
Make it possible to have only one ADB device on machines with
first-generation ADB hardware. Fixes PR#7407.
 1.21.2.3 21-Nov-1999  he Pull up revisions 1.26-1.33 (via patch, requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.21.2.2 07-Jun-1999  perry pullup 1.22->1.23 (scottr): make auto power off work on Performa 58x's
 1.21.2.1 06-May-1999  cgd branches: 1.21.2.1.2; 1.21.2.1.4;
pull up rev 1.22 from trunk (scottr)
 1.21.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.21.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.21.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.25.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.4.1 15-Nov-1999  fvdl Sync with -current
 1.25.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.26.2.2 06-Nov-1999  scottr Don't invoke the upper half handler unless we're still
initializing the ADB bus. This fixes PR 7870.
 1.26.2.1 06-Nov-1999  scottr file adb_direct.c was added on branch comdex-fall-1999 on 1999-11-06 22:25:21 +0000
 1.42.4.2 28-Sep-2000  scottr Pull up rev 1.44 from scottr (approved by thorpej):
Set up ADB hardware type before making decisions based on same.
 1.42.4.1 21-Sep-2000  scottr Pull up rev 1.43 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.44.8.4 11-Nov-2002  nathanw Catch up to -current
 1.44.8.3 20-Jun-2002  nathanw Catch up to -current.
 1.44.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.44.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.44.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.44.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.44.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.46.6.1 14-Jul-2002  gehenna catch up with -current.
 1.48.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.48.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.48.6.1 03-Aug-2004  skrll Sync with HEAD
 1.51.2.5 07-Dec-2007  yamt sync with head
 1.51.2.4 03-Sep-2007  yamt sync with head.
 1.51.2.3 26-Feb-2007  yamt sync with head.
 1.51.2.2 30-Dec-2006  yamt sync with head.
 1.51.2.1 21-Jun-2006  yamt sync with head.
 1.53.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.53.8.1 26-Jun-2006  yamt sync with head.
 1.53.4.1 09-Sep-2006  rpaulo sync with head
 1.54.6.1 10-Dec-2006  yamt sync with head.
 1.54.4.2 01-Feb-2007  ad Sync with head.
 1.54.4.1 12-Jan-2007  ad Sync with head.
 1.56.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.57.10.1 03-Oct-2007  garbled Sync with HEAD
 1.57.4.1 11-Jul-2007  mjf Sync with head.
 1.57.2.2 03-Dec-2007  ad Sync with HEAD.
 1.57.2.1 15-Jul-2007  ad Sync with head.
 1.58.10.2 09-Jan-2008  matt sync with HEAD
 1.58.10.1 06-Nov-2007  matt sync with HEAD
 1.58.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.59.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.60.14.2 02-Jun-2008  mjf Sync with HEAD.
 1.60.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.63.54.1 18-May-2014  rmind sync with head
 1.63.48.2 03-Dec-2017  jdolecek update from HEAD
 1.63.48.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.63.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.67.20.1 10-Jun-2019  christos Sync with HEAD
 1.67.18.1 18-Jan-2019  pgoyette Synch with HEAD
 1.72.2.1 02-Aug-2025  perseant Sync with HEAD
 1.2 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.1 08-Apr-1997  scottr Direct-to-hardware ADB interface/driver, written by John P. Wittkoski.
 1.49 22-Aug-2019  rin Remove adbsys.c, which has been unused since 1998!
 1.48 01-Nov-2009  snj branches: 1.48.64;
Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.47 04-Mar-2007  christos branches: 1.47.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.46 11-Dec-2005  christos branches: 1.46.26;
merge ktrace-lwp.
 1.45 15-Jan-2005  chs branches: 1.45.10;
de-__P, remove register, ansify, b* -> mem*.
 1.44 15-Jul-2003  lukem __KERNEL_RCSID()
 1.43 19-Mar-2000  scottr branches: 1.43.28;
Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.42 07-Nov-1999  scottr Garbage-collect adb_init(). It's been dead for a long time.
 1.41 07-Nov-1999  scottr ite_polling -> adb_polling
 1.40 11-Feb-1999  ender branches: 1.40.2; 1.40.4; 1.40.10; 1.40.12; 1.40.16;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.39 11-Aug-1998  briggs Patch from Takashi NAKAMURA <QZM00427@nifty.ne.jp> to support the
Contour 3-button mouse from the Contour Design Corp.
It looks like a Microspeed mouse.
 1.38 28-May-1998  scottr Handle a non-EMP Trackman the same way we handle a non-EMP Mouseman.
Patch from John Wittkoski.
 1.37 23-Feb-1998  scottr Mostly KNF. There's still a bunch of ugly comments and some problems
with long lines, but this is at least a big step in the right direction.
 1.36 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.35 20-Feb-1998  scottr Fix for ADB hang while probing, based on information from Colin Wood:
Rather than waiting indefinitely for a mouse or extended keyboard to
respond -- which may not even exist -- time out after 2 seconds and
continue. This corrects a very common problem with the MRG-based ADB
driver that has bitten many people running 1.3.
 1.34 26-Nov-1997  scottr Don't attempt to open the ADB device if it hasn't been initialized.
Also, don't allow more than one instance to be configured.
 1.33 07-Nov-1997  scottr Update from John Wittkoski: work around problem with mice that claim to
support Extended Mouse Protocol, but really don't; the Logitech Mouseman
is one such mouse (model M-AC13-4MD).
 1.32 05-Nov-1997  ender Recognize Apple Standard Keyboard (ISO layout)
 1.31 02-Oct-1997  briggs branches: 1.31.2;
port-mac68k/4158: current kernel doesn't recognize some adb devices.
Patch applied. Thanks to SUNAGAWA Keiki for the change-request.
 1.30 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.29 09-Aug-1997  ender o Fixed definition of PowerBook extended keyboard from previous commit
o Added recognition of some additional ADB device types
 1.28 08-Aug-1997  ender Add recognition of more keyboard types (including ISO layouts)
 1.27 16-Jun-1997  scottr branches: 1.27.4;
Add support for Mouse Systems A3 mouse. From Colin Wood.
 1.26 14-Apr-1997  scottr Use the new opt_mrg_adb.h header.
 1.25 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.24 13-Jan-1997  scottr Some changes to make ADB work when compiled with -O2:

- extdms_done is modified by things outside of our direct control;
it needs to be declared `volatile'
- CountADBs() fails when we call it the second time. We can work
around this by telling extdms_init() how many ADB devices we have,
only calling CountADBs() once.
 1.23 13-Oct-1996  christos backout previous kprintf change
 1.22 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.21 21-Jun-1996  scottr Test for serial console in adb_init() early, and abort if we're using it.
Initiialize ROM vectors regardless of this so that the PRAM RTC read and
write work regardless of whether a serial console is in use.
 1.20 08-May-1996  briggs Minor fix to last patch--from Taras.
 1.19 08-May-1996  briggs Minor update from Taras Ivanenko <ivanenko@ctpa03.mit.edu>.
 1.18 05-May-1996  briggs MicroSpeed mouse support from Taras Ivanenko <ivanenko@ctpa03.mit.edu>.
Also some updates to actually used #defined constants instead of numeric
constants.
 1.17 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.16 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.15 04-Sep-1995  briggs Remove an extra "talk" command--from Ken Nakata <kenn@remus.rutgers.edu>
 1.14 03-Sep-1995  briggs Add support for Extended Apple Mouse Protocol from
Ken Nakata <kenn@remus.rutgers.edu>.
 1.13 03-Sep-1995  briggs Changes from Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>.
This forces the need for booter version 1.8.
 1.12 02-Sep-1995  briggs Weren't quite ready for the last change.
 1.11 02-Sep-1995  briggs Rearrange a bit.
 1.10 25-Jun-1995  briggs Remove a compile warning.
 1.9 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.8 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 12-Sep-1994  briggs Nuke a CVS Log entry. Attribute introspection to Brad.
 1.5 12-Sep-1994  briggs Remove need for "bounds.h." Brad can still use it if he wants ;-)
 1.4 30-Jul-1994  lkestel branches: 1.4.2;
Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.3 21-Jul-1994  lkestel Fixed a few bugs in the key-repeat function and disabled key-repeat
when /dev/adb is closed to avoid infinite repeat problem. Brad claims
that he's got this solved in his version...
 1.2 09-Jul-1994  briggs Cleanup a printf, raise the probe timeout, and notice if the probe
does time out.
 1.1 08-Jul-1994  lkestel 6x10.h: shifted font over by two pixels.
keyboard.h: added constants for commonly used keys and reformatted
array so that gcc would be happy.
adbsys.c: new adb system.
bounds.h: bound-checking macros.
ite.c: new built-in mini-console.
8x14.h: no longer used by built-in console.
adb.c: replaced by adbsys.c
 1.4.2.2 12-Sep-1994  cgd from trunk, per briggs
 1.4.2.1 30-Jul-1994  cgd file adbsys.c was added on branch netbsd-1-0 on 1994-09-12 21:07:41 +0000
 1.27.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.27.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.31.2.4 24-Feb-1998  mellon Pull up 1.35 (scottr)
 1.31.2.3 11-Nov-1997  mellon Pull rev 1.33 back up from trunk (scottr)
 1.31.2.2 10-Nov-1997  scottr Back out rev 1.33 changes, as they are part of a separate pull-up
reqeust. (approved by mellon)
 1.31.2.1 07-Nov-1997  mellon Pull rev 1.32 and 1.33 up from trunk (ender)
 1.40.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.40.12.1 15-Nov-1999  fvdl Sync with -current
 1.40.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.40.4.1 21-Nov-1999  he Pull up revisions 1.41-1.42 (requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.40.2.1 09-Nov-1999  scottr Sync with main branch.
 1.43.28.4 17-Jan-2005  skrll Sync with HEAD.
 1.43.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.43.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.43.28.1 03-Aug-2004  skrll Sync with HEAD
 1.45.10.1 03-Sep-2007  yamt sync with head.
 1.46.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.47.44.1 11-Mar-2010  yamt sync with head
 1.48.64.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2 30-Jul-1994  mycroft Clean up deleted files.
 1.1 08-Jul-1994  lkestel 6x10.h: shifted font over by two pixels.
keyboard.h: added constants for commonly used keys and reformatted
array so that gcc would be happy.
adbsys.c: new adb system.
bounds.h: bound-checking macros.
ite.c: new built-in mini-console.
8x14.h: no longer used by built-in console.
adb.c: replaced by adbsys.c
 1.13 31-May-2020  rin #ifdef out debug garbage.
 1.12 01-Nov-2009  snj Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.11 20-Nov-2001  chs branches: 1.11.122;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.10 14-Feb-2000  scottr branches: 1.10.8; 1.10.12;
Merge wscons work onto the main development branch.
 1.9 11-Feb-1999  ender branches: 1.9.2; 1.9.10;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.8 26-Oct-1998  scottr Use the <machine/asm.h> macros, and don't call code that we haven't
included.
 1.7 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.6 07-Nov-1997  scottr Update from John Wittkoski: work around problem with mice that claim to
support Extended Mouse Protocol, but really don't; the Logitech Mouseman
is one such mouse (model M-AC13-4MD).
 1.5 16-Jun-1997  scottr branches: 1.5.8;
Add support for Mouse Systems A3 mouse. From Colin Wood.
 1.4 13-Oct-1996  christos backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 03-Sep-1995  briggs Add support for Extended Apple Mouse Protocol from
Ken Nakata <kenn@remus.rutgers.edu>.
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.5.8.1 11-Nov-1997  mellon Pull rev 1.6 up from trunk (scottr)
 1.9.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.10.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.10.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.11.122.1 11-Mar-2010  yamt sync with head
 1.26 01-Nov-2009  snj Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.25 03-Apr-2008  scottr branches: 1.25.4;
Factor out ADB spin-wait timeout loop, and use it for synchronous
operations to access the PRAM RTC, etc. in the IIsi and Cuda cases.
Thanks to Martin Husemann for pointing out the flaw.

This is a slightly more thorough workaround for the issue Martin found
in PR 37611, as it affected more than just adb_read_date_time().
 1.24 08-Mar-2007  tsutsui branches: 1.24.40;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.23 11-Dec-2005  christos branches: 1.23.26;
merge ktrace-lwp.
 1.22 15-Jan-2005  chs branches: 1.22.10;
de-__P, remove register, ansify, b* -> mem*.
 1.21 09-Apr-2003  thorpej branches: 1.21.2;
G/c the traceq; nothing uses it.
 1.20 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.19 03-Jul-2000  scottr branches: 1.19.4; 1.19.8; 1.19.16;
Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.18 19-Mar-2000  scottr branches: 1.18.4;
Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.17 07-Nov-1999  scottr Garbage collect adb_initted.
 1.16 07-Nov-1999  scottr We need adb_initted in a couple of places; declare it here.
 1.15 28-Jun-1999  briggs branches: 1.15.2; 1.15.4; 1.15.8;
Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.14 11-Feb-1999  ender branches: 1.14.2; 1.14.6;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.13 14-Nov-1998  briggs Make this compile _and_ link with DEBUG / ADB_DEBUG defined.
 1.12 26-Oct-1998  scottr Don't hide the ADB hardware types when we're building an MRG_ADB kernel;
we really do need them around, anyway.
 1.11 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.10 23-Feb-1998  scottr Mostly KNF. There's still a bunch of ugly comments and some problems
with long lines, but this is at least a big step in the right direction.
 1.9 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.8 07-Nov-1997  scottr Update from John Wittkoski: work around problem with mice that claim to
support Extended Mouse Protocol, but really don't; the Logitech Mouseman
is one such mouse (model M-AC13-4MD).
 1.7 16-Jun-1997  scottr branches: 1.7.8;
Add support for Mouse Systems A3 mouse. From Colin Wood.
 1.6 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.5 13-Jan-1997  scottr Some changes to make ADB work when compiled with -O2:

- extdms_done is modified by things outside of our direct control;
it needs to be declared `volatile'
- CountADBs() fails when we call it the second time. We can work
around this by telling extdms_init() how many ADB devices we have,
only calling CountADBs() once.
 1.4 14-Sep-1996  scottr Implement poll(2).
 1.3 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.7.8.1 11-Nov-1997  mellon Pull rev 1.8 up from trunk (scottr)
 1.14.6.1 01-Jul-1999  thorpej Sync w/ -current.
 1.14.2.1 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.15.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.4.1 15-Nov-1999  fvdl Sync with -current
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.18.4.1 21-Sep-2000  scottr Pull up rev 1.19 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.19.16.1 19-May-2002  gehenna Remove unnecessary prototype.
 1.19.8.1 17-Sep-2002  nathanw Catch up to -current.
 1.19.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.21.2.1 17-Jan-2005  skrll Sync with HEAD.
 1.22.10.1 03-Sep-2007  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.40.1 03-Apr-2008  mjf Sync with HEAD.
 1.25.4.1 11-Mar-2010  yamt sync with head
 1.43 03-Apr-2025  nat Add pbbat(4)

Now it is possible to monitor the PowerBook 1xx AC adaptors and battery via
envsys(4).
 1.42 12-Jan-2025  nat Stop echoing keys for special key sequences.

This includes brightness and emulated mouse buttons.
 1.41 09-Dec-2024  nat Add support for backlight control.

Currently it is only supported on PowerBooks.
The backlight can be turned off or on via pmf(9) events on wsdisplay(4)
devices.
 1.40 14-Sep-2024  nat Add support for brightness control on Powerbook 1xx.
 1.39 05-Jun-2024  nat branches: 1.39.2;
Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303
 1.38 26-Sep-2021  thorpej branches: 1.38.4;
Driver "kqfilter" entry points return an error code, so if an invalid
filter is requested, return EINVAL rather than 1.
 1.37 26-Sep-2021  thorpej Use seltrue_filtops rather than rolling our own with filt_seltrue.
 1.36 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.35 19-Dec-2020  thorpej Use sel{record,remove}_knote().
 1.34 25-Oct-2017  maya branches: 1.34.8; 1.34.16;
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.33 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.32 16-Mar-2014  dholland branches: 1.32.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.31 19-Oct-2013  martin comment out unused code (for documentation purposes)
 1.30 27-Oct-2012  chs branches: 1.30.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.29 01-Nov-2009  snj branches: 1.29.12; 1.29.22;
Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.28 11-Jun-2008  cegger use device_lookup_private to get softc
 1.27 01-Mar-2008  rmind branches: 1.27.2; 1.27.4; 1.27.6; 1.27.8;
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.26 03-Dec-2007  ad branches: 1.26.10; 1.26.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.25 17-Oct-2007  garbled branches: 1.25.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.24 09-Jul-2007  ad branches: 1.24.8; 1.24.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.23 04-Mar-2007  christos branches: 1.23.2; 1.23.4; 1.23.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.22 29-Mar-2006  thorpej branches: 1.22.14;
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 05-Jun-2005  rjs branches: 1.20.2;
Rename shadowing variable.
 1.19 16-Jan-2005  chs branches: 1.19.2;
don't require that the aed unit number be zero.
 1.18 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.17 15-Jul-2003  lukem __KERNEL_RCSID()
 1.16 26-Nov-2002  christos branches: 1.16.6;
si_ -> sel_
 1.15 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.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.11 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.10 23-Mar-2000  thorpej branches: 1.10.6; 1.10.8; 1.10.12; 1.10.20;
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-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.8 07-Nov-1999  scottr ite_polling -> adb_polling
 1.7 16-Feb-1999  ender branches: 1.7.2; 1.7.4; 1.7.10; 1.7.12; 1.7.16;
Add NetBSD RCS Id's
 1.6 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.5 19-Dec-1998  scottr Protect a keyup event for ADBK_3 in the mouse button emulation code with
ALTXBUTTONS, so as to not cause trouble with some non-US English
keyboards. From SUNAGAWA Keiki, PR 6613.
 1.4 28-Nov-1998  ender Remember to recognize modifier key releases when the Option key is down.
Fixes art of PR 6444. Tested by Frederick Bruckman <fb@enteract.com>.
 1.3 24-Nov-1998  ender Take emulated button state into account before handing off mouse events.
Fixes part of PR 6444. Tested by Frederick Bruckman (fb@enteract.com).
 1.2 26-Oct-1998  ender Make the kernel compile when the ALTXBUTTONS option is set.
Fixes PR#6363 from Frederick Bruckman (fb@enteract.com)
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.7.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.12.1 15-Nov-1999  fvdl Sync with -current
 1.7.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.4.1 21-Nov-1999  he Pull up revision 1.8 (requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.7.2.4 15-Nov-1999  scottr Avoid passing data up to wskbd if the aed device is open.
 1.7.2.3 09-Nov-1999  scottr Sync with main branch.
 1.7.2.2 11-Mar-1999  scottr We no longer have ite or grf in files.mac68k.
 1.7.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.10.20.1 17-May-2002  gehenna Add device switch.
 1.10.12.4 11-Dec-2002  thorpej Sync with HEAD.
 1.10.12.3 11-Nov-2002  nathanw Catch up to -current
 1.10.12.2 18-Oct-2002  nathanw Catch up to -current.
 1.10.12.1 17-Sep-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 18-Jun-2002  jdolecek g/c prototypes from aedvar.h, use cdev_decl(), compile fixes
 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.16.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.16.6.5 25-Jan-2005  skrll Adapt to branch.
 1.16.6.4 17-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.2.2 16-Jan-2005  chs don't require that the aed unit number be zero.
 1.19.2.1 16-Jan-2005  chs file aed.c was added on branch kent-audio2 on 2005-01-16 00:32:17 +0000
 1.20.2.4 17-Mar-2008  yamt sync with head.
 1.20.2.3 07-Dec-2007  yamt sync with head
 1.20.2.2 03-Sep-2007  yamt sync with head.
 1.20.2.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.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.23.10.1 03-Oct-2007  garbled Sync with HEAD
 1.23.4.1 11-Jul-2007  mjf Sync with head.
 1.23.2.2 03-Dec-2007  ad Sync with HEAD.
 1.23.2.1 15-Jul-2007  ad Sync with head.
 1.24.10.3 23-Mar-2008  matt sync with HEAD
 1.24.10.2 09-Jan-2008  matt sync with HEAD
 1.24.10.1 06-Nov-2007  matt sync with HEAD
 1.24.8.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.25.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.26.14.2 29-Jun-2008  mjf Sync with HEAD.
 1.26.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.26.10.1 24-Mar-2008  keiichi sync with head.
 1.27.8.1 18-Jun-2008  simonb Sync with head.
 1.27.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.27.4.2 11-Mar-2010  yamt sync with head
 1.27.4.1 04-May-2009  yamt sync with head.
 1.27.2.1 17-Jun-2008  yamt sync with head.
 1.29.22.3 03-Dec-2017  jdolecek update from HEAD
 1.29.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.29.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.29.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.29.12.1 30-Oct-2012  yamt sync with head
 1.30.2.1 18-May-2014  rmind sync with head
 1.32.2.1 10-Aug-2014  tls Rebase.
 1.34.16.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.34.8.1 20-Jun-2024  martin Pull up following revision(s) (requested by nat in ticket #1847):

sys/arch/macppc/dev/aed.c: revision 1.35
sys/arch/mac68k/dev/aed.c: revision 1.39

Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303
 1.38.4.1 20-Jun-2024  martin Pull up following revision(s) (requested by nat in ticket #708):

sys/arch/macppc/dev/aed.c: revision 1.35
sys/arch/mac68k/dev/aed.c: revision 1.39

Pass event up to adb device.

While here do the same for macppc.

Addresses PR/58303
 1.39.2.1 02-Aug-2025  perseant Sync with HEAD
 1.9 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.8 01-Nov-2009  snj branches: 1.8.12; 1.8.22;
Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.7 11-Dec-2005  christos branches: 1.7.78;
merge ktrace-lwp.
 1.6 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.5 06-Sep-2002  gehenna branches: 1.5.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.4 23-Mar-2000  thorpej branches: 1.4.6; 1.4.8; 1.4.12; 1.4.20;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.3 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.2 11-Feb-1999  ender branches: 1.2.2; 1.2.10;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.2.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 15-Nov-1999  scottr Avoid passing data up to wskbd if the aed device is open.
 1.4.20.1 19-May-2002  gehenna Remove unnecessary prototype.
 1.4.12.1 17-Sep-2002  nathanw Catch up to -current.
 1.4.8.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.4.8.1 18-Jun-2002  jdolecek g/c prototypes from aedvar.h, use cdev_decl(), compile fixes
 1.4.6.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.5.6.1 17-Jan-2005  skrll Sync with HEAD.
 1.7.78.1 11-Mar-2010  yamt sync with head
 1.8.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.12.1 30-Oct-2012  yamt sync with head
 1.28 12-Jan-2025  nat Stop echoing keys for special key sequences.

This includes brightness and emulated mouse buttons.
 1.27 18-Sep-2021  tsutsui branches: 1.27.10;
Remove unnecessary (and unimplemented) WSKBD_*BELL ioctls in kbd drivers.

It looks the only ioctl(4) to be implemented for WSKBDIO_*BELL in
the backend keyboard driver is WSKBDIO_COMPLEXBELL.
All other BELL ioctls (WSKBDIO_BELL, WSKBDIO_SETBELL, WSKBDIO_GETBELL,
WSKBDIO_SETDEFAULTBELL, and WSKBDIO_GETDEFAULTBELL) are handled in the
MI wskbd driver (in wskbd_displayioctl() in src/sys/dev/wscons/wskbd.c).
 1.26 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.25 24-Apr-2021  thorpej branches: 1.25.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.24 25-Oct-2013  martin branches: 1.24.44;
Mark a potentially unused variable
 1.23 27-Oct-2012  chs branches: 1.23.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.22 10-Dec-2010  macallan branches: 1.22.8; 1.22.18;
return the right values for ioctl(WSKBDIO_GTYPE) and ioctl(WSMOUSEIO_GTYPE)
fixes PR 23991
 1.21 10-Mar-2007  hauke branches: 1.21.66;
Fix more fallout from caddr_t removal.

Since kbd_adbcomplete() uses the buffer parameter for accessing a
(sic!) data buffer, make it uint8_t *, instead of casting the pointer
everywhere it is actually used.

While here, fix prototype naming issue. One of these days, the code
should be converted to either all kbd_*, or all akbd_*.
 1.20 05-Mar-2007  he Cast to uint8_t* or char* before indexing or doing pointer arithmetic.
 1.19 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 11-Dec-2005  christos branches: 1.18.26;
merge ktrace-lwp.
 1.17 15-Jan-2005  chs branches: 1.17.10;
de-__P, remove register, ansify, b* -> mem*.
 1.16 15-Jul-2003  lukem __KERNEL_RCSID()
 1.15 02-Oct-2002  thorpej branches: 1.15.6;
Use CFATTACH_DECL().
 1.14 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.13 17-Mar-2002  atatat 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.12 05-Jun-2001  thorpej branches: 1.12.2; 1.12.8;
HZ -> hz
 1.11 22-Sep-2000  scottr branches: 1.11.2;
Attach exactly one keyboard to the wscons console.
 1.10 03-Jul-2000  scottr Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.9 17-Jun-2000  scottr branches: 1.9.2;
Since interrupts are now enabled during ADB autoconfig, it's possible to get
a keyboard event before wskbd is attached. Make sure we've done that before
passing an event to kbd_intr(), which in turn hands off to wskbd_input().
This is another part of the fix for PR 10086.
 1.8 17-Jun-2000  scottr Only the first device that we're sure is a keyboard should be attached
as the wskbd console device. (Part of the fix for PR 10086.)
 1.7 19-Mar-2000  scottr branches: 1.7.2;
Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.6 17-Feb-2000  ender Include mac68k/dev/akbdmap.h, not macppc/dev/akbdmap.h. Fixes PR 9435
filed by Dave Huang <khym@bga.com>.
 1.5 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.4 05-Mar-1999  scottr branches: 1.4.2;
These files were created by repository copy for use on the
scottr-mac68k-wscons branch.
 1.3 16-Feb-1999  ender branches: 1.3.2;
Add NetBSD RCS Id's
 1.2 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.3.2.7 20-Nov-1999  scottr Cosmetic changes to make a bit of #ifdef'ed code slightly less ugly.
 1.3.2.6 18-Nov-1999  scottr If we're polling, i.e. in the debugger, we really ought to make
sure to pass events on up. The debugger is kind of useless without
a console keyboard...
 1.3.2.5 15-Nov-1999  scottr Avoid passing data up to wskbd if the aed device is open.
 1.3.2.4 11-Mar-1999  scottr Pull in opt_adb.h for ADB_DEBUG
 1.3.2.3 10-Mar-1999  scottr Make akbd_cngetc() work for the MRG-based driver.
 1.3.2.2 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.3.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 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.7.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.9.2.2 22-Sep-2000  scottr Pull up rev 1.11 from scottr:
Attach exactly one keyboard to the wscons console.
 1.9.2.1 21-Sep-2000  scottr Pull up rev 1.10 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.11.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.12.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.12.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.12.8.1 05-Jun-2001  nathanw file akbd.c was added on branch nathanw_sa on 2002-04-01 07:40:48 +0000
 1.12.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.12.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.6.5 25-Jan-2005  skrll Adapt to branch.
 1.15.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.15.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.6.1 03-Aug-2004  skrll Sync with HEAD
 1.17.10.2 03-Sep-2007  yamt sync with head.
 1.17.10.1 21-Jun-2006  yamt sync with head.
 1.18.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.21.66.1 05-Mar-2011  rmind sync with head
 1.22.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.22.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.22.8.1 30-Oct-2012  yamt sync with head
 1.23.2.1 18-May-2014  rmind sync with head
 1.24.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.25.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.27.10.1 02-Aug-2025  perseant Sync with HEAD
 1.10 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.9 08-Nov-2006  macallan branches: 1.9.52; 1.9.54; 1.9.56;
add control codes for virtual console switching
looks like I forgot to commit this ages ago...
 1.8 11-Dec-2005  christos branches: 1.8.20; 1.8.22;
merge ktrace-lwp.
 1.7 05-May-2005  abs branches: 1.7.2;
Add ADB Portuguese (pt_PT) keyboard map, from Rui Paulo in PR/30126
 1.6 30-Oct-2004  mbw branches: 1.6.10;
Change to fix PR 25689 for Swedish ADB keyboards
- KC(52), KS_Mode_switch,KS_Multi_key,
+ KC(58), KS_Mode_switch,KS_Multi_key,
 1.5 19-Jul-2004  jmmv Add the Spanish keymap.

While here, add support for the Num Lock key (with all needed changes in the
numeric keypad), Print Screen, Hold Screen, Pause, Insert, and Delete.

Ok'ed by silence in port-mac68k@.
 1.4 23-Feb-2003  manu branches: 1.4.2; 1.4.6;
Merged mac68k and macppc keayboards, since they are the same. The file
could move to <arch/mac> if one day we create it.

Fixed french keymap: option was not mapped correctly, thus making
impossible to use |{}[] (tested).
Added jp keymap from PR/15438, and sf, sv, de and uk keymaps from OpenBSD.
(all untested).
 1.3 22-Feb-2003  manu Added a french keyboard layout.
 1.2 14-Feb-2000  scottr branches: 1.2.22;
Merge wscons work onto the main development branch.
 1.1 05-Mar-1999  scottr branches: 1.1.2; 1.1.4;
file akbdmap.h was initially added on branch scottr-mac68k-wscons.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.2.22.1 02-Jun-2003  tron Pull up revision 1.3-1.4 (requested by manu in ticket #1183):
Added a french keyboard layout.
Merged mac68k and macppc keayboards, since they are the same. The file
could move to <arch/mac> if one day we create it.
Fixed french keymap: option was not mapped correctly, thus making
impossible to use |{}[] (tested).
Added jp keymap from PR/15438, and sf, sv, de and uk keymaps from
OpenBSD.
(all untested).
 1.4.6.1 16-May-2005  riz Pull up revision 1.7 via patch (requested by abs in ticket #1506):
Add ADB Portuguese (pt_PT) keyboard map, from Rui Paulo in PR/30126
 1.4.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.2.2 02-Nov-2004  skrll Sync with HEAD.
 1.4.2.1 03-Aug-2004  skrll Sync with HEAD
 1.6.10.1 09-May-2005  tron Pull up revision 1.7 (requested by abs in ticket #268):
Add ADB Portuguese (pt_PT) keyboard map, from Rui Paulo in PR/30126
 1.7.2.1 30-Dec-2006  yamt sync with head.
 1.8.22.1 10-Dec-2006  yamt sync with head.
 1.8.20.1 18-Nov-2006  ad Sync with head.
 1.9.56.1 16-May-2008  yamt sync with head.
 1.9.54.1 18-May-2008  yamt sync with head.
 1.9.52.1 02-Jun-2008  mjf Sync with HEAD.
 1.10 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.9 10-Mar-2007  hauke branches: 1.9.78; 1.9.88;
Fix more fallout from caddr_t removal.

Since kbd_adbcomplete() uses the buffer parameter for accessing a
(sic!) data buffer, make it uint8_t *, instead of casting the pointer
everywhere it is actually used.

While here, fix prototype naming issue. One of these days, the code
should be converted to either all kbd_*, or all akbd_*.
 1.8 04-Mar-2007  christos 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 15-Jan-2005  chs branches: 1.6.10;
de-__P, remove register, ansify, b* -> mem*.
 1.5 14-Feb-2000  scottr branches: 1.5.28;
Merge wscons work onto the main development branch.
 1.4 05-Mar-1999  scottr branches: 1.4.2;
These files were created by repository copy for use on the
scottr-mac68k-wscons branch.
 1.3 16-Feb-1999  ender branches: 1.3.2;
Add NetBSD RCS Id's
 1.2 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.3.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 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.28.1 17-Jan-2005  skrll Sync with HEAD.
 1.6.10.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.9.88.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.9.78.1 30-Oct-2012  yamt sync with head
 1.28 16-Dec-2024  nat Fix matching of the PowerBook 500 trackpad.

Addresses PR port-mac68k/58883.
 1.27 07-Dec-2024  nat Usability enhancement.

For the emulated middle and right mouse buttons, one has to hold the combo keys
and it is sent on the mouse click.

Patch from PR applied.

Addresses PR mac68k/58672.
 1.26 30-Jul-2022  rin branches: 1.26.10;
Fix WSMOUSEIO_GTYPE so that X does not fail to initialize wsmouse(4).
 1.25 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.24 24-Apr-2021  thorpej branches: 1.24.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.23 09-Jun-2020  tsutsui branches: 1.23.4;
Fix inverted Y-axis value passed to wsmouse_input(9).

Note this is what src/sys/arch/macppc/dev/ams.c does as
"upward (moving the mouse forward) is positive" as noted in wsmouse(9):
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/macppc/dev/ams.c#rev1.4

Reported and tested by @NonameInsect on his SE/30 and Xorg server.
Should be pulled up to netbsd-8 and netbsd-9.
 1.22 19-Oct-2013  martin branches: 1.22.22; 1.22.34;
Mark a potentially unused variable
 1.21 27-Oct-2012  chs branches: 1.21.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.20 10-Dec-2010  macallan branches: 1.20.8; 1.20.18;
return the right values for ioctl(WSKBDIO_GTYPE) and ioctl(WSMOUSEIO_GTYPE)
fixes PR 23991
 1.19 05-Mar-2007  he branches: 1.19.66;
Use a helper variable so that we can index it as an array.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 12-Nov-2006  plunky branches: 1.17.4;
Tidy away wsmouse_input() abstractions and update
documentation to include the W direction.
 1.16 11-Dec-2005  christos branches: 1.16.20; 1.16.22;
merge ktrace-lwp.
 1.15 15-Jan-2005  chs branches: 1.15.10;
de-__P, remove register, ansify, b* -> mem*.
 1.14 15-Jul-2003  lukem __KERNEL_RCSID()
 1.13 02-Oct-2002  thorpej branches: 1.13.6;
Use CFATTACH_DECL().
 1.12 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.11 17-Mar-2002  atatat 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.10 01-Oct-2000  scottr branches: 1.10.4; 1.10.8;
In ems_init(): make sure there's valid data in the buffer after sending
a TALK command to a device. Noticed by Ken'ichi Ishizaka.
 1.9 03-Jul-2000  scottr Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.8 11-Jun-2000  scottr branches: 1.8.2;
Since interrupts are now enabled during ADB autoconfig, it's possible
to get a mouse event before wsmouse is attached. Make sure we've done
that before passing an event to wsmouse_input().
 1.7 19-Mar-2000  scottr branches: 1.7.2;
Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.6 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.5 05-Mar-1999  scottr branches: 1.5.2;
These files were created by repository copy for use on the
scottr-mac68k-wscons branch.
 1.4 16-Feb-1999  ender branches: 1.4.2;
Add NetBSD RCS Id's
 1.3 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.2 16-Jan-1999  scottr Add support for the Contour 3-button mouse, inadvertantly missed
in the ADB split a few months back. Noticed by Takashi NAKAMURA.
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.4.2.5 13-Feb-2000  scottr Fix return value of iteioctl().
 1.4.2.4 13-Feb-2000  scottr Catch up with wsmouse_input() interface change.
 1.4.2.3 20-Nov-1999  scottr Pass input up to the wsmouse driver. From Colin (mostly).
 1.4.2.2 15-Nov-1999  scottr Avoid passing data up to wskbd if the aed device is open.
 1.4.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 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 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.8.2.2 15-Nov-2000  tv Pullup 1.10 [scottr]:
In ems_init(): make sure there's valid data in the buffer after sending
a TALK command to a device. Noticed by Ken'ichi Ishizaka.
 1.8.2.1 21-Sep-2000  scottr Pull up rev 1.9 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.10.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.10.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.10.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.10.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.13.6.5 25-Jan-2005  skrll Adapt to branch.
 1.13.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.13.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.13.6.1 03-Aug-2004  skrll Sync with HEAD
 1.15.10.3 03-Sep-2007  yamt sync with head.
 1.15.10.2 30-Dec-2006  yamt sync with head.
 1.15.10.1 21-Jun-2006  yamt sync with head.
 1.16.22.1 10-Dec-2006  yamt sync with head.
 1.16.20.1 18-Nov-2006  ad Sync with head.
 1.17.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.66.1 05-Mar-2011  rmind sync with head
 1.20.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.20.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.20.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.20.8.1 30-Oct-2012  yamt sync with head
 1.21.2.1 18-May-2014  rmind sync with head
 1.22.34.1 20-Jun-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #955):

sys/arch/mac68k/dev/ams.c: revision 1.23

Fix inverted Y-axis value passed to wsmouse_input(9).

Note this is what src/sys/arch/macppc/dev/ams.c does as
"upward (moving the mouse forward) is positive" as noted in wsmouse(9):
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/macppc/dev/ams.c#rev1.4

Reported and tested by @NonameInsect on his SE/30 and Xorg server.
Should be pulled up to netbsd-8 and netbsd-9.
 1.22.22.1 16-Jun-2020  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1557):
sys/arch/mac68k/dev/ams.c: revision 1.23
Fix inverted Y-axis value passed to wsmouse_input(9).
Note this is what src/sys/arch/macppc/dev/ams.c does as
"upward (moving the mouse forward) is positive" as noted in wsmouse(9):
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/macppc/dev/ams.c#rev1.4
Reported and tested by @NonameInsect on his SE/30 and Xorg server.
Should be pulled up to netbsd-8 and netbsd-9.
 1.23.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.24.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.26.10.1 02-Aug-2025  perseant Sync with HEAD
 1.11 27-Jun-2025  andvar Grammar and spelling fixes, mainly in comments. A few in documentation,
logging, test description, and SCSI ASC/ASCQ assignment descriptions.
 1.10 07-Dec-2024  nat Usability enhancement.

For the emulated middle and right mouse buttons, one has to hold the combo keys
and it is sent on the mouse click.

Patch from PR applied.

Addresses PR mac68k/58672.
 1.9 27-Oct-2012  chs branches: 1.9.74;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.8 04-Mar-2007  christos branches: 1.8.78; 1.8.88;
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 15-Jan-2005  chs branches: 1.6.10;
de-__P, remove register, ansify, b* -> mem*.
 1.5 14-Feb-2000  scottr branches: 1.5.28;
Merge wscons work onto the main development branch.
 1.4 05-Mar-1999  scottr branches: 1.4.2;
These files were created by repository copy for use on the
scottr-mac68k-wscons branch.
 1.3 16-Feb-1999  ender branches: 1.3.2;
Add NetBSD RCS Id's
 1.2 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.3.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 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.28.1 17-Jan-2005  skrll Sync with HEAD.
 1.6.10.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.8.88.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.8.78.1 30-Oct-2012  yamt sync with head
 1.9.74.1 02-Aug-2025  perseant Sync with HEAD
 1.27 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.26 13-Jan-1998  scottr Update for bus.h changes.
 1.25 12-Jan-1998  thorpej Update for changes to config.
 1.24 10-Oct-1997  scottr branches: 1.24.2;
Remove advertising clause.
 1.23 16-Sep-1997  scottr Set up base address of ASC for IIfx, per GtMFH.
 1.22 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.21 10-Jun-1997  veego branches: 1.21.4;
s/mac68k_btop/m68k_btop/
 1.20 24-Feb-1997  scottr Update copyright and license.
 1.19 13-Feb-1997  scottr Remove redundant info from bus_space_map() diagnostic in ascattach()
 1.18 11-Feb-1997  scottr Add a bus space tag field to obio_attach args, initialize it in
obio_search(), and use it in the ASC driver. Thanks to Jason for
pointing this out. Minor KNFing while I'm here.
 1.17 11-Feb-1997  scottr Complete revamp of Apple Sound Chip support. The ASC can now be accessed
as a real device whose registers and buffers are available through mmap(2),
which makes further development of the driver considerably less painful.
 1.16 03-Feb-1997  scottr branches: 1.16.2;
Convert to bus.h; this removes the need for the ASCBase global.
 1.15 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.14 09-Nov-1996  briggs Check to make sure that ASCBase is accessable before claiming that we
have an Apple Sound Chip. Make sure that we have configured the device
before allowing accesses to ASC memory. Among other things, this
prevents the 660AV and 840AV from getting a kernel bus error when trying
to beep on the console.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.10 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.9 01-Nov-1995  briggs Remove bogus assignment.
 1.8 21-Sep-1995  briggs Fix warning and use __P for prototypes.
 1.7 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 21-Jul-1994  briggs Make this into more of a device so it can be probed and attached. Nuke
RCS/CVS Log. Make ASCBase an offset instead of an absolute.
 1.4 26-Jun-1994  briggs branches: 1.4.2;
Minor mods. Get rid of constants, or update to use a better default
value.
 1.3 06-May-1994  briggs Missed some warnings...
 1.2 06-May-1994  briggs Clean up some warnings, mainly w/ timeout().
 1.1 21-Dec-1993  briggs Add basic sound support and a beeping (instead of flashing) console...
from Brad Grantham.
 1.4.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.16.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.21.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.4.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24.2.1 23-Nov-1998  cgd Fix many real and potential security problems with character device
driver mmap routines that did not properly bounds check offsets.
See NetBSD security advisory NetBSD-SA1998-005 for details. Done
as a patch because it's large, and a fair number of bits are different
in -current. (mrg)
 1.4 11-Feb-1997  scottr Complete revamp of Apple Sound Chip support. The ASC can now be accessed
as a real device whose registers and buffers are available through mmap(2),
which makes further development of the driver considerably less painful.
 1.3 21-Apr-1995  briggs branches: 1.3.8;
First pass of KNFication. Needs more.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 21-Dec-1993  briggs Add basic sound support and a beeping (instead of flashing) console...
from Brad Grantham.
 1.3.8.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.5 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.4 10-Oct-1997  scottr Remove advertising clause.
 1.3 24-Feb-1997  scottr branches: 1.3.4;
Update copyright and license.
 1.2 11-Feb-1997  scottr Complete revamp of Apple Sound Chip support. The ASC can now be accessed
as a real device whose registers and buffers are available through mmap(2),
which makes further development of the driver considerably less painful.
 1.1 05-May-1996  briggs branches: 1.1.6;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.1.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6 02-May-1998  scottr Dead, unused, kaput.
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 08-Jul-1994  lkestel 6x10.h: shifted font over by two pixels.
keyboard.h: added constants for commonly used keys and reformatted
array so that gcc would be happy.
adbsys.c: new adb system.
bounds.h: bound-checking macros.
ite.c: new built-in mini-console.
8x14.h: no longer used by built-in console.
adb.c: replaced by adbsys.c
 1.3 30-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.16 24-Jul-1994  mycroft Clean up deleted files.
 1.15 05-Jul-1994  briggs Need the extra byte in the temp buffer to avoid overrun in scrollup on
wide screens.
 1.14 04-Jul-1994  briggs Don't blow up on huge screens.
 1.13 02-Jul-1994  briggs Reset sccaddr if we're resetting the video address.
Nuke some debugging output.
 1.12 26-Jun-1994  briggs Minor mods. Get rid of constants, or update to use a better default
value.
 1.11 06-May-1994  briggs Clean up some warnings, mainly w/ timeout().
 1.10 22-Feb-1994  briggs Various fixes, changes and so forth by lkestel. Among them should be
support for > 1-bit modes (slow...)...
 1.9 10-Feb-1994  briggs ioctl now takes struct proc *.
 1.8 30-Jan-1994  briggs Nuke final references to chars.h. It wasn't being used.
 1.7 20-Jan-1994  briggs Take out coninit and clean up some warnings.
 1.6 13-Jan-1994  briggs Basic cleanup. Get rid of my_frame for frame.
 1.5 21-Dec-1993  briggs Add basic sound support and a beeping (instead of flashing) console...
from Brad Grantham.
 1.4 15-Dec-1993  briggs Add (broken) support for DDB. Also fix a bug in console that confused the
scrollback. Clean up includes a tad.
 1.3 06-Dec-1993  briggs Fix includes to use ../mac68k instead of ../mac and add some semi-colons
to a couple of default: switches. gcc2 doesn't mind not having them,
but gcc1 sure does.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.4 24-Jul-1994  mycroft Clean up deleted files.
 1.3 21-Dec-1993  briggs Add basic sound support and a beeping (instead of flashing) console...
from Brad Grantham.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.4 03-Jul-1994  mycroft Clean up deleted files.
 1.3 26-Jun-1994  briggs This should probably be deprecated--minor slash job.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.15 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.14 12-Jan-1998  thorpej Update for changes to config.
 1.13 19-Nov-1997  briggs * Disable parity checking on all devices until we find a better way to
deal with cheap CD-ROMs and other devices that do not appear to have
any way to enable parity generation. In the future, it might be nice
to have this configurable on a per-device basis with back-to-back
parity errors automatically disabling parity for the device. That
would require some MI changes.
* Handle unaligned and odd-length transfers.
This could probably be handled better in the future.
 1.12 05-Nov-1997  briggs A first cut at faster SCSI for non-AV quadras. Could probably perform better,
but is a marked improvement. This takes advantage of a pseudo-DMA hardware
hack of Apple's that exposes a 16-bit register that the Apple-designed
memory controller acts like a DMA controller and handshakes into or out
of the FIFO. Wierd.
 1.11 27-Aug-1997  bouyer branches: 1.11.4;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.10 05-Mar-1997  briggs branches: 1.10.2; 1.10.4;
Copyright foo.
 1.9 01-Mar-1997  scottr Fix prototype for espmatch()
 1.8 28-Feb-1997  scottr Convert to generalized VIA interrupt registration
 1.7 27-Feb-1997  briggs mac68k-specific portion of m.i. ncr53c9x driver.
 1.6 16-Dec-1996  scottr branches: 1.6.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.5 10-Dec-1996  thorpej Fill in sc_link.max_target
 1.4 04-Nov-1996  briggs - Move offset for 2nd scsi controller (Q900/Q950/WGS95) to 0x402
instead of 0x400.
- Restructure interrupt handling for more performance--continue to
read/write data as long as the device keeps us in a data xfer phase.
There is still a lot of room for speed improvement here. Perhaps it
lies is speeding up the interrupt path in general?
 1.3 02-Nov-1996  briggs Improve reliability on my Q700, at least. Was getting the occasional
glitch--an extra byte on occasion.
 1.2 30-Oct-1996  briggs macs with scsibase offset 0x10000 from iobase use a SCSI CLK of 16.5MHz
(off PrimeTime)--all others appear to use 25MHz.
 1.1 29-Oct-1996  briggs Interrupt-driven, but slow, NCR 53c96 driver for the 040-based macs. Contains
some guesses for the machines that have two of these buggers (I don't have
such a machine). This driver is a copy of the sparc/alpha esp with a
minimum of changes--after we get it performing a bit more respectably,
we should see about re-normalizing the sources.
 1.6.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.10.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.11.4.2 19-Nov-1997  mellon Pull rev 1.13 up from trunk (briggs)
 1.11.4.1 15-Nov-1997  mellon Pull rev 1.12 up from trunk (briggs)
 1.2 27-Feb-1997  briggs mac68k-specific portion of m.i. ncr53c9x driver.
 1.1 29-Oct-1996  briggs branches: 1.1.6;
Interrupt-driven, but slow, NCR 53c96 driver for the 040-based macs. Contains
some guesses for the machines that have two of these buggers (I don't have
such a machine). This driver is a copy of the sparc/alpha esp with a
minimum of changes--after we get it performing a bit more respectably,
we should see about re-normalizing the sources.
 1.1.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.6 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.5 25-Nov-1997  briggs Forgot a declaration in last change to esp.c.
 1.4 05-Nov-1997  briggs A first cut at faster SCSI for non-AV quadras. Could probably perform better,
but is a marked improvement. This takes advantage of a pseudo-DMA hardware
hack of Apple's that exposes a 16-bit register that the Apple-designed
memory controller acts like a DMA controller and handshakes into or out
of the FIFO. Wierd.
 1.3 27-Feb-1997  briggs branches: 1.3.8;
mac68k-specific portion of m.i. ncr53c9x driver.
 1.2 02-Nov-1996  briggs branches: 1.2.6;
Improve reliability on my Q700, at least. Was getting the occasional
glitch--an extra byte on occasion.
 1.1 29-Oct-1996  briggs Interrupt-driven, but slow, NCR 53c96 driver for the 040-based macs. Contains
some guesses for the machines that have two of these buggers (I don't have
such a machine). This driver is a copy of the sparc/alpha esp with a
minimum of changes--after we get it performing a bit more respectably,
we should see about re-normalizing the sources.
 1.2.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.8.2 26-Nov-1997  mellon Pull rev 1.5 up from trunk (briggs)
 1.3.8.1 15-Nov-1997  mellon Pull rev 1.4 up from trunk (briggs)
 1.3 09-Dec-2024  nat Add support for backlight control.

Currently it is only supported on PowerBooks.
The backlight can be turned off or on via pmf(9) events on wsdisplay(4)
devices.
 1.2 21-Oct-2020  rin branches: 1.2.26;
Drop inappropriate WSFB_VRAM_IS_RAM bit from fbi_flags;
framebuffer is not regular RAM.

Thanks to jmcneill@ and macallan@ for kind explanation
(at elsewhere).
 1.1 26-Jul-2019  rin branches: 1.1.10;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.1.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.10.1 26-Jul-2019  martin file genfb_grfbus.c was added on branch phil-wifi on 2020-04-13 08:03:57 +0000
 1.2.26.1 02-Aug-2025  perseant Sync with HEAD
 1.64 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.63 28-Jun-1999  briggs branches: 1.63.2;
Include resourcevar.h for p_limit/rlimit definition.
 1.62 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.61 07-Apr-1999  scottr vm_size_t -> vsize_t
 1.60 26-Mar-1999  ender branches: 1.60.4;
Include uvm/uvm.h instead of uvm/uvm_extern.h because we need the prototype
for uvm_unmap() in order to compile a kernel with GRF_COMPAT defined.

Fix provided by Frederick Bruckman <fb@enteract.com> in PR #7237.
 1.59 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.58 22-Dec-1998  scottr branches: 1.58.2;
vm_offset_t -> {paddr_t, vaddr_t}
 1.57 19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.56 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.55 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.54 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.53 02-Jun-1998  scottr Store the PA of the framebuffer in the softc. This eliminates the need
for the sc_phys callback; we can just store the PA in the grfbus attach
args, rather than a function pointer, which simplifies the code nicely.
 1.52 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.51 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.50 17-Jan-1998  scottr Now, correct the problem the correct way: s/cfattach/cfdriver/
 1.49 17-Jan-1998  scottr Back out previous change.
 1.48 12-Jan-1998  scottr Missed a change for the updated config(8).
 1.47 12-Jan-1998  thorpej Update for changes to config.
 1.46 01-Dec-1997  scottr Make grfdebug a patchable variable, and default to no debugging messages.
Noticed by Hauke Fath.
 1.45 11-Aug-1997  scottr branches: 1.45.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.44 03-Aug-1997  scottr Overhaul grf drivers to correct recent problems with X and dt
(address error faults), as well as other reported problems:

- Simplify grfmv_phys() to work like grfiv_phys(), and eliminate the
second argument to both, as we don't use it anyway.
- Handle fbbase and fboff consistently throughout. Closes PR 3862.
- Eliminate grfaddr() by pulling it into grfmmap(), which is the
only place it was used, previously.
- grfmap() now gets the physical address of the framebuffer from
the appropriate driver, rather than try to compute it by itself.
Be careful with aligning the base to a page address and increase
the length of the mapped region appropriately. Closes PR 2867.
 1.43 10-Jun-1997  veego branches: 1.43.4;
s/mac68k_round_page/m68k_round_page/ s/mac68k_trunc_page/m68k_trunc_page/
s/mac68k_btop/m68k_btop/
 1.42 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.41 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.40 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.39 16-Dec-1996  scottr branches: 1.39.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.38 13-Oct-1996  christos backout previous kprintf change
 1.37 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.36 14-Sep-1996  scottr Implement poll(2).
 1.35 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device, instead of obio.
 1.34 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.33 19-May-1996  scottr branches: 1.33.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.32 06-May-1996  briggs Do not depend on the nubus being mapped in one huge segment.
 1.31 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.30 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.29 21-Sep-1995  briggs Fix a warning.
 1.28 06-Jul-1995  briggs Add another routine for the grf display-specific drivers to return a physical
address.
 1.27 06-Jul-1995  briggs Put in a cast to make compiler happy.
 1.26 06-Jul-1995  briggs Fix a bug I introduced earlier.
 1.25 02-Jul-1995  briggs Add missing interface for getting a grfmode structure from kernel.
 1.24 02-Jul-1995  briggs Fix grfmap() as well as grfmmap().
 1.23 02-Jul-1995  briggs Set and use new fboff element from grfmode structure.
 1.22 01-Jul-1995  briggs Fix buglet that was missed when converting nubus to non pa==va mapping.
 1.21 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.20 21-Apr-1995  briggs Handle grf_softc in the config.new manner.
Should have been done long ago.
 1.19 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.18 13-Apr-1995  briggs Update interrupts to use (void *client_data) instead of (int unit) as
parameter to interrupt function.
 1.17 10-Apr-1995  mycroft Switch grfmap and grfmmap.
 1.16 26-Mar-1995  briggs Do iteon() and iteoff(). Right now, they just clear/draw the cursor and
clear the screen. "We" should look at updating these further.
 1.15 25-Mar-1995  briggs Don't count video interrupts.
 1.14 23-Mar-1995  briggs Add macvideo_intr to handle video interrupts. Currently has behavior
that was previously in slot_noint().
 1.13 03-Dec-1994  briggs Nuke DEBUG.
 1.12 30-Oct-1994  briggs Fix a buglet in computation of fbsize. Pointed out by monroe@cs.pdx.edu.
 1.11 26-Oct-1994  cgd new RCS ID format.
 1.10 31-Jul-1994  lkestel Make internal video look like a grf device so that desktop and X can use
it. GRFIOCMAP modifies addr to include the offset into the screen where
the first pixel is. Not a very clean way to do it -- we should add a
field to grfinfo for offset.
 1.9 30-Jul-1994  lkestel Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.8 09-Jul-1994  briggs Minor hacks to get this to compile for now. ite.c now uses the proper
consdev structure to keep itself from crashing...
 1.7 26-Jun-1994  briggs branches: 1.7.2;
Minor mods. Get rid of constants, or update to use a better default
value.
 1.6 04-May-1994  briggs Don't even pay lip service to HPUXCOMPAT, now COMPAT_HPUX.
 1.5 05-Apr-1994  briggs Clean out some old printf()s and get rid of MAP_FILE reference.
 1.4 30-Jan-1994  briggs Include-cop.
 1.3 10-Jan-1994  briggs Update grf.h to increment a number of devices when it configures.
Fix a small bug in serial.
Both from Brad, Lawrence, and/or Mike.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.7.2.2 05-Aug-1994  mycroft update from trunk
 1.7.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.33.4.1 05-Aug-1996  jtc Pulled up from rev 1.34 by request from Scott Reynolds
 1.39.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.43.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.4.2 23-Nov-1998  cgd Fix many real and potential security problems with character device
driver mmap routines that did not properly bounds check offsets.
See NetBSD security advisory NetBSD-SA1998-005 for details. Done
as a patch because it's large, and a fair number of bits are different
in -current. (mrg)
 1.45.4.1 29-Jan-1998  mellon PUll up 1.46 (scottr)
 1.58.2.1 11-Mar-1999  scottr ite/grf is dead. long live ite/grf!
 1.60.4.2 01-Jul-1999  thorpej Sync w/ -current.
 1.60.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.63.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.29 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.28 20-Aug-2015  christos branches: 1.28.18;
include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.27 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.26 25-Jul-2014  dholland branches: 1.26.2; 1.26.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.25 16-Mar-2014  dholland branches: 1.25.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.24 30-Jan-2014  martin Add missing cast (to make it compilable)
 1.23 26-Jan-2014  christos kill VM_DEFAULT_ADDRESS use
 1.22 06-Jun-2010  mrg branches: 1.22.8; 1.22.18; 1.22.22;
defflag GRF_COMPAT.
 1.21 25-Jan-2008  dogcow branches: 1.21.10; 1.21.30; 1.21.32;
fallout from v_specinfo removal
 1.20 05-Mar-2007  he branches: 1.20.20; 1.20.26;
Cast to char* before doing pointer arithmetic.
 1.19 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18 24-Jan-2007  hubertf branches: 1.18.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.17 09-Mar-2006  he branches: 1.17.10;
Remove now-unused local variable.
 1.16 08-Mar-2006  scottr Cleaner check for offset to grf_mmap
 1.15 11-Dec-2005  christos branches: 1.15.4; 1.15.6; 1.15.8; 1.15.10;
merge ktrace-lwp.
 1.14 15-Jan-2005  chs branches: 1.14.10;
de-__P, remove register, ansify, b* -> mem*.
 1.13 15-Jul-2003  lukem branches: 1.13.6;
__KERNEL_RCSID()
 1.12 24-Feb-2003  atatat branches: 1.12.2;
Cast VM_DEFAULT_ADDRESS() to a caddr_t.
 1.11 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.10 23-Oct-2002  jdolecek merge kqueue branch into -current

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

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

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.9 10-Oct-2002  jdolecek replace the somewhat strange poll routine with standard nopoll() (a.k.a
seltrue())
 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 30-Apr-2001  wiz branches: 1.7.2; 1.7.4; 1.7.8; 1.7.16;
Remove unused variable. Reported by Thilo Manske in port-mac68k/12794.
 1.6 15-Mar-2001  chs 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.5 29-Jun-2000  mrg branches: 1.5.2; 1.5.4;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.4 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.3 08-Jun-2000  scottr branches: 1.3.2;
Make this compile with GRF_COMPAT. Problem pointed out by Hauke Fath.
 1.2 14-Feb-2000  scottr branches: 1.2.2;
Merge wscons work onto the main development branch.
 1.1 15-Nov-1999  scottr branches: 1.1.2;
file grf_compat.c was initially added on branch scottr-mac68k-wscons.
 1.1.2.5 20-Nov-1999  scottr Clear the screen on close to emulate the behavior of legacy
grf devices.
 1.1.2.4 18-Nov-1999  scottr Revert 1.1.2.2; further testing shows that the problem lies elsewhere.
 1.1.2.3 18-Nov-1999  scottr Improved emulation of grf devices:

- sync return value for unsupported ioctls with legacy grf driver
- returning (-1) from grfioctl() is hardly appropriate; return EINVAL
when we are given an unknown ioctl (duh)
- don't add the displayable region offset in grfmmap(); apps handlj
this themselves
 1.1.2.2 17-Nov-1999  scottr Avoid MAP_FIXED in grfmap(); it doesn't buy us anything
with the apps that use it, and can cause some systems (e.g. the IIci)
to behave erratically.
 1.1.2.1 15-Nov-1999  scottr Implement a more straightforward approach to grf emulation.
 1.2.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.3.2.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.5.4.2 21-Jun-2001  nathanw Catch up to -current.
 1.5.4.1 09-Apr-2001  nathanw Catch up with -current.
 1.5.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.5.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.5.2.1 29-Jun-2000  bouyer file grf_compat.c was added on branch thorpej_scsipi on 2000-11-20 20:12:16 +0000
 1.7.16.1 17-May-2002  gehenna Add device switch.
 1.7.8.4 11-Nov-2002  nathanw Catch up to -current
 1.7.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.7.8.2 17-Sep-2002  nathanw Catch up to -current.
 1.7.8.1 30-Apr-2001  nathanw file grf_compat.c was added on branch nathanw_sa on 2002-09-17 21:15:24 +0000
 1.7.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.7.2.3 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.7.2.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.7.2.1 18-Jun-2002  jdolecek provide dummy grfkqfilter()
 1.12.2.5 25-Jan-2005  skrll Adapt to branch.
 1.12.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.12.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.12.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.12.2.1 03-Aug-2004  skrll Sync with HEAD
 1.13.6.2 09-Mar-2006  snj Revert previous change, which was accidentally committed to the wrong branch.
 1.13.6.1 08-Mar-2006  scottr Cleaner check for offset to grf_mmap
 1.14.10.4 04-Feb-2008  yamt sync with head.
 1.14.10.3 03-Sep-2007  yamt sync with head.
 1.14.10.2 26-Feb-2007  yamt sync with head.
 1.14.10.1 21-Jun-2006  yamt sync with head.
 1.15.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.15.8.1 13-Mar-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.17.10.1 01-Feb-2007  ad Sync with head.
 1.18.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.26.1 18-Feb-2008  mjf Sync with HEAD.
 1.20.20.1 23-Mar-2008  matt sync with HEAD
 1.21.32.1 03-Jul-2010  rmind sync with head
 1.21.30.1 17-Aug-2010  uebayasi Sync with HEAD.
 1.21.10.1 11-Aug-2010  yamt sync with head.
 1.22.22.1 18-May-2014  rmind sync with head
 1.22.18.2 03-Dec-2017  jdolecek update from HEAD
 1.22.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.8.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.25.2.1 10-Aug-2014  tls Rebase.
 1.26.4.2 22-Sep-2015  skrll Sync with HEAD
 1.26.4.1 06-Apr-2015  skrll Sync with HEAD
 1.26.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.28.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.7 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 30-Jul-1994  lkestel Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.4 26-Jun-1994  briggs branches: 1.4.2;
Minor mods. Get rid of constants, or update to use a better default
value.
 1.3 30-Jan-1994  briggs Include-cop.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.4.2.1 11-Aug-1994  mycroft update from trunk
 1.4 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.32 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.31 22-Mar-1998  scottr The monitor sense code we have is not reliable on DAFB-based machines with
certain 17" monitors. Change from Michael R. Zucca, PR 4988.

XXX - This can cause problems on system with the DAFB chip which currently
use only a NuBus-based video adapter. In particular, grf devices may not be
attached properly in this case. This unfortunate situation is less annoying
than not having a reasonable console, however. A reasonable, reliable
monitor sense algorithm for the DAFB would resolve the problem.
 1.30 22-Mar-1998  scottr Disable Valkyrie interrupts on the Quadra 630. Part of a change
from Michael R. Zucca, PR 4988.
 1.29 13-Jan-1998  scottr Update for bus.h changes.
 1.28 12-Jan-1998  thorpej Update for changes to config.
 1.27 08-Nov-1997  scottr KNF: Fix some whitespace inconsistencies.
 1.26 08-Nov-1997  briggs Force the probe to find the internal video for the 63x/575 models.
 1.25 08-Oct-1997  briggs branches: 1.25.2;
Disable video interrupts on the AV machines. Thanks to Michael R. Zucca
(mrz5149@cs.rit.edu) for the addresses and hints as to how the interrupts
might be disabled, and thanks to Henry Hotz (h.b.hotz@jpl.nasa.gov) for
testing on the 840AV.
Unmap the DAFB regs on the other Quadras after attachment. They're not
used.
 1.24 03-Aug-1997  scottr Fix grf{i,m}v_phys() prototypes.
 1.23 03-Aug-1997  scottr Overhaul grf drivers to correct recent problems with X and dt
(address error faults), as well as other reported problems:

- Simplify grfmv_phys() to work like grfiv_phys(), and eliminate the
second argument to both, as we don't use it anyway.
- Handle fbbase and fboff consistently throughout. Closes PR 3862.
- Eliminate grfaddr() by pulling it into grfmmap(), which is the
only place it was used, previously.
- grfmap() now gets the physical address of the framebuffer from
the appropriate driver, rather than try to compute it by itself.
Be careful with aligning the base to a page address and increase
the length of the mapped region appropriately. Closes PR 2867.
 1.22 26-Jul-1997  scottr branches: 1.22.2;
KNF
 1.21 10-Jun-1997  veego s/mac68k_trunc_page/m68k_trunc_page/
 1.20 21-Apr-1997  briggs Take care when accessing DAFB--some quadra-class machines use other video
controllers.
 1.19 01-Apr-1997  briggs Remove tag.
 1.18 01-Apr-1997  briggs - Support DAFB machines mo' better. Actually detect if a monitor is
present and initialize a few things. No color support, yet.
- Properly disable interrupts for DAFB.
- Rearrange for better nubus display card interrupt support. Only register
an interrupt if we know how to clear it.
- Complain if we don't know about a given display card and can not install
an interrupt handler.
- Change MYSTERY stuff to cb264--still need to get the DrSW so we can
actually call the routine to clear an interrupt from this card.
 1.17 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.16 16-Dec-1996  scottr branches: 1.16.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.15 13-Oct-1996  christos backout previous kprintf change
 1.14 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.12 19-May-1996  scottr branches: 1.12.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.11 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.10 11-Aug-1995  briggs Don't fake these values.
 1.9 04-Aug-1995  briggs Nuke int_video_start in favor of consistent use of mac68k_vidlog.
Don't find the internal video more than once.
Probe for internal video before nubus instead of after.
 1.8 04-Aug-1995  briggs Be consistent and use mac68k_vidlog instead of int_video_start.
 1.7 30-Jul-1995  briggs Fix the internal video probe again.
 1.6 28-Jul-1995  briggs Don't show up in "slot" 0xe.\n
 1.5 06-Jul-1995  briggs Add another routine for the grf display-specific drivers to return a physical
address.
 1.4 04-Jul-1995  briggs First cut at a kludge for IIvx internal video.
 1.3 02-Jul-1995  briggs Set and use new fboff element from grfmode structure.
 1.2 21-Jun-1995  briggs Be a bit more careful on the probe... Make sure that the current slot's
addresses contain the int_video_start--or assume that internal video is
is "slot" 0xE.
 1.1 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.12.4.1 05-Aug-1996  jtc Pulled up from rev 1.13 by request from Scott Reynolds
 1.16.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.22.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.2 05-May-1998  mycroft Pull up 1.30-1.31, per request of scottr.
 1.25.2.1 09-Nov-1997  mellon Pull rev 1.26 up from trunk (briggs)
 1.43 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.42 26-Apr-1998  briggs Deal with the video interrupt for the RasterOps 8/24XLi. Thanks for the
information go to Tadashi Ueda <ng6t-ued@asahi-net.or.jp>.
 1.41 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.40 24-Apr-1998  briggs Add interrupt support for two more video cards: the Formac color card II
and the Radius PrecisionColor 24Xp. Thanks to <falk.stern@luene.net> and
<Mario_Magliocco@broder.com> for their remote sleuthing and testing.
 1.39 12-Jan-1998  thorpej Update for changes to config.
 1.38 03-Dec-1997  briggs Thanks to Paul Goyette <paul@whooppee.com> for a patch to clear the
interrupt properly on a SuperMac Spectrum/8 Series III, and thanks
to Dan McMahill for loaning the card to Paul.
I modified Paul's patch somewhat to change grfmv_intr_generic_{1,4}
to grfmv_intr_generic_write{1,4} and added grfmv_intr_generic_or4 to
handle this card.
 1.37 01-Dec-1997  scottr Correct a comment from previous commit.
 1.36 30-Nov-1997  briggs Support for the Lapis ProColorServer 8 PDS on the SE/30. This prevents
hangs when trying to use this video card in conjunction with an ethernet
card. Thanks to David Condon <david@apk.net> for information and testing.
 1.35 25-Oct-1997  briggs Handle interrupts on E-Machines Futura-SX. From Paul Goyette, PR 4348.
 1.34 09-Oct-1997  briggs branches: 1.34.2;
Clear interrupts properly on the Radius PrecisionColor 8.
Thanks for the info go to Andrew MacGibbon <andrew-m@cs.auckland.ac.nz>
 1.33 15-Aug-1997  briggs Add interrupt handler for SuperMac GFX.
Tested by Kai-Yew Lum <kaiyewl@engin.umich.edu> back in May.
 1.32 14-Aug-1997  scottr Recognize the Sigma Designs ColorMax card, and handle the interrupt. Code
provided by Brian Foley <bfoley@gpo.iol.ie> via Allen Briggs, updated for
bus.h by me.
 1.31 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.30 03-Aug-1997  scottr Fix grf{i,m}v_phys() prototypes.
 1.29 03-Aug-1997  scottr Overhaul grf drivers to correct recent problems with X and dt
(address error faults), as well as other reported problems:

- Simplify grfmv_phys() to work like grfiv_phys(), and eliminate the
second argument to both, as we don't use it anyway.
- Handle fbbase and fboff consistently throughout. Closes PR 3862.
- Eliminate grfaddr() by pulling it into grfmmap(), which is the
only place it was used, previously.
- grfmap() now gets the physical address of the framebuffer from
the appropriate driver, rather than try to compute it by itself.
Be careful with aligning the base to a page address and increase
the length of the mapped region appropriately. Closes PR 2867.
 1.28 26-Jul-1997  scottr branches: 1.28.2;
Add support for Macintosh Display Card, using information provided
by Taras Ivanenko <ivanenko@ctpa03.mit.edu> in PR 3862. (The PR
is still open, due to an unresolved issue regarding the fbbase
field.)
 1.27 01-Jul-1997  scottr Add support for Portrait Video Card. From SUNAGAWA Keiki
<kei_sun@ba2.so-net.or.jp> in PR 3821.
 1.26 12-May-1997  scottr Convert several interrupt handlers to bus space model, removing some
XXX's. Also, fix a bug in grfmv_intr_generic() that I found and
confirmed with Allen.
 1.25 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.24 03-May-1997  briggs Support for clearing interrupts on a Rasterops Colorboard 364.
Thanks go to Michel Chalufour <michelc@tiac.net> for grovelling around for
me.
 1.23 02-May-1997  briggs Thanks to Tobias Beal <tbeal41@maine.maine.edu>, we can clear interrupts
on at least one Radius Precisioncolor 8 board.
 1.22 01-May-1997  briggs Clear the interrupts properly on an E-Machines Futura II LX and make a wild
guess at clearing them on a Futura II SX/DSP and RasterOps ColorBoard 364.
Thanks to Michel Chalufour <michelc@tiac.net> for loaning me the II LX.
 1.21 14-Apr-1997  scottr Purely cosmetic cleanup:

- Remove unused `register' modifier on declarations
- Reverse the sense of some tests to make the code more clear
- Type casts per KNF
- Move a static variable into the only function that uses it (perhaps
we can eliminate it entirely, someday?)
 1.20 10-Apr-1997  briggs Ignore SE/30 faux-video card.
 1.19 01-Apr-1997  briggs Add DrHW for RasterOps CB264--From Scott Reynolds--and link it in to the
proper interrupt routine.
 1.18 01-Apr-1997  briggs - Support DAFB machines mo' better. Actually detect if a monitor is
present and initialize a few things. No color support, yet.
- Properly disable interrupts for DAFB.
- Rearrange for better nubus display card interrupt support. Only register
an interrupt if we know how to clear it.
- Complain if we don't know about a given display card and can not install
an interrupt handler.
- Change MYSTERY stuff to cb264--still need to get the DrSW so we can
actually call the routine to clear an interrupt from this card.
 1.17 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.16 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.15 16-Dec-1996  scottr branches: 1.15.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.14 13-Oct-1996  christos backout previous kprintf change
 1.13 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.11 19-May-1996  scottr branches: 1.11.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.10 06-May-1996  briggs Set sc_slot--we need it later.
 1.9 06-May-1996  briggs Do not depend on the nubus being mapped in one huge segment.
 1.8 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7 24-Aug-1995  briggs Some code to support a vector passed in from booter 1.8.
 1.6 06-Jul-1995  briggs Add another routine for the grf display-specific drivers to return a physical
address.
 1.5 02-Jul-1995  briggs Set and use new fboff element from grfmode structure.
 1.4 30-Jun-1995  briggs Fix oversight.
 1.3 21-Jun-1995  briggs Make no assumptions about the absolute address of nubus cards.
 1.2 06-May-1995  briggs Get rid of a printf() that got left behind in the probe.
 1.1 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.11.4.1 05-Aug-1996  jtc Pulled up from rev 1.12 by request from Scott Reynolds
 1.15.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.28.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.34.2.2 01-Dec-1997  mellon Pull rev 1.36 and 1.37 up from trunk (briggs) (reviewed by mellon)
 1.34.2.1 26-Oct-1997  mellon Pull rev 1.35 up from trunk (briggs)
 1.25 09-Aug-2022  rin Switch from ``(1 << depth) color'' to ``(depth)-bpp color'' in
attach message.

For depth == 32, fix ``0 color'', and prevent ambiguous ``16Mi color''.

I don't know whether there is 24-bpp graphic card for mac68k or not,
although.
 1.24 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.23 24-Apr-2021  thorpej branches: 1.23.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.22 26-Jul-2019  rin branches: 1.22.12;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.21 27-Oct-2012  chs branches: 1.21.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.20 28-Apr-2008  martin branches: 1.20.34; 1.20.44;
Remove clause 3 and 4 from TNF licenses
 1.19 11-Dec-2005  christos branches: 1.19.74; 1.19.76; 1.19.78;
merge ktrace-lwp.
 1.18 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.17 15-Jul-2003  lukem __KERNEL_RCSID()
 1.16 01-Jan-2003  thorpej branches: 1.16.2;
Use aprint_normal() for cfprint routines.
 1.15 14-Feb-2000  scottr branches: 1.15.12;
Merge wscons work onto the main development branch.
 1.14 12-Aug-1998  scottr branches: 1.14.6; 1.14.14;
New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.13 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.12 02-Jun-1998  scottr Store the PA of the framebuffer in the softc. This eliminates the need
for the sc_phys callback; we can just store the PA in the grfbus attach
args, rather than a function pointer, which simplifies the code nicely.
 1.11 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.10 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.9 03-Aug-1997  scottr Fix typo found by Colin Wood, PR 3934: ga_handle should get the value of
the handle, not the tag.
 1.8 03-Aug-1997  scottr Adjust grf_establish() prototype.
 1.7 11-May-1997  scottr branches: 1.7.4;
Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.6 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.5 13-Oct-1996  christos branches: 1.5.6;
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 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.1 19-May-1996  scottr branches: 1.1.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.1.4.1 05-Aug-1996  jtc Pulled up from rev 1.2 by request from Scott Reynolds
 1.5.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.7.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.7.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.14.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.14.6.1 11-Mar-1999  scottr First cut at grf emulation. Neither GRFIOCMAP nor mmap'ing a wsdisplay device
work, though several other grf ioctls are properly emulated.
 1.15.12.1 03-Jan-2003  thorpej Sync with HEAD.
 1.16.2.4 17-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.78.1 16-May-2008  yamt sync with head.
 1.19.76.1 18-May-2008  yamt sync with head.
 1.19.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.44.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.20.34.1 30-Oct-2012  yamt sync with head
 1.21.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.22.12.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.23.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.3 30-Jul-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.32 26-Jul-2019  rin Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.31 27-Oct-2012  chs branches: 1.31.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 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 04-Mar-2007  christos branches: 1.29.66; 1.29.72; 1.29.74;
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 03-Jun-2005  rjs branches: 1.27.2;
Add const.
 1.26 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.25 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.24 14-Feb-2000  scottr branches: 1.24.28;
Merge wscons work onto the main development branch.
 1.23 22-Dec-1998  scottr branches: 1.23.2; 1.23.10;
vm_offset_t -> {paddr_t, vaddr_t}
 1.22 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.21 02-Jun-1998  scottr Store the PA of the framebuffer in the softc. This eliminates the need
for the sc_phys callback; we can just store the PA in the grfbus attach
args, rather than a function pointer, which simplifies the code nicely.
 1.20 03-Aug-1997  scottr Adjust prototype for ga_phys field in grfbus_attach_args.
 1.19 03-Aug-1997  scottr Adjust grf_establish() prototype.
 1.18 03-Aug-1997  scottr Overhaul grf drivers to correct recent problems with X and dt
(address error faults), as well as other reported problems:

- Simplify grfmv_phys() to work like grfiv_phys(), and eliminate the
second argument to both, as we don't use it anyway.
- Handle fbbase and fboff consistently throughout. Closes PR 3862.
- Eliminate grfaddr() by pulling it into grfmmap(), which is the
only place it was used, previously.
- grfmap() now gets the physical address of the framebuffer from
the appropriate driver, rather than try to compute it by itself.
Be careful with aligning the base to a page address and increase
the length of the mapped region appropriately. Closes PR 2867.
 1.17 26-Jul-1997  scottr branches: 1.17.2;
cli_offset should be a bus_size_t now, and cli_value is an unsigned 32-bit int.
 1.16 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.15 01-May-1997  briggs Clear the interrupts properly on an E-Machines Futura II LX and make a wild
guess at clearing them on a Futura II SX/DSP and RasterOps ColorBoard 364.
Thanks to Michel Chalufour <michelc@tiac.net> for loaning me the II LX.
 1.14 01-Apr-1997  briggs - Support DAFB machines mo' better. Actually detect if a monitor is
present and initialize a few things. No color support, yet.
- Properly disable interrupts for DAFB.
- Rearrange for better nubus display card interrupt support. Only register
an interrupt if we know how to clear it.
- Complain if we don't know about a given display card and can not install
an interrupt handler.
- Change MYSTERY stuff to cb264--still need to get the DrSW so we can
actually call the routine to clear an interrupt from this card.
 1.13 14-Sep-1996  scottr Implement poll(2).
 1.12 14-Sep-1996  scottr Update prototypes to match Chris' cfprint_t change. Also, update comments
in autoconf.h to reflect the mainbus.c split.
 1.11 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.10 19-May-1996  scottr branches: 1.10.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.9 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.8 06-Jul-1995  briggs Add another routine for the grf display-specific drivers to return a physical
address.
 1.7 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.6 21-Apr-1995  briggs Handle grf_softc in the config.new manner.
Should have been done long ago.
 1.5 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.4 23-Mar-1995  briggs KERNEL -> _KERNEL
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.10.4.1 05-Aug-1996  jtc Pulled up from rev 1.11 by request from Scott Reynolds
 1.17.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.23.2.2 20-Nov-1999  scottr G/C the sc_isopen field in out softc.
 1.23.2.1 15-Nov-1999  scottr Implement a more straightforward approach to grf emulation.
 1.24.28.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.24.28.4 17-Jan-2005  skrll Sync with HEAD.
 1.24.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.24.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.24.28.1 03-Aug-2004  skrll Sync with HEAD
 1.27.2.1 03-Sep-2007  yamt sync with head.
 1.28.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.29.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.29.66.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.31.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.80 19-Jan-2010  pooka 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.79 06-Jan-2007  martin branches: 1.79.48;
If we have a single byte left over after filling in all mbuf data, we need
to increase the "totlen" count too. From Sungwon Chung.
 1.78 09-Sep-2006  tsutsui branches: 1.78.4;
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.
 1.77 11-Dec-2005  christos branches: 1.77.8; 1.77.18; 1.77.20;
merge ktrace-lwp.
 1.76 15-Jan-2005  chs branches: 1.76.8; 1.76.10;
de-__P, remove register, ansify, b* -> mem*.
 1.75 15-Jul-2003  lukem branches: 1.75.6;
__KERNEL_RCSID()
 1.74 22-Jan-2003  bouyer branches: 1.74.2;
We want bus_space_set_region_2(), not _1() here.
 1.73 21-Jan-2003  jdolecek fix pasto in previous to make this compile
 1.72 15-Jan-2003  bouyer Zero out the NIC memory when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN
sc->write_mbuf now return len of buffer, including padding.
Tested with a PCI ne2000.
 1.71 10-Nov-2001  jklos branches: 1.71.10;
Now properly probes for cards with 64k of buffer. Reversed order
of tests in case space isn't fully decoded.
 1.70 13-Sep-2000  scottr branches: 1.70.4; 1.70.6; 1.70.8;
Resolve bus_space_write_region_2() type mismatches.
 1.69 13-Sep-2000  scottr ae_write_mbuf() broke with the last change; revert.
 1.68 30-Jul-2000  briggs Make bus_space_write_region_2 usage match prototype.
 1.67 12-Jan-1998  thorpej branches: 1.67.16; 1.67.26;
Update for changes to config.
 1.66 02-Nov-1997  thorpej Adjust for ifmedia-related changes to dp8390 driver.
 1.65 11-Aug-1997  scottr branches: 1.65.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.64 29-Apr-1997  scottr branches: 1.64.4;
Use the new MI 8390 driver, and garbage collect.
 1.63 28-Apr-1997  scottr From Mycroft: Oops; forgot to GC the last mbuf allocated when
out of clusters.
 1.62 24-Apr-1997  scottr From Mycroft: If we fail to allocate a cluster to hold a large packet,
simply drop it rather than using a chain of tiny mbufs.
 1.61 14-Apr-1997  scottr Purely cosmetic cleanup:

- Remove unused `register' modifier on declarations
- Reverse the sense of some tests to make the code more clear
- Type casts per KNF
- Move a static variable into the only function that uses it (perhaps
we can eliminate it entirely, someday?)
 1.60 19-Mar-1997  scottr Several more changes to move us toward MI-ness:

- Use more consistent and portable types in the softc.
- Map registers using an array of bus_size_t offsets, and set up the
mapping in the attach code (thanks to Jason Thorpe for suggesting
this!).
- Disable the ae-specific watchdog, which is no longer necessary in
the general case.

Still remaining: split out functions used to copy data to/from the
card, and retain a way to have a local driver name with the MI code.
 1.59 17-Mar-1997  scottr Clean up some missed pieces of the new ARP conversion.
 1.58 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.57 04-Mar-1997  scottr Correct offsets in the memory size probe; bus_space uses byte offsets. Fix suggested by
Ken Nakata.
 1.56 28-Feb-1997  scottr Define aesetup() to return an int, so that the attach function can
determine whether there was an error (if so, we unmap the slot space
for this device). Use this functionality to tell the attach function
that we couldn't clear the card's buffer.

Also in aesetup(), eliminate the bogus repetition of the error message
we print when the buffer clear actually fails. Noticed by Hauke Fath.
 1.55 28-Feb-1997  scottr Move the NuBus-specific watchdog function from if_ae.c to if_ae_nubus.c,
and allow the attach function to override the default watchdog. Also,
do some minor cosmetic surgery (rename bus space tags/handles and some
KNFing I missed the first time around).
 1.54 25-Feb-1997  scottr Move bus-independent setup code back into if_ae.c; enable the use of
configuration flags. For NuBus cards, attempt to find the MAC address
in the declaration ROM resources.
 1.53 24-Feb-1997  scottr Add support for the Kinetics EtherPort SE/30, from Ken Nakata.
 1.52 24-Feb-1997  scottr Split out the NuBus attachment code, and convert to bus.h
 1.51 22-Feb-1997  scottr Add bus.h, in light of recent nubus_attach_args changes
 1.50 18-Dec-1996  scottr branches: 1.50.6;
Work around uninitialized variable warning
 1.49 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.48 13-Oct-1996  christos backout previous kprintf change
 1.47 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.46 15-May-1996  briggs print the failure if we do not correctly determine the amount of RAM
on the ethernet card.
 1.45 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_start)()
to take a struct ifnet *, rather than a unit number.
 1.44 06-May-1996  briggs Do not depend on the nubus being mapped in one huge segment.
 1.43 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.42 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.41 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.40 02-Feb-1996  briggs Force the talley counters to be read when we get the interrupt. GCC was
nicely optimizing the reads out for us. Kudos for this one go to
Steven R. Weiss <srw@hvcn.org>.
 1.39 13-Jan-1996  briggs Fix typo in last change.
 1.38 12-Jan-1996  briggs Patch to at least recognise FOCUS EtherLAN. From Erik Bertelson
<erik@sockdev.uni-c.dk>
 1.37 24-Dec-1995  mycroft The IST_* and IPL_* constants are not bus-specific; don't treat them as such.
Change splimp -> splnet in Ethernet, ARCnet, and FDDI drivers.
 1.36 24-Sep-1995  briggs Add Technology Works ethernet card. From
Kazunari Nakamura <kazu@nkk.co.jp>.
 1.35 09-Aug-1995  briggs Missing increment operator for if_opackets in last change.
 1.34 30-Jul-1995  briggs Fix signed/unsigned gaff in last.
Bring up-to-date with latest rash of changes to if_ed.c.
 1.33 30-Jul-1995  briggs Add support for Farallon from Brian Gaeke (brg@dgate.org).
 1.32 30-Jul-1995  briggs Read the packet header count in bytes, not as a word--word reads return
invalid data on some cards (notably old Apple Ethernet NB and Farallon
cards at least).
 1.31 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.30 21-Jun-1995  briggs Treat 0 as a failure case for ae_id_card() and take out
null-op check for a 0 addrlist in init.
 1.29 05-May-1995  briggs Add some code/defines to differentiate Asante and Interlan/Gator cards
correctly with the new nubus code.
 1.28 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.27 22-Apr-1995  briggs Add some multicast byteorder-related changes from djh@mulga.cs.mu.OZ.AU.
 1.26 21-Apr-1995  briggs Enable nubus interrupts after registering.
 1.25 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.24 19-Apr-1995  briggs Initialize totlen in ae_put. Thanks to chopps for pointing it out!
Also, switch back from using struct ed_ring to using struct ae_ring
because BYTE_ORDER == BIG_ENDIAN, but the card is in x86 byte order
mode because NuBUS does the swap "for us" on 16- and 32-bit transfers.
We should probably figure some way to use the std ed_ring if/when
all the 8390 drivers are all fully merged.
 1.23 16-Apr-1995  briggs Get this working. Mainly, don't always round to word transfers on
receive.
 1.22 13-Apr-1995  briggs Update to use dev/ic/dp8390.h. Mostly from mycroft.
Still get extra data on either transmit or recieve, but want to
checkpoint this work.
 1.21 12-Apr-1995  briggs Almost working synch with if_ed.c. Much by mycroft. Fixups by me.
Inserts garbage characters--this driver isn't ready for use quite yet.
 1.20 08-Apr-1995  briggs Fixup types of a few functions to match if.h structure.
 1.19 08-Apr-1995  briggs Print a diagnostic if we do hit the watchdog and recover w/o resetting.
 1.18 23-Mar-1995  briggs Serious kludge around network timeouts. Network timeouts seem to be
caused by the VIA missing the ethernet slot interrupt. If we get a
watchdog, try calling the via's nubus interrupt function. If that
causes an interrupt, don't reset anything. If it doesn't, use old
behavior (log timeout and reset).

Yuck.
 1.17 01-Mar-1995  briggs Raise watchdog timer a tad.
 1.16 04-Dec-1994  briggs Nuke Log in if_aereg.h and remove duplicate (and benign) sc->smem_size
assignment from Brad Parker (brad@fcr.com).
 1.15 03-Dec-1994  briggs At least somewhat functional ethernet driver from Brad Parker
(brad@fcr.com). Requires changes to via.c which are coming with
other changes in a moment...
 1.14 26-Oct-1994  cgd new RCS ID format.
 1.13 26-Jun-1994  briggs MIN -> min. This needs a lot of work.
 1.12 20-Mar-1994  lkestel Fixed a few major bugs. add_nubus_intr() was getting the wrong address,
and bcopy and bzero were being used. The latter use longs to copy/zero,
and some ethernet cards can't handle longs. I've added bbcopy and bbzero
as a temporary hack, but these should later be added to locore and maybe
changed to use shorts. Still doesn't work: I can now get an interrupt on
the first transmit, but further transmits don't generate more interrupts.
 1.11 20-Mar-1994  briggs Goof. Missed some mods in the changes to config.new a long time ago.
Thanks go to kesteloo@cs.unc.edu (Lawrence Kesteloot) for finding this.
 1.10 01-Mar-1994  briggs More Dayna separation.
 1.9 27-Feb-1994  briggs A little clean-up.
 1.8 26-Feb-1994  briggs Cleaned up the probe a little by actually using data from the decl. ROMs.
 1.7 23-Feb-1994  briggs Bail out in the probe since it's not safe at the moment (hangs on my
DaynaPort card). Will fix when I get docs for the card.
 1.6 22-Feb-1994  briggs Get rid of if_init assignment.
 1.5 30-Jan-1994  briggs Include-cop strikes again.
 1.4 24-Jan-1994  briggs Apply patch as suggested by Theo.
 1.3 21-Dec-1993  briggs Update ethernet driver to use config.new. At least, it's a first stab
working from mycroft's magnum changes to if_ed.c.
 1.2 15-Dec-1993  briggs Get rid of IFF_ALTPHYS and hence IFF_LLC0 reference. It doesn't appear
to have been used in this driver ;-)
 1.1 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.50.6.3 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.50.6.2 10-Mar-1997  is netinet/if_ether.h => netinet/if_inarp.h
 1.50.6.1 04-Mar-1997  is Convert to the new world order.
 1.64.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.65.4.1 05-Nov-1997  thorpej Pull up from trunk: update for ifmedia changes to dp8390.c
 1.67.26.3 23-Feb-2002  he Pull up revision 1.71 (requested by jklos):
Detect the full 64KB of buffer on many Nubus ethernet cards.
Fixes PR#14455.
 1.67.26.2 14-Sep-2000  scottr Pull up revs 1.69 and 1.70 from scottr:
The last change causes garbage data to be sent. Revert and
implement a different solution.
 1.67.26.1 06-Aug-2000  briggs Pullups approved by thorpej --
Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.

Add bus_space_*_stream_N functions to bus_space.

Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).

There were some bogus assumptions about bus_space_handle_t and some
function calls that didn't match prototypes--fix those here, too.
 1.67.16.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.70.8.2 17-Jan-2003  thorpej Sync with HEAD.
 1.70.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.70.6.1 12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.70.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.71.10.2 28-Jan-2003  jmc Pullup revisions 1.73-1.74 (requested by bouyer in ticket #1124)
We want bus_space_set_region_2(), not _1() here.
 1.71.10.1 27-Jan-2003  jmc Pullup revisions 1.71-1.73 (requested by bouyer in ticket #1096)
Zero out the NIC memory when padding packet to
ETHER_MIN_LEN-ETHER_CRC_LEN sc->write_mbuf now return len of
buffer, including padding.
 1.74.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.74.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.74.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.74.2.1 03-Aug-2004  skrll Sync with HEAD
 1.75.6.1 11-Sep-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #10692):
sys/arch/mac68k/dev/if_ae.c: revision 1.78
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.
 1.76.10.2 26-Feb-2007  yamt sync with head.
 1.76.10.1 30-Dec-2006  yamt sync with head.
 1.76.8.1 16-Sep-2006  ghen Pull up following revision(s) (requested by tsutsui in ticket #1512):
sys/arch/mac68k/include/bus.h: revision 1.25
sys/arch/mac68k/dev/if_ae.c: revision 1.78
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.
Apply patch in PR port-mac68k/33636 from Dave Huang (with wrapping long lines).
i.e. args in macro should be wrapped with parentheses.
 1.77.20.2 12-Jan-2007  ad Sync with head.
 1.77.20.1 18-Nov-2006  ad Sync with head.
 1.77.18.1 14-Sep-2006  riz Pull up following revision(s) (requested by tsutsui in ticket #154):
sys/arch/mac68k/include/bus.h: revision 1.25
sys/arch/mac68k/dev/if_ae.c: revision 1.78
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.
Apply patch in PR port-mac68k/33636 from Dave Huang (with wrapping long lines).
i.e. args in macro should be wrapped with parentheses.
 1.77.8.1 14-Sep-2006  yamt sync with head.
 1.78.4.1 06-Jan-2007  bouyer Pull up following revision(s) (requested by martin in ticket #335):
sys/arch/mac68k/dev/if_ae.c: revision 1.79
If we have a single byte left over after filling in all mbuf data, we need
to increase the "totlen" count too. From Sungwon Chung.
 1.79.48.1 11-Mar-2010  yamt sync with head
 1.26 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.25 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.24 02-Nov-1997  thorpej Adjust for ifmedia-related changes to dp8390 driver.
 1.23 17-Oct-1997  briggs branches: 1.23.2;
Make this compile again.
 1.22 15-Oct-1997  thorpej Pulldown from marc-pcmcia branch: adapt to changes in the MI dp8390 driver.
 1.21 10-Oct-1997  scottr Remove advertising clause.
 1.20 26-Sep-1997  briggs Add another Dayna card to the Apple-compa. list.
Define a constant for the SuperMac Spectrum/24 series III display card.
Thanks go to Luca Falzoni <falzoni@jetai.unipv.it> for trying out the
code for the Dayna ethernet support.
 1.19 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.18 11-May-1997  scottr branches: 1.18.4;
Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.17 01-May-1997  briggs Treat drhw 118 and 119 the same for Apple ethernet cards.
 1.16 30-Apr-1997  scottr Fix typo in last change.
 1.15 30-Apr-1997  scottr Adjust to use16bit -> dcr_reg change in MI driver.
 1.14 29-Apr-1997  scottr Use the new MI 8390 driver, and garbage collect.
 1.13 22-Apr-1997  scottr Remove obsolete drsw diagnostic
 1.12 10-Apr-1997  briggs Changes from Bob Nestor to come closer to supporting his Apple SONIC-based
nubus card.
 1.11 19-Mar-1997  scottr Several more changes to move us toward MI-ness:

- Use more consistent and portable types in the softc.
- Map registers using an array of bus_size_t offsets, and set up the
mapping in the attach code (thanks to Jason Thorpe for suggesting
this!).
- Disable the ae-specific watchdog, which is no longer necessary in
the general case.

Still remaining: split out functions used to copy data to/from the
card, and retain a way to have a local driver name with the MI code.
 1.10 18-Mar-1997  briggs Help this compile and get the nubus address into myaddr instead of
sc->sc_arpcom.ac_enaddr.
 1.9 17-Mar-1997  scottr Some cards we identify as InterLAN cards do not seem to have the MAC
address in the configuration ROM. For these, fall back to the old method
if we can't find the expected sResource record.
 1.8 15-Mar-1997  scottr Defer enabling NuBus slot interrupts until all slots have been probed
and drivers attached. This removes the need for the MAC68K_BROKEN_VIDEO
option. From Allen Briggs.
 1.7 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.6 10-Mar-1997  scottr branches: 1.6.2;
Add missing call to ae_nb_get_enaddr(), from <kei_sun@ba2.so-net.or.jp>.
Fixes PR 3312.
 1.5 28-Feb-1997  scottr Define aesetup() to return an int, so that the attach function can
determine whether there was an error (if so, we unmap the slot space
for this device). Use this functionality to tell the attach function
that we couldn't clear the card's buffer.

Also in aesetup(), eliminate the bogus repetition of the error message
we print when the buffer clear actually fails. Noticed by Hauke Fath.
 1.4 28-Feb-1997  scottr Move the NuBus-specific watchdog function from if_ae.c to if_ae_nubus.c,
and allow the attach function to override the default watchdog. Also,
do some minor cosmetic surgery (rename bus space tags/handles and some
KNFing I missed the first time around).
 1.3 25-Feb-1997  scottr Move bus-independent setup code back into if_ae.c; enable the use of
configuration flags. For NuBus cards, attempt to find the MAC address
in the declaration ROM resources.
 1.2 24-Feb-1997  scottr Add support for the Kinetics EtherPort SE/30, from Ken Nakata.
 1.1 24-Feb-1997  scottr Split out the NuBus attachment code, and convert to bus.h
 1.6.2.2 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.6.2.1 10-Mar-1997  is file if_ae_nubus.c was added on branch is-newarp on 1997-03-12 15:08:37 +0000
 1.18.4.5 14-Oct-1997  thorpej Mark this interface as enabled right from the get-go.
 1.18.4.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.4.3 14-Oct-1997  thorpej Adapt to changes in the generic DP8390 driver.
 1.18.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 05-Nov-1997  thorpej Pull up from trunk: update for ifmedia changes to dp8390.c
 1.17 12-Aug-1998  scottr Support Cabletron Ethernet card, from John Marohn in PR 5762.
 1.16 29-Apr-1997  scottr Use the new MI 8390 driver, and garbage collect.
 1.15 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.14 24-Feb-1997  scottr Add support for the Kinetics EtherPort SE/30, from Ken Nakata.
 1.13 24-Feb-1997  scottr Split out the NuBus attachment code, and convert to bus.h
 1.12 12-Jan-1996  briggs branches: 1.12.8;
Patch to at least recognise FOCUS EtherLAN. From Erik Bertelson
<erik@sockdev.uni-c.dk>
 1.11 30-Jul-1995  briggs Add support for Farallon from Brian Gaeke (brg@dgate.org).
 1.10 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.9 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.8 19-Apr-1995  briggs Define struct ae_ring which is necessary because BYTE_ORDER == BIG_ENDIAN,
but the card is in x86 byte order mode because NuBUS does the swap "for us"
on 16- and 32-bit transfers. We should probably figure some way to use
the std struct ed_ring if/when all the 8390 drivers are all fully merged.
 1.7 13-Apr-1995  briggs Update to use dev/ic/dp8390.h. Mostly from mycroft.
Still get extra data on either transmit or recieve, but want to
checkpoint this work.
 1.6 12-Apr-1995  briggs Almost working synch with if_ed.c. Much by mycroft. Fixups by me.
Inserts garbage characters--this driver isn't ready for use quite yet.
 1.5 04-Dec-1994  briggs Nuke Log in if_aereg.h and remove duplicate (and benign) sc->smem_size
assignment from Brad Parker (brad@fcr.com).
 1.4 03-Dec-1994  briggs At least somewhat functional ethernet driver from Brad Parker
(brad@fcr.com). Requires changes to via.c which are coming with
other changes in a moment...
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 01-Mar-1994  briggs More Dayna separation.
 1.1 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.12.8.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.8 29-Apr-1997  scottr branches: 1.8.58;
Use the new MI 8390 driver, and garbage collect.
 1.7 19-Mar-1997  scottr Several more changes to move us toward MI-ness:

- Use more consistent and portable types in the softc.
- Map registers using an array of bus_size_t offsets, and set up the
mapping in the attach code (thanks to Jason Thorpe for suggesting
this!).
- Disable the ae-specific watchdog, which is no longer necessary in
the general case.

Still remaining: split out functions used to copy data to/from the
card, and retain a way to have a local driver name with the MI code.
 1.6 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.5 28-Feb-1997  scottr branches: 1.5.2;
Define aesetup() to return an int, so that the attach function can
determine whether there was an error (if so, we unmap the slot space
for this device). Use this functionality to tell the attach function
that we couldn't clear the card's buffer.

Also in aesetup(), eliminate the bogus repetition of the error message
we print when the buffer clear actually fails. Noticed by Hauke Fath.
 1.4 28-Feb-1997  scottr Move the NuBus-specific watchdog function from if_ae.c to if_ae_nubus.c,
and allow the attach function to override the default watchdog. Also,
do some minor cosmetic surgery (rename bus space tags/handles and some
KNFing I missed the first time around).
 1.3 25-Feb-1997  scottr Move bus-independent setup code back into if_ae.c; enable the use of
configuration flags. For NuBus cards, attempt to find the MAC address
in the declaration ROM resources.
 1.2 24-Feb-1997  scottr Add support for the Kinetics EtherPort SE/30, from Ken Nakata.
 1.1 24-Feb-1997  scottr Split out the NuBus attachment code, and convert to bus.h
 1.5.2.2 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.5.2.1 28-Feb-1997  is file if_aevar.h was added on branch is-newarp on 1997-03-12 15:08:39 +0000
 1.8.58.1 17-Jan-2005  skrll Sync with HEAD.
 1.59 29-Jun-2024  riastradh if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.58 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.57 24-Jan-2021  rin Add rnd(9) support.
 1.56 20-Oct-2020  roy branches: 1.56.2;
le(4): add link status change reporting to drivers which support it

Reviewed by thorpej@
Tested by martin@
 1.55 30-Jan-2020  martin Fix more typos
 1.54 30-Jan-2020  martin Fix typo
 1.53 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.52 27-Dec-2019  msaitoh branches: 1.52.2;
s/expresion/expression/ in comment.
 1.51 28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.50 23-May-2019  msaitoh No functional change:
- Change ac(was arpcom) to ec(ethercom)
- Simplify MII structure initialization.
- u_int*_t -> uint*_t.
- KNF
 1.49 05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.48 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.47 26-Jun-2018  msaitoh branches: 1.47.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.46 22-Jun-2018  msaitoh It's not required to include net/bpfdesc.h. Remove it.
 1.45 22-Feb-2017  nonaka branches: 1.45.6; 1.45.12;
Apply deferred if_start to more MD drivers.
 1.44 15-Dec-2016  ozaki-r branches: 1.44.2;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

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

Proposed on tech-kern and tech-net
 1.43 02-Oct-2016  christos MFREE -> m_free
 1.42 10-Jun-2016  ozaki-r branches: 1.42.2;
Introduce m_set_rcvif and m_reset_rcvif

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

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

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

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

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

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

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.40 19-Oct-2013  martin branches: 1.40.6;
Remove an unused variable
 1.39 27-Oct-2012  chs branches: 1.39.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.38 05-Apr-2010  joerg branches: 1.38.8; 1.38.18;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.37 19-Jan-2010  pooka branches: 1.37.2; 1.37.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

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

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.36 18-Mar-2009  cegger bcmp -> memcmp
 1.35 07-Nov-2008  dyoung branches: 1.35.4;
*** Summary ***

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

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

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

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

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Let ifioctl_common() handle SIOCGIFADDR.

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

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

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.34 17-Oct-2007  garbled branches: 1.34.16; 1.34.20; 1.34.26; 1.34.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.33 01-Sep-2007  jmmv Fix build after dyoung's changes.
 1.32 01-Sep-2007  dyoung Change a bazillion occurrences of code resembling this,

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

if (error == ENETRESET) {

to this,

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

which does the same thing.

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

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.31 05-Mar-2007  he branches: 1.31.2; 1.31.10; 1.31.14; 1.31.18; 1.31.20;
Cast to char* or u_char* before doing pointer arithmetic.
 1.30 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.29 24-Jan-2007  hubertf branches: 1.29.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.28 12-Dec-2006  martin Convert DMA memory allocation to bus_dmamem_alloc. From Dave Huang.
 1.27 07-Sep-2006  dogcow branches: 1.27.2; 1.27.4; 1.27.6;
remove more vestiges of CCITT, LLC, HDLC, NS, and NSIP.
 1.26 11-Dec-2005  christos branches: 1.26.4; 1.26.8;
merge ktrace-lwp.
 1.25 15-Jan-2005  chs branches: 1.25.10;
de-__P, remove register, ansify, b* -> mem*.
 1.24 30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.23 26-Mar-2004  wiz branches: 1.23.4;
Update David Huang's email address in the license
per his request in PR 24907.
 1.22 15-Jul-2003  lukem __KERNEL_RCSID()
 1.21 04-Jun-2003  bjh21 branches: 1.21.2;
In mcstop(), don't clear IFF_UP. Other drivers don't mess with IFF_UP
internally, other than to set it when they gain their first address.
Every caller of mcstop() bar one was either preserving the state of IFF_UP
itself or was conditional on its already being clear, so the only effect of
this is to simplify the code and to change that one case, thereby curing
PR port-macppc/12088 (underflows on "mc" cause it to be taken down).
 1.20 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.19 16-Jan-2002  thorpej branches: 1.19.10;
Use bpf_mtap().
 1.18 15-Nov-2000  thorpej branches: 1.18.4; 1.18.8;
Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.17 01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.16 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.15 20-Dec-1999  scottr branches: 1.15.4;
Make this compile without bpf. Problem noted by Bob Nestor, fix from
Frederick Bruckman.
 1.14 14-Oct-1999  scottr branches: 1.14.2;
Be less noisy about collision errors. From Dave Huang, closes PR 8605.
 1.13 18-May-1999  thorpej branches: 1.13.2;
Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.12 22-Dec-1998  scottr branches: 1.12.2; 1.12.4; 1.12.6;
vm_offset_t -> {paddr_t, vaddr_t}
 1.11 08-Jul-1998  scottr branches: 1.11.6;
mac68k/obio/if_mc_obio.c needs hide/integrate defines, too. Moved back to
if_mcvar.h.
 1.10 05-Jul-1998  jonathan defopt NS, NSIP.
 1.9 05-Jul-1998  jonathan defopt LLC
 1.8 05-Jul-1998  jonathan defopt CCITT.
 1.7 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.6 29-Mar-1998  mycroft Use a 4-bit table to speed up the CRC even further, without increasing the
code size too much.
 1.5 09-Mar-1998  scottr Sync mc_rint() prototype with if_mcvar.h. (How did this
one slip by? Forty lashes for me...)
 1.4 12-Jan-1998  thorpej Update for changes to config.
 1.3 07-Dec-1997  scottr Fix prototypes so that we can compile without DDB. Closes
PR 4633.
 1.2 07-Nov-1997  briggs NetBSD RCSIds.
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.4 05-May-1998  mycroft Pull up 1.5, per request of scottr.
 1.1.2.3 09-Dec-1997  thorpej Sync w/ trunk: make it work without DDB (scottr)
 1.1.2.2 12-Nov-1997  mellon Pull rev 1.2 up from trunk (briggs)
 1.1.2.1 04-Nov-1997  mellon file if_mc.c was added on branch netbsd-1-3 on 1997-11-12 02:09:22 +0000
 1.11.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.12.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.12.4.2 05-Jan-2000  he Undo pullup of revision 1.15 (requested by scottr).
The fix in that revision is not relevant to the netbsd-1-4 branch.
 1.12.4.1 20-Dec-1999  he Pull up revision 1.15 (requested by scottr):
Make this compile without bpf.
 1.12.2.3 13-Feb-2000  scottr Sync with main branch.
 1.12.2.2 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.12.2.1 08-Jun-1999  scottr Sync with main branch.
 1.13.2.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.14.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.14.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.15.4.1 17-Jun-2003  msaitoh Pull up revisions 1.21 (requested by Ben Harris in ticket #46):
Don't bring down mc(4) interfaces when they underflow.
Fixes PR#12088.
 1.18.8.1 28-Feb-2002  nathanw Catch up to -current.
 1.18.4.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.19.10.1 17-Jun-2003  msaitoh Pull up revisions 1.21 (requested by Ben Harris in ticket #1314):
Don't bring down mc(4) interfaces when they underflow.
Fixes PR#12088.
 1.21.2.5 17-Jan-2005  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.23.4.1 24-Jan-2005  he Pull up revision 1.24 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.25.10.3 03-Sep-2007  yamt sync with head.
 1.25.10.2 26-Feb-2007  yamt sync with head.
 1.25.10.1 30-Dec-2006  yamt sync with head.
 1.26.8.1 14-Sep-2006  yamt sync with head.
 1.26.4.1 09-Sep-2006  rpaulo sync with head
 1.27.6.1 15-Dec-2006  tron Pull up following revision(s) (requested by martin in ticket #272):
sys/arch/mac68k/dev/if_mc.c: revision 1.28
sys/arch/mac68k/obio/if_mc_obio.c: revision 1.16
sys/arch/mac68k/dev/if_mcvar.h: revision 1.12
Convert DMA memory allocation to bus_dmamem_alloc. From Dave Huang.
 1.27.4.1 18-Dec-2006  yamt sync with head.
 1.27.2.2 01-Feb-2007  ad Sync with head.
 1.27.2.1 12-Jan-2007  ad Sync with head.
 1.29.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.31.20.1 06-Nov-2007  matt sync with HEAD
 1.31.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.31.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.31.10.1 03-Oct-2007  garbled Sync with HEAD
 1.31.2.1 09-Oct-2007  ad Sync with head.
 1.34.28.2 28-Apr-2009  skrll Sync with HEAD.
 1.34.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.34.26.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.34.20.3 11-Aug-2010  yamt sync with head.
 1.34.20.2 11-Mar-2010  yamt sync with head
 1.34.20.1 04-May-2009  yamt sync with head.
 1.34.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.35.4.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.37.4.1 30-May-2010  rmind sync with head
 1.37.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.38.18.3 03-Dec-2017  jdolecek update from HEAD
 1.38.18.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.38.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.38.8.1 30-Oct-2012  yamt sync with head
 1.39.2.1 18-May-2014  rmind sync with head
 1.40.6.5 28-Aug-2017  skrll Sync with HEAD
 1.40.6.4 05-Feb-2017  skrll Sync with HEAD
 1.40.6.3 05-Oct-2016  skrll Sync with HEAD
 1.40.6.2 09-Jul-2016  skrll Sync with HEAD
 1.40.6.1 19-Mar-2016  skrll Sync with HEAD
 1.42.2.3 20-Mar-2017  pgoyette Sync with HEAD
 1.42.2.2 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.42.2.1 04-Nov-2016  pgoyette Sync with HEAD
 1.44.2.1 21-Apr-2017  bouyer Sync with HEAD
 1.45.12.3 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.45.12.2 28-Jul-2018  pgoyette Sync with HEAD
 1.45.12.1 25-Jun-2018  pgoyette Sync with HEAD
 1.45.6.1 26-Jul-2018  snj Pull up following revision(s) (requested by msaitoh in ticket #938):
sys/arch/acorn32/podulebus/if_ie.c: revision 1.41
sys/arch/amiga/dev/if_es.c: revision 1.58
sys/arch/amiga/dev/if_qn.c: revision 1.45
sys/arch/arm/at91/at91emac.c: revision 1.20
sys/arch/arm/ep93xx/epe.c: revision 1.37
sys/arch/emips/ebus/if_le_ebus.c: revision 1.14
sys/arch/emips/ebus/if_le_ebus.c: revision 1.15
sys/arch/mac68k/dev/if_mc.c: revision 1.46
sys/arch/macppc/dev/am79c950.c: revision 1.39
sys/arch/newsmips/apbus/if_sn.c: revision 1.40
sys/arch/next68k/dev/mb8795.c: revision 1.59
sys/arch/playstation2/dev/if_smap.c: revision 1.25
sys/arch/playstation2/dev/if_smap.c: revision 1.26
sys/arch/sun2/dev/if_ec.c: revision 1.28
sys/arch/sun3/dev/if_ie.c: revision 1.63
sys/arch/x68k/dev/if_ne_intio.c: revision 1.19
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.75
sys/arch/xen/xen/xennetback_xenbus.c: revision 1.63
sys/dev/bi/if_ni.c: revision 1.45
sys/dev/cadence/if_cemac.c: revision 1.12
sys/dev/ic/am7990.c: revision 1.78
sys/dev/ic/am79900.c: revision 1.27
sys/dev/ic/an.c: revision 1.67
sys/dev/ic/cs89x0.c: revision 1.40
sys/dev/ic/dm9000.c: revision 1.13
sys/dev/ic/dm9000.c: revision 1.14
sys/dev/ic/dp8390.c: revision 1.88
sys/dev/ic/elink3.c: revision 1.141
sys/dev/ic/elinkxl.c: revision 1.122
sys/dev/ic/hme.c: revision 1.98
sys/dev/ic/i82586.c: revision 1.77
sys/dev/ic/lance.c: revision 1.53
sys/dev/ic/mb86950.c: revision 1.27
sys/dev/ic/mb86960.c: revision 1.86
sys/dev/ic/mtd803.c: revision 1.34
sys/dev/ic/pdq_ifsubr.c: revision 1.59
sys/dev/ic/rrunner.c: revision 1.86
sys/dev/ic/seeq8005.c: revision 1.58
sys/dev/ic/sgec.c: revision 1.47
sys/dev/ic/smc90cx6.c: revision 1.72
sys/dev/ic/smc91cxx.c: revision 1.96
sys/dev/ic/tropic.c: revision 1.49
sys/dev/ic/wi.c: revision 1.245
sys/dev/isa/if_eg.c: revision 1.93
sys/dev/isa/if_el.c: revision 1.95
sys/dev/isa/if_iy.c: revision 1.101
sys/dev/ofw/ofnet.c: revision 1.58
sys/dev/pci/if_alc.c: revision 1.27
sys/dev/pci/if_de.c: revision 1.152
sys/dev/pci/if_fpa.c: revision 1.61
sys/dev/pci/if_jme.c: revision 1.34
sys/dev/pci/if_tl.c: revision 1.108
sys/dev/pci/if_vte.c: revision 1.19
sys/dev/pci/ixgbe/ixgbe.h: revision 1.50
sys/dev/pcmcia/if_cnw.c: revision 1.62
sys/dev/pcmcia/if_malo_pcmcia.c: revision 1.17
sys/dev/pcmcia/if_ray.c: revision 1.89
sys/dev/pcmcia/if_xi.c: revision 1.81
sys/dev/pcmcia/mhzc.c: revision 1.51
sys/dev/pcmcia/xirc.c: revision 1.34
sys/dev/qbus/if_de.c: revision 1.33
sys/dev/qbus/if_qe.c: revision 1.78
sys/dev/qbus/if_qt.c: revision 1.22
sys/dev/sbus/be.c: revision 1.87
sys/dev/sbus/qe.c: revision 1.68
sys/dev/scsipi/if_se.c: revision 1.96
sys/dev/usb/if_atu.c: revision 1.59
sys/net/if_l2tp.c: revision 1.28 via patch
sys/net/if_ppp.c: revision 1.160
It's not required to include net/bpfdesc.h. Remove it.
--
Simplify like other drivers. NULL check of ifp->if_bpf is done in
bpf_mtap(), so it's not required to do it here.
--
Remove duplicated inclusion of net/bpf.h.
--
Remove duplicated inclusion of net/bpf.h.
--
Simplify bpf_mtap() call. No functional change.
 1.47.2.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.47.2.1 10-Jun-2019  christos Sync with HEAD
 1.52.2.1 29-Feb-2020  ad Sync with head.
 1.56.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.5 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.4 13-Jan-1998  scottr Update for bus.h changes.
 1.3 07-Nov-1997  briggs NetBSD RCSIds.
 1.2 05-Nov-1997  briggs Check for machine class, not for PSCBase as initial check in mc_obio_match().
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.2 12-Nov-1997  mellon Pull rev 1.3 up from trunk (briggs)
 1.1.2.1 04-Nov-1997  mellon file if_mc_obio.c was added on branch netbsd-1-3 on 1997-11-12 02:10:42 +0000
 1.6 25-Jun-2025  andvar s/Confiuration/Configuration/ in comments.
 1.5 31-Oct-2022  andvar branches: 1.5.8;
s/interrut/interrupt/ and s/accelelerator/accelerator/ in comments.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 26-Mar-2004  wiz Update David Huang's email address in the license
per his request in PR 24907.
 1.2 07-Nov-1997  briggs branches: 1.2.50;
NetBSD RCSIds.
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.2 12-Nov-1997  mellon Pull rev 1.2 up from trunk (briggs)
 1.1.2.1 04-Nov-1997  mellon file if_mcreg.h was added on branch netbsd-1-3 on 1997-11-12 02:11:35 +0000
 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.5.8.1 02-Aug-2025  perseant Sync with HEAD
 1.18 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.17 24-Jan-2021  rin Add rnd(9) support.
 1.16 27-Oct-2012  chs branches: 1.16.50;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.15 05-Mar-2007  he branches: 1.15.78; 1.15.88;
On second thought, make sc_txbuf and sc_rxbuf uint8_t*s, since if_mc_obio.c
likes to index directly into sc_rxbuf.
 1.14 05-Mar-2007  he Fix another instance of "void * a, b;" to be "void *a, *b;".
 1.13 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 12-Dec-2006  martin branches: 1.12.2;
Convert DMA memory allocation to bus_dmamem_alloc. From Dave Huang.
 1.11 24-Dec-2005  perry branches: 1.11.20; 1.11.22; 1.11.24;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.10 11-Dec-2005  christos merge ktrace-lwp.
 1.9 15-Jan-2005  chs branches: 1.9.10;
de-__P, remove register, ansify, b* -> mem*.
 1.8 26-Mar-2004  wiz Update David Huang's email address in the license
per his request in PR 24907.
 1.7 09-Apr-2003  thorpej branches: 1.7.2;
Use PAGE_SIZE rather than NBPG.
 1.6 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.5 08-Jul-1998  scottr Revert last change.
 1.4 04-Jul-1998  jonathan defopt DDB.
 1.3 07-Dec-1997  scottr Fix prototypes so that we can compile without DDB. Closes
PR 4633.
 1.2 07-Nov-1997  briggs NetBSD RCSIds.
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.3 09-Dec-1997  thorpej Sync w/ trunk: make it work without DDB (scottr)
 1.1.2.2 12-Nov-1997  mellon Pull rev 1.2 up from trunk (briggs)
 1.1.2.1 04-Nov-1997  mellon file if_mcvar.h was added on branch netbsd-1-3 on 1997-11-12 02:12:24 +0000
 1.7.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.7.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.7.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.7.2.1 03-Aug-2004  skrll Sync with HEAD
 1.9.10.3 03-Sep-2007  yamt sync with head.
 1.9.10.2 30-Dec-2006  yamt sync with head.
 1.9.10.1 21-Jun-2006  yamt sync with head.
 1.11.24.1 15-Dec-2006  tron Pull up following revision(s) (requested by martin in ticket #272):
sys/arch/mac68k/dev/if_mc.c: revision 1.28
sys/arch/mac68k/obio/if_mc_obio.c: revision 1.16
sys/arch/mac68k/dev/if_mcvar.h: revision 1.12
Convert DMA memory allocation to bus_dmamem_alloc. From Dave Huang.
 1.11.22.1 18-Dec-2006  yamt sync with head.
 1.11.20.1 12-Jan-2007  ad Sync with head.
 1.12.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.88.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.15.78.1 30-Oct-2012  yamt sync with head
 1.16.50.1 03-Apr-2021  thorpej Sync with HEAD.
 1.47 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.46 10-Jun-2007  tsutsui branches: 1.46.10;
Switch mac68k's sn(4) Ethernet to MI SONIC driver.

Tested with Apple Ethernet CS Twisted-Pare Card on LC630 by me
and Quadra 650 on-board Ethernet by hauke@.
NuBus based cards and PowerBook variants are still untested.
 1.45 08-Mar-2007  tsutsui branches: 1.45.2; 1.45.4; 1.45.10;
In snintr(), reset the chip on fatal errors and
call snstart() after all events are handled.

XXX: We should switch to MI sys/dev/ic/dp83932.c.
 1.44 05-Mar-2007  he Use char* for pointer arithmetic.
 1.43 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.42 24-Jan-2007  hubertf branches: 1.42.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.41 07-Oct-2006  he Cast addresses to int before doing arithmetic on them, as in uses
of roundup().
 1.40 04-Oct-2006  christos don't use home-grown round macros
 1.39 24-Dec-2005  perry branches: 1.39.20; 1.39.22;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.38 11-Dec-2005  christos merge ktrace-lwp.
 1.37 22-May-2005  christos branches: 1.37.2;
No 0x in front of %p...
 1.36 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.35 30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.34 15-Jul-2003  lukem branches: 1.34.4;
__KERNEL_RCSID()
 1.33 02-Apr-2003  thorpej branches: 1.33.2;
Use PAGE_SIZE rather than NBPG.
 1.32 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.31 16-Jan-2002  thorpej Use bpf_mtap().
 1.30 22-Jul-2001  wiz branches: 1.30.6;
seperate -> separate
 1.29 19-Jun-2001  wiz branches: 1.29.2;
`accessible' only has one `a'.
 1.28 15-Nov-2000  thorpej branches: 1.28.2;
Move bpfattach()/bpfdetach() calls into ether_ifattach()/ether_ifdetach().
 1.27 01-Oct-2000  thorpej Move the check for "promisc + unicast + not for us" into ether_input(),
and change Ethernet drivers to always pass all received frames to
ether_input() (with a few exceptions, which are documented in the
code).
 1.26 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.25 12-Dec-1999  scottr Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.24 29-Sep-1999  scottr branches: 1.24.2; 1.24.8;
Normalize autoconfig output.
 1.23 24-May-1999  thorpej Fix some broken packet length checks. Really (no, I mean really) works now
after the ether_input() changes -- tested on my Quadra 650.
 1.22 21-May-1999  thorpej Fix a couple of problems from the ether_input() change:
- Make it compile again, with BPF.
- Don't subtract the Ethernet header length from the total packet length.
- Copy the alignment fix from sys/dev/ic/i82586.c (though the m68k shouldn't
really be affected).
 1.21 18-May-1999  thorpej Rework layer 2 protocol input routines. Instead of calling e.g. ether_input()
directly, call the function pointer (*if_input)(ifp, m). The input routine
expects the packet header to be at the head of the packet, and will adjust
as necessary. Privatize the layer 2 input and output routines, allowing
*_ifattach() to set them up as appropriate.
 1.20 22-Dec-1998  scottr branches: 1.20.2; 1.20.6;
vm_offset_t -> {paddr_t, vaddr_t}
 1.19 05-Jul-1998  jonathan branches: 1.19.6;
defopt INET, NETATALK.
 1.18 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.17 12-Jan-1998  thorpej Update for changes to config.
 1.16 04-Nov-1997  briggs Fix a space-wasting bug found by David Huang in his work on the MACE driver.
 1.15 15-Jun-1997  scottr branches: 1.15.8;
Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.14 19-May-1997  scottr Fix some printf format inconsistencies; from SUNAGAWA Keiki
<kei_sun@ba2.so-net.or.jp>, fixes PR 3619.
 1.13 25-Apr-1997  briggs A couple of performance improvements from Denny Gentry <denny1@home.com>
 1.12 22-Apr-1997  scottr Make formatting consistent; inline -> __inline__; KNF.
 1.11 18-Apr-1997  briggs Fix from Denny Gentry--initialize receive seq. counter.
 1.10 13-Apr-1997  briggs Some updates based on information from Bob Nestor <rnestor@metronet.com>
about his SONIC-T LC/PDS card.
 1.9 10-Apr-1997  briggs Changes from Denny Gentry <denny1@home.com>:
Change in the way receive buffer areas are handled. Before we gave
the chip 16 buffers, each 1536 bytes (big enough for one packet).
Now we're handing the chip 8 buffers, each 4 Kbytes, and letting
the chip fit as many packets as it can in each one. This should
help keep it from running out of buffer space. Also make some of
the performance-crucial routines inline. It made no measurable
difference except to make me feel better

Changes from Bob Nestor <rnestor@metronet.com> to get closer to support
for his Apple SONIC-based nubus card.

Changes from me to try to get SONIC's MAC address from MacOS settings if
we can't read the PROM space.
 1.8 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.7 20-Mar-1997  scottr Several minor changes:

- Indent some comments appropriately per KNF.
- Output all diagnostics using the device name rather than a static string.
- Fix a (mostly marmless) bug in snintr(), where loss of heartbeat wasn't
properly ignored and could mask the `receive descriptors exhausted'
diagnostic.
 1.6 17-Mar-1997  briggs Flip around Takeshi Yanagisawa's name. Add back a physaccess() call that I was a bit hasty
in removing.
 1.5 17-Mar-1997  briggs *Blush* It's Denton, not Dennis, Gentry.
 1.4 17-Mar-1997  briggs Make this compile again. XXX - save ethernet address in softc until multicast is supported.
 1.3 17-Mar-1997  briggs Integrate a couple of changes suggested by Scott Reynolds and Takeshi Yanagisawa.
 1.2 16-Mar-1997  is On request from Allen Briggs, converted this to new ARP
system. Somebody should actually test if this compiles (and works) on
Mac68k... I only carefully checked cvs diff -u.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.15.8.1 15-Nov-1997  mellon Pull rev 1.16 up from trunk (briggs)
 1.19.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.20.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.2.3 12-Dec-1999  scottr Sync with main branch.
 1.20.2.2 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.20.2.1 08-Jun-1999  scottr Sync with main branch.
 1.24.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.24.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.24.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.28.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.29.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.29.2.2 11-Feb-2002  jdolecek Sync w/ -current.
 1.29.2.1 03-Aug-2001  lukem update to -current
 1.30.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.30.6.2 28-Feb-2002  nathanw Catch up to -current.
 1.30.6.1 22-Jul-2001  nathanw file if_sn.c was added on branch nathanw_sa on 2002-02-28 04:10:35 +0000
 1.33.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.33.2.4 02-Nov-2004  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.4.1 24-Jan-2005  he Pull up revision 1.35 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.37.2.4 03-Sep-2007  yamt sync with head.
 1.37.2.3 26-Feb-2007  yamt sync with head.
 1.37.2.2 30-Dec-2006  yamt sync with head.
 1.37.2.1 21-Jun-2006  yamt sync with head.
 1.39.22.1 22-Oct-2006  yamt sync with head
 1.39.20.2 01-Feb-2007  ad Sync with head.
 1.39.20.1 18-Nov-2006  ad Sync with head.
 1.42.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.45.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.45.4.1 11-Jul-2007  mjf Sync with head.
 1.45.2.1 15-Jul-2007  ad Sync with head.
 1.46.10.1 06-Nov-2007  matt sync with HEAD
 1.18 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.17 26-Oct-1997  briggs The 16- and 32-bit Apple card types got reversed somehow.
 1.16 11-Aug-1997  scottr branches: 1.16.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.15 26-Jun-1997  scottr branches: 1.15.4;
Identify and use the Apple Twisted Pair NB card properly, from PR 3789
submitted by Denny Gentry <denny1@home.com>; investigation on the hardware
done by Bob Nestor.
 1.14 15-Jun-1997  scottr Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.13 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.12 01-May-1997  briggs Treat drhw 118 and 119 the same for Apple ethernet cards.
 1.11 30-Apr-1997  scottr Remove dependency on if_aereg.h for vendor constants; these are really
driver-, not architecture-specific.
 1.10 22-Apr-1997  scottr Remove obsolete drsw diagnostic; make formatting consistent; KNF.
 1.9 22-Apr-1997  briggs Make sure that we unmap the space that we mapped if we can't identify the card.
 1.8 22-Apr-1997  briggs Initialize 'offset' to make gcc happy.
 1.7 14-Apr-1997  briggs Use an offset parameter when loading the reg_map--some cards use the "other"
16 bits of the words.
 1.6 13-Apr-1997  briggs Oops. We do not want to unmap something that we've used bus_space_subregion
to get.
 1.5 13-Apr-1997  briggs Some updates based on information from Bob Nestor <rnestor@metronet.com>
about his SONIC-T LC/PDS card.
 1.4 10-Apr-1997  briggs Changes from Denny Gentry <denny1@home.com>:
Change in the way receive buffer areas are handled. Before we gave
the chip 16 buffers, each 1536 bytes (big enough for one packet).
Now we're handing the chip 8 buffers, each 4 Kbytes, and letting
the chip fit as many packets as it can in each one. This should
help keep it from running out of buffer space. Also make some of
the performance-crucial routines inline. It made no measurable
difference except to make me feel better

Changes from Bob Nestor <rnestor@metronet.com> to get closer to support
for his Apple SONIC-based nubus card.

Changes from me to try to get SONIC's MAC address from MacOS settings if
we can't read the PROM space.
 1.3 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.2 16-Mar-1997  is On request from Allen Briggs, converted this to new ARP
system. Somebody should actually test if this compiles (and works) on
Mac68k... I only carefully checked cvs diff -u.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.15.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.4.1 27-Oct-1997  mellon Pull rev 1.17 up from trunk (briggs)
 1.15 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.14 13-Jan-1998  scottr Update for bus.h changes.
 1.13 05-Nov-1997  briggs For the LC575/Q630 (comm-slot machines), try to derive the card settings.
Unfortunately, there does not seem to be a good way to determine what
variety of comm-slot card is present in a machine. There is still an
interrupt issue preventing these cards from working--hopefully that will
be ironed out shortly.
 1.12 09-Oct-1997  briggs branches: 1.12.2;
Probe for the SONIC before saying that we found it. Some early Centris
models (low-end) shipped without ethernet installed.
 1.11 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.10 15-Jun-1997  scottr branches: 1.10.4;
Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.9 22-Apr-1997  scottr If we can't map SONIC register space, just print a diagnostic message and
continue. Make formatting consistent and KNF while here.
 1.8 13-Apr-1997  briggs Some updates based on information from Bob Nestor <rnestor@metronet.com>
about his SONIC-T LC/PDS card.
 1.7 10-Apr-1997  briggs Changes from Denny Gentry <denny1@home.com>:
Change in the way receive buffer areas are handled. Before we gave
the chip 16 buffers, each 1536 bytes (big enough for one packet).
Now we're handing the chip 8 buffers, each 4 Kbytes, and letting
the chip fit as many packets as it can in each one. This should
help keep it from running out of buffer space. Also make some of
the performance-crucial routines inline. It made no measurable
difference except to make me feel better

Changes from Bob Nestor <rnestor@metronet.com> to get closer to support
for his Apple SONIC-based nubus card.

Changes from me to try to get SONIC's MAC address from MacOS settings if
we can't read the PROM space.
 1.6 04-Apr-1997  briggs Do not set DCR_SYNC for the C/Q[68]xx systems.
Thanks to Steve Brown <sbrown@best.com> for working with me to find this.
 1.5 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.4 29-Mar-1997  briggs Fix bug that would have prevented PB5xx series from detecting the SONIC.
Bug noticed by Denny Gentry.
 1.3 17-Mar-1997  briggs Make this compile again. XXX - save ethernet address in softc until multicast is supported.
 1.2 16-Mar-1997  is On request from Allen Briggs, converted this to new ARP
system. Somebody should actually test if this compiles (and works) on
Mac68k... I only carefully checked cvs diff -u.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.10.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.1 15-Nov-1997  mellon Pull rev 1.13 up from trunk (briggs)
 1.5 10-Jun-2007  tsutsui Switch mac68k's sn(4) Ethernet to MI SONIC driver.

Tested with Apple Ethernet CS Twisted-Pare Card on LC630 by me
and Quadra 650 on-board Ethernet by hauke@.
NuBus based cards and PowerBook variants are still untested.
 1.4 15-Jun-1997  scottr branches: 1.4.74; 1.4.116; 1.4.118; 1.4.124;
Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.3 30-Apr-1997  scottr Remove dependency on if_aereg.h for vendor constants; these are really
driver-, not architecture-specific.
 1.2 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.4.124.1 26-Jun-2007  garbled Sync with HEAD.
 1.4.118.1 11-Jul-2007  mjf Sync with head.
 1.4.116.1 15-Jul-2007  ad Sync with head.
 1.4.74.1 03-Sep-2007  yamt sync with head.
 1.21 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.20 10-Jun-2007  tsutsui branches: 1.20.10;
Switch mac68k's sn(4) Ethernet to MI SONIC driver.

Tested with Apple Ethernet CS Twisted-Pare Card on LC630 by me
and Quadra 650 on-board Ethernet by hauke@.
NuBus based cards and PowerBook variants are still untested.
 1.19 08-Mar-2007  tsutsui branches: 1.19.2; 1.19.4; 1.19.10;
Use volatile on access to DMA descriptors.
 1.18 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 11-Dec-2005  christos branches: 1.17.26;
merge ktrace-lwp.
 1.16 15-Jan-2005  chs branches: 1.16.10;
de-__P, remove register, ansify, b* -> mem*.
 1.15 20-Oct-2002  chs branches: 1.15.6;
merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.14 29-Sep-1999  scottr branches: 1.14.20;
Add support for the Macintosh LC Ethernet Adapter, from Ken'ichi Ishizaka.
This was erroneously recognized as an 8390-based card, where in fact it is
using the 83932 (SONIC) controller.
 1.13 22-Dec-1998  scottr branches: 1.13.2; 1.13.4;
vm_offset_t -> {paddr_t, vaddr_t}
 1.12 01-May-1998  scottr Missed a prototype in the NuBus interrupt handler cleanup.
Fixes PRs 5365, 5367, 5368, and 5373.
 1.11 04-Nov-1997  briggs Raise the number of transmit and receive buffers.
 1.10 26-Jun-1997  scottr branches: 1.10.8;
Identify and use the Apple Twisted Pair NB card properly, from PR 3789
submitted by Denny Gentry <denny1@home.com>; investigation on the hardware
done by Bob Nestor.
 1.9 15-Jun-1997  scottr Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.8 25-Apr-1997  briggs A couple of performance improvements from Denny Gentry <denny1@home.com>
 1.7 22-Apr-1997  scottr space vs. tab formatting, KNF
 1.6 13-Apr-1997  briggs Some updates based on information from Bob Nestor <rnestor@metronet.com>
about his SONIC-T LC/PDS card.
 1.5 10-Apr-1997  briggs Changes from Denny Gentry <denny1@home.com>:
Change in the way receive buffer areas are handled. Before we gave
the chip 16 buffers, each 1536 bytes (big enough for one packet).
Now we're handing the chip 8 buffers, each 4 Kbytes, and letting
the chip fit as many packets as it can in each one. This should
help keep it from running out of buffer space. Also make some of
the performance-crucial routines inline. It made no measurable
difference except to make me feel better

Changes from Bob Nestor <rnestor@metronet.com> to get closer to support
for his Apple SONIC-based nubus card.

Changes from me to try to get SONIC's MAC address from MacOS settings if
we can't read the PROM space.
 1.4 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.3 17-Mar-1997  briggs Make this compile again. XXX - save ethernet address in softc until multicast is supported.
 1.2 16-Mar-1997  is On request from Allen Briggs, converted this to new ARP
system. Somebody should actually test if this compiles (and works) on
Mac68k... I only carefully checked cvs diff -u.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.10.8.1 15-Nov-1997  mellon Pull rev 1.11 up from trunk (briggs)
 1.13.4.1 01-Jul-2000  he Pull up revision 1.14 (requested by fredb):
Add support for the Macintosh LC Ethernet Adapter. This was
previously erroneously recognized as an 8390-based card, where
in fact it is using the 83932 (SONIC) controller.
 1.13.2.1 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.14.20.1 11-Nov-2002  nathanw Catch up to -current
 1.15.6.1 17-Jan-2005  skrll Sync with HEAD.
 1.16.10.1 03-Sep-2007  yamt sync with head.
 1.17.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.19.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.19.4.1 11-Jul-2007  mjf Sync with head.
 1.19.2.1 15-Jul-2007  ad Sync with head.
 1.20.10.1 06-Nov-2007  matt sync with HEAD
 1.53 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.52 07-Nov-1999  scottr ite_polling -> adb_polling
 1.51 08-Jul-1999  thorpej branches: 1.51.2; 1.51.4; 1.51.8;
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.50 21-Apr-1999  scottr Actually, the last change solved a different but related problem than
the one mentioned in PR 7376. By clearing the display in iteon()
instead, we can kill both birds with the same stone.
 1.49 21-Apr-1999  scottr When attaching the ite console, clear the entire display rather than assuming
that the emulator will do it for us. (The emulator will only clear
full character-sized rows.) Incidentally fixes PR 7376.
 1.48 27-Mar-1999  briggs branches: 1.48.2;
Compile itecnputc if NZSC == 0.
 1.47 12-Mar-1999  perry exterminate ovbcopy. patches provided by Erik Bertelsen, pr-7145
 1.46 22-Dec-1998  scottr branches: 1.46.2;
vm_offset_t -> {paddr_t, vaddr_t}
 1.45 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.44 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.43 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.42 12-Jan-1998  thorpej Update for changes to config.
 1.41 25-Nov-1997  scottr In iteoff()/iteon(), don't try to do anything if we haven't
initialized the ite.
 1.40 19-Nov-1997  scottr Fix emulation, mostly from Dave Huang in PR 4482 (one tweak by me for CUU/CUD, and
one from him to correct a fencepost error in {reset,clear}_tabs()).
 1.39 06-Sep-1997  scottr branches: 1.39.4;
In itematch(), check to see if the framebuffer PA matches either the
$Fssxxxxx 1MB slot space documented in the old Inside Macintosh, or the
$Fs0xxxxx 1MB slot space documented in the new IM and Guide to Macintosh
Family Hardware.
 1.38 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.37 23-Jul-1997  scottr branches: 1.37.2;
The PA of the framebuffer may not be page aligned, so make sure to
do this before comparing against the result of pmap_extract().
 1.36 12-May-1997  scottr KNF and other cosmetics.
 1.35 20-Apr-1997  scottr Fix itematch() for case where fboff is not zero. From Dave Huang,
closes PR #3501.
 1.34 14-Apr-1997  briggs Capslock support from Steve Brown <sbrown@best.com>
 1.33 08-Apr-1997  briggs Changes from Michael R. Zucca <mrz5149@cs.rit.edu> for 16-bit and 32-bit
console support.
 1.32 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.31 11-Feb-1997  scottr Remove dependency on asc driver, using generic console bell callback
instead. Bell parameters are now entirely self-contained, as they
are managed by ite-specific ioctl()'s.
 1.30 18-Dec-1996  scottr branches: 1.30.4;
Fix the potentially uninitialized variable in clear_screen() (correctly
pointed out by gcc -Wall).
 1.29 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.28 19-Nov-1996  scottr Kill the conspa variable, and use mac68k_vidphys instead. Where we used
to initialize conspa was invalid on non-040 machines, since we don't
know which MMU we're using on those, yet. On the other hand, by the time
we get to check_video() on the 040 machines, the MMU has been disabled.
Compromise: get the video PA in setmachdep() on the 040, and in
check_video() on the others. (This is not optimal. *sigh*)
 1.27 10-Nov-1996  scottr VT220-related emulation additions:
- Add reset attribute sequences for bold, underline, and reverse
- Add insert/delete line sequences
- Recognize but ignore G0/G1 character set sequences

Performance:
- Speed up clear_line() when clearing the entire line

Also, some stylistic changes for checking/setting scroll region bounds
and in putc_getpars().

These changes make the ITE work properly with the 1.2 termcap file.
 1.26 13-Oct-1996  christos backout previous kprintf change
 1.25 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.24 05-Aug-1996  scottr Attach ite semantics to the appropriate grf device, instead of obio.
 1.23 01-Jun-1996  scottr Add tty_attach() as appropriate (for pstat -t)
 1.22 25-May-1996  briggs Do not let getty open ite if it's not been initialized.
 1.21 18-May-1996  briggs branches: 1.21.4;
Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.20 07-May-1996  scottr - Rewrite scrollup(), scrolldown(), and clear_screen() to move/clear only
visible screen memory. This results in a considerable performance win
at all depths.
- Correct clear_screen() behavior when clearing to the top and bottom of
screen; start at current cursor position, not current cursor row.
- Add local prototypes, and other KNF.
 1.19 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.18 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.17 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.16 17-Jul-1995  briggs Some more bugs fixed and functionality corrected by:
"Paul R. Goyette" <paul@pgoyette.bdt.com>.
Implemeted the Set Scrolling Region, Set Tab Stop, and Clear All
Tab Stops functions.
 1.15 09-Jul-1995  briggs patch to handle cursor moves better. From Paul Goyette
(Paul@pgoyette.bdt.com)
 1.14 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.13 20-Apr-1995  briggs Prototype iteopen correctly (oversight from a while back...).
 1.12 20-Apr-1995  briggs Add itetty().
 1.11 26-Mar-1995  briggs Do iteon() and iteoff(). Right now, they just clear/draw the cursor and
clear the screen. "We" should look at updating these further.
 1.10 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 29-Sep-1994  briggs Actually implement serial boot (console) echo (minor change to ite.c).
Remove some old junk in ser.c and implement serial console and serial
boot echo (if serial console's enabled, clear echo).
 1.7 12-Sep-1994  briggs Fix a scrolling bug when we have more than 64k to scroll.
 1.6 02-Aug-1994  briggs branches: 1.6.2;
Nuke holdovers from old HP300 console code. Get rid of any reference
to serial_boot_echo stuff here.
 1.5 31-Jul-1994  lkestel Fixed bug with bcopy()'ing more than 65535 bytes; initialize d_ttys and cn_tp
on itecnprobe(); other minor bug and warning fixes.
 1.4 30-Jul-1994  lkestel Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.3 21-Jul-1994  lkestel Added vt100 emulation and sped up text writing, scrolling, etc.
 1.2 09-Jul-1994  briggs Minor hacks to get this to compile for now. ite.c now uses the proper
consdev structure to keep itself from crashing...
 1.1 08-Jul-1994  lkestel 6x10.h: shifted font over by two pixels.
keyboard.h: added constants for commonly used keys and reformatted
array so that gcc would be happy.
adbsys.c: new adb system.
bounds.h: bound-checking macros.
ite.c: new built-in mini-console.
8x14.h: no longer used by built-in console.
adb.c: replaced by adbsys.c
 1.6.2.3 29-Sep-1994  cgd from trunk, per briggs.
 1.6.2.2 12-Sep-1994  cgd from trunk, per briggs
 1.6.2.1 02-Aug-1994  cgd file ite.c was added on branch netbsd-1-0 on 1994-09-12 21:07:58 +0000
 1.21.4.3 03-Jun-1996  scottr Back out previous change; we now have new tty stats code.
 1.21.4.2 02-Jun-1996  scottr My mistake; we're not yet ready for tty_attach() on this branch.
 1.21.4.1 01-Jun-1996  scottr Pull up version 1.23 from the main branch.
 1.30.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.37.2.2 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.37.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.39.4.2 26-Nov-1997  mellon Pull rev 1.41 up from trunk (scott)
 1.39.4.1 19-Nov-1997  mellon Pull rev 1.40 up from trunk (scottr)
 1.46.2.3 11-Mar-1999  scottr ite/grf is dead. long live ite/grf!
 1.46.2.2 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.46.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.48.2.3 21-Nov-1999  he Pull up revision 1.52 (requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.48.2.2 21-Apr-1999  perry branches: 1.48.2.2.2;
pullup 1.49->1.50 (scottr): rest of fix for pr7376
 1.48.2.1 21-Apr-1999  perry pullup 1.48->1.49 (scottr): partial fix for pr7376
 1.48.2.2.2.2 02-Aug-1999  thorpej Update from trunk.
 1.48.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.51.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.51.4.1 15-Nov-1999  fvdl Sync with -current
 1.51.2.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.14 26-Mar-2023  andvar s/diplay/display/ and s/DIPPLAY/DISPLAY/ in comments.
 1.13 20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.12 25-Jul-2014  dholland branches: 1.12.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.11 16-Mar-2014  dholland branches: 1.11.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.10 04-Mar-2007  christos branches: 1.10.78; 1.10.88; 1.10.94;
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 15-Jan-2005  chs branches: 1.8.10;
de-__P, remove register, ansify, b* -> mem*.
 1.7 15-Jul-2003  lukem __KERNEL_RCSID()
 1.6 23-Oct-2002  jdolecek branches: 1.6.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.5 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.4 14-May-2001  scw branches: 1.4.2; 1.4.4; 1.4.8; 1.4.16;
port-mac68l/12931 by Dave Huang:

Add an itepoll() function. This one slipped through my recent sweep
of line-disciplines...
 1.3 22-Jan-2001  scottr branches: 1.3.2;
Correct a thinko: iteopen()/iteclose() shouldn't just pass off to
the wsdisplay driver. Otherwise, closing ttye0 (ite compat) ends
up closing ttyE0, the actual console, when ttyflags runs. Fixes
PR 12022.
 1.2 14-Feb-2000  scottr branches: 1.2.4; 1.2.6;
Merge wscons work onto the main development branch.
 1.1 07-Feb-2000  scottr branches: 1.1.2;
file ite_compat.c was initially added on branch scottr-mac68k-wscons.
 1.1.2.3 11-Feb-2000  scottr Get the console device without any outside help. Also, do a sanity
check in iteioctl().
 1.1.2.2 07-Feb-2000  scottr Add missing copyright/license.
 1.1.2.1 07-Feb-2000  scottr Implement an ite console emulator for wscons. The only thing we actually
need to do is handle a few ioctls, as wsdisplay already handles everything
else nicely.
 1.2.6.3 11-Feb-2001  bouyer Sync with HEAD.
 1.2.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.6.1 14-Feb-2000  bouyer file ite_compat.c was added on branch thorpej_scsipi on 2000-11-20 20:12:17 +0000
 1.2.4.1 03-Feb-2001  he Pull up revision 1.3 (requested by scottr):
Correct the implementation of iteopen()/iteclose(). Fixes
PR#12022.
 1.3.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.4.16.1 19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.4.8.3 11-Nov-2002  nathanw Catch up to -current
 1.4.8.2 17-Sep-2002  nathanw Catch up to -current.
 1.4.8.1 14-May-2001  nathanw file ite_compat.c was added on branch nathanw_sa on 2002-09-17 21:15:25 +0000
 1.4.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.4.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.6.6.5 25-Jan-2005  skrll Adapt to branch.
 1.6.6.4 17-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.8.10.2 03-Sep-2007  yamt sync with head.
 1.8.10.1 21-Jun-2006  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.10.94.1 18-May-2014  rmind sync with head
 1.10.88.2 03-Dec-2017  jdolecek update from HEAD
 1.10.88.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.10.78.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.11.2.1 10-Aug-2014  tls Rebase.
 1.12.4.1 22-Sep-2015  skrll Sync with HEAD
 1.3 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.2 08-Apr-1997  briggs branches: 1.2.16; 1.2.24;
Changes from Michael R. Zucca <mrz5149@cs.rit.edu> for 16-bit and 32-bit
console support.
 1.1 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2.24.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.2.16.3 11-Feb-2000  scottr Get the console device without any outside help. Also, do a sanity
check in iteioctl().
 1.2.16.2 07-Feb-2000  scottr Update copyright/license.
 1.2.16.1 07-Feb-2000  scottr Implement an ite console emulator for wscons. The only thing we actually
need to do is handle a few ioctls, as wsdisplay already handles everything
else nicely.
 1.4 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.3 16-Feb-1999  ender branches: 1.3.2; 1.3.10;
Add NetBSD RCS Id's
 1.2 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.3.10.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3.2.2 15-Nov-1999  scottr These have been moved via repository copy to akbd/ams for consistency with
the macppc port.
 1.3.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.4 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.3 16-Feb-1999  ender branches: 1.3.2; 1.3.10;
Add NetBSD RCS Id's
 1.2 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.3.10.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3.2.1 15-Nov-1999  scottr These have been moved via repository copy to akbd/ams for consistency with
the macppc port.
 1.4 30-Jul-1994  mycroft Clean up deleted files.
 1.3 08-Jul-1994  lkestel 6x10.h: shifted font over by two pixels.
keyboard.h: added constants for commonly used keys and reformatted
array so that gcc would be happy.
adbsys.c: new adb system.
bounds.h: bound-checking macros.
ite.c: new built-in mini-console.
8x14.h: no longer used by built-in console.
adb.c: replaced by adbsys.c
 1.2 29-Nov-1993  briggs branches: 1.2.2;
Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.50 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.49 25-Oct-2013  martin branches: 1.49.28; 1.49.30;
Simplify
 1.48 06-Dec-2012  hauke branches: 1.48.2;
Remove the R1 syntactic sugar, since it collides with a #define in
<m68k/regs.h>, breaking the build.

The R1s serve to bring the buffer pointer to a 4 byte boundary, but
that should be clear from the context.
 1.47 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.46 17-Jul-2011  joerg branches: 1.46.2; 1.46.12;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.45 09-Jul-2011  mrg avoid inconsistent inline usage to appease gcc 4.5.
 1.44 24-Dec-2005  perry __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.43 11-Dec-2005  christos merge ktrace-lwp.
 1.42 16-Jun-2005  jmc branches: 1.42.2;
Fixes for volatile problems
 1.41 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.40 15-Jul-2003  lukem __KERNEL_RCSID()
 1.39 18-Jun-2003  drochner branches: 1.39.2;
don't #include <sys/dkstat.h> where it is (appearently) unused
 1.38 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.37 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.36 14-Feb-2000  scottr branches: 1.36.8; 1.36.12;
Merge wscons work onto the main development branch.
 1.35 22-Dec-1998  scottr branches: 1.35.2; 1.35.10;
vm_offset_t -> {paddr_t, vaddr_t}
 1.34 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.33 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.32 29-Jun-1997  scottr branches: 1.32.2; 1.32.4;
Update for mac68k_buserr_addr -> m68k_fault_addr change.
 1.31 27-Apr-1997  briggs What was I thinking?
 1.30 15-Apr-1997  briggs Take a stab at making this more reliable.
 1.29 28-Feb-1997  scottr Convert to generalized VIA interrupt registration
 1.28 19-Dec-1996  scottr branches: 1.28.6;
Clean up a few bogons+typos introduced in the removal of the broken indirect
config code.
 1.27 13-Oct-1996  christos backout previous kprintf change
 1.26 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.25 07-Jun-1996  briggs Fix a typo.
 1.24 25-May-1996  briggs Clean up the interrupt handling somewhat.
 1.23 05-May-1996  briggs branches: 1.23.4;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.22 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.21 20-Mar-1996  scottr Fix a long-standing bug uncovered by the new device attachment
model. Thanks to Jason Thorpe for the fix (fixed PR 2235).
 1.20 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.19 19-Feb-1996  briggs Update to latest Atari driver, but with some local modifications.
 1.18 03-Feb-1996  briggs Move debugging defines, etc. into mac68k5380.c and use them instead of
something similar but different. Make a few cosmetic changes.
 1.17 24-Jan-1996  briggs Patch a few of the holes in the machine-dependent part of this driver.
Sync the m.i. part with the Atari.
 1.16 11-Jan-1996  briggs Keep two states for pdma debugging. Turn debugging back on. Sigh.
 1.15 01-Nov-1995  briggs Fixup error/debugging message.
 1.14 01-Oct-1995  briggs Finally get this right... Final fix from Paul Goyette paul@pgoyette.bdt.com
 1.13 30-Sep-1995  briggs Yet another error in the (next-to) last changes.
 1.12 30-Sep-1995  briggs Fix stupid error in one of my last changes here.
 1.11 27-Sep-1995  briggs Bullet-proof a little.
Make some more pdma code conditional on USE_PDMA.
Handle transfers of size > MIN_PHYS.
 1.10 23-Sep-1995  briggs Much improved pdma transfers.
Still not nearly as fast as FWB's drivers under the MacOS.
Uses the "blind" transfer method instead of polled pdma.
 1.9 16-Sep-1995  briggs Only use PIO instead of PDMA if DRIVER_NOINT.
 1.8 16-Sep-1995  briggs Rename scsi_main_irq() to pdma_ready().
Missed a few ATNs in last patch. (pointed out by Leo).
Raise timeout from 100 to 1000. From Leo.
 1.7 12-Sep-1995  briggs Update for Leo's changes.
 1.6 04-Sep-1995  briggs Get softc as parameter in interrupt function, using new changes from
via.[ch]
 1.5 03-Sep-1995  briggs Make a local copy of the atari m.i. scsi driver sources for the time
being. Some people aren't supping arch/atari and this allows those
people to get the sources.
 1.4 02-Sep-1995  briggs Optimize this some. Still seems slower than it ought to be.
Register interrupt functions with via.c.
Clean up somewhat. Turn off DEBUG.
 1.3 02-Sep-1995  briggs Rearrange a bit.
 1.2 02-Sep-1995  briggs DTRT. This should be considered the base version of the file.
 1.1 01-Sep-1995  briggs A first pass at a scsi driver based on the Atari ncr5380{reg.h,.c} code.
 1.23.4.2 07-Jun-1996  briggs Bring in fix for a typo from -current.
 1.23.4.1 01-Jun-1996  scottr Pull up version 1.24 from the main branch (fix interrupt handling)
 1.28.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.32.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.2 14-Aug-1997  bouyer Sync with trunk.
 1.32.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.35.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.35.2.1 14-Feb-2000  scottr Make this compile (we lost cpu.h somewhere along the line).
 1.36.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.36.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.39.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.39.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.39.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.39.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.39.2.1 03-Aug-2004  skrll Sync with HEAD
 1.42.2.1 21-Jun-2006  yamt sync with head.
 1.46.12.3 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.12.2 25-Feb-2013  tls resync with head
 1.46.12.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.46.2.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.46.2.2 16-Jan-2013  yamt sync with (a bit old) head
 1.46.2.1 30-Oct-2012  yamt sync with head
 1.48.2.1 18-May-2014  rmind sync with head
 1.49.30.1 10-Jun-2019  christos Sync with HEAD
 1.49.28.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.10 26-Jul-2019  rin Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.9 17-Oct-2007  garbled branches: 1.9.108;
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 29-Aug-2007  jmmv Pack all global video-related variables into a structure for clarity.

A comment said that they weren't in a struct for speed reasons but...
this should not affect performance because these variables are mostly
used to set other variables (hence they are read few times).
 1.7 29-Aug-2007  jmmv Move the definition of multiple video-related variables into a new
header file (machine/video.h) so that we can kill all the "manual"
externs spread around the code (which were inconsistent among them).
 1.6 11-Dec-2005  christos branches: 1.6.30; 1.6.38; 1.6.44; 1.6.48; 1.6.50;
merge ktrace-lwp.
 1.5 15-Jan-2005  chs branches: 1.5.10;
de-__P, remove register, ansify, b* -> mem*.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 06-Sep-2002  gehenna branches: 1.3.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.2 14-Feb-2000  scottr branches: 1.2.8; 1.2.12; 1.2.20;
Merge wscons work onto the main development branch.
 1.1 22-May-1999  scottr branches: 1.1.2; 1.1.4;
file maccons.c was initially added on branch scottr-mac68k-wscons.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.3 09-Feb-2000  scottr Add support for serial boot echo.
 1.1.2.2 29-Dec-1999  scottr Don't avoid the IIfx. The original idea was to avoid crashes due to the fact that
the ADB driver isn't working, but that's no longer a problem. (In
reality, while the IOP code doesn't quite work, it does not cause
instability like previous attempts to use MRG ADB did.)
 1.1.2.1 22-May-1999  scottr Add support for wscons as a console, using evil trickery. To fix this
we'll have to revisit (and rip out) a bunch of things that happen before
the MMU is set up.

As a result, serial consoles now work again.
 1.2.20.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.2.12.1 17-Sep-2002  nathanw Catch up to -current.
 1.2.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.3.6.4 17-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.5.10.1 03-Sep-2007  yamt sync with head.
 1.6.50.1 06-Nov-2007  matt sync with HEAD
 1.6.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.6.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.6.38.1 03-Oct-2007  garbled Sync with HEAD
 1.6.30.1 09-Oct-2007  ad Sync with head.
 1.9.108.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 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 19-Dec-2020  thorpej branches: 1.21.2;
malloc(9) -> kmem(9)
 1.20 27-Oct-2012  chs branches: 1.20.50;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.19 17-Oct-2007  garbled branches: 1.19.54; 1.19.64;
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.18 29-Aug-2007  jmmv Pack all global video-related variables into a structure for clarity.

A comment said that they weren't in a struct for speed reasons but...
this should not affect performance because these variables are mostly
used to set other variables (hence they are read few times).
 1.17 29-Aug-2007  jmmv Move the definition of multiple video-related variables into a new
header file (machine/video.h) so that we can kill all the "manual"
externs spread around the code (which were inconsistent among them).
 1.16 29-Aug-2007  jmmv Split the global videosize variable into videowidth and videoheight:
makes the code clearer and avoids multiple parts of it having to know
how videosize was encoded.
 1.15 04-Mar-2007  christos branches: 1.15.2; 1.15.10; 1.15.14; 1.15.18; 1.15.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.14 12-Apr-2006  jmmv branches: 1.14.14;
Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.13 28-Mar-2006  thorpej Use device_unit().
 1.12 11-Dec-2005  christos branches: 1.12.4; 1.12.6; 1.12.8; 1.12.10; 1.12.12;
merge ktrace-lwp.
 1.11 15-Jan-2005  chs branches: 1.11.10;
de-__P, remove register, ansify, b* -> mem*.
 1.10 15-Jul-2003  lukem __KERNEL_RCSID()
 1.9 02-Oct-2002  thorpej branches: 1.9.6;
Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 04-Jul-2002  junyoung alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.6 17-Mar-2002  atatat branches: 1.6.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.5 22-Oct-2000  scottr branches: 1.5.4; 1.5.8;
Replace the call to macfb_init() when attaching a non-console fb device
with a call to macfb_clear().

[The purpose of macfb_init() is almost exclusively to initialize the
raster console blitter. We really, really do not want to do this unless
we are actually initializing the console device, else we'll give rcons
the attributes of the last-seen fb device. These will not necessarily
correspond to the attributes of the actual console device!]
 1.4 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.3 17-Mar-2000  scottr branches: 1.3.4;
Resurrect a chunk of code from the ite driver that we lost along the way.
This code is necessary for SE/30 internal video, at a minimum.
 1.2 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.1 08-Mar-1999  scottr branches: 1.1.2; 1.1.4;
file macfb.c was initially added on branch scottr-mac68k-wscons.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.11 12-Feb-2000  scottr Remove ite emulation code. This is now done by the ite pseudo-device.
 1.1.2.10 24-Dec-1999  scottr Calculate the rcons start-of-pixels value correctly.
 1.1.2.9 13-Dec-1999  scottr A change and a bugfix, inadvertantly committed together:

- Catch up with recent change to the show_screen accessop.

- Be careful to set dc_paddr/dc_vaddr to page-aligned values, and
use dc_offset to take up the slack.
 1.1.2.8 23-Nov-1999  scottr Transpose error in rcons_init args.
 1.1.2.7 21-Nov-1999  scottr Bump maxcols to 192 so that we don't artificially limit 1152x864 displays.
Noted by Frederick Bruckman.
 1.1.2.6 20-Nov-1999  scottr Pull out the code to clear the display into a separate function.
 1.1.2.5 15-Nov-1999  scottr Implement a more straightforward approach to grf emulation.
 1.1.2.4 02-Nov-1999  scottr [Redo] Catch up to uvm_mmap() interface change.
 1.1.2.3 16-May-1999  scottr UVM is no longer optional.
 1.1.2.2 11-Mar-1999  scottr First cut at grf emulation. Neither GRFIOCMAP nor mmap'ing a wsdisplay device
work, though several other grf ioctls are properly emulated.
 1.1.2.1 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.3.4.2 01-Nov-2000  tv Pullup 1.5 [scottr]:
Replace the call to macfb_init() when attaching a non-console fb device
with a call to macfb_clear().
 1.3.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.5.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.5.8.2 01-Aug-2002  nathanw Catch up to -current.
 1.5.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.5.4.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.5.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.4.1 16-Jul-2002  gehenna catch up with -current.
 1.9.6.5 25-Jan-2005  skrll Adapt to branch.
 1.9.6.4 17-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.11.10.2 03-Sep-2007  yamt sync with head.
 1.11.10.1 21-Jun-2006  yamt sync with head.
 1.12.12.2 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.12.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.12.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.12.8.2 24-May-2006  yamt sync with head.
 1.12.8.1 01-Apr-2006  yamt sync with head.
 1.12.6.1 22-Apr-2006  simonb Sync with head.
 1.12.4.1 09-Sep-2006  rpaulo sync with head
 1.14.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.15.20.1 06-Nov-2007  matt sync with HEAD
 1.15.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.15.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.15.10.1 03-Oct-2007  garbled Sync with HEAD
 1.15.2.1 09-Oct-2007  ad Sync with head.
 1.19.64.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.54.1 30-Oct-2012  yamt sync with head
 1.20.50.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.21.2.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.22.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.5 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.4 11-Dec-2005  christos branches: 1.4.112; 1.4.122;
merge ktrace-lwp.
 1.3 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.2 14-Feb-2000  scottr branches: 1.2.28;
Merge wscons work onto the main development branch.
 1.1 08-Mar-1999  scottr branches: 1.1.2; 1.1.4;
file macfbvar.h was initially added on branch scottr-mac68k-wscons.
 1.1.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.3 20-Nov-1999  scottr Pull out the code to clear the display into a separate function.
 1.1.2.2 11-Mar-1999  scottr First cut at grf emulation. Neither GRFIOCMAP nor mmap'ing a wsdisplay device
work, though several other grf ioctls are properly emulated.
 1.1.2.1 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.2.28.1 17-Jan-2005  skrll Sync with HEAD.
 1.4.122.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.4.112.1 30-Oct-2012  yamt sync with head
 1.9 21-Jan-2002  jdolecek Switch to MI dev/md_root.c for archs which don't have any special
memory disk hooks (i.e. everything except atari).
 1.8 17-Mar-1999  sommerfe branches: 1.8.22; 1.8.26;
defopt MINIROOTSIZE
 1.7 13-Feb-1997  scottr branches: 1.7.16;
#include <sys/systm.h> to bring in printf() prototype
 1.6 28-Dec-1996  pk branches: 1.6.6;
rename: ramdisk => md
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 07-Mar-1996  leo Allow for a machine dependent match function - rd_match_hook()
 1.1 21-Nov-1995  briggs Add rd_root.c from sun3.
 1.6.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.7.16.1 16-May-1999  scottr Sync with main branch.
 1.8.26.1 28-Feb-2002  nathanw Catch up to -current.
 1.8.22.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.5 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.4 16-Feb-1999  ender branches: 1.4.2; 1.4.10;
Add NetBSD RCS Id's
 1.3 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.2 16-Jan-1999  scottr Add support for the Contour 3-button mouse, inadvertantly missed
in the ADB split a few months back. Noticed by Takashi NAKAMURA.
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.4.10.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.4.2.1 15-Nov-1999  scottr These have been moved via repository copy to akbd/ams for consistency with
the macppc port.
 1.4 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.3 16-Feb-1999  ender branches: 1.3.2; 1.3.10;
Add NetBSD RCS Id's
 1.2 11-Feb-1999  ender o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.1 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.3.10.1 20-Nov-2000  bouyer Remove files that are no longer on the trunck
 1.3.2.1 15-Nov-1999  scottr These have been moved via repository copy to akbd/ams for consistency with
the macppc port.
 1.72 01-Aug-2023  andvar fix various typos in comments.
 1.71 07-Apr-2022  andvar fix various typos in comments.
 1.70 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.69 24-Apr-2021  thorpej branches: 1.69.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.68 29-Sep-2020  msaitoh branches: 1.68.4;
s/implicitely/implicitly/
 1.67 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.66 25-Oct-2013  martin Simplify
 1.65 27-Oct-2012  chs branches: 1.65.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.64 28-Feb-2010  snj branches: 1.64.10; 1.64.20;
Fight the ever-increasing size of src checkouts by spelling "useful"
without an extra l.
 1.63 20-Oct-2009  snj branches: 1.63.2;
Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.62 25-Feb-2006  wiz branches: 1.62.72;
Fix typos, reported by Alexey Dobriyan ("Gathered from Linux"),
forwarded by jmc@openbsd.
 1.61 24-Dec-2005  perry branches: 1.61.2; 1.61.4; 1.61.6;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.60 11-Dec-2005  christos merge ktrace-lwp.
 1.59 16-Jun-2005  jmc branches: 1.59.2;
Shadowing and const fixes.
 1.58 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.57 15-Jan-2005  chs branches: 1.57.2; 1.57.4;
de-__P, remove register, ansify, b* -> mem*.
 1.56 07-Dec-2004  thorpej - Use the cmdlen specified in the scsipi_xfer structure. Keying off
the command group ID won't necessarily work for vendor-specific commands.
- Expand the storage in the SC_REQ structure to account for 16-byte commands.
 1.55 30-Oct-2003  matt Fix real uninitialized variable bug.
 1.54 30-Oct-2003  matt Fix indentation/whitespace.
 1.53 15-Jul-2003  lukem __KERNEL_RCSID()
 1.52 03-May-2003  wiz branches: 1.52.2;
DMA, not dma nor Dma.
 1.51 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.50 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.49 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.48 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.47 25-Apr-2001  bouyer branches: 1.47.2; 1.47.8;
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.46 12-Dec-1999  scottr branches: 1.46.6;
Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.45 30-Sep-1999  thorpej branches: 1.45.2; 1.45.8;
Update for SCSIPI changes.
 1.44 05-Dec-1998  mjacob branches: 1.44.4;
Update HBAs to incorporate the new max_lun property.
 1.43 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.42 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.41 02-Jul-1998  wrstuden Another printf("%:"...) bites the dust (->vprintf(...))
 1.40 12-Jan-1998  thorpej Update for changes to config.
 1.39 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.38 19-Dec-1996  scottr branches: 1.38.8; 1.38.10;
Clean up a few bogons+typos introduced in the removal of the broken indirect
config code.
 1.37 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.36 10-Dec-1996  thorpej Fill in sc_link.max_target
 1.35 13-Oct-1996  christos backout previous kprintf change
 1.34 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.33 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.32 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.31 23-Jun-1996  briggs Add a comment about the last change.
 1.30 07-Jun-1996  briggs Wait longer (2.5 sec) in wait_req_true/false. Some targets take a long time.
 1.29 22-May-1996  briggs Get rid of compiler warning if DBG_PID is not defined.
 1.28 06-May-1996  briggs branches: 1.28.4;
Update to something closer to the atari port.
 1.27 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.26 30-Mar-1996  christos Change %r -> %: as for recursive printf's
 1.25 29-Mar-1996  briggs Fix minor oversight in a sanity check--caught by Jason, I think, and reported
by Scott.
 1.24 20-Mar-1996  scottr Fix a long-standing bug uncovered by the new device attachment
model. Thanks to Jason Thorpe for the fix (fixed PR 2235).
 1.23 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.22 07-Mar-1996  briggs Fix a typo in last.
 1.21 07-Mar-1996  briggs Disable SCSI linked commands, but allow kernel option to override.
 1.20 19-Feb-1996  briggs Update to latest Atari driver, but with some local modifications.
 1.19 03-Feb-1996  briggs Move debugging defines, etc. into mac68k5380.c and use them instead of
something similar but different. Make a few cosmetic changes.
 1.18 24-Jan-1996  briggs Patch a few of the holes in the machine-dependent part of this driver.
Sync the m.i. part with the Atari.
 1.17 06-Jan-1996  briggs Fix from Paul Goyette for off-by-one error.
 1.16 06-Jan-1996  briggs Bring in a few changes from Atari port.
Add support from Paul Goyette for keeping more than just the last 2
states when debugging.
 1.15 13-Dec-1995  briggs Fix from Paul Goyette to disable linked commands on drives that
reject them for simple commands. Leo W. reports that this does
not work for some systems. It's better than what we have now,
though. From Paul Goyette <paul@pgoyette.bdt.com>.
 1.14 04-Dec-1995  briggs Fix from Paul Goyette (paul@pgoyette.bdt.com) for drives that don't grok
linked commands.
 1.13 01-Dec-1995  briggs cmdlen-2 is right for the last byte of the command. Ifdef out for right now,
though, as some devices apparently don't support linked commands and will
reject commands that have the link bit set in them.
 1.12 30-Nov-1995  briggs Put the link flag in the right place.
Pointed out by Paul@pgoyette.bdt.com (Paul Goyette).
 1.11 31-Oct-1995  briggs Pull in all but one of Leo's changes from the atari copy.
 1.10 08-Oct-1995  briggs branches: 1.10.2;
Pick up changes from leo's latest version.
 1.9 02-Oct-1995  briggs Change to allow nack_message() to take an argument and send
MSG_REJECT_MESSAGE instead of MSG_ABORT when we get an extended message.
This allows a DEC drive to work when it attempts to negotiate synch.
transfers on us.
 1.8 18-Sep-1995  briggs Do not define MIN_PHYS here--it is m.d..
 1.7 16-Sep-1995  briggs Sync. with atari ncr5380.c -- mainly whitespace changes.
 1.6 16-Sep-1995  briggs Rename scsi_main_irq() to pdma_ready().
Missed a few ATNs in last patch. (pointed out by Leo).
Raise timeout from 100 to 1000. From Leo.
 1.5 15-Sep-1995  briggs As Leo pointed out, my last change was not safe. This one should be.
I added two new bitfields to ncr_softc. They flag which devices have
been selected, and which ones have failed to go to message out when
selected with ATN. If a target fails to go to message out the first
time it is selected, it goes into the latter bitfield. If it fails
thereafter, we treat it as we did before.
 1.4 14-Sep-1995  briggs Gah... The Asante SCSI/ethernet box doesn't answer the ATN request
for a 'MESSAGE OUT' phase, so add support in scsi_select() for the
phase to be either 'MESSAGE OUT' or 'COMMAND'.
 1.3 12-Sep-1995  briggs Updates from Leo's changes in the atari port.
 1.2 05-Sep-1995  briggs Remove infinite loop per Leo and Mycroft.
 1.1 03-Sep-1995  briggs Make a local copy of the atari m.i. scsi driver sources for the time
being. Some people aren't supping arch/atari and this allows those
people to get the sources.
 1.10.2.2 31-Oct-1995  briggs Bring in version from HEAD.
 1.10.2.1 16-Oct-1995  briggs Get rid of an 'if' in reselect() that causes a hang for me--pointed out by
Leo and Mattias(sp?).
 1.28.4.2 25-Jun-1996  jtc Pulled up from rev 1.30 by request from Allen Briggs
 1.28.4.1 01-Jun-1996  scottr Pull up version 1.29 from the main branch (unused variable warning)
 1.38.10.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.38.8.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.44.4.2 12-Dec-1999  scottr Sync with main branch.
 1.44.4.1 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.45.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.45.2.3 29-Mar-2001  bouyer Pass compile-test on i386.
 1.45.2.2 27-Mar-2001  bouyer Convert to thorpej_scsipi (untested).
 1.45.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.46.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.47.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.47.8.1 25-Apr-2001  nathanw file ncr5380.c was added on branch nathanw_sa on 2002-10-18 02:38:20 +0000
 1.47.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.52.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.52.2.6 04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.52.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.52.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.52.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.52.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.52.2.1 03-Aug-2004  skrll Sync with HEAD
 1.57.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.57.2.1 29-Apr-2005  kent sync with -current
 1.59.2.1 21-Jun-2006  yamt sync with head.
 1.61.6.1 22-Apr-2006  simonb Sync with head.
 1.61.4.1 09-Sep-2006  rpaulo sync with head
 1.61.2.1 01-Mar-2006  yamt sync with head.
 1.62.72.1 11-Mar-2010  yamt sync with head
 1.63.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.64.20.3 03-Dec-2017  jdolecek update from HEAD
 1.64.20.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.64.20.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.64.10.2 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.64.10.1 30-Oct-2012  yamt sync with head
 1.65.2.1 18-May-2014  rmind sync with head
 1.68.4.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.69.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.20 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.19 20-Oct-2009  snj branches: 1.19.12; 1.19.22;
Remove 3rd and 4th clause on Leo Weppelman's license. OK leo@.
 1.18 11-Dec-2005  christos branches: 1.18.78;
merge ktrace-lwp.
 1.17 16-Jun-2005  jmc Shadowing and const fixes.
 1.16 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.15 07-Dec-2004  thorpej - Use the cmdlen specified in the scsipi_xfer structure. Keying off
the command group ID won't necessarily work for vendor-specific commands.
- Expand the storage in the SC_REQ structure to account for 16-byte commands.
 1.14 03-May-2003  wiz branches: 1.14.2;
DMA, not dma nor Dma.
 1.13 09-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.12 25-Apr-2001  bouyer branches: 1.12.8;
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.11 19-Nov-1998  thorpej branches: 1.11.12; 1.11.24;
Adapt to the new scsipi_adapter interface.
 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 05-May-1996  briggs branches: 1.9.10; 1.9.12;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.8 19-Feb-1996  briggs Update to latest Atari driver, but with some local modifications.
 1.7 03-Feb-1996  briggs Move debugging defines, etc. into mac68k5380.c and use them instead of
something similar but different. Make a few cosmetic changes.
 1.6 13-Dec-1995  briggs Fix from Paul Goyette to disable linked commands on drives that
reject them for simple commands. Leo W. reports that this does
not work for some systems. It's better than what we have now,
though. From Paul Goyette <paul@pgoyette.bdt.com>.
 1.5 04-Dec-1995  briggs Fix from Paul Goyette (paul@pgoyette.bdt.com) for drives that don't grok
linked commands.
 1.4 02-Oct-1995  briggs Change to allow nack_message() to take an argument and send
MSG_REJECT_MESSAGE instead of MSG_ABORT when we get an extended message.
This allows a DEC drive to work when it attempts to negotiate synch.
transfers on us.
 1.3 15-Sep-1995  briggs As Leo pointed out, my last change was not safe. This one should be.
I added two new bitfields to ncr_softc. They flag which devices have
been selected, and which ones have failed to go to message out when
selected with ATN. If a target fails to go to message out the first
time it is selected, it goes into the latter bitfield. If it fails
thereafter, we treat it as we did before.
 1.2 12-Sep-1995  briggs Update from Leo's changes.
 1.1 03-Sep-1995  briggs Make a local copy of the atari m.i. scsi driver sources for the time
being. Some people aren't supping arch/atari and this allows those
people to get the sources.
 1.9.12.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.10.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.11.24.1 21-Jun-2001  nathanw Catch up to -current.
 1.11.12.1 27-Mar-2001  bouyer Convert to thorpej_scsipi (untested).
 1.12.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.12.8.1 25-Apr-2001  bouyer file ncr5380reg.h was added on branch nathanw_sa on 2001-04-25 17:53:15 +0000
 1.14.2.3 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.2.2 17-Jan-2005  skrll Sync with HEAD.
 1.14.2.1 18-Dec-2004  skrll Sync with HEAD.
 1.18.78.1 11-Mar-2010  yamt sync with head
 1.19.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.19.12.1 30-Oct-2012  yamt sync with head
 1.5 24-Dec-2005  perry __asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 15-Jan-2005  chs branches: 1.3.10;
de-__P, remove register, ansify, b* -> mem*.
 1.2 25-May-1996  briggs branches: 1.2.64;
Clean up the interrupt handling somewhat.
 1.1 05-May-1996  briggs branches: 1.1.4;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.1.4.1 01-Jun-1996  scottr Pull up version 1.2 from the main branch (fix interrupt handling)
 1.2.64.1 17-Jan-2005  skrll Sync with HEAD.
 1.3.10.1 21-Jun-2006  yamt sync with head.
 1.11 25-Apr-1996  scottr Renamed these files.
 1.10 25-Apr-1996  scottr Remove some now-useless code.
 1.9 25-Apr-1996  scottr We don't need to enforce the MAX_DMA_SIZE limit in dma_alloc();
this is handled properly by sbc_drq_intr() already.
 1.8 25-Apr-1996  scottr - Remove several hacks that didn't do much but waste cycles.
- Disable interrupt-driven PDMA when writing (use polled PDMA instead).
- Be more careful about when to flag a transfer as completed.

The result of these changes is that interrupt-driven PDMA works well
enough to bring the system up.
 1.7 23-Apr-1996  scottr Clean up sbc_drq_intr() a bit; also, be more paranoid about size of transfer.
 1.6 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.5 21-Mar-1996  scottr DEBUG -> SBC_DEBUG, and fix comment regarding sbc_options
 1.4 20-Mar-1996  scottr Fix a long-standing bug uncovered by the new device attachment
model. Thanks to Jason Thorpe for the fix (fixed PR 2235).
 1.3 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.2 22-Feb-1996  scottr - Clean up DEBUG code.
- Setting the "monitor BSY" flag for polled PDMA is non-optimal. The
polled requests generate an interrupt that isn't serviced until the
command has been cleared from the queue.
 1.1 10-Feb-1996  scottr New SCSI driver for Macintosh II family machines, implemented using
the MI 5380 driver. It has been verified to work on the IIx, IIsi,
and IIci only, but should work with any Macintosh 5380-based SCSI
controller.

- This driver is _not_ intended to be a general purpose replacement
for the `ncrscsi' driver. It is an alternative for those having
problems with that driver.
- Disconnect/reselect doesn't (yet) work, so don't expect SCSI tape
or magneto-optical disk drives to function properly.
 1.2 25-Apr-1996  scottr Renamed these files.
 1.1 10-Feb-1996  scottr New SCSI driver for Macintosh II family machines, implemented using
the MI 5380 driver. It has been verified to work on the IIx, IIsi,
and IIci only, but should work with any Macintosh 5380-based SCSI
controller.

- This driver is _not_ intended to be a general purpose replacement
for the `ncrscsi' driver. It is an alternative for those having
problems with that driver.
- Disconnect/reselect doesn't (yet) work, so don't expect SCSI tape
or magneto-optical disk drives to function properly.
 1.44 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.43 13-Jan-1998  scottr Update for bus.h changes.
 1.42 12-Jan-1998  thorpej Update for changes to config.
 1.41 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.40 15-Jul-1997  scottr branches: 1.40.2;
In nubus_print(), always print the NuBus slot number. Also, refine it so
that when no driver matches, our output is a little more consistent with
existing practice.
 1.39 14-Jul-1997  scottr Clean up some DIAGNOSTIC messages: use %x to display the slot number.
 1.38 13-May-1997  scottr Update a recently-added comment re: bytelanes values.
 1.37 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.36 23-Apr-1997  briggs On video devices, if we're loading non-default resource values, save the
resource ID. Thanks to Paul Goyette <paul@pgoyette.bdt.com> for spotting
this one.
 1.35 22-Apr-1997  scottr #ifdef DIAGNOSTIC, print the NuBus type fields for unrecognized boards.
 1.34 10-Apr-1997  briggs Some patches from Bob Nestor <rnestor@metronet.com> and myself to edge
toward support for an Apple SONIC-based ethernet card. Some cards, like
his, were being missed and/or probed like video cards!
 1.33 15-Mar-1997  scottr Defer enabling NuBus slot interrupts until all slots have been probed
and drivers attached. This removes the need for the MAC68K_BROKEN_VIDEO
option. From Allen Briggs.
 1.32 28-Feb-1997  scottr Remove duplicate <machine/bus.h> include that crept in.
 1.31 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.30 22-Feb-1997  scottr Make this compile again; missed this file when fixing nubus.h errors.
 1.29 17-Dec-1996  scottr branches: 1.29.6;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.28 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.27 21-Oct-1996  scottr Fix a raft of printf format strings and some declaration problems for
the case where we define DEBUG. From Erik Bertelsen, closes PR 2871.
 1.26 13-Oct-1996  christos backout previous kprintf change
 1.25 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.24 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.23 08-May-1996  scottr Make this compile if DEBUG is defined.
 1.22 07-May-1996  briggs Clean up an error printf() and use proper macro.
 1.21 06-May-1996  briggs Ooops. Remove debugging printf().
 1.20 06-May-1996  briggs Do not depend on the nubus being mapped in one huge segment.
 1.19 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.18 04-Apr-1996  scottr Make this compile again; will need to deal with matchbyname() later, though.
 1.17 01-Apr-1996  briggs Clean up for higher warning level.
 1.16 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.15 12-Jan-1996  briggs Fixes from PR #1931 w/ minor mod in vm_machdep.c
 1.14 04-Aug-1995  briggs Nuke int_video_start in favor of consistent use of mac68k_vidlog.
Don't find the internal video more than once.
Probe for internal video before nubus instead of after.
 1.13 30-Jul-1995  briggs Fix the internal video probe again.
 1.12 21-Jun-1995  briggs Add some debugging (conditional on DEBUG). Add a more correct probe for
internal video. Clean up nubusprint() a bit.
 1.11 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.10 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.9 12-Apr-1995  briggs Make nubus indirect. Duh.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 26-Jun-1994  briggs Don't assume NuBus is at NBBASE. We might remap it.
 1.6 23-Feb-1994  briggs Do a cleaner probe. This still needs lots of work, but will work on
reasonable cards...
 1.5 22-Feb-1994  briggs Minor tweaks to prevent hangs and other bad behavior... Needs much more
work now that we have more info (Designing Cards and Drivers for the
Macintosh Family Hardware.
 1.4 30-Jan-1994  briggs Just playing include-cop.
 1.3 21-Dec-1993  briggs Update ethernet driver to use config.new. At least, it's a first stab
working from mycroft's magnum changes to if_ed.c.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.29.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.40.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.38 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.37 26-Apr-1998  briggs Deal with the video interrupt for the RasterOps 8/24XLi. Thanks for the
information go to Tadashi Ueda <ng6t-ued@asahi-net.or.jp>.
 1.36 24-Apr-1998  briggs Add interrupt support for two more video cards: the Formac color card II
and the Radius PrecisionColor 24Xp. Thanks to <falk.stern@luene.net> and
<Mario_Magliocco@broder.com> for their remote sleuthing and testing.
 1.35 03-Dec-1997  briggs Thanks to Paul Goyette <paul@whooppee.com> for a patch to clear the
interrupt properly on a SuperMac Spectrum/8 Series III, and thanks
to Dan McMahill for loaning the card to Paul.
I modified Paul's patch somewhat to change grfmv_intr_generic_{1,4}
to grfmv_intr_generic_write{1,4} and added grfmv_intr_generic_or4 to
handle this card.
 1.34 30-Nov-1997  briggs Support for the Lapis ProColorServer 8 PDS on the SE/30. This prevents
hangs when trying to use this video card in conjunction with an ethernet
card. Thanks to David Condon <david@apk.net> for information and testing.
 1.33 25-Oct-1997  briggs Handle interrupts on E-Machines Futura-SX. From Paul Goyette, PR 4348.
 1.32 09-Oct-1997  briggs branches: 1.32.2;
Clear interrupts properly on the Radius PrecisionColor 8.
Thanks for the info go to Andrew MacGibbon <andrew-m@cs.auckland.ac.nz>
 1.31 26-Sep-1997  briggs Add another Dayna card to the Apple-compa. list.
Define a constant for the SuperMac Spectrum/24 series III display card.
Thanks go to Luca Falzoni <falzoni@jetai.unipv.it> for trying out the
code for the Dayna ethernet support.
 1.30 15-Aug-1997  briggs Add interrupt handler for SuperMac GFX.
Tested by Kai-Yew Lum <kaiyewl@engin.umich.edu> back in May.
 1.29 14-Aug-1997  scottr Recognize the Sigma Designs ColorMax card, and handle the interrupt. Code
provided by Brian Foley <bfoley@gpo.iol.ie> via Allen Briggs, updated for
bus.h by me.
 1.28 15-Jul-1997  scottr branches: 1.28.2;
Add DrHw value for the Macintosh Display Card
 1.27 01-Jul-1997  scottr Add support for Portrait Video Card. From SUNAGAWA Keiki
<kei_sun@ba2.so-net.or.jp> in PR 3821.
 1.26 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.25 02-May-1997  briggs Thanks to Tobias Beal <tbeal41@maine.maine.edu>, we can clear interrupts
on at least one Radius Precisioncolor 8 board.
 1.24 01-May-1997  briggs Treat drhw 118 and 119 the same for Apple ethernet cards.
 1.23 01-May-1997  briggs Add in a couple more board types.
 1.22 10-Apr-1997  briggs Ignore SE/30 faux-video card.
 1.21 10-Apr-1997  briggs Comment video cards and add define for SuperMac Thunder/24.
 1.20 10-Apr-1997  briggs Changes from Bob Nestor to come closer to supporting his Apple SONIC-based
nubus card.
 1.19 01-Apr-1997  briggs Add DrHW for RasterOps CB264--From Scott Reynolds--and link it in to the
proper interrupt routine.
 1.18 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.17 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.16 19-Feb-1997  scottr Add a bus space tag field to nubus_attach_args
 1.15 17-Dec-1996  scottr branches: 1.15.6;
Define struct nubus_attach_args
 1.14 07-May-1996  briggs Get rid of some old, now meaningless macros.
 1.13 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.12 12-Jan-1996  briggs Patch to at least recognise FOCUS EtherLAN. From Erik Bertelson
<erik@sockdev.uni-c.dk>
 1.11 24-Sep-1995  briggs Add Technology Works ethernet card. From
Kazunari Nakamura <kazu@nkk.co.jp>.
 1.10 25-Aug-1995  briggs Add constants for CSI's communications card.
 1.9 30-Jul-1995  briggs Fix the internal video probe again.
 1.8 01-Jul-1995  briggs Fix buglet that was missed when converting nubus to non pa==va mapping.
 1.7 21-Jun-1995  briggs Make NUBUS_BASE_TO_SLOT and reverse not depend on VA==PA for NuBus.
Add constant for DRSW_FARALLON.
 1.6 05-May-1995  briggs Add some code/defines to differentiate Asante and Interlan/Gator cards
correctly with the new nubus code.
 1.5 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.4 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.15.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.28.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.2 01-Dec-1997  mellon Pull rev 1.34 up from trunk (briggs) (reviewed by mellon)
 1.32.2.1 26-Oct-1997  mellon Pull rev 1.33 up from trunk (briggs)
 1.10 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.9 12-Jan-1998  thorpej Update for changes to config.
 1.8 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.7 13-Feb-1997  scottr branches: 1.7.4;
Add hsk and drq locators, which will be used only by SCSI devices.
 1.6 11-Feb-1997  scottr Add a bus space tag field to obio_attach args, initialize it in
obio_search(), and use it in the ASC driver. Thanks to Jason for
pointing this out. Minor KNFing while I'm here.
 1.5 17-Dec-1996  scottr branches: 1.5.4;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.4 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_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  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.5.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.7.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.5 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.4 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.3 13-Feb-1997  scottr branches: 1.3.4;
Add hsk and drq locators, which will be used only by SCSI devices.
 1.2 11-Feb-1997  scottr Add a bus space tag field to obio_attach args, initialize it in
obio_search(), and use it in the ASC driver. Thanks to Jason for
pointing this out. Minor KNFing while I'm here.
 1.1 17-Dec-1996  scottr branches: 1.1.4;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.1.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 09-Apr-2025  nat branches: 1.2.4;
If the charge rate is zero we're not charging.
 1.1 03-Apr-2025  nat Add pbbat(4)

Now it is possible to monitor the PowerBook 1xx AC adaptors and battery via
envsys(4).
 1.2.4.2 02-Aug-2025  perseant Sync with HEAD
 1.2.4.1 09-Apr-2025  perseant file pbbat.c was added on branch perseant-exfatfs on 2025-08-02 05:55:50 +0000
 1.43 14-May-2025  nat Add sysctls for brightness control of PowerBook LCD screens.

Manual page description of these will be in a follow up commit.
 1.42 12-May-2025  nat Expose power manager type and defines.

These will be used by ascaudio(4) in future for setting up the Digitally
Filtered Audio Chip (dafc) on PowerBook 500 and similar.

NFCI.
 1.41 06-May-2025  nat Lessen the number of times a second the slider thread runs.

Four times a second is plenty and it's still nice and responsive.
 1.40 01-May-2025  nat Support the brightness slider on PowerBook 1xx series.
Update copyright.
 1.39 01-May-2025  nat Use the right location for powering off the PowerBook.

The previous location would only power off the computer if the AC adaptor was
connected.
 1.38 03-Apr-2025  nat Serialize pm requests.

Now with pbbat(4) added there is more than one caller to the power manager.
So serialize the requests with a lock.
 1.37 12-Jan-2025  nat Fix brightness controls on PowerBook 500 and similar.
 1.36 26-Sep-2024  riastradh mac68k/dev/pm_direct.c: Nix trailing whitespace.

No functional change intended.
 1.35 14-Sep-2024  nat Add support for the power button on the PowerBook 160/180.
 1.34 14-Sep-2024  nat Add support for poweroff on PowerBook 1xx.

This excludes the PowerBook 150 and 190, which are more similar to the 500
series.
 1.33 14-Sep-2024  nat Add support for brightness control on Powerbook 1xx.
 1.32 02-Jun-2024  andvar branches: 1.32.2;
fix various typos in word `interrupt', mainly in comments.
 1.31 26-Apr-2024  nat Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).

XXX pullup-10, pullup-9, pullup-8.
 1.30 21-Aug-2021  andvar branches: 1.30.4;
fix some more typos in comments/log messages, improve wording as well.
 1.29 25-Oct-2013  martin branches: 1.29.34;
Remove unused variables
 1.28 24-Jan-2007  hubertf branches: 1.28.82; 1.28.92; 1.28.98;
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.27 24-Dec-2005  perry branches: 1.27.20;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.26 11-Dec-2005  christos merge ktrace-lwp.
 1.25 28-Oct-2005  christos PR/31942: Hauke Fath: -current DEBUG kernel build fails because of gcc whining
 1.24 16-Jun-2005  jmc branches: 1.24.2; 1.24.4;
Shadowing and const fixes.
 1.23 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.22 15-Jul-2003  lukem __KERNEL_RCSID()
 1.21 03-Nov-2002  shiba branches: 1.21.6;
Support internal ADB keyboard of PowerBook 190,190cs.
The keyboard works fine now. I don't confirm working internal
ADB track pad.

But an internal IDE drive is not recognized, and
an internal SCSI host controller(sbc driver) don't work yet.
 1.20 30-May-2002  thorpej Don't use multi-line string literals.
 1.19 05-Mar-2002  shiba branches: 1.19.6;
Fix up a bug which PB150 shuts down when one boots up in progress.
PB150 will work with SCSI disk. But we cannot use an internal IDE
disk yet.

Reviewed by briggs
 1.18 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.17 16-Sep-2001  wiz branches: 1.17.4;
Grammar improvements in comments.
 1.16 16-Sep-2001  wiz Spell 'occurred' with two 'r's.
 1.15 27-Sep-2000  scottr branches: 1.15.2; 1.15.4;
The Duo ADB controller doesn't notify us that it needs to be polled
through the (emulated) VIA. Work around this problem by polling the
Power Manager chip directly. From Daishi Kato, PR 9852.
 1.14 03-Jul-2000  scottr Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.13 05-Apr-2000  scottr branches: 1.13.4;
Correct a pasto in pm_pmgrop_pm1(); while there were no negative side
effects, the place this code ended up couldn't have had any positive
effect, either.
 1.12 05-Apr-2000  scottr Correct a few instances where we returned from a function that
had set splhigh() but returned without restoring the previous spl.
The PowerBook keyboard works better, now, but still starts to flake
out pretty badly at 70+ wpm.
 1.11 19-Mar-2000  scottr Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.10 07-Nov-1999  scottr ite_polling -> adb_polling
 1.9 28-Jun-1999  briggs branches: 1.9.2; 1.9.4; 1.9.8;
Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.8 05-Mar-1999  scottr branches: 1.8.2; 1.8.4; 1.8.6;
Add the PowerBook 170 to what appears to be the correct
class of systems, based on the Apple dev notes for this system.
 1.7 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.6 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.5 29-Mar-1998  scottr Better integration of Power Manager IC ADB driver into the direct ADB driver framework,
from Takashi Hamada. Also includes a handler for unsolicited ADB
packets.
 1.4 23-Feb-1998  scottr Mostly KNF. There's still a bunch of ugly comments and some problems
with long lines, but this is at least a big step in the right direction.
 1.3 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.2 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.1 08-Apr-1997  scottr branches: 1.1.4;
Power Manager interface/driver, written by Takashi Hamada.
 1.1.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.6.1 01-Jul-1999  thorpej Sync w/ -current.
 1.8.4.1 21-Nov-1999  he Pull up revision 1.10 (requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.8.2.4 09-Nov-1999  scottr Sync with main branch.
 1.8.2.3 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.8.2.2 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.8.2.1 05-Mar-1999  scottr file pm_direct.c was added on branch scottr-mac68k-wscons on 1999-03-05 08:24:25 +0000
 1.9.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.4.1 15-Nov-1999  fvdl Sync with -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.13.4.2 28-Sep-2000  scottr Pull up rev 1.15 from scottr (approved by thorpej):
On the Duo, poll the Power Manager directly rather than waiting
for the VIA to indicate that the PM has data queued.
 1.13.4.1 21-Sep-2000  scottr Pull up rev 1.14 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.15.4.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.4.2 16-Mar-2002  jdolecek Catch up with -current.
 1.15.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.17.4.5 11-Nov-2002  nathanw Catch up to -current
 1.17.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.17.4.3 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.17.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.17.4.1 16-Sep-2001  nathanw file pm_direct.c was added on branch nathanw_sa on 2002-01-08 00:26:00 +0000
 1.19.6.1 14-Jul-2002  gehenna catch up with -current.
 1.21.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.21.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.21.6.1 03-Aug-2004  skrll Sync with HEAD
 1.24.4.1 02-Nov-2005  yamt sync with head.
 1.24.2.2 26-Feb-2007  yamt sync with head.
 1.24.2.1 21-Jun-2006  yamt sync with head.
 1.27.20.1 01-Feb-2007  ad Sync with head.
 1.28.98.1 18-May-2014  rmind sync with head
 1.28.92.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.28.82.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.29.34.1 11-May-2024  martin Pull up following revision(s) (requested by nat in ticket #1839):

sys/arch/mac68k/dev/pm_direct.c: revision 1.31

Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).
 1.30.4.1 11-May-2024  martin Pull up following revision(s) (requested by nat in ticket #686):

sys/arch/mac68k/dev/pm_direct.c: revision 1.31

Return early if PM data is not available.

This avoids random crashes on my Powerbook when using the mouse or keyboard.

The same was needed for the Powerbook 5xx/Duos (compile tested only).
 1.32.2.1 02-Aug-2025  perseant Sync with HEAD
 1.4 12-May-2025  nat Expose power manager type and defines.

These will be used by ascaudio(4) in future for setting up the Digitally
Filtered Audio Chip (dafc) on PowerBook 500 and similar.

NFCI.
 1.3 14-Sep-2024  nat Add support for poweroff on PowerBook 1xx.

This excludes the PowerBook 150 and 190, which are more similar to the 500
series.
 1.2 14-Sep-2024  nat Add support for brightness control on Powerbook 1xx.
 1.1 08-Apr-1997  scottr branches: 1.1.284;
Power Manager interface/driver, written by Takashi Hamada.
 1.1.284.1 02-Aug-2025  perseant Sync with HEAD
 1.6 28-Dec-1996  pk rename: ramdisk => md
 1.5 13-Oct-1996  christos backout previous kprintf change
 1.4 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.3 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 07-Mar-1996  leo Allow for a machine dependent match function - rd_match_hook()
 1.1 21-Nov-1995  briggs Add rd_root.c from sun3.
 1.70 24-May-2025  nat Should the transfer stop somewhere in the firt four bytes transferred,
make sure the count is correct.

NFCI.
 1.69 10-Mar-2025  nat Remove CHECKMORE.

This was a performance penalty and was found to be unnecessary as the root
cause of errors doing pdma interrupt xfers was addressed in an earlier commit.
 1.68 10-Mar-2025  nat Serialize pdma xfers.

The same is done for pdma interrupt xfers.
 1.67 22-Nov-2024  nat Make writing of dummy byte conditional.

This is insurance against devices that do not leave ACK hanging at the end of
each transfer.

Final part of PR kern/58452.
 1.66 22-Nov-2024  nat This delay is no longer necessary.

The delays throught the code were there to ensure error free transfers. This
has been fixed in an eariler commit today by serializing the drq interrupt.

Part of PR kern/58452.
 1.65 22-Nov-2024  nat No need any additional delay waiting for DREQ.

This results in utilites like time(1) reporting results closer to reality
when timing the transfer of data. With the added benefit that transfers are
slightly faster.

Part of PR kern/58452.
 1.64 22-Nov-2024  nat Serialize drq interrupt.

This results in error free transfers between disks.

Part of PR kern/58452.
 1.63 26-Oct-2024  nat Spinkle a little delay.

This was needed to ensure a reliable transfer of data.
 1.62 26-Oct-2024  nat Write an extra byte to handle the last ACK from 5380.

This was found from the example code in the NCR5380 Interface Manual.

This is not needed (but does not hurt) on the 53C80 and later.

This fixed many problems from stuck busy to phase mismatches when aborting
transfers and avoiding hard lockups of the scsi subsystem originating from
what I first thought were errors from the target device.

XXX pullup-9, pullup 10.

I will look next at the pdma_out function to do the same there.
 1.61 26-Oct-2024  nat Rework of previous.

While here set the priority in sync witho pdma_in/out.
Use sbc_ready same as pdma_in/out.
 1.60 14-Sep-2024  nat Use smaller size when sending PDMA data, and check that the next block can
be sent before sending it.

This fixes PDMA support (which previously has been flakey at best).

These changes provide maximum performance and importantly reliablity.

The lack of support for the PDMA intr should now be revisited on the PowerBook
5xx series (Unfortunately I don't have the hw to test with).

These changes have been tested on emulated (PiSCSI/BlueSCSI) and real hw.
 1.59 18-Feb-2023  nat branches: 1.59.6;
Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.
 1.58 18-Feb-2023  nat Honor the XS_CTL_POLL flag and fallback to polled io instead of PDMA.

As posted to tech-kern.
 1.57 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.56 29-Jun-2014  martin branches: 1.56.26; 1.56.28;
Remove an unused variable
 1.55 07-Dec-2012  hauke branches: 1.55.10;
Remove the R1 syntactic sugar, since it collides with a #define in
<m68k/regs.h>, breaking the build.

The R1s serve to bring the buffer pointer to a 4 byte boundary, but
that should be clear from the context.
 1.54 23-Nov-2009  rmind branches: 1.54.12; 1.54.22;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.53 04-Apr-2008  tsutsui branches: 1.53.4;
Split devict_t/softc for ncr5380sbc SCSI, and misc cosmetic changes.
 1.52 04-Mar-2007  christos branches: 1.52.40;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.51 04-Aug-2006  mhitch branches: 1.51.10;
gcc4 "uninitialized" variable; previous workaround doesn't satisfy gcc4 -
explicitly initialize drq.
 1.50 10-May-2006  skrll Fix a bunch of cast lvalues.
 1.49 17-Jan-2006  chs branches: 1.49.2; 1.49.4; 1.49.6; 1.49.8; 1.49.10;
add fault-protection in sbc_pdma_in() like in all the other PDMA functions.
fixes PR 9679.
 1.48 24-Dec-2005  perry branches: 1.48.2;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.47 11-Dec-2005  christos merge ktrace-lwp.
 1.46 16-Jun-2005  jmc branches: 1.46.2;
Fixes for volatile problems
 1.45 15-Jan-2005  chs branches: 1.45.8;
de-__P, remove register, ansify, b* -> mem*.
 1.44 15-Jul-2003  lukem __KERNEL_RCSID()
 1.43 03-May-2003  wiz branches: 1.43.2;
DMA, not dma nor Dma.
 1.42 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.41 18-Mar-2000  mycroft branches: 1.41.8; 1.41.12;
Add a ncr5380_attach() routine which does part of the initialization, attaches
the scsibus, and does the addref/delref dance.
 1.40 02-Nov-1999  scottr [Redo] Catch up with recent changes to scsipi flags. Closes PR 8675.
 1.39 17-Sep-1999  thorpej branches: 1.39.2; 1.39.4; 1.39.6;
Centralize the declaration and clearing of `cold'.
 1.38 19-Nov-1998  thorpej branches: 1.38.4;
Adapt to the new scsipi_adapter interface.
 1.37 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.36 04-Jul-1998  jonathan defopt DDB.
 1.35 17-Jan-1998  scottr We haven't needed a driver-specific minphys() for quite some time now.
 1.34 12-Jan-1998  thorpej Update for changes to config.
 1.33 06-Dec-1997  scottr PR 4078: Enabling the SCSI IRQ interrupt to allow reselects to work
causes the MI interrupt handler to barf when we get a 5380 RST interrupt
while probing. Worse, the VIA latches the interrupt, so simply having
all interrupts disabled during autoconfig doesn't resolve the problem.
[I demonstrated the latter on a IIci, which erroneously reports a
reselection attempt(!) after autoconfig is complete. The latched
interrupt results from the SCSI bus reset we do when initializing the
bus.]

Since interrupts must be enabled during autoconfig anyway (sigh), test
to see if autoconfig has completed in sbc_irq_intr(). If not, we don't
pass the interrupt up to the MI interrupt handler. Also, make sure to
clear the VIA interrupt if we're servicing an unclaimed 5380 RST
interrupt.

Thanks to Bill Studenmund for providing the key insight needed to unlock
this problem.
 1.32 10-Oct-1997  scottr branches: 1.32.2;
Remove advertising clause.
 1.31 06-Sep-1997  scottr Catch bus error in sbc_pdma_out() and panic with a reasonable
error message.
 1.30 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.29 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.28 30-Jun-1997  scottr branches: 1.28.2; 1.28.4;
Due to reliability problems on some models, back out the more radical of
the pc532/dev/ncr.c-inspired changes; in particular, wait for previous
transfer to complete before starting another, as we used to do. Retain
splbio() protection and simplified sbc_pdma_in().
 1.27 29-Jun-1997  scottr Update for mac68k_buserr_addr -> m68k_fault_addr change.
 1.26 13-May-1997  scottr Tweak sbc_drq_intr() (interrupt-driven PDMA interrupt handler); it
now works properly on at least some disks. Further testing is
necessary.
 1.25 28-Apr-1997  scottr Undo a hack added in the last overhaul (which caused an extraneous byte
to be written to the target). Also, use the sc_min_dma_len field
to determine whether to use PDMA or PIO.
 1.24 18-Apr-1997  scottr For small writes, use PIO rather than PDMA; this increases the reliability
of the driver (considerably, on some systems/targets).
 1.23 07-Apr-1997  scottr Rework PDMA read/write functions based on Matthias Pfaller's pc532 ncr
driver. Major highlights:

- Protect with splbio(), now that interrupts from the chip might be
enabled by default;
- Wait for current transfer to complete before returning, rather than
wait for previous transfer to complete before starting another;
- Instead of logging a "timeout" message when a target disconnects,
just return, letting the sbc_ready() and sbc_wait_not_req() print
timeout messages if such really did occur.

With interrupt changes to sbc_obio.c, disconnect/reselect now works if
configured into the kernel.
 1.22 01-Mar-1997  scottr Split bus-dependent autoconfig code from the driver. This allows for
the future addition of a Duo Dock front end.
 1.21 28-Feb-1997  scottr Convert to generalized VIA interrupt registration
 1.20 26-Feb-1997  gwr Minimal changes to adapt to removal of NCR5380_PERMIT_RESELECT.
This driver should be updated to allow per-target control over
disconnect/reselect, but I will leave that to the port masters.
 1.19 24-Feb-1997  scottr Update copyright and license.
 1.18 20-Jan-1997  scottr branches: 1.18.4;
#ifdef out write hack, and fix possible uninitialized variable.
 1.17 07-Jan-1997  scottr Fix typo in last: cf->cf_unit -> sc->dv.dv_unit
 1.16 05-Jan-1997  scottr Add basic support for a Duo dock SCSI controller, from Daishi Kato.

XXX - This could probably be improved if all docking hardware has a
NuBus declaration ROM that we can get to. This should be investigated
further.
 1.15 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.14 13-Nov-1996  thorpej Use bitmask_snprintf().
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 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.10 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.9 19-Jun-1996  scottr Update some comments, and the copyright
 1.8 11-Jun-1996  scottr Deal with interrupt flags more carefully, and use the correct offset
for PB500-series SCSI I/O. While I'm here, update the copyright.
 1.7 29-May-1996  scottr - Simplify writes in sbc_drq_intr().
- When finished writing, if the SCSI bus has BSY asserted, write another
byte to the SBC to ensure we get an interrupt.
- Unflag SCSI interrupts on the VIA whenever we clear the interrupts
on the SBC itself.
 1.6 08-May-1996  scottr branches: 1.6.4;
Remove some gross hacks that were added due to interrupt grossness that
has been partially fixed. Also, add a new flag (which rearranges them
a bit, unfortunately) to use PDMA for polled transfers.
 1.5 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.4 30-Apr-1996  scottr Kill unused variables and fix prototypes.
 1.3 30-Apr-1996  scottr - Drop SCSI IRQ interrupts if we are already handling one. This works around
a condition that occurs with some slow SCSI devices when they disconnect
(e.g. the AppleCD 600), generating spurious selection interrupts.
- Reorganize the debugging code slightly.
 1.2 25-Apr-1996  scottr Ooops. ncr_sbcreg.h -> sbcreg.h
 1.1 25-Apr-1996  scottr Renamed these files.
 1.6.4.2 20-Jun-1996  jtc Pulled up from revision 1.9 by request of Scott Reynolds.
Updates copyright/licence and comments. No code changes.
 1.6.4.1 11-Jun-1996  scottr Pull up from trunk:
>Deal with interrupt flags more carefully, and use the correct offset
>for PB500-series SCSI I/O. While I'm here, update the copyright.
 1.18.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.28.4.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.2 14-Aug-1997  bouyer Sync with trunk.
 1.28.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.32.2.4 29-Jan-1998  mellon Pull up 1.34 (scottr)
 1.32.2.3 09-Dec-1997  thorpej Sync w/ trunk: fix potential hang during autoconfig. (scottr)
 1.32.2.2 19-Nov-1997  mellon DEBUG -> SBC_DEBUG (scottr)
 1.32.2.1 18-Nov-1997  mellon Undo parts of 1.23 to fix autoconfig hangs on some Macs. Not on trunk - trunk version is more correct. (scottr)
 1.38.4.3 16-Nov-1999  scottr Pull up the version from the trunk; some changes crept in that ought not
to have been committed.
 1.38.4.2 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.38.4.1 16-May-1999  scottr Sync with main branch.
 1.39.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.39.4.1 15-Nov-1999  fvdl Sync with -current
 1.39.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.41.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.41.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.43.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.43.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.43.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.43.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.43.2.1 03-Aug-2004  skrll Sync with HEAD
 1.45.8.1 30-Jan-2006  tron Pull up following revision(s) (requested by chs in ticket #1146):
sys/arch/mac68k/dev/sbc.c: revision 1.49
add fault-protection in sbc_pdma_in() like in all the other PDMA functions.
fixes PR 9679.
 1.46.2.3 03-Sep-2007  yamt sync with head.
 1.46.2.2 30-Dec-2006  yamt sync with head.
 1.46.2.1 21-Jun-2006  yamt sync with head.
 1.48.2.1 01-Feb-2006  yamt sync with head.
 1.49.10.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.49.8.1 11-May-2006  elad sync with head
 1.49.6.2 11-Aug-2006  yamt sync with head
 1.49.6.1 24-May-2006  yamt sync with head.
 1.49.4.1 01-Jun-2006  kardel Sync with head.
 1.49.2.1 09-Sep-2006  rpaulo sync with head
 1.51.10.1 12-Mar-2007  rmind Sync with HEAD.
 1.52.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.53.4.1 11-Mar-2010  yamt sync with head
 1.54.22.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.54.22.1 25-Feb-2013  tls resync with head
 1.54.12.1 16-Jan-2013  yamt sync with (a bit old) head
 1.55.10.1 10-Aug-2014  tls Rebase.
 1.56.28.1 10-Jun-2019  christos Sync with HEAD
 1.56.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.59.6.1 02-Aug-2025  perseant Sync with HEAD
 1.8 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.7 16-Dec-1997  scottr Don't enable interrupts unless we are using reselect or interrupt-
driven PDMA modes.
 1.6 10-Oct-1997  scottr branches: 1.6.2;
Remove advertising clause.
 1.5 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.4 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.3 07-Apr-1997  scottr branches: 1.3.2; 1.3.4;
Always enable SCSI IRQ interrupt; the SBC_INTR flag now controls only
the SCSI DRQ interrupt, for "blind" transfers.
 1.2 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 01-Mar-1997  scottr branches: 1.1.2;
Split bus-dependent autoconfig code from the driver. This allows for
the future addition of a Duo Dock front end.
 1.1.2.2 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.1.2.1 01-Mar-1997  is file sbc_obio.c was added on branch is-newarp on 1997-03-12 15:08:48 +0000
 1.3.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.2.2 14-Aug-1997  bouyer Sync with trunk.
 1.3.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.6.2.1 17-Dec-1997  mellon Pull rev 1.7 up from trunk (scottr)
 1.2 01-Mar-1997  scottr Split bus-dependent autoconfig code from the driver. This allows for
the future addition of a Duo Dock front end.
 1.1 25-Apr-1996  scottr branches: 1.1.8;
Renamed these files.
 1.1.8.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.15 22-Nov-2024  nat Serialize drq interrupt.

This results in error free transfers between disks.

Part of PR kern/58452.
 1.14 22-Jan-2024  nat branches: 1.14.2;
Missing '\'

Many thnanks rillig@

XXX-pullup10.
 1.13 18-Feb-2023  nat Introduce a flag to disable PDMA when writing.

The use of pdma when writing would always cause a panic on my Powerbook 160,
possibly others as well.

As posted to tech-kern.
 1.12 11-Dec-2005  christos merge ktrace-lwp.
 1.11 05-Mar-2005  chs remove some more __P that I missed before.
 1.10 15-Jan-2005  chs branches: 1.10.2; 1.10.4;
de-__P, remove register, ansify, b* -> mem*.
 1.9 18-Mar-2000  mycroft branches: 1.9.28;
Add a ncr5380_attach() routine which does part of the initialization, attaches
the scsibus, and does the addref/delref dance.
 1.8 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.7 22-Dec-1998  scottr branches: 1.7.2; 1.7.10;
vm_offset_t -> {paddr_t, vaddr_t}
 1.6 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.5 04-Jul-1998  jonathan defopt DDB.
 1.4 10-Oct-1997  scottr Remove advertising clause.
 1.3 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.2 15-Mar-1997  is branches: 1.2.2; 1.2.4;
New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 01-Mar-1997  scottr branches: 1.1.2;
Split bus-dependent autoconfig code from the driver. This allows for
the future addition of a Duo Dock front end.
 1.1.2.2 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.1.2.1 01-Mar-1997  is file sbcvar.h was added on branch is-newarp on 1997-03-12 15:08:50 +0000
 1.2.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.7.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.7.2.1 16-May-1999  scottr Sync with main branch.
 1.9.28.2 08-Mar-2005  skrll Sync with HEAD.
 1.9.28.1 17-Jan-2005  skrll Sync with HEAD.
 1.10.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.10.2.1 29-Apr-2005  kent sync with -current
 1.14.2.1 02-Aug-2025  perseant Sync with HEAD
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.21 06-May-1996  briggs This code has not been used in ages and there are at least 2 better 5380
drivers in the tree, now.
 1.20 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.19 03-Sep-1995  briggs Note that this is now an obsolete driver.
 1.18 12-Aug-1995  mycroft minphys() functions really should return void.
 1.17 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.16 04-Jul-1995  briggs A few nits.
 1.15 21-Jun-1995  briggs Clean up I/O base settings a bit.
 1.14 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.13 20-Apr-1995  briggs Update to use softc better and handle mainbus being indirect.
 1.12 01-Feb-1995  briggs Set sc_link->openings.
Simplification of scsi_cmd from pc532 mods to this driver.
 1.11 15-Jan-1995  briggs Update for scsi changes. Incl. xs->resid = 0 (thanks Phil).
Changes compile, but are not tested.
 1.10 03-Dec-1994  briggs Remove private delay() and clean up some odd delay times that we were
using...
 1.9 29-Nov-1994  briggs "../scsi/*.h" -> <scsi/*.h>
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 10-Jul-1994  briggs Be somewhat better at machine dependence.
 1.6 26-Jun-1994  briggs branches: 1.6.2;
Add some support for the '040 macs which use a different scsi chip. The
scsi96 driver is just a skeleton at the moment.
 1.5 30-Jan-1994  briggs Change to support config.new and magnum-esque scsi code. Works much
more nicely.
 1.4 15-Jan-1994  briggs Put lun in CDB. Is there be a way to determine when this is really
necessary? (It is for some drives).
 1.3 15-Dec-1993  briggs Add (semi-bogus?) test to scsi_gen to handle luns in test unit ready
commands. W/o this test, some old drives were being identified at
all luns... Also some cleanup and spelling corrections ;-)
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.6.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.22 15-Nov-1996  briggs Remove scsi96 driver.
 1.21 13-Oct-1996  christos backout previous kprintf change
 1.20 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.19 28-Aug-1996  cgd (1) set scsi_link channel to either the appropriate channel (if a
multi-channel driver), or to SCSI_CHANNEL_ONLY_ONE if a
single-channel driver.
(2) use scsiprint() rather than a locally-defined autoconfig print
function, and kill any locally-defined print function.
 1.18 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.17 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.16 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.15 24-Mar-1996  briggs Get rid of a compiler warning about Debugger();
 1.14 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.13 14-Aug-1995  briggs Always fail when probed--until this driver works.
 1.12 12-Aug-1995  mycroft minphys() functions really should return void.
 1.11 24-Jul-1995  cgd update SCSI minphys routines' definitions to match standard minphys()
definition and usage.
 1.10 04-Jul-1995  briggs Update a bit.
 1.9 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.8 15-Jan-1995  briggs Update for scsi changes. Incl. xs->resid = 0 (thanks Phil).
Changes compile, but are not tested.
 1.7 03-Dec-1994  briggs Get rid of private delay().
 1.6 29-Nov-1994  briggs "../scsi/*.h" -> <scsi/*.h>
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 21-Jul-1994  briggs Put in a warning message that the driver is non-working and checkpoint
with a little bit more debugging stuffage.
 1.3 10-Jul-1994  briggs Be somewhat better at machine dependence.
 1.2 08-Jul-1994  briggs Just a checkpoint. Still not close to working, but TUR works--more docs
coming today...
 1.1 26-Jun-1994  briggs branches: 1.1.2;
Add some support for the '040 macs which use a different scsi chip. The
scsi96 driver is just a skeleton at the moment.
 1.1.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.4 02-May-1998  scottr Dead, unused, kaput.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.39 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.38 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.37 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.36 06-Mar-1996  briggs Fix for serial console handling from Bill Studenmund.
 1.35 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.34 12-Jan-1996  briggs Fixes from PR #1931 w/ minor mod in vm_machdep.c
 1.33 11-Jan-1996  briggs Move splzs to spl4 from splhigh. Really same difference...
 1.32 13-Dec-1995  briggs Remove printf() that I forgot about.
 1.31 13-Dec-1995  briggs Update from Bill Studenmund <wrstuden@loki.stanford.edu> with some minor
cleanup from me. Now supports serial console.
 1.30 09-Oct-1995  briggs Port of Sun3/Sparc zs driver from wrstuden@loki.stanford.edu
(Bill Studenmund). Should be massaged into machine independence
for 1.2.
 1.29 11-Aug-1995  briggs The serial console works again (at least on the Q700).
 1.28 11-Aug-1995  briggs Note that we've been initialized.
 1.27 11-Aug-1995  briggs Do the serial console a bit better (still has problems).
 1.26 28-Jun-1995  cgd note that most of dev/ic's contents have changed names
 1.25 21-Jun-1995  briggs Clean up I/O base settings a bit.
 1.24 09-Jun-1995  briggs "Always compile before you commit."
 1.23 08-Jun-1995  briggs In the interrupt routine, bail out if we've not been initialized, yet.
 1.22 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.21 20-Apr-1995  briggs Add a sertty() and update to use ser_softc instead of a bunch of arrays
everywhere.
 1.20 12-Apr-1995  briggs Fix typo from last changes.
 1.19 11-Apr-1995  mycroft Use global 8530 defs.
 1.18 08-Apr-1995  briggs Back to previous version of the serial driver until we can figure out
why the new one gets a lot of overflows and doesn't work on the IIsi
or IIvx at all.
 1.17 11-Feb-1995  briggs Many changes and updates from Dave Leonard (d@fnarg.net.au) and
Brad Parker (brad@fcr.com). I've been sitting on these for a while.
Notes from Dave:
redocumented z8530 stuff.
Added break ioctls and detection.
Pass framing/parity errors to line discipline.
Added TIOC[SG]FLAG.
Attempt at bringing all chip ops together.
deepended s/w fifos to match chip's.
 1.16 29-Nov-1994  briggs Boolean goof. (True)
 1.15 03-Nov-1994  briggs Modify the serial port initialization slightly so it works on the IIsi.
 1.14 26-Oct-1994  cgd new RCS ID format.
 1.13 30-Sep-1994  briggs Change strategy slightly so that serial console is enabled if internal
console is not--regardless of the value of the boot-time flag.
Suggested by a question from bit@gnu.ai.mit.edu (jim howard - bit.map).
 1.12 29-Sep-1994  briggs Actually implement serial boot (console) echo (minor change to ite.c).
Remove some old junk in ser.c and implement serial console and serial
boot echo (if serial console's enabled, clear echo).
 1.11 05-Aug-1994  briggs Lots of cleanup. Add functions for serial console--just stubs for now.
Fix initialization (for good this time?).
Little things.
 1.10 21-Jul-1994  briggs Make "unknown ioctl" printf ifdef DEBUG and take out an extra comma from
the format string.
 1.9 21-Jul-1994  briggs Separate init from serattach and make more machine independent by
calculating speed during init (different models of macs feed SCC with
different clocks).
 1.8 10-Jul-1994  briggs Be somewhat better at machine dependence.
 1.7 09-Jul-1994  briggs Move a function here from the old console.c.
 1.6 26-Jun-1994  briggs branches: 1.6.2;
Change some default constants--might be overridden during boot, but
correct for MacII-class.
 1.5 10-Feb-1994  briggs ioctl now takes struct proc *.
 1.4 30-Jan-1994  briggs Fixup includes and prototype stuff. Still need to go back and put in
old-style function headers to be pedantic.
 1.3 10-Jan-1994  briggs Update grf.h to increment a number of devices when it configures.
Fix a small bug in serial.
Both from Brad, Lawrence, and/or Mike.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.6.2.3 29-Sep-1994  cgd from trunk, per briggs.
 1.6.2.2 05-Aug-1994  mycroft update from trunk
 1.6.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.10 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.9 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.8 11-Apr-1995  mycroft Use global 8530 defs.
 1.7 08-Apr-1995  briggs Back to previous version of the serial driver until we can figure out
why the new one gets a lot of overflows and doesn't work on the IIsi
or IIvx at all.
 1.6 11-Feb-1995  briggs Many changes and updates from Dave Leonard (d@fnarg.net.au) and
Brad Parker (brad@fcr.com). I've been sitting on these for a while.
Notes from Dave:
redocumented z8530 stuff.
Added break ioctls and detection.
Pass framing/parity errors to line discipline.
Added TIOC[SG]FLAG.
Attempt at bringing all chip ops together.
deepended s/w fifos to match chip's.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 10-Jul-1994  briggs Be somewhat better at machine dependence.
 1.3 26-Jun-1994  briggs branches: 1.3.2;
Let's not hard-code constants, OK?
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.3 15-Dec-1993  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.4 20-Oct-1997  scottr Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.3 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.2 01-Feb-1996  mycroft LOCORE -> _LOCORE
 1.1 09-Oct-1995  briggs Port of Sun3/Sparc zs driver from wrstuden@loki.stanford.edu
(Bill Studenmund). Should be massaged into machine independence
for 1.2.
 1.4 20-Oct-1997  scottr Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.3 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.2 26-Aug-1996  scottr branches: 1.2.10;
After servicing an interrupt, check to see that there's not another
one pending before we clear the interrupt flag. This avoids a condition
where the line appears to go catatonic (which is particularly easily
triggered by pppd). From Bill Studenmund <wrstuden@loki.stanford.edu>.
XXX - we should probably log this if it gets excessive.
 1.1 18-May-1996  briggs branches: 1.1.4;
Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.1.4.1 05-Sep-1996  jtc Pulled up rev 1.2 by request from Scott Reynolds
 1.2.10.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3 20-Oct-1997  scottr Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.2 15-Oct-1996  scottr Critical fix from Bill Studenmund: if CTS is deasserted and then
immediately reasserted before we get a chance to process the interrupt,
we can inadvertantly get stuck with zs_tx_stopped set. Move the delta
detection to the hard zs interrupt handler; the softint handler
will notice that something has happened with CTS and restart the
transmitter if it's asserted.
 1.1 18-May-1996  briggs branches: 1.1.4;
Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.1.4.1 05-Dec-1996  rat Patch supplied by Scott Reynolds <scottr@NetBSD.ORG>

>The following patch corrects a mac68k zs bug corresponding to Gordon's
>MI zs changes submitted for patch 1. Specifically, output may fail to
>restart if we get multiple status interrupts before the "software
>interrupt" routine gets a chance to run.
>
>Bill Studenmund noticed this and submitted the original fix.
 1.14 20-Oct-1997  scottr Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.13 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.12 23-Jul-1997  scottr branches: 1.12.2;
Since spltty() will not lower the spl, only raise it, we need to
use splx() to undo the effect of the splzs() in zstty_softint().
 1.11 17-Jul-1997  jtk use locator defines in "locators.h" to index cf_loc[]
 1.10 18-Dec-1996  scottr Work around another gcc initialization warning.
 1.9 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.8 15-Oct-1996  scottr Critical fix from Bill Studenmund: if CTS is deasserted and then
immediately reasserted before we get a chance to process the interrupt,
we can inadvertantly get stuck with zs_tx_stopped set. Move the delta
detection to the hard zs interrupt handler; the softint handler
will notice that something has happened with CTS and restart the
transmitter if it's asserted.
 1.7 13-Oct-1996  christos backout previous kprintf change
 1.6 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.5 16-Sep-1996  scottr Move check for ZS_HWFLAG_CONABRT to zs_abort().
 1.4 02-Sep-1996  mycroft tty stop functions really should return void, not int, and certainly not both.
 1.3 01-Jun-1996  scottr Add tty_attach() as appropriate (for pstat -t)
 1.2 23-May-1996  briggs Fix from Bill Studenmund to set flags sanely on serial console.
 1.1 18-May-1996  briggs branches: 1.1.4;
Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.1.4.4 05-Dec-1996  rat Patch supplied by Scott Reynolds <scottr@NetBSD.ORG>

>The following patch corrects a mac68k zs bug corresponding to Gordon's
>MI zs changes submitted for patch 1. Specifically, output may fail to
>restart if we get multiple status interrupts before the "software
>interrupt" routine gets a chance to run.
>
>Bill Studenmund noticed this and submitted the original fix.
 1.1.4.3 03-Jun-1996  scottr Back out previous change; we now have new tty stats code.
 1.1.4.2 02-Jun-1996  scottr My mistake; we're not yet ready for tty_attach() on this branch.
 1.1.4.1 01-Jun-1996  scottr Pull up version 1.2 from the main branch
 1.12.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2 20-Oct-1997  scottr Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.1 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.63 23-Sep-2023  andvar some whitespace cleanup for debug printf calls.
 1.62 23-Sep-2023  andvar change zsprintf to printf. It was defined as printf in include/z8530var.h
up to rev 1.4, then removed with conversion to MI 8530 SCC driver back in 1997.

Fixes build with ZSMACDEBUG option enabled for mac68k and macppc.
 1.61 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.60 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.59 24-Apr-2021  thorpej branches: 1.59.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.58 27-Oct-2009  snj branches: 1.58.78;
Drop 3rd and 4th clauses. Approved by gwr@ and wrstuden@ (copyright
holders).
 1.57 18-Mar-2009  cegger Ansify function definitions w/o arguments. Generated with sed.
 1.56 29-Mar-2008  tsutsui branches: 1.56.4; 1.56.12; 1.56.18;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.55 03-Dec-2007  ad branches: 1.55.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.54 09-Nov-2007  ad Call zs_lock_init() to set up the chanstate's lock.
 1.53 08-Mar-2007  tsutsui branches: 1.53.2; 1.53.18; 1.53.20; 1.53.24; 1.53.26;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.52 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.51 24-Nov-2006  wiz branches: 1.51.4;
s/independant/independent/, from Zafer.
 1.50 28-Mar-2006  thorpej branches: 1.50.8; 1.50.10;
Use device_unit().
 1.49 11-Dec-2005  christos branches: 1.49.4; 1.49.6; 1.49.8; 1.49.10; 1.49.12;
merge ktrace-lwp.
 1.48 16-Jun-2005  jmc branches: 1.48.2;
Fixes for volatile problems
 1.47 16-Jan-2005  chs branches: 1.47.2;
only match one instance (instead of an unlimited number).
simplify by not pretending that mac68k can have more than 1 zsc.
 1.46 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.45 14-Dec-2004  christos Move the definition of sccA from zc.c to machdep.c and always initialize it.
This way we save a mess of #ifdefs. XXX: This code is disgusting. Drivers
should not communicate with the rest of the kernel by means of global variables.
 1.44 04-Dec-2003  keihan netbsd.org -> NetBSD.org

All "netbsd.org" is now gone from src/sys/arch.
 1.43 15-Jul-2003  lukem __KERNEL_RCSID()
 1.42 28-Jan-2003  pk branches: 1.42.2;
Provide locking required by the interrupt handlers running at IPL_SERIAL.
 1.41 06-Jan-2003  wiz interrupt with two rs.
 1.40 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.39 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.38 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.37 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.36 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.35 17-Mar-2002  atatat branches: 1.35.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.34 19-Jun-2001  wiz branches: 1.34.2; 1.34.4; 1.34.8;
`existent', not `existant'
 1.33 25-Jun-2000  wrstuden branches: 1.33.2;
Fix logic bug which would keep PPS from working. Noticed by:

Charles Carvalho <carvalho@cisco.com>
 1.32 02-Nov-1999  scottr branches: 1.32.6;
[Redo] Allow rates higher than 57600, per PR 8070. Change originally
from Bill Studenmund.
 1.31 27-Mar-1999  wrstuden branches: 1.31.2; 1.31.8; 1.31.10; 1.31.12;
Enable pps support, only if CLOCAL set & MDMBUF clear and no clock present.
 1.30 23-Mar-1999  wrstuden Oops. mac68k does NOT use PCLK as a clock source, so don't enable it in
the default channel setup.
 1.29 11-Feb-1999  mycroft branches: 1.29.2;
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.28 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.27 22-Oct-1998  scottr Defopt ALTXBUTTONS, DISABLE_EXT_CACHE, and ZS_CONSOLE_ABORT.
 1.26 10-Sep-1998  scottr Use correct devices for zs driver on AVs. From Dave Huang (PR 6107).
 1.25 12-Aug-1998  scottr A simple, obvious optimization, now that the loop has been
removed from zshard(). Pointed out by Bill Studenmund.
 1.24 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.23 04-Jul-1998  jonathan defopt DDB.
 1.22 02-Jul-1998  wrstuden Fixup last revision to zs.c. Keep a lot of the comment cleanup, and
keep the explicit clearing of interupts in zscnprobe.
 1.21 30-Jun-1998  wrstuden Overkill patches to make serial console work again. Should also make
serial echo work, but not sure. Tested by Paul Goyette.

A few of these changes can probably be backed out, but I'm not sure which.
This part should work for now, and get things going again. These fixes
should also get rid of the problem of things crashing just as zstty0 gets
configured.
 1.20 05-May-1998  scottr Add the remaining kgdb pieces from sun3/hp300, with some mac68k-specific
adjustments to initialization.
 1.19 12-Jan-1998  thorpej Update for changes to config.
 1.18 16-Dec-1997  wrstuden Add initialization code for cs_wr5_dtr as the M.I. layer now tests
it in initializing during autoconfig. Similar to sys/arch/sun3/dev/zs.c
revision 1.47. Ought to fix hangs at first tty access reported by
Johnny Lam, <jlbg+@andrew.cmu.edu>.
 1.17 06-Dec-1997  scottr Shades of rev 1.13: Really, we shouldn't call Debugger() if we
haven't got ddb in the kernel. Fixes PR 4632.
 1.16 02-Nov-1997  mycroft Set rr0_dcd.
Don't set DCD_IE and CTS_IE here; let the MI code do it.
Handle MDMBUF.
 1.15 20-Oct-1997  scottr branches: 1.15.2;
Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.14 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.13 15-Jun-1997  scottr branches: 1.13.4;
Don't call Debugger() if we don't have ddb. Fixes PR 3744.
 1.12 18-Dec-1996  scottr Work around another bogus uninitialized warning, and fix a legitimate one.
Clearly mark the former.

XXX The bogus warnings show up with -O, but not -O2. Unfortunately,
NetBSD/mac68k can't (yet) use -O2.
 1.11 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 16-Sep-1996  scottr Somehow the last change got mangled. Do over.
 1.7 16-Sep-1996  scottr - Add a ZS_CONSOLE_ABORT option to enable a serial console break to
force a drop to the system debugger. WARNING: this used to be the
default behavior! Modify custom kernel configs accordingly.
- Check for ZS_HWFLAG_CONABRT in zs_abort(), and don't abort if it's
not set.
 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 09-Jun-1996  briggs Add machine/viareg for prototype of via_set_modem().
 1.4 07-Jun-1996  briggs Changes from Bill Studenmund to support external clocks on the modem port.
 1.3 07-Jun-1996  briggs Patches from Bill Studenmund to get serial default settings from the booter.
 1.2 23-May-1996  briggs Change the console banner message.
 1.1 18-May-1996  briggs branches: 1.1.4;
Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.1.4.4 09-Jun-1996  briggs Bring #include <machine/viareg.h> from trunk for via_set_modem() prototype.
 1.1.4.3 07-Jun-1996  briggs Pull up changes from trunk. Console fix and external serial clock support.
 1.1.4.2 07-Jun-1996  briggs Bring in last changes from -current. ADB fixes for MacTV and serial state
from the booter.
 1.1.4.1 01-Jun-1996  scottr Pull up version 1.2 from the main branch.
 1.13.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.15.2.3 17-Dec-1997  mellon Pull rev 1.18 up from trunk (scottr)
 1.15.2.2 09-Dec-1997  thorpej Sync w/ trunk: Make it work without DDB (scottr)
 1.15.2.1 04-Nov-1997  mellon Pull rev 1.16 up from trunk (mycroft)
 1.29.2.2 02-Nov-1999  scottr [Redo] Sync with main branch.
 1.29.2.1 16-May-1999  scottr Sync with main branch.
 1.31.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.31.10.1 15-Nov-1999  fvdl Sync with -current
 1.31.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.31.2.2 27-Jun-2000  he Pull up revision 1.33 (requested by wrstuden):
Correct a bug in handling of CLOCAL and MDMBUF flags.
 1.31.2.1 20-Nov-1999  he Pull up revision 1.32 (requested by wrstuden):
Allow rates higher than 57600, fixing PR#8070
 1.32.6.1 03-Jul-2000  thorpej Pull up rev. 1.33:
Fix logic bug which would keep PPS from working. Noticed by:

Charles Carvalho <carvalho@cisco.com>
 1.33.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.34.8.6 07-Jan-2003  thorpej Sync with HEAD.
 1.34.8.5 03-Jan-2003  thorpej Sync with HEAD.
 1.34.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.34.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.34.8.2 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.34.8.1 19-Jun-2001  nathanw file zs.c was added on branch nathanw_sa on 2002-04-01 07:40:49 +0000
 1.34.4.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.34.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.34.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.35.4.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.42.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.42.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.42.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.42.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.42.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.42.2.1 03-Aug-2004  skrll Sync with HEAD
 1.47.2.2 16-Jan-2005  chs only match one instance (instead of an unlimited number).
simplify by not pretending that mac68k can have more than 1 zsc.
 1.47.2.1 16-Jan-2005  chs file zs.c was added on branch kent-audio2 on 2005-01-16 00:33:00 +0000
 1.48.2.5 07-Dec-2007  yamt sync with head
 1.48.2.4 15-Nov-2007  yamt sync with head.
 1.48.2.3 03-Sep-2007  yamt sync with head.
 1.48.2.2 30-Dec-2006  yamt sync with head.
 1.48.2.1 21-Jun-2006  yamt sync with head.
 1.49.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.49.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.49.8.1 01-Apr-2006  yamt sync with head.
 1.49.6.1 22-Apr-2006  simonb Sync with head.
 1.49.4.1 09-Sep-2006  rpaulo sync with head
 1.50.10.1 10-Dec-2006  yamt sync with head.
 1.50.8.1 12-Jan-2007  ad Sync with head.
 1.51.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.53.26.2 08-Dec-2007  mjf Sync with HEAD.
 1.53.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.53.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.53.20.1 09-Jan-2008  matt sync with HEAD
 1.53.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.53.18.1 11-Nov-2007  joerg Sync with HEAD.
 1.53.2.1 03-Dec-2007  ad Sync with HEAD.
 1.55.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.56.18.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.56.12.1 28-Apr-2009  skrll Sync with HEAD.
 1.56.4.2 11-Mar-2010  yamt sync with head
 1.56.4.1 04-May-2009  yamt sync with head.
 1.58.78.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.59.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 16-Jan-2005  chs branches: 1.3.2;
only match one instance (instead of an unlimited number).
simplify by not pretending that mac68k can have more than 1 zsc.
 1.2 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.1 05-May-1998  scottr branches: 1.1.50;
Add the remaining kgdb pieces from sun3/hp300, with some mac68k-specific
adjustments to initialization.
 1.1.50.1 17-Jan-2005  skrll Sync with HEAD.
 1.3.2.2 16-Jan-2005  chs only match one instance (instead of an unlimited number).
simplify by not pretending that mac68k can have more than 1 zsc.
 1.3.2.1 16-Jan-2005  chs file zs_cons.h was added on branch kent-audio2 on 2005-01-16 00:33:00 +0000
 1.12 24-Oct-2023  andvar apply similar changes between different archs/machines for zs_kgdb.c:
1) adjust zs_kgdb_init tty attachment message for kgdb_dev type change.
(one arch uses cast to int instead, but kept one approach for consistency)
2) remove unused rr0 declaration and assignment in zs_kgdb_txint()
3) adjust kgdb_dev format specifier to %llx/d if needed.
4) add const for zs_kgdb_devname declaration (macppc only).
should fix zs_kgdb.c build for all these ports.
 1.11 28-Apr-2008  martin branches: 1.11.68; 1.11.78;
Remove clause 3 and 4 from TNF licenses
 1.10 17-Oct-2007  garbled branches: 1.10.16; 1.10.18; 1.10.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.9 23-Jun-2007  hauke branches: 1.9.10;
Fix a warning from gcc 4 about stripping the volatile qualifier by a cast
by doing the proper __UNVOLATILE() dance.
 1.8 11-Dec-2005  christos branches: 1.8.30; 1.8.32; 1.8.38;
merge ktrace-lwp.
 1.7 16-Jan-2005  chs branches: 1.7.2; 1.7.10;
simplify by not pretending that mac68k can have more than 1 zsc.
 1.6 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.5 16-Jun-2004  briggs Make sure kernels with KGDB enabled will compile properly.
Apply patch from Hauke Fath in PR port-mac68k/25678.
 1.4 15-Jul-2003  lukem branches: 1.4.2;
__KERNEL_RCSID()
 1.3 06-Sep-2002  gehenna branches: 1.3.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.2 03-Feb-1999  mycroft branches: 1.2.24; 1.2.28; 1.2.36;
Don't set DCD_IE in the frontends. KGDB doesn't even use DCD, and the tty
frontends get it from zsparam() anyway.
 1.1 05-May-1998  scottr Add the remaining kgdb pieces from sun3/hp300, with some mac68k-specific
adjustments to initialization.
 1.2.36.1 19-May-2002  gehenna Replace the access to devsw table and the hard-coded majors with devsw API.
 1.2.28.1 17-Sep-2002  nathanw Catch up to -current.
 1.2.24.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.3.6.4 17-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.2.1 17-Jun-2004  tron Pull up revision 1.5 (requested by briggs in ticket #500):
Make sure kernels with KGDB enabled will compile properly.
Apply patch from Hauke Fath in PR port-mac68k/25678.
 1.7.10.1 03-Sep-2007  yamt sync with head.
 1.7.2.2 16-Jan-2005  chs simplify by not pretending that mac68k can have more than 1 zsc.
 1.7.2.1 16-Jan-2005  chs file zs_kgdb.c was added on branch kent-audio2 on 2005-01-16 00:33:44 +0000
 1.8.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.8.32.1 11-Jul-2007  mjf Sync with head.
 1.8.30.1 15-Jul-2007  ad Sync with head.
 1.9.10.1 06-Nov-2007  matt sync with HEAD
 1.10.20.1 16-May-2008  yamt sync with head.
 1.10.18.1 18-May-2008  yamt sync with head.
 1.10.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.11.78.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.11.68.1 20-Jul-2016  pgoyette Adapt the machine/arch dependent code to the new {b,c}devsw reference
counting.

XXX Most of these will require testing by someone other than myself, as
I have a limited selection of hardware!
 1.3 20-Oct-1997  scottr Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.2 13-Dec-1995  briggs Double ring limits from Bill Studenmund <wrstuden@loki.stanford.edu>.
 1.1 09-Oct-1995  briggs Port of Sun3/Sparc zs driver from wrstuden@loki.stanford.edu
(Bill Studenmund). Should be massaged into machine independence
for 1.2.
 1.26 30-Nov-2024  christos Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.25 12-Jul-2018  maxv branches: 1.25.36;
Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.24 24-Dec-2015  christos branches: 1.24.16; 1.24.18;
fenv for m68k
 1.23 17-Jul-2011  joerg branches: 1.23.12; 1.23.30;
Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.22 09-Feb-2007  ad Merge newlock2 to head.
 1.21 26-Jul-2006  drochner branches: 1.21.4;
don't install <machine/db_machdep.h>, this is kernel only
 1.20 11-Dec-2005  christos branches: 1.20.4; 1.20.8;
merge ktrace-lwp.
 1.19 08-May-2004  kleink branches: 1.19.12;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 1.18 17-Jan-2003  thorpej branches: 1.18.2;
Merge the nathanw_sa branch.
 1.17 26-Nov-2002  lukem Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more.
 1.16 07-Aug-2002  briggs Implement pmc(9) -- An interface to hardware performance monitoring
counters. These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.15 28-Nov-2001  kleink branches: 1.15.8;
No point in installing svr4_machdep.h.
 1.14 06-May-2001  kleink branches: 1.14.2; 1.14.8;
Cosmetical oversight.
 1.13 15-Apr-2001  kleink Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.12 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.11 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
Tidy Makefiles up a little.
 1.10 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.9 26-Jun-2000  kleink branches: 1.9.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.8 29-Apr-2000  thorpej Require that each each MACHINE/MACHINE_ARCH supply a lock.h. This file
contains the values __SIMPLELOCK_LOCKED and __SIMPLELOCK_UNLOCKED, which
replace the old SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED. These files
are also required to supply inline functions __cpu_simple_lock(),
__cpu_simple_lock_try(), and __cpu_simple_unlock() if locking is to be
supported on that platform (i.e. if MULTIPROCESSOR is defined in the
_KERNEL case). Change these functions to take an int * (&alp->lock_data)
rather than the struct simplelock * itself.

These changes make it possible for userland to use the locking primitives
by including <machine/lock.h>.
 1.7 17-Mar-2000  tron Install "machineendian_machdep.h".
 1.6 23-Dec-1999  kleink C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.5 19-Apr-1999  kleink branches: 1.5.2;
Add COMPAT_SVR4 for m68k.
 1.4 15-Mar-1999  minoura branches: 1.4.4;
Pullin m68k/ieee.h.
 1.3 15-Jan-1999  bouyer branches: 1.3.2;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.2 12-Jul-1998  veego Add elf_machdep.h to the INCS list.
 1.1 12-Jun-1998  cgd Rework the way kernel include files are installed. In the new method,
as with user-land programs, include files are installed by each directory
in the tree that has includes to install. (This allows more flexibility
as to what gets installed, makes 'partial installs' easier, and gives us
more options as to which machines' includes get installed at any given
time.) The old SYS_INCLUDES={symlinks,copies} behaviours are _both_
still supported, though at least one bug in the 'symlinks' case is
fixed by this change. Include files can't be build before installation,
so directories that have includes as targets (e.g. dev/pci) have to move
those targets into a different Makefile.
 1.3.2.2 13-Feb-2000  scottr Sync with main branch.
 1.3.2.1 16-May-1999  scottr Sync with main branch.
 1.4.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.5.2.2 21-Apr-2001  bouyer Sync with HEAD
 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.9.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.8.5 11-Dec-2002  thorpej Sync with HEAD.
 1.14.8.4 13-Aug-2002  nathanw Catch up to -current.
 1.14.8.3 08-Jan-2002  nathanw Catch up to -current.
 1.14.8.2 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.14.8.1 06-May-2001  scw file Makefile was added on branch nathanw_sa on 2001-11-10 21:22:51 +0000
 1.14.2.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.14.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.8.1 31-Aug-2002  gehenna catch up with -current.
 1.18.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.12.2 26-Feb-2007  yamt sync with head.
 1.19.12.1 30-Dec-2006  yamt sync with head.
 1.20.8.1 11-Aug-2006  yamt sync with head
 1.20.4.1 09-Sep-2006  rpaulo sync with head
 1.21.4.1 01-Feb-2007  ad Header file cleanup.
 1.23.30.1 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.23.12.1 03-Dec-2017  jdolecek update from HEAD
 1.24.18.1 10-Jun-2019  christos Sync with HEAD
 1.24.16.1 28-Jul-2018  pgoyette Sync with HEAD
 1.25.36.1 02-Aug-2025  perseant Sync with HEAD
 1.13 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.12 23-Oct-1998  ender branches: 1.12.6; 1.12.14;
New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.11 11-Aug-1998  briggs Patch from Takashi NAKAMURA <QZM00427@nifty.ne.jp> to support the
Contour 3-button mouse from the Contour Design Corp.
It looks like a Microspeed mouse.
 1.10 05-Nov-1997  ender Recognize Apple Standard Keyboard (ISO layout)
 1.9 02-Oct-1997  briggs branches: 1.9.2;
port-mac68k/4158: current kernel doesn't recognize some adb devices.
Patch applied. Thanks to SUNAGAWA Keiki for the change-request.
 1.8 09-Aug-1997  ender o Fixed definition of PowerBook extended keyboard from previous commit
o Added recognition of some additional ADB device types
 1.7 08-Aug-1997  ender Add recognition of more keyboard types (including ISO layouts)
 1.6 16-Jun-1997  scottr branches: 1.6.4;
Add support for Mouse Systems A3 mouse. From Colin Wood.
 1.5 05-May-1996  briggs MicroSpeed mouse support from Taras Ivanenko <ivanenko@ctpa03.mit.edu>.
Also some updates to actually used #defined constants instead of numeric
constants.
 1.4 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.3 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jul-1994  lkestel branches: 1.1.2;
Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.1.2.2 30-Jul-1994  lkestel Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.1.2.1 30-Jul-1994  lkestel file adbsys.h was added on branch netbsd-1-0 on 1994-07-30 04:21:59 +0000
 1.6.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.2.1 07-Nov-1997  mellon Pull rev 1.10 up from trunk (ender)
 1.12.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.12.6.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.10 08-Oct-1996  cgd repoint at shared aout_machdep.h, not exec.h
 1.9 08-Sep-1996  thorpej Use <m68k/exec.h>.
 1.8 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 06-Dec-1993  briggs Move MID_MACHINE to param.h from exec.h and get rid of bogus includes.
 1.5 03-Dec-1993  briggs Added struct relocation_info_mac68k. Copied from hp300.
 1.4 02-Dec-1993  briggs Update MACHINE to mac68k in param.h.
Update MACHINE_MID to MID_M68K -- untested.
Add __LDPGSZ as 8192 -- untested.
 1.3 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.2 18-Oct-1993  pk Put definition of __LDPGSZ and `struct relocation_info' where they belong:
in <machine/exec.h>.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 23-Jan-1994  cgd stub
 1.13 16-Jun-2017  jdolecek dumpconf(void) long doesn't exist, remove the prototype

PR kern/39714 by Henning Petersen
 1.12 04-Mar-2007  christos branches: 1.12.88; 1.12.108;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 20-Nov-2006  hauke branches: 1.11.4;
Add Timecounter support for mac68k, using the otherwise idle second
timer of VIA1. Passes regression/sys/kern/time regression test.

While we are here, GC leftover prototypes from MI todr integration,
and clean up clockreg.h in the light of "Guide to the Macintosh
Hardware" information.

(Reviewed and okayed by Martin Husemann)
 1.10 11-Dec-2005  christos branches: 1.10.20; 1.10.22;
merge ktrace-lwp.
 1.9 15-Jan-2005  chs branches: 1.9.10;
de-__P, remove register, ansify, b* -> mem*.
 1.8 10-Apr-2002  briggs branches: 1.8.10;
Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.7 22-Dec-1998  scottr branches: 1.7.24; 1.7.28;
vm_offset_t -> {paddr_t, vaddr_t}
 1.6 06-Oct-1998  thorpej configure() prototype is in <sys/device.h>
 1.5 17-Dec-1996  scottr Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.4 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.3 14-Sep-1996  scottr Update prototypes to match Chris' cfprint_t change. Also, update comments
in autoconf.h to reflect the mainbus.c split.
 1.2 18-May-1996  briggs Fixup a few prototypes and put 'em in their place.
 1.1 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7.28.1 17-Apr-2002  nathanw Catch up to -current.
 1.7.24.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.8.10.1 17-Jan-2005  skrll Sync with HEAD.
 1.9.10.2 03-Sep-2007  yamt sync with head.
 1.9.10.1 30-Dec-2006  yamt sync with head.
 1.10.22.1 10-Dec-2006  yamt sync with head.
 1.10.20.1 12-Jan-2007  ad Sync with head.
 1.11.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.12.108.1 28-Aug-2017  skrll Sync with HEAD
 1.12.88.1 03-Dec-2017  jdolecek update from HEAD
 1.2 21-Aug-1999  simonb Include <sys/bswap.h> for function prototypes. i386, pc532 and vax
still include <machine/byte_swap.h> and define macros for some of
the bswap*() functions.
 1.1 15-Jan-1999  bouyer branches: 1.1.2;
Move the bswap functions from libutil to libc (this bups the
minor of libc and the major of libutil). For little-endian architectures
merge the bnswap() assembly versions with nto* and hton* using symbols
aliasing. Use symbol renaming for the bswap function in this case to avoid
namespace pollution.
Declare bswap* in machine/bswap.h, not machine/endian.h. For little-endian
machines, common code for inline macros go in machine/byte_swap.h
Sync libkern with libc.
Adjust #include in kernel sources for machine/bswap.h.
 1.1.2.1 01-Nov-1999  scottr Sync with main branch.
 1.30 23-Jan-2021  christos Remove cargo-culted '#if 0' code that was designed to produce a
compile-time error if any of the bus_space_*_8 functions was used,
but was documented that it produces a link-time error.
 1.29 02-Apr-2020  msaitoh branches: 1.29.4;
s/impliment/implement/ in comment.
 1.28 23-Sep-2019  skrll Provide PRIxBUSADDR, PRIxBUSSIZE, PRIuBUSSIZE, and PRIxBSH for all arches
to follow arm and (generic) mips.

Reviewed by christos.
 1.27 23-Jul-2019  rin PR port-mac68k/24883

Style-only changes in preparation to import AV DMA code:

- G/C unused from esp_softc
- clean up headers:
- prefer <sys/bus.h> over <machine/bus.h>
- G/C unused
- sort
- staticify private functions and variables
- stop using inline qualifier for functions called via function pointers
- use C99 initializer
- provide bus_space_vaddr(9) and use it, instead of using member of
bus_handle_t directly
- use uint*_t:
- u_char --> uint8_t
- u_int*_t --> uint*_t
- use proper names from ncr53c9xreg.h instead of magic numbers
- and some KNF, and etc.

No functional changes intended.
 1.26 28-Apr-2008  martin branches: 1.26.88;
Remove clause 3 and 4 from TNF licenses
 1.25 09-Sep-2006  tsutsui branches: 1.25.54; 1.25.56; 1.25.58;
Apply patch in PR port-mac68k/33636 from Dave Huang (with wrapping long lines).
i.e. args in macro should be wrapped with parentheses.
 1.24 16-Feb-2006  perry branches: 1.24.2; 1.24.12; 1.24.14;
Change "inline" back to "__inline" in .h files -- C99 is still too
new, and some apps compile things in C89 mode. C89 keywords stay.

As per core@.
 1.23 24-Dec-2005  perry branches: 1.23.2; 1.23.4; 1.23.6;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.22 11-Dec-2005  christos merge ktrace-lwp.
 1.21 15-Jan-2005  chs branches: 1.21.8; 1.21.10;
de-__P, remove register, ansify, b* -> mem*.
 1.20 10-Apr-2002  briggs branches: 1.20.10; 1.20.16;
Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.19 09-Apr-2002  briggs Constify bus_space_write_multi_N() and bus_space_write_region_N().
Addresses PR port-mac68k/16233.
 1.18 14-Sep-2001  briggs branches: 1.18.4;
Define __BUS_SPACE_HAS_STREAM_METHODS since the functions are there. Noted
on tech-kern & port-mac68k by "John Ruschmeyer" <jruschme@mac.com>.
 1.17 31-Jul-2000  briggs branches: 1.17.2; 1.17.4;
Add bus_space_*_stream_N functions.
 1.16 31-Jul-2000  briggs Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).
 1.15 30-Jul-2000  briggs Make sure that bus_space read/write functions that take a count will not be
called if count is zero. The smc91cxx driver, for example, may try to call
bus_space_write_multi_2() with a count of 0.
 1.14 30-Jul-2000  briggs Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.
 1.13 25-Jan-2000  drochner branches: 1.13.4;
define a "BUS_SPACE_MAP_PREFETCHABLE" flag which basically means that
device accesses are idempotent (but should not be cached by the CPU)
 1.12 23-Mar-1999  drochner branches: 1.12.8;
Add a macro to check for sufficient pointer alignment in bus.h context,
"BUS_SPACE_ALIGNED_POINTER()".
Equal to the param.h "ALIGNED_POINTER()" normally, but obeys additional
requirements of the bus_space_xxx_n() macros. (BUS_SPACE_DEBUG)
 1.11 06-Jan-1999  briggs branches: 1.11.2;
Fix PR port-mac68k/6665 from Paul Goyette with some minor mods.
Cast values is bus_space macros to the appropriate types so we end up
with valid assembly.
 1.10 16-Aug-1998  scottr Remove semicolons from the end of bus_space_*_multi_*(). From Ken Nakata
in PR 5965.
 1.9 13-Jan-1998  scottr Conform to spec, and make bus_space_copy() handle overlapping copies.
From Jason Thorpe.
 1.8 10-Oct-1997  scottr Remove advertising clause.
 1.7 04-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.6 24-Feb-1997  scottr branches: 1.6.4;
The bus space tag really isn't used; stop the compiler from complaining.
 1.5 22-Feb-1997  scottr Remove niggles that made it into the copyright, and correct the
license terms (added Jason Thorpe).
 1.4 20-Feb-1997  scottr Implement bus_space_set_multi_N(), bus_space_set_region_N(), and
bus_space_copy_N(). Bus space support is now complete.
 1.3 14-Feb-1997  scottr Add prototypes for bus_space_alloc() and bus_space_free()
 1.2 11-Feb-1997  scottr Initialize and use extent manager for bus space mapping functions.
Tweak bus_space_{tag,handle}_t types slightly to facilitate this.
 1.1 03-Feb-1997  scottr branches: 1.1.2;
Implement basic bus space access macros/functions.

Note: we currently do not use the extent manager.
 1.1.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.6.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.2.2 13-Feb-2000  scottr Sync with main branch.
 1.11.2.1 16-May-1999  scottr Sync with main branch.
 1.12.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.13.4.2 08-Oct-2001  he Pull up revision 1.18 (requested by briggs):
Define __BUS_SPACE_HAS_STREAM_METHODS since that fits what we
have.
 1.13.4.1 06-Aug-2000  briggs Pullups approved by thorpej --
Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.

Add bus_space_*_stream_N functions to bus_space.

Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).

There were some bogus assumptions about bus_space_handle_t and some
function calls that didn't match prototypes--fix those here, too.
 1.17.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.17.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.17.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.18.4.2 17-Apr-2002  nathanw Catch up to -current.
 1.18.4.1 14-Sep-2001  nathanw file bus.h was added on branch nathanw_sa on 2002-04-17 00:03:33 +0000
 1.20.16.1 12-Sep-2006  tron Pull up following revision(s) (requested by tsutsui in ticket #10692):
sys/arch/mac68k/include/bus.h: revision 1.25
Apply patch in PR port-mac68k/33636 from Dave Huang (with wrapping long lines).
i.e. args in macro should be wrapped with parentheses.
 1.20.10.1 17-Jan-2005  skrll Sync with HEAD.
 1.21.10.1 30-Dec-2006  yamt sync with head.
 1.21.8.1 16-Sep-2006  ghen Pull up following revision(s) (requested by tsutsui in ticket #1512):
sys/arch/mac68k/include/bus.h: revision 1.25
sys/arch/mac68k/dev/if_ae.c: revision 1.78
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.
Apply patch in PR port-mac68k/33636 from Dave Huang (with wrapping long lines).
i.e. args in macro should be wrapped with parentheses.
 1.23.6.1 22-Apr-2006  simonb Sync with head.
 1.23.4.1 09-Sep-2006  rpaulo sync with head
 1.23.2.1 18-Feb-2006  yamt sync with head.
 1.24.14.1 18-Nov-2006  ad Sync with head.
 1.24.12.1 14-Sep-2006  riz Pull up following revision(s) (requested by tsutsui in ticket #154):
sys/arch/mac68k/include/bus.h: revision 1.25
sys/arch/mac68k/dev/if_ae.c: revision 1.78
Apply patch from Scott Reynolds in PR port-mac68k/32583
with some tweaks (add a comment and macro):
Handle odd byte case correctly in (ETHER_MIN_LEN-ETHER_CRC_LEN) padding
so that bus_space_set_region_2() won't be called with count==0.
Apply patch in PR port-mac68k/33636 from Dave Huang (with wrapping long lines).
i.e. args in macro should be wrapped with parentheses.
 1.24.2.1 14-Sep-2006  yamt sync with head.
 1.25.58.1 16-May-2008  yamt sync with head.
 1.25.56.1 18-May-2008  yamt sync with head.
 1.25.54.1 02-Jun-2008  mjf Sync with HEAD.
 1.26.88.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.26.88.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.29.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.2 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.1 19-Jan-1995  jtc This file, which will be included by <sys/cdefs.h>, will contain macros
such as __warn_references() and __weak_reference() which are actually
machine dependant. This will make it easier for ports that are being
bootstraped with ELF and ECOFF based toolchains.

This change also introduces a new macro, _C_LABEL(x). _C_LABEL expands
its argument, an identifier, to a character string of the identifier
name as it is represented in an object file.

For most ports, _C_LABEL(x) will expand to "_x", for ELF based ports
_C_LABEL(x) will expand to "x".
 1.107 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.106 27-Feb-2024  nat Use proper clockframe size for those platforms that require it.

XXX This is a tempory measure, better to fix clock interrupts to take the
common clockframe size.

OK thorpej@.
 1.105 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.104 18-Jan-2024  thorpej Make the M68K_MMU_* defines real kernel options, available in opt_m68k_arch.h.
For 68030, 68040, and 68060, infer M68K_MMU_MOTOROLA. For 68010 and 68020, it
must be an explicit option (set in std.${MACHINE} or, in the case of hp300,
inferred from the specific model option).
 1.103 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.102 23-Nov-2019  ad cpu_need_resched():

- Remove all code that should be MI, leaving the bare minimum under arch/.
- Make the required actions very explicit.
- Pass in LWP pointer for convenience.
- When a trap is required on another CPU, have the IPI set it locally.
- Expunge cpu_did_resched().
 1.101 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.100 22-Aug-2018  msaitoh - Cleanup for dynamic sysctl:
- Remove unused *_NAMES macros for sysctl.
- Remove unused *_MAXID for sysctls.
- Move CTL_MACHDEP sysctl definitions for m68k into m68k/include/cpu.h and
use them on all m68k machines.
 1.99 17-Dec-2016  flxd branches: 1.99.14; 1.99.16;
Fix typo "one the" and architecture where appropriate.
 1.98 19-Oct-2013  christos branches: 1.98.6; 1.98.10;
make cpu_need_resched() macros consistent; __USE flags
 1.97 02-Feb-2012  tsutsui branches: 1.97.6; 1.97.10;
Always include <m68k/cpu.h> (i.e. outside #if defined(_KERNEL))
for crash(8) as amiga and sun3. There are _KERNEL protections in it.

Briefly tested by "build.sh -m news68k -U build".
Further possible botch will be fixed later.
 1.96 16-May-2011  tsutsui branches: 1.96.4; 1.96.8;
- merge and move pasted m68k MD setreg() functions into m68k/m68k_machdep.c
- move m68881_save() and m68881_restore() declarations into <m68k/m68k.h>

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.95 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.94 22-Dec-2010  matt branches: 1.94.2; 1.94.4;
Collect cpu_info and friends and move to m68k/include/cpu.h
Add a define __HAVE_CPU_DATA_FIRST which means that cpu_data is the first
member in struct cpu_info.
 1.93 21-Oct-2009  rmind branches: 1.93.4;
Remove uarea swap-out functionality:

- Addresses the issue described in PR/38828.
- Some simplification in threading and sleepq subsystems.
- Eliminates pmap_collect() and, as a side note, allows pmap optimisations.
- Eliminates XS_CTL_DATA_ONSTACK in scsipi code.
- Avoids few scans on LWP list and thus potentially long holds of proc_lock.
- Cuts ~1.5k lines of code. Reduces amd64 kernel size by ~4k.
- Removes __SWAP_BROKEN cases.

Tested on x86, mips, acorn32 (thanks <mpumford>) and partly tested on
acorn26 (thanks to <bjh21>).

Discussed on <tech-kern>, reviewed by <ad>.
 1.92 27-Feb-2008  xtraeme branches: 1.92.4;
Remove CTL_MACHDEP_NAMES, it's not used anywhere.

Ok by martin@.
 1.91 19-Feb-2008  dogcow branches: 1.91.2; 1.91.6;
revert previous; as yamt pointed out, these bits are in <sys/cpu.h>.
 1.90 19-Feb-2008  dogcow cargo-cult CPU_INFOITERATOR and _FOREACH to make kern_prf.c build again.
These should probably be abstracted out to sys/cpu.h at some point, since
they don't really change from arch to arch.
 1.89 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.88 04-Aug-2007  ad branches: 1.88.2;
Add ci_cpuid where it's missing.
 1.87 02-Jun-2007  tsutsui branches: 1.87.2; 1.87.4; 1.87.8;
Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.86 21-May-2007  tsutsui Move declarations of m68k common functions
from <machine/cpu.h> to <m68k/m68k.h>.
While here, remove some obsolete function decls.
 1.85 21-May-2007  tsutsui Remove obsolete decralations of switch_exit() and switch_lwp_ext().
 1.84 20-May-2007  mhitch Add missing call to lwp_startup() in lwp_trampoline() (which was renamed
from proc_trampoline to match the other ports).

A DIAGNOSTIC kernel will now boot and run. LOCKDEBUG still doesn't work yet.
Also, my amiga no longer loses time.
 1.83 17-May-2007  rjs Start yamt-idlelwp fixes.
 1.82 04-Mar-2007  christos branches: 1.82.2; 1.82.4; 1.82.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.81 16-Feb-2007  ad branches: 1.81.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.80 09-Feb-2007  ad Merge newlock2 to head.
 1.79 11-Dec-2005  christos branches: 1.79.20;
merge ktrace-lwp.
 1.78 03-Jun-2005  rjs branches: 1.78.2;
Add const.
 1.77 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.76 26-Sep-2004  yamt don't expose cpu_info to userland.
 1.75 22-Sep-2004  yamt move some per-cpu data definitions to MI place so that they can be modified
without touching all ports. discussed on tech-kern@.
 1.74 04-Jan-2004  jdolecek Rearrange process exit path to avoid need to free resources from different
process context ('reaper').

From within the exiting process context:
* deactivate pmap and free vmspace while we can still block
* introduce MD cpu_lwp_free() - this cleans all MD-specific context (such
as FPU state), and is the last potentially blocking operation;
all of cpu_wait(), and most of cpu_exit(), is now folded into cpu_lwp_free()
* process is now immediatelly marked as zombie and made available for pickup
by parent; the remaining last lwp continues the exit as fully detached
* MI (rather than MD) code bumps uvmexp.swtch, cpu_exit() is now same
for both 'process' and 'lwp' exit

uvm_lwp_exit() is modified to never block; the u-area memory is now
always just linked to the list of available u-areas. Introduce (blocking)
uvm_uarea_drain(), which is called to release the excessive u-area memory;
this is called by parent within wait4(), or by pagedaemon on memory shortage.
uvm_uarea_free() is now private function within uvm_glue.c.

MD process/lwp exit code now always calls lwp_exit2() immediatelly after
switching away from the exiting lwp.

g/c now unneeded routines and variables, including the reaper kernel thread
 1.73 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.72 17-Jan-2003  thorpej branches: 1.72.2;
Merge the nathanw_sa branch.
 1.71 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.70 10-Apr-2002  briggs Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.69 04-Mar-2002  shiba Add the machine id of PowerBook 190CS.
 1.68 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.67 30-May-2001  mrg branches: 1.67.2; 1.67.8;
use _KERNEL_OPT
 1.66 19-Dec-2000  scw branches: 1.66.2;
Unification of the m68k syscall() function.
 1.65 25-Aug-2000  thorpej Make need_resched() take a "struct cpu_info *" argument. This
causes gives a primitive form of processor affinity. Its use in
roundrobin() still needs some work.
 1.64 26-May-2000  thorpej First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.63 10-Aug-1999  thorpej branches: 1.63.2;
Define cpu_number() as discussed on tech-smp.
 1.62 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.61 06-Apr-1999  scottr Prototype kvtop() here.
 1.60 26-Feb-1999  is branches: 1.60.2; 1.60.4;
oops. void->int
 1.59 26-Feb-1999  is synchronize types, and s/curproc/p/ in one forgotten place
 1.58 25-Feb-1999  is mac68k part of pr 6152 fix, and missing bits for the others
 1.57 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.56 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.55 22-Aug-1998  scottr Add gestalt machine type for the PowerBook 190/190cs.
 1.54 13-Feb-1998  scottr Avoid declaring the "astpending" and "want_resched" globals in cpu.h,
as this breaks C++ code that happens to indirectly include this header.
Both Matthias Scheler and I noticed this, independently.

This problem notably does not affect the atari and sun3/sun3x ports,
which have already implemented a similar solution.
 1.53 26-Oct-1997  is Make these compile after m68k/m68k.h 1.4->1.5.
 1.52 20-Oct-1997  scottr branches: 1.52.2;
Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.51 02-Oct-1997  briggs port-mac68k/4175: Need to add support for 33 MHz LC475/Q605.
Fix applied. Thanks to David Johnston for the PR and the reminder.
 1.50 29-Jun-1997  scottr branches: 1.50.4;
Prototype DCIS().
 1.49 22-May-1997  scottr Remove redundant cpu_set_kpc() prototype, found by Paul Goyette.
 1.48 20-May-1997  scottr Adjust for previous m68k/pcb.h change
 1.47 13-Apr-1997  scottr Move all splxxx() and softint-related macros and prototypes to intr.h,
and include it where appropriate.
 1.46 15-Mar-1997  briggs Move physaccess/physunaccess prototypes.
 1.45 10-Feb-1997  scottr Console bell callback support prototypes
 1.44 20-Jan-1997  scottr branches: 1.44.2;
Define single-instruction implementations of setsoft*() and siroff(),
and declare ssir as volatile. This avoids the problem of lost softints
should a hard interrupt cause a softint to be flagged while we are
clearing a different one.

Idea from atari mtpr.h, modified/optimized by me.
 1.43 15-Oct-1996  scottr Define MACH_CLASSQ2, used by Performa 575.
Remove susword() because of prototype conflict with <sys/systm.h>.
 1.42 12-Oct-1996  scottr Add second Quadra class and machineid (gestalt value) for Color Classic II
 1.41 11-Sep-1996  thorpej Use <m68k/cpu.h>.
 1.40 12-Jul-1996  scottr Back out previous; actually, this is never a problem for us. (Duh.)
 1.39 10-Jul-1996  scottr Fix from Leo Weppelman: Change accesses to 'ssir' to inline asm macro's.
 1.38 11-Jun-1996  scottr Add Powerbook 500 series machine ID
 1.37 07-Jun-1996  briggs Patches from Bill Studenmund to get serial default settings from the booter.
 1.36 25-May-1996  briggs More from Dave Huang (khym@bga.com)--set ROMLEN to 2MB and make another
class for AV machines (C660AV and Q840AV).
 1.35 22-May-1996  briggs Add MACH_CLASSDUO.
 1.34 05-May-1996  briggs branches: 1.34.4;
m68881_restore takes struct fpframe *, not int [].
 1.33 05-May-1996  briggs Prototype for sunos_sendsig() is now in sunos.h as suggested by veego.
 1.32 05-May-1996  briggs Include pcb.h for prototypes.
 1.31 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.30 05-May-1996  briggs Prototype for sunos_sendsig().
 1.29 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.28 27-Feb-1996  briggs Clean out some unneeded constants.
 1.27 09-Jan-1996  briggs Add #defines for some more machines.
 1.26 21-Dec-1995  mycroft Remove deprecated cpu_setstack().
 1.25 14-Sep-1995  briggs Shuffle MACH_CLASSes around a tad and add IIvx as a seperate class because
it may have a different method for accessing the 'via2' functions.
 1.24 12-Aug-1995  briggs Get rid of cpu040 for good.
 1.23 06-Jul-1995  briggs Change NBSBASE to 0x90000000 and let it and NBSTOP be defined.
 1.22 21-Jun-1995  briggs Remove cpu_set_init_frame() define.
Remove BROKEN_SWAP
Change cpu_swapout() to null-op.
Remove profile_tick() define.
Add some 040 stuff and make other 040 stuff compat. with hp300 port.
Cleanup a bit.
 1.21 17-May-1995  briggs Nuke cpu_exec and remove extra semicolon on cpu_swapout() panic string
(preparing for more changes in a bit...)
 1.20 05-May-1995  cgd define BROKEN_SWAP and/or cpu_swapout as appropriate.
 1.19 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.18 23-Mar-1995  briggs KERNEL -> _KERNEL
 1.17 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.16 26-Oct-1994  cgd new RCS ID format.
 1.15 31-Jul-1994  briggs Add a serial console flag that's passed in from the booter.
 1.14 21-Jul-1994  briggs Add a field for cpu-dependent structure to flag if SONIC is on-board.
 1.13 10-Jul-1994  briggs Be somewhat better at machine dependence.
 1.12 07-Jul-1994  briggs branches: 1.12.2;
Revert back to old HP MMU defines so we can use fpsp w/o changes.
 1.11 26-Jun-1994  briggs Cleanup a lot and bring in line w/ 4.4-lite.
 1.10 06-May-1994  briggs Get things to compile with latest changes.
 1.9 22-Apr-1994  briggs Make external definition for cpu040.
 1.8 21-Apr-1994  briggs '040 changes from Amiga.
Protect against multiple inclusion.
Swap arguments in struct clockframe.
 1.7 01-Mar-1994  briggs At least recognize different machine types.
 1.6 27-Feb-1994  briggs Add LCII machine id.
 1.5 22-Feb-1994  briggs Add a few new defined machine type constants and a few new globals.
 1.4 17-Jan-1994  briggs We aren't a VAX.
 1.3 15-Dec-1993  briggs Change constants and comments to reflect the current MACHINE value.
Define T_BRKPT and T_WATCHPOINT.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.12.2.3 11-Aug-1994  mycroft update from trunk
 1.12.2.2 24-Jul-1994  cgd update, as requested by briggs
 1.12.2.1 07-Jul-1994  cgd file cpu.h was added on branch netbsd-1-0 on 1994-07-24 01:23:22 +0000
 1.34.4.5 10-Jul-1996  scottr Whoops. This was _not_ supposed to be here.
 1.34.4.4 10-Jul-1996  scottr Fix from Leo Weppelman: Change accesses to 'ssir' to inline asm macro's.
 1.34.4.3 11-Jun-1996  scottr Pull up from trunk:
>Add Powerbook 500 series machine ID
 1.34.4.2 07-Jun-1996  briggs Bring in last changes from -current. ADB fixes for MacTV and serial state
from the booter.
 1.34.4.1 01-Jun-1996  scottr Pull up version 1.36 from the main branch; Duo/AV fixes.
 1.44.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.50.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.52.2.1 23-Nov-1998  cgd pull up rev 1.55 from trunk (scottr)
 1.60.4.1 21-Apr-1999  perry branches: 1.60.4.1.2;
pullup 1.60->1.61 (scottr): sync to hp300 pmap
 1.60.4.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.60.4.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.60.2.2 01-Nov-1999  scottr Sync with main branch.
 1.60.2.1 16-May-1999  scottr Sync with main branch.
 1.63.2.2 05-Jan-2001  bouyer Sync with HEAD
 1.63.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.66.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.67.8.8 03-Dec-2002  gmcgarry Now use cpu_proc_fork().
 1.67.8.7 11-Nov-2002  nathanw Catch up to -current
 1.67.8.6 17-Apr-2002  nathanw Catch up to -current.
 1.67.8.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.67.8.4 08-Jan-2002  nathanw Catch up to -current.
 1.67.8.3 08-Dec-2001  thorpej Add a cpu_proc_fork(), called from uvm_proc_fork(), which takes care
of machine-dependent handling a fork() time (this is different from
forking the actual context in an LWP world). #define it away on
platforms which do not need it.

Problem noted by Gregory McGarry.
 1.67.8.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.67.8.1 30-May-2001  scw file cpu.h was added on branch nathanw_sa on 2001-11-18 18:12:01 +0000
 1.67.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.67.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.67.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.72.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.72.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.72.2.5 19-Oct-2004  skrll Sync with HEAD
 1.72.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.72.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.72.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.72.2.1 03-Aug-2004  skrll Sync with HEAD
 1.78.2.3 17-Mar-2008  yamt sync with head.
 1.78.2.2 03-Sep-2007  yamt sync with head.
 1.78.2.1 26-Feb-2007  yamt sync with head.
 1.79.20.1 06-Feb-2007  ad Make amiga & mac68k compile.
 1.81.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.82.10.3 03-Oct-2007  garbled Sync with HEAD
 1.82.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.82.10.1 22-May-2007  matt Update to HEAD.
 1.82.4.1 11-Jul-2007  mjf Sync with head.
 1.82.2.3 20-Aug-2007  ad Sync with HEAD.
 1.82.2.2 09-Jun-2007  ad Sync with head.
 1.82.2.1 27-May-2007  ad Sync with head.
 1.87.8.1 04-Aug-2007  jmcneill Sync with HEAD.
 1.87.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.87.2.1 07-Aug-2007  matt Sync with HEAD.
 1.88.2.2 23-Mar-2008  matt sync with HEAD
 1.88.2.1 06-Nov-2007  matt sync with HEAD
 1.91.6.1 03-Apr-2008  mjf Sync with HEAD.
 1.91.2.1 24-Mar-2008  keiichi sync with head.
 1.92.4.1 11-Mar-2010  yamt sync with head
 1.93.4.2 31-May-2011  rmind sync with head
 1.93.4.1 05-Mar-2011  rmind sync with head
 1.94.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.94.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.96.8.1 18-Feb-2012  mrg merge to -current.
 1.96.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.96.4.1 17-Apr-2012  yamt sync with head
 1.97.10.1 18-May-2014  rmind sync with head
 1.97.6.2 03-Dec-2017  jdolecek update from HEAD
 1.97.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.98.10.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.98.6.1 05-Feb-2017  skrll Sync with HEAD
 1.99.16.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.99.16.1 10-Jun-2019  christos Sync with HEAD
 1.99.14.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.5 06-Nov-2017  christos Cleanup and clarify the ELFSIZE mess:

We now have 2 variables automatically set in elf_machdep.h:

ARCH_ELFSIZE: the size for userland binaries
KERN_ELFSIZE: the size for the kernel binaries

DB_ELFSIZE has been deleted and KERN_ELFSIZE should have always the
same values DB_ELFSIZE used to have.

In sys/exec_elf.h, if ELFSIZE is not set, it is set to KERN_ELFSIZE
for the kernel and ARCH_ELFSIZE for userland. These defaults should
eliminate the need for most manual ELFSIZE setting.
 1.4 20-Nov-2001  chs branches: 1.4.166;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.3 26-Oct-1994  cgd branches: 1.3.48; 1.3.52;
new RCS ID format.
 1.2 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.1 15-Dec-1993  briggs Added for ddb support. I think it's at least partially wrong. This and
the files in mac68k/db_* started off as the sun3 files...
 1.3.52.1 08-Jan-2002  nathanw Catch up to -current.
 1.3.48.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.166.1 03-Dec-2017  jdolecek update from HEAD
 1.8 03-Apr-2019  christos centralize setdisklabel(9)
 1.7 30-Aug-2011  bouyer branches: 1.7.54;
Add getlabelusesmbr(), as proposed in
http://mail-index.netbsd.org/tech-userlevel/2011/08/25/msg005404.html
This is used by disk tools such as disklabel(8) to dynamically decide is
the undelyling platform uses a disklabel-in-mbr-partition or not
(instead of using a compile-time list of ports).
getlabelusesmbr() reads the sysctl kern.labelusesmbr, takes its value from the
machdep #define LABELUSESMBR.
For evbmips, make LABELUSESMBR 1 if the platform uses pmon
as bootloader, and 0 (the previous value) otherwise.
 1.6 27-Jan-1999  thorpej Use <sys/disklabel_mbr.h>.
 1.5 30-Oct-1998  scottr Add DOS partition handling, from Ken Nakata in PR 4999, with
only slight tweaking by me.

XXX - does not currently handle NetBSD/i386 or 386BSD/FreeBSD partitions.
 1.4 02-Mar-1998  scottr Add magic number for driver map structure. (oops!)
 1.3 27-Feb-1998  scottr Integrate Macintosh partition map and driver descriptor map definitions.
 1.2 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.1 14-Oct-1994  cgd move arch dependence to archs. clean up a bit. deal with weird MAXPARTITONS.
 1.7.54.1 10-Jun-2019  christos Sync with HEAD
 1.1 12-Jul-1998  thorpej Basic elf_machdep.h for m68k; doesn't include relocations, yet.
 1.6 17-Mar-2000  mycroft In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.5 26-Oct-1994  cgd branches: 1.5.34;
new RCS ID format.
 1.4 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.3 02-Dec-1993  briggs Add symbols for quads to limits and endian and protect endian from mult.
inclusion.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.5.34.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1 17-Mar-2000  mycroft branches: 1.1.6;
In the `MY THAT'S GROSS' department...
Eliminate the recursive include of machine/endian.h from sys/endian.h.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 17-Mar-2000  bouyer file endian_machdep.h was added on branch thorpej_scsipi on 2000-11-20 20:12:19 +0000
 1.10 08-Oct-1996  cgd moved to aout_machdep.h (via repository copy)
 1.9 08-Sep-1996  thorpej Use <m68k/exec.h>.
 1.8 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 06-Dec-1993  briggs Move MID_MACHINE to param.h from exec.h and get rid of bogus includes.
 1.5 03-Dec-1993  briggs Added struct relocation_info_mac68k. Copied from hp300.
 1.4 02-Dec-1993  briggs Update MACHINE to mac68k in param.h.
Update MACHINE_MID to MID_M68K -- untested.
Add __LDPGSZ as 8192 -- untested.
 1.3 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.2 18-Oct-1993  pk Put definition of __LDPGSZ and `struct relocation_info' where they belong:
in <machine/exec.h>.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.1 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.1 24-Dec-2015  christos branches: 1.1.2; 1.1.18;
fenv for m68k
 1.1.18.2 03-Dec-2017  jdolecek update from HEAD
 1.1.18.1 24-Dec-2015  jdolecek file fenv.h was added on branch tls-maxphys on 2017-12-03 11:36:24 +0000
 1.1.2.2 27-Dec-2015  skrll Sync with HEAD (as of 26th Dec)
 1.1.2.1 24-Dec-2015  skrll file fenv.h was added on branch nick-nhusb on 2015-12-27 12:09:38 +0000
 1.7 03-Feb-1998  mycroft Prototype __flt_rounds() consistently.
 1.6 05-May-1996  briggs branches: 1.6.16;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.5 20-Jun-1995  jtc Wrap with #ifndef _XXX_FLOAT_H_/#define _XXX_FLOAT_H_/ ... /#endif.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.6.16.1 08-May-1998  mycroft Sync with trunk, per request of mycroft.
 1.5 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.15 07-Sep-2015  dholland Final bit of PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers most if not all of the MD headers.

XXX: a lot of the ioctl definitions in some of these files are cutpasted.
 1.14 08-Feb-2011  rmind branches: 1.14.14; 1.14.32;
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 04-Mar-2007  christos branches: 1.13.66; 1.13.72; 1.13.74;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.12 11-Dec-2005  christos branches: 1.12.26;
merge ktrace-lwp.
 1.11 29-Apr-2004  fredb branches: 1.11.12;
Protect against multiple inclusion. Lets "kdump" and "ktrace" build again
on mac68k.
 1.10 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.9 20-Nov-2001  chs branches: 1.9.16;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.8 14-Feb-2000  scottr branches: 1.8.8; 1.8.12;
Merge wscons work onto the main development branch.
 1.7 01-Jul-1998  scottr branches: 1.7.8; 1.7.16;
Whoops, forgot to bracket struct grfinfo with #ifdef GRF_COMPAT.
 1.6 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.5 02-Jul-1995  briggs Add missing interface for getting a grfmode structure from kernel.
 1.4 02-Jul-1995  briggs Add a couple elements to the grfmode structure.
 1.3 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 30-Jul-1994  lkestel branches: 1.1.2;
Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.1.2.2 30-Jul-1994  lkestel Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.1.2.1 30-Jul-1994  lkestel file grfioctl.h was added on branch netbsd-1-0 on 1994-07-30 04:22:00 +0000
 1.7.16.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.8.2 20-Nov-1999  scottr The grf pseudo-device obviates WSDISPLAY_COMPAT_GRF; translate tests on the latter to
tests against NGRF instead.
 1.7.8.1 11-Mar-1999  scottr First cut at grf emulation. Neither GRFIOCMAP nor mmap'ing a wsdisplay device
work, though several other grf ioctls are properly emulated.
 1.8.12.1 08-Jan-2002  nathanw Catch up to -current.
 1.8.8.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 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.11.12.1 03-Sep-2007  yamt sync with head.
 1.12.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.74.1 17-Feb-2011  bouyer Sync with HEAD
 1.13.72.1 06-Jun-2011  jruoho Sync with HEAD.
 1.13.66.1 05-Mar-2011  rmind sync with head
 1.14.32.1 22-Sep-2015  skrll Sync with HEAD
 1.14.14.1 03-Dec-2017  jdolecek update from HEAD
 1.2 30-Aug-1999  mycroft A foolish consistency.
 1.1 15-Mar-1999  minoura branches: 1.1.4;
Pullin m68k/ieee.h.
 1.1.4.3 01-Nov-1999  scottr Sync with main branch.
 1.1.4.2 16-May-1999  scottr Sync with main branch.
 1.1.4.1 15-Mar-1999  scottr file ieee.h was added on branch scottr-mac68k-wscons on 1999-05-16 22:38:10 +0000
 1.2 16-Apr-1995  jtc Fix typo: ieefp.h -> ieeefp.h.
 1.1 09-Apr-1995  mycroft Move fp_except and fp_rnd definitions to machine/include.
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 integer constant macros.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 integer constant macros.
 1.1.12.1 14-Apr-2001  kleink file int_const.h was added on branch nathanw_sa on 2001-04-14 22:38:39 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_const.h was added on branch thorpej_scsipi on 2001-04-21 17:53:56 +0000
 1.1 15-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 15-Apr-2001  kleink Add definitions of C99 integer format conversion macros.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 15-Apr-2001  kleink file int_fmtio.h was added on branch nathanw_sa on 2001-04-15 17:13:13 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_fmtio.h was added on branch thorpej_scsipi on 2001-04-21 17:53:56 +0000
 1.1 15-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 15-Apr-2001  kleink Add definitions of C99 specified-width integer type limits.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 15-Apr-2001  kleink file int_limits.h was added on branch nathanw_sa on 2001-04-15 15:29:08 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 15-Apr-2001  bouyer file int_limits.h was added on branch thorpej_scsipi on 2001-04-21 17:53:57 +0000
 1.1 14-Apr-2001  kleink branches: 1.1.2; 1.1.4; 1.1.12;
Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.2 14-Apr-2001  kleink Add definitions of C99 minimum-width and greatest-width integer types.
XXX Fastest minimum-width integer types haven't been decided upon yet.
 1.1.12.1 14-Apr-2001  kleink file int_mwgwtypes.h was added on branch nathanw_sa on 2001-04-14 12:19:56 +0000
 1.1.4.1 21-Jun-2001  nathanw Catch up to -current.
 1.1.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.1.2.1 14-Apr-2001  bouyer file int_mwgwtypes.h was added on branch thorpej_scsipi on 2001-04-21 17:53:57 +0000
 1.1 26-Jun-2000  kleink branches: 1.1.2;
Add <machine/int_types.h>, which provides namespace-pure definitions
of exact-width integer types.
 1.1.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.2.1 26-Jun-2000  bouyer file int_types.h was added on branch thorpej_scsipi on 2000-11-20 20:12:20 +0000
 1.33 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.32 11-Jul-2023  riastradh mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
 1.31 17-Jul-2008  tsutsui branches: 1.31.112;
Revert part of previous changes:
> make makeiplcookie() return PSL bits via ipl2psl_table[]
> rather than IPL_FOO indexes
because ipl2psl_table[] could be updated during autoconf(9)
and we can't use it as cookie before cpu_configure(9).
 1.30 19-Jun-2008  tsutsui branches: 1.30.2;
Unify splraiseipl(9) implementation among m68k ports as per
suggestion from isaki@ on port-m68k.

For mac68k:
- rename mac68k_ipls[] to common ipl2psl_table[]
- make makeiplcookie() return PSL bits via ipl2psl_table[]
rather than IPL_FOO indexes
 1.29 26-Jan-2008  tsutsui branches: 1.29.6; 1.29.10; 1.29.12; 1.29.14;
Remove unused splfoo() definitions.
 1.28 03-Dec-2007  ad 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.27 11-Mar-2007  thorpej branches: 1.27.16; 1.27.18; 1.27.24;
- Shrink ipl_cookie_t from 32-bits to 16-bits (large enough to hold
an SR value or an IPL_* constant).
- Take advange of the smaller ipl_cookie_t to shrink kmutex_t from
16 bytes to 8 bytes by overlapping storage where possible.
- Implement a RAS-based _lock_cas() for mc68010 systems (Sun2). See
sun68k/sun68k/isr.c.

Tested on various m68k platforms, but NOT Sun2. In any case, at least
Sun2 compiles now.
 1.26 08-Mar-2007  tsutsui branches: 1.26.2;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.25 16-Feb-2007  ad branches: 1.25.2;
Remove spllowersoftclock() and CLKF_BASEPRI(), and always dispatch callouts
via a soft interrupt. In the near future, softclock will be run from process
context.
 1.24 21-Dec-2006  yamt merge yamt-splraiseipl branch.

- finish implementing splraiseipl (and makeiplcookie).
http://mail-index.NetBSD.org/tech-kern/2006/07/01/0000.html
- complete workqueue(9) and fix its ipl problem, which is reported
to cause audio skipping.
- fix netbt (at least compilation problems) for some ports.
- fix PR/33218.
 1.23 24-Dec-2005  perry branches: 1.23.20; 1.23.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.22 27-Nov-2005  yamt implement splraiseipl() for the following ports.
evbppc, evbmips, evbsh3, hp700, mac68k, vax, x68k.
 1.21 15-Jan-2005  chs branches: 1.21.10; 1.21.16;
de-__P, remove register, ansify, b* -> mem*.
 1.20 13-Apr-2001  thorpej branches: 1.20.8; 1.20.24;
Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.19 14-Jan-2001  thorpej branches: 1.19.2;
Make sure everybody has an splvm() and equate it with splimp() (splimp()
is the historical name for this interrupt level, and the historical name
is going to go away in the near future).
 1.18 22-Aug-2000  thorpej Add spllock(). See spl(9) for details.
 1.17 06-Nov-1999  scottr Change the behavior of spladb() so that it raises the IPL only
high enough to block ADB interrupts.
 1.16 05-Aug-1999  thorpej branches: 1.16.2; 1.16.4; 1.16.8;
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.15 04-Aug-1999  thorpej Use an array for PSL values, rather than individual shortwords, like
the hp300 port.
 1.14 15-Jun-1999  kleink Slightly rearrange the SSIR inline assembly implementation in order to avoid
making assumptions on C symbol name prefixes.
 1.13 28-Feb-1999  scottr branches: 1.13.2; 1.13.6;
Move all IPL setup to intr.c, and do some sanity checking.
 1.12 17-Feb-1999  scottr Fix a typo in the (unused!) splsched() macro.
 1.11 25-Aug-1998  scottr The return value from intr_dispatch() is no longer necessary.
 1.10 25-Aug-1998  scottr Implement splaudio().
 1.9 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.8 07-Nov-1997  scottr Update from John Wittkoski: bug fixes for Cuda support.
 1.7 04-Nov-1997  briggs Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.6 10-Oct-1997  scottr branches: 1.6.2;
Remove advertising clause.
 1.5 03-Aug-1997  scottr Drop splsched() to spl3(), so that it no longer blocks serial interrupts.
 1.4 23-Jul-1997  scottr branches: 1.4.2;
New implementation of _splraise(): use word-length operands where possible
by implementing entirely in assembly. This saves some 6 bytes on all MPUs,
and about 8 cycles on the 030.

Now that it's optimized, define spltty() in terms of _splraise() so that
we don't inadvertantly lower the SPL.
 1.3 12-May-1997  scottr Add en implementation of the Deferred Task Manager, contributed by Paul
Goyette <paul@pgoyette.bdt.com>.
 1.2 14-Apr-1997  scottr Add copyright notice.
 1.1 13-Apr-1997  scottr Move all splxxx() and softint-related macros and prototypes to intr.h,
and include it where appropriate.
 1.4.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.2.2 11-Nov-1997  mellon Pull rev 1.8 up from trunk (scottr)
 1.6.2.1 05-Nov-1997  mellon Pull rev 1.7 up from trunk (scottr)
 1.13.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.13.2.2 09-Nov-1999  scottr Sync with main branch.
 1.13.2.1 01-Nov-1999  scottr Sync with main branch.
 1.16.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.16.4.1 15-Nov-1999  fvdl Sync with -current
 1.16.2.3 21-Apr-2001  bouyer Sync with HEAD
 1.16.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 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 21-Jun-2001  nathanw Catch up to -current.
 1.20.24.2 11-Dec-2005  christos Sync with head.
 1.20.24.1 17-Jan-2005  skrll Sync with HEAD.
 1.20.8.2 13-Apr-2001  thorpej Remove the use of splimp() from the NetBSD kernel. splnet()
and only splnet() is allowed for the protection of data structures
used by network devices.
 1.20.8.1 13-Apr-2001  thorpej file intr.h was added on branch nathanw_sa on 2001-04-13 23:30:01 +0000
 1.21.16.1 29-Nov-2005  yamt sync with head.
 1.21.10.6 04-Feb-2008  yamt sync with head.
 1.21.10.5 07-Dec-2007  yamt sync with head
 1.21.10.4 03-Sep-2007  yamt sync with head.
 1.21.10.3 26-Feb-2007  yamt sync with head.
 1.21.10.2 30-Dec-2006  yamt sync with head.
 1.21.10.1 21-Jun-2006  yamt sync with head.
 1.23.22.1 21-Sep-2006  yamt implement new api for mac68k.
 1.23.20.1 12-Jan-2007  ad Sync with head.
 1.25.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.26.2.2 03-Dec-2007  ad Sync with HEAD.
 1.26.2.1 13-Mar-2007  ad Sync with head.
 1.27.24.2 18-Feb-2008  mjf Sync with HEAD.
 1.27.24.1 08-Dec-2007  mjf Sync with HEAD.
 1.27.18.2 23-Mar-2008  matt sync with HEAD
 1.27.18.1 09-Jan-2008  matt sync with HEAD
 1.27.16.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.29.14.2 18-Jul-2008  simonb Sync with head.
 1.29.14.1 27-Jun-2008  simonb Sync with head.
 1.29.12.2 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.29.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.29.10.1 04-May-2009  yamt sync with head.
 1.29.6.2 28-Sep-2008  mjf Sync with HEAD.
 1.29.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.30.2.1 19-Oct-2008  haad Sync with HEAD.
 1.31.112.1 09-Aug-2023  martin Pull up following revision(s) (requested by maya in ticket #316):

sys/arch/m68k/include/mutex.h: revision 1.13
sys/arch/arm/include/cpu.h: revision 1.125
sys/arch/sun68k/include/intr.h: revision 1.21
sys/arch/arm/include/mutex.h: revision 1.28
sys/sys/rwlock.h: revision 1.18
sys/arch/powerpc/include/mutex.h: revision 1.7
sys/arch/arm/include/mutex.h: revision 1.29
sys/arch/powerpc/include/mutex.h: revision 1.8
sys/uvm/uvm_param.h: revision 1.42
sys/sys/ksem.h: revision 1.16
sys/arch/x86/include/mutex.h: revision 1.10
sys/sys/proc.h: revision 1.372
sys/sys/ksem.h: revision 1.17
sys/arch/ia64/include/mutex.h: revision 1.8
sys/arch/evbarm/include/intr.h: revision 1.29
sys/sys/lua.h: revision 1.9
sys/arch/next68k/include/intr.h: revision 1.23
sys/arch/ia64/include/mutex.h: revision 1.9
sys/arch/hp300/include/intr.h: revision 1.35
sys/arch/hp300/include/intr.h: revision 1.36
sys/arch/sparc/include/cpu.h: revision 1.111
sys/arch/hppa/include/mutex.h: revision 1.16
sys/arch/vax/include/intr.h: revision 1.31
sys/arch/hppa/include/mutex.h: revision 1.17
sys/arch/news68k/include/intr.h: revision 1.28
sys/arch/hppa/include/mutex.h: revision 1.18
sys/arch/hppa/include/intr.h: revision 1.3
sys/arch/hppa/include/mutex.h: revision 1.19
sys/arch/hppa/include/intr.h: revision 1.4
sys/sys/sched.h: revision 1.92
sys/opencrypto/cryptodev.h: revision 1.51
sys/arch/vax/include/mutex.h: revision 1.20
sys/arch/sparc64/include/mutex.h: revision 1.10
sys/arch/ia64/include/sapicvar.h: revision 1.2
sys/arch/riscv/include/mutex.h: revision 1.5
sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
sys/arch/riscv/include/mutex.h: revision 1.6
sys/ddb/files.ddb: revision 1.16
sys/arch/mac68k/include/intr.h: revision 1.32
share/man/man4/ddb.4: revision 1.203
sys/ddb/db_command.c: revision 1.183
sys/arch/mips/include/mutex.h: revision 1.10
sys/ddb/db_command.c: revision 1.184
sys/arch/x68k/include/intr.h: revision 1.22
sys/arch/sparc/include/psl.h: revision 1.51
sys/arch/or1k/include/mutex.h: revision 1.4
sys/arch/mips/include/mutex.h: revision 1.11
sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
sys/arch/sparc64/include/cpu.h: revision 1.134
sys/arch/sparc/include/psl.h: revision 1.52
sys/arch/or1k/include/mutex.h: revision 1.5
sys/arch/mvme68k/include/intr.h: revision 1.22
sys/arch/luna68k/include/intr.h: revision 1.16
external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
sys/arch/sparc/include/mutex.h: revision 1.12
sys/arch/sparc/include/mutex.h: revision 1.13
sys/arch/usermode/include/mutex.h: revision 1.5
sys/arch/usermode/include/mutex.h: revision 1.6
sys/kern/kern_core.c: revision 1.38
usr.sbin/crash/Makefile: revision 1.49
sys/arch/amiga/include/intr.h: revision 1.23
sys/arch/alpha/include/mutex.h: revision 1.12
sys/arch/alpha/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
sys/ddb/ddb.h: revision 1.6
sys/arch/sparc64/include/mutex.h: revision 1.8
sys/arch/sh3/include/mutex.h: revision 1.12
sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
sys/ddb/db_syncobj.c: revision 1.1
sys/arch/vax/include/mutex.h: revision 1.18
sys/arch/sparc64/include/psl.h: revision 1.63
sys/arch/sparc64/include/mutex.h: revision 1.9
sys/arch/sh3/include/mutex.h: revision 1.13
sys/arch/evbarm/lubbock/obio.c: revision 1.13
sys/arch/atari/include/intr.h: revision 1.23
sys/ddb/db_syncobj.c: revision 1.2
sys/arch/vax/include/mutex.h: revision 1.19
sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
sys/arch/cesfic/include/intr.h: revision 1.14
sys/ddb/db_syncobj.h: revision 1.1
sys/arch/x86/include/cpu.h: revision 1.134
sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
sys/arch/cesfic/include/intr.h: revision 1.15
sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
sys/sys/cpu_data.h: revision 1.54
sys/arch/m68k/include/mutex.h: revision 1.12
sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes. Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h. avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h. And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex. Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT. Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 08-Jun-2005  rjs Add message definitions for SWIM and for ADB autopoll.
 1.5 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.4 30-Jul-2000  briggs branches: 1.4.24;
Some uncommitted poking around. No functional change.
 1.3 21-Feb-2000  scottr Explicitly include headers needed by iopreg.h
 1.2 28-Jun-1999  briggs branches: 1.2.2; 1.2.4; 1.2.8;
Include a bit more info about what's not happening with IOP.
 1.1 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.2.8.2 28-Jun-1999  briggs Include a bit more info about what's not happening with IOP.
 1.2.8.1 28-Jun-1999  briggs file iopreg.h was added on branch scottr-mac68k-wscons on 1999-06-28 04:33:22 +0000
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.2.2.1 28-Jun-1999  thorpej file iopreg.h was added on branch chs-ubc2 on 1999-07-01 23:10:00 +0000
 1.4.24.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.24.1 17-Jan-2005  skrll Sync with HEAD.
 1.4 11-Dec-2005  christos merge ktrace-lwp.
 1.3 29-Apr-2004  fredb Protect against multiple inclusion. Lets "kdump" and "ktrace" build again
on mac68k.
 1.2 13-Oct-1997  lukem branches: 1.2.52;
rcsid fascism
 1.1 03-Dec-1994  briggs branches: 1.1.14;
Mac ROM Glue changes from grantham@tenon.com.
 1.1.14.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.52.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.52.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.52.1 03-Aug-2004  skrll Sync with HEAD
 1.1 23-Apr-1997  scottr Implement new crash dump format. Mostly taken from hp300, extended to
support multiple physical RAM segments by me. Garbage collect functions
obsoleted by this change.
 1.6 09-Apr-1997  scottr Make C-\\ work; from Bill Studenmund, who noticed the swapped keycodes.
Closes PR #3294.
 1.5 23-Feb-1996  scottr Add ^^ and ^_ codes to default keyboard layout
 1.4 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 31-Jul-1994  lkestel branches: 1.2.2;
Added a few macros for keys; cleaned up; only define key array
ifdef KEYBOARD_ARRAY, else just declare it.
 1.1 30-Jul-1994  lkestel Moved adbsys.h grfioctl.h and keyboard.h to include to make desktop
and X compile more cleanly.
 1.2.2.2 31-Jul-1994  lkestel Added a few macros for keys; cleaned up; only define key array
ifdef KEYBOARD_ARRAY, else just declare it.
 1.2.2.1 31-Jul-1994  lkestel file keyboard.h was added on branch netbsd-1-0 on 1994-07-31 06:33:42 +0000
 1.8 28-Mar-2012  christos - Normalize inclusion protection (remove)
- Move CHAR_{MIN,MAX} to a common file.
- Fix broken comments
 1.7 09-Jan-1998  perry branches: 1.7.190; 1.7.194;
multiple include protect machine/limits.h, fixes pr 4473 (from Mika Nystrom)
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.4 02-Dec-1993  briggs Add symbols for quads to limits and endian and protect endian from mult.
inclusion.
 1.3 02-Dec-1993  briggs Get rid of CLK_TCK. Theo reminds me that the value isn't
machine-dependent, which is why it's defined in time.h.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.7.194.1 05-Apr-2012  mrg sync to latest -current.
 1.7.190.1 17-Apr-2012  yamt sync with head
 1.1 29-Apr-2000  thorpej branches: 1.1.6;
Require that each each MACHINE/MACHINE_ARCH supply a lock.h. This file
contains the values __SIMPLELOCK_LOCKED and __SIMPLELOCK_UNLOCKED, which
replace the old SIMPLELOCK_LOCKED and SIMPLELOCK_UNLOCKED. These files
are also required to supply inline functions __cpu_simple_lock(),
__cpu_simple_lock_try(), and __cpu_simple_unlock() if locking is to be
supported on that platform (i.e. if MULTIPROCESSOR is defined in the
_KERNEL case). Change these functions to take an int * (&alp->lock_data)
rather than the struct simplelock * itself.

These changes make it possible for userland to use the locking primitives
by including <machine/lock.h>.
 1.1.6.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.6.1 29-Apr-2000  bouyer file lock.h was added on branch thorpej_scsipi on 2000-11-20 20:12:20 +0000
 1.1 30-Nov-2024  christos branches: 1.1.4;
Create a new header lwp_private.h to contain _lwp_getprivate_fast,
_lwp_gettcb_fast, _lwp_settcb and remove them from mcontext.h, so that:
1. we don't need special hacks to hide them
2. we can include <lwp.h> where needed to get the necessary prototypes
without redefining them locally.
 1.1.4.2 02-Aug-2025  perseant Sync with HEAD
 1.1.4.1 30-Nov-2024  perseant file lwp_private.h was added on branch perseant-exfatfs on 2025-08-02 05:55:50 +0000
 1.1 23-Dec-1999  kleink branches: 1.1.2; 1.1.8;
C99: Define a NAN macro in <math.h> which evaulates to a constant expression of
a single-precision quiet NaN; only to be defined on platforms that do support
this value.
 1.1.8.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.1.8.1 23-Dec-1999  bouyer file math.h was added on branch thorpej_scsipi on 2000-11-20 20:12:20 +0000
 1.1.2.2 13-Feb-2000  scottr Sync with main branch.
 1.1.2.1 23-Dec-1999  scottr file math.h was added on branch scottr-mac68k-wscons on 2000-02-13 04:17:42 +0000
 1.2 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.1 10-Nov-2001  scw branches: 1.1.2;
file mcontext.h was initially added on branch nathanw_sa.
 1.1.2.1 10-Nov-2001  scw Kernel mcontext glue for Scheduler Activations on m68k from
Klaus Klein <kleink@netbsd.org>.
 1.3 17-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2 09-Feb-2007  ad branches: 1.2.4;
Merge newlock2 to head.
 1.1 22-Dec-2006  ad branches: 1.1.2;
file mutex.h was initially added on branch newlock2.
 1.1.2.1 22-Dec-2006  ad Pull in CPU specific stubs.
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file mutex.h was added on branch yamt-lazymbuf on 2007-02-26 09:07:17 +0000
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.46 06-Jun-2019  jklos As per port-m68k/54254 and a few months of testing, mac68k will switch
to 8KB pages. OK with hauke@, rjs@ and tsutsui@.
 1.45 10-Feb-2012  para branches: 1.45.48;
proper sizing of kmem_arena on different ports

PR port-i386/45946: Kernel locks up in VMEM system
 1.44 08-Feb-2011  rmind branches: 1.44.4; 1.44.8;
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.43 11-Dec-2009  tsutsui branches: 1.43.4; 1.43.6; 1.43.8;
Refactoring MD segment related definitions on m68k ports:
- move macro SEGSHIFT, NBSEG, and SEGOFSET from <machine/param.h>
to <m68k/pmap_motorola.h> where they should belong
- also simplify NBSEG macro for both 020/030 and 040/060 cases
- also move m68k_trunc_seg(), m68k_round_seg(), and m68k_seg_offset()
(that use SEGOFSET) from <m68k/param.h> to <m68k/pmap_motorola.h>
- add comments about each segment size value used on pmap_motorola
implementation
- add TIA_SIZE, TIA_SHIFT, TIB_SIZE, and TIB_SHIFT macro which can be
used for ste/pte index sizes
- use proper vaddr_t cast instead of unsigned for SEGOFSET/PGOFSET macro

Tested on atari, hp300, and news68k.
 1.42 09-Dec-2009  tsutsui Fix wrong NBSEG values for all hp300 pmap derived m68k ports.
They were incorrect since 1997 on amiga and atari, and since 2002
on other ports, but fortunately they don't look so fatal.

Anyway, these values will be moved into <m68k/pmap_motorola.h> soon
since they are quite pmap implementation dependent.
 1.41 11-Dec-2005  christos branches: 1.41.78;
merge ktrace-lwp.
 1.40 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.39 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.38 03-Nov-2002  chs branches: 1.38.6;
merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.37 20-May-2002  scottr From John Klos, originally committed to the amiga port:
Updated NKMEMPAGES_MAX_DEFAULT so that large memory systems won't crash
when allocating/deallocating lots of memory at once.
 1.36 11-Feb-2000  thorpej branches: 1.36.8; 1.36.12; 1.36.20;
Update for the NKMEMPAGES changes.
 1.35 04-Dec-1999  ragge CL* discarding.
 1.34 20-Sep-1997  leo branches: 1.34.10; 1.34.18; 1.34.24;
Move the definition of MSGBUFSIZE up to the machine-arch level if
possible. Pointed out by Bernd Ernesti.
 1.33 19-Sep-1997  leo Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.32 10-Jul-1997  veego branches: 1.32.2;
Restore the define of NPTEPG.
 1.31 10-Jun-1997  veego The 'Mach derived conversion macros' are now in <m68k/param.h>
 1.30 10-Jun-1997  veego Use the MI <m68k/param.h> include.
 1.29 13-Apr-1997  scottr Move all splxxx() and softint-related macros and prototypes to intr.h,
and include it where appropriate.
 1.28 01-Mar-1997  scottr Protect MCLSHIFT definition so users can customize MCLBYTES, from Jonathan.
 1.27 24-Feb-1997  fvdl Define ALIGNED_POINTER
 1.26 05-May-1996  briggs branches: 1.26.8;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.25 04-Mar-1996  cgd add _MACHINE and _MACHINE_ARCH, which are like MACHINE and MACHINE_ARCH,
execpt without quotes. meant to be __CONCAT()ted for easy #includes
of machine-dependent headers for MI code (e.g. for the MI ISA/EISA/PCI/TC
bus code).
 1.24 17-Feb-1996  briggs Move spl stuff from param.h to psl.h. Prototype delay() in param.h.
 1.23 02-Feb-1996  mycroft Fix #includes.
 1.22 13-Jan-1996  briggs Move splimp to 2 and spltty to 1.
 1.21 13-Aug-1995  briggs Document spl()s a bit, order the splfoo()s in splX() order.
 1.20 13-Aug-1995  mycroft Replace splnet() with splsoftnet(). Add splnet(). Make splimp() > spltty().
 1.19 26-Jun-1995  cgd clean up definitions of ctod(), dtoc(), ctob(), btoc(), btodb(), and
dbtob(). remove unused definitions of ctos(), stoc(), and dtob().
 1.18 21-Jun-1995  briggs Update to look more like hp300. Clean up a lot.
 1.17 22-Apr-1995  briggs Define DELAY.
 1.16 29-Mar-1995  briggs Get rid of some BARFs and assign some semi-reasonable spl()s...
 1.15 18-Mar-1995  cgd don't be so quick to cast macro arguments to unsigned; if the
arguments are really off_t's (e.g. to btodb), then you can lose
information. This was the "> 4G file systems don't work" bug; physio
uses btodb, which was broken.
 1.14 01-Nov-1994  briggs Raise MCLBYTES to 2048.
 1.13 26-Oct-1994  cgd new RCS ID format.
 1.12 16-Sep-1994  jtc asm -> __asm (PR #463).
 1.11 23-Aug-1994  briggs Add USPACE.
 1.10 06-May-1994  briggs Get things to compile with latest changes.
 1.9 21-Apr-1994  briggs '040 changes from Amiga.
Protect against multiple inclusion.
 1.8 30-Jan-1994  briggs Get rid of DELAY defines. These are bogus. There has to be a better
way. And there will be.
 1.7 15-Dec-1993  briggs Change constants and comments to reflect the current MACHINE value.
Define T_BRKPT and T_WATCHPOINT.
 1.6 06-Dec-1993  briggs Dumb typo. Must be dyslexic. Changed MACHINE_MID to MID_MACHINE.
 1.5 06-Dec-1993  briggs Move MID_MACHINE to param.h from exec.h and get rid of bogus includes.
 1.4 04-Dec-1993  briggs Change USRTEXT to 8192 in vmparam.h.
Add MACHINE_ARCH (m68k) to param.h.
 1.3 02-Dec-1993  briggs Update MACHINE to mac68k in param.h.
Update MACHINE_MID to MID_M68K -- untested.
Add __LDPGSZ as 8192 -- untested.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.26.8.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.32.2.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.34.24.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.34.18.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.34.10.2 13-Feb-2000  scottr Sync with main branch.
 1.34.10.1 12-Dec-1999  scottr Sync with main branch.
 1.36.20.1 30-May-2002  gehenna Catch up with -current.
 1.36.12.2 11-Nov-2002  nathanw Catch up to -current
 1.36.12.1 20-Jun-2002  nathanw Catch up to -current.
 1.36.8.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.38.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.38.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.38.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.38.6.1 03-Aug-2004  skrll Sync with HEAD
 1.41.78.1 11-Mar-2010  yamt sync with head
 1.43.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.43.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.43.4.1 05-Mar-2011  rmind sync with head
 1.44.8.1 18-Feb-2012  mrg merge to -current.
 1.44.4.1 17-Apr-2012  yamt sync with head
 1.45.48.1 10-Jun-2019  christos Sync with HEAD
 1.8 19-May-1997  scottr Use common m68k/pcb.h; noted by Erik Bertelsen <erik@sockdev.uni-c.dk>,
closes PR 3650.
 1.7 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.6 21-Jun-1995  briggs Get rid of pcb_cmap2.
 1.5 17-May-1995  briggs Make comment fit reality.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 26-Jun-1994  briggs Add md_coredump.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.4 24-Dec-2005  perry bare asm -> __asm
 1.3 26-Oct-1994  cgd branches: 1.3.84;
new RCS ID format.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3.84.1 21-Jun-2006  yamt sync with head.
 1.39 18-Aug-2025  andvar Fix various typos, mainly in comments:
s/invaid/invalid/
s/instad/instead/
s/wich/with/
s/tranform/transform/
s/tranmist/transmit/
s/tranceiver/transceiver/
s/Tranparent/Transparent/
s/tranlated/translated/
s/tranfer/transfer/
s/tranmissions/transmissions/
s/condtions/conditions/
s/Recient/Recent/
 1.38 27-Dec-2023  thorpej Define values for the 68030 TT registers in terms of the definitions
in <m68k/mmu_30.h> rather than using magic numbers.
 1.37 03-Nov-2002  chs merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.36 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.35 22-Sep-2002  chs it really helps to get the stub right before cutting + pasting it 27 times.
alas, I did not. doh.
 1.34 22-Sep-2002  chs add pmap_remove_all() hook (empty on most platforms so far).
 1.33 10-Sep-2001  chris branches: 1.33.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.32 26-May-2001  chs branches: 1.32.2; 1.32.4;
replace vm_page_t with struct vm_page *.
 1.31 26-May-2001  chs replace {simple_,}lock{_data,}_t with struct {simple,}lock {,*}.
 1.30 22-Apr-2001  thorpej Undo a misguided previous change to the pmap_update() API.
 1.29 22-Apr-2001  thorpej Give pmap_update() an argument (a pmap_t) so that it knows which
pmap it should be updating.
 1.28 21-Apr-2001  thorpej #define away pmap_update() in <machine/pmap.h> so that no function
call overhead is incurred as we start sprinkling pmap_update() calls
throughout the source tree (no pmaps currently defer operations, but
we are adding the infrastructure to allow them to do so).
 1.27 28-Nov-1999  scottr branches: 1.27.6;
Sync cachectl1() implementation with other m68k ports.
 1.26 21-Jul-1999  briggs branches: 1.26.2; 1.26.8;
Declare struct pmap kernel_pmap_store extern.
 1.25 25-Feb-1999  is branches: 1.25.2; 1.25.4; 1.25.6;
mac68k part of pr 6152 fix, and missing bits for the others
 1.24 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.23 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.22 18-Feb-1998  cgd Move pmap_map() function definition to MD headers, as appropriate. It's
an internal function, and the VM system shouldn't try to prototype it.
(Note that some ports _don't_ prototype it.)
 1.21 06-Jan-1998  thorpej Garbage-collect pm_stchanged; it's not used by anything.
 1.20 06-Jan-1998  thorpej Garbage-collect use of the PCB's copy of the user segment table pointer.
 1.19 03-Jan-1998  thorpej Now that all ports have pmap_activate(), and it has an identical interface,
prototype it in <vm/pmap.h>
 1.18 01-Jan-1998  thorpej Change an argument name to PMAP_ACTIVATE() to more accurately describe the
semantics of the argument.
 1.17 01-Jan-1998  thorpej - Make pmap_activate() and pmap_deactivate() take a struct proc *.
- Define active_user_pmap() and use it in the appropriate places (from hp300
port).
 1.16 10-Jun-1997  veego s/mac68k_btop/m68k_btop/
 1.15 20-May-1997  scottr Adjust for previous m68k/pcb.h change
 1.14 02-Feb-1997  scottr copypage() is now declared in m68k/cpu.h
 1.13 18-May-1996  briggs Fixup a few prototypes and put 'em in their place.
 1.12 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.11 24-Jun-1995  briggs pmap_page_index isn't a macro.
 1.10 21-Jun-1995  briggs Cleanup some and make these look more like hp300 versions.
 1.9 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.8 23-Mar-1995  briggs KERNEL -> _KERNEL
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 31-Jul-1994  lkestel Different pa_index() ifdef MACHINE_NONCONTIG.
 1.5 26-Jun-1994  briggs branches: 1.5.2;
Fix warnings...
 1.4 21-Apr-1994  briggs '040 changes from Amiga.
 1.3 15-Dec-1993  briggs Change constants and comments to reflect the current MACHINE value.
Define T_BRKPT and T_WATCHPOINT.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.5.2.1 11-Aug-1994  mycroft update from trunk
 1.25.6.1 02-Aug-1999  thorpej Update from trunk.
 1.25.4.1 29-Nov-1999  he Pull up revision 1.27 (reqyested by scottr):
Fix i-cache/d-cache synchronization for M68040 cpus (see M68040
UM p.4-10). Makes regress/sys/kern/sigtramp work even on M68040.
 1.25.2.2 28-Nov-1999  scottr Sync with main branch.
 1.25.2.1 01-Nov-1999  scottr Sync with main branch.
 1.26.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.26.2.2 23-Apr-2001  bouyer Sync with HEAD.
 1.26.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.27.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.32.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.32.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.32.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.33.4.6 11-Nov-2002  nathanw Catch up to -current
 1.33.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.33.4.4 02-Jul-2002  nathanw Adjust whitespace so that this matches the trunk.
 1.33.4.3 24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.33.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.33.4.1 10-Sep-2001  scw file pmap.h was added on branch nathanw_sa on 2001-11-18 18:12:01 +0000
 1.2 12-Jul-2018  maxv Remove the kernel PMC code. Sent yesterday on tech-kern@.

This change:

* Removes "options PERFCTRS", the associated includes, and the associated
ifdefs. In doing so, it removes several XXXSMPs in the MI code, which is
good.

* Removes the PMC code of ARM XSCALE.

* Removes all the pmc.h files. They were all empty, except for ARM XSCALE.

* Reorders the x86 PMC code not to rely on the legacy pmc.h file. The
definitions are put in sysarch.h.

* Removes the kern/sys_pmc.c file, and along with it, the sys_pmc_control
and sys_pmc_get_info syscalls. They are marked as OBSOL in kern,
netbsd32 and rump.

* Removes the pmc_evid_t and pmc_ctr_t types.

* Removes all the associated man pages. The sets are marked as obsolete.
 1.1 07-Aug-2002  briggs branches: 1.1.2; 1.1.4; 1.1.6; 1.1.202; 1.1.204;
Implement pmc(9) -- An interface to hardware performance monitoring
counters. These counters do not exist on all CPUs, but where they
do exist, can be used for counting events such as dcache misses that
would otherwise be difficult or impossible to instrument by code
inspection or hardware simulation.

pmc(9) is meant to be a general interface. Initially, the Intel XScale
counters are the only ones supported.
 1.1.204.1 10-Jun-2019  christos Sync with HEAD
 1.1.202.1 28-Jul-2018  pgoyette Sync with HEAD
 1.1.6.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.6.1 07-Aug-2002  jdolecek file pmc.h was added on branch kqueue on 2002-09-06 08:36:54 +0000
 1.1.4.2 31-Aug-2002  gehenna catch up with -current.
 1.1.4.1 07-Aug-2002  gehenna file pmc.h was added on branch gehenna-devsw on 2002-08-31 13:45:03 +0000
 1.1.2.2 13-Aug-2002  nathanw Catch up to -current.
 1.1.2.1 07-Aug-2002  nathanw file pmc.h was added on branch nathanw_sa on 2002-08-13 02:18:27 +0000
 1.7 13-Jul-2002  scw m68k syscall rototill:

- Switch all m68k-based ports over to __HAVE_SYSCALL_INTERN.
- Add systrace glue.
- Define struct mdproc in <m68k/proc.h> instead of <machine/proc.h>.
(They were all defined exactly the same anyway, other than a couple
of the MDP_* flags.)
 1.6 11-Jun-1997  kleink branches: 1.6.38; 1.6.42; 1.6.50;
GC obsolete MDP_AST flag.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 06-May-1994  briggs Get things to compile with latest changes.
 1.3 27-Feb-1994  briggs Add MDP_STACKADJ for compat_sunos.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.6.50.1 16-Jul-2002  gehenna catch up with -current.
 1.6.42.2 01-Aug-2002  nathanw Catch up to -current.
 1.6.42.1 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.6.38.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.4 31-Aug-2001  simonb branches: 1.4.6;
Use comments around the token after a #endif.
 1.3 05-May-1996  briggs branches: 1.3.46;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 23-May-1994  briggs Copied from Amiga. Just include m68k/profile.h.
 1.3.46.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.4.6.2 31-Aug-2001  simonb Use comments around the token after a #endif.
 1.4.6.1 31-Aug-2001  simonb file profile.h was added on branch nathanw_sa on 2001-08-31 04:44:57 +0000
 1.8 23-Jul-2019  rin PR port-mac68k/24883

Support DMA xfer for SCSI adapter of AV Mac (660/840AV), written by
Michael Zucca.

This improves disk I/O performance by nearly one order of magnitude.
In addition, interrupt storm due to heavy disk PIO is resolved.

I'm deeply grateful to Michael Zucca for his analysis of DMA engine
and submission of PR. I also thank Izumi Tsutsui (useful comments on
port-mac68k@) and Martin Husemann (test on 660AV).
 1.7 11-Dec-2005  christos branches: 1.7.166;
merge ktrace-lwp.
 1.6 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.5 26-Mar-2004  wiz Update David Huang's email address in the license
per his request in PR 24907.
 1.4 28-Jun-1999  briggs branches: 1.4.36;
Add some constants from Linux/mac68k to note SCC, floppy, and SCSI registers.
Add some code, inspired by Linux/mac68k, to shutdown all DMA on the PSC
at startup and to disable and clear all interrupts except the SCC.
 1.3 24-Apr-1998  scottr branches: 1.3.8; 1.3.12;
Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.2 07-Nov-1997  briggs NetBSD RCSIds.
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.2 12-Nov-1997  mellon Pull rev 1.2 up from trunk (briggs)
 1.1.2.1 04-Nov-1997  mellon file psc.h was added on branch netbsd-1-3 on 1997-11-12 02:16:42 +0000
 1.3.12.1 01-Jul-1999  thorpej Sync w/ -current.
 1.3.8.1 01-Nov-1999  scottr Sync with main branch.
 1.4.36.4 17-Jan-2005  skrll Sync with HEAD.
 1.4.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.4.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.4.36.1 03-Aug-2004  skrll Sync with HEAD
 1.7.166.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.13 13-Apr-1997  scottr Move all splxxx() and softint-related macros and prototypes to intr.h,
and include it where appropriate.
 1.12 12-Sep-1996  scottr Define spladb() (conservatively, at least for now).
 1.11 21-Jun-1996  briggs Move splimp back to spl2 (from spl4).
 1.10 14-Jun-1996  scottr raise splimp() to spl4(); we need to block zs interrupts, too.
 1.9 19-May-1996  briggs branches: 1.9.4;
Ooops. cut 'n' pasto. splzs should 4, not 2.
 1.8 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.7 06-May-1996  scottr Update several comments.
 1.6 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.5 17-Feb-1996  briggs Move spl stuff from param.h to psl.h. Prototype delay() in param.h.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.9.4.2 25-Jun-1996  jtc Pulled up from rev 1.11 by request from Allen Briggs
 1.9.4.1 14-Jun-1996  scottr Pull up from trunk:
>1.10: raise splimp() to spl4(); we need to block zs interrupts, too.
 1.11 14-Oct-2002  chs merge pte.h for m68k w/ motorola or compatible MMU
(only 4k-page platforms so far).
 1.10 12-Dec-1999  scottr branches: 1.10.12;
Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.9 05-May-1996  briggs branches: 1.9.24; 1.9.32; 1.9.38;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.8 21-Jun-1995  briggs Cleanup some and make these look more like hp300 versions.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 29-Jun-1994  briggs Oops. w/ 4k pages, PTSIZE is larger.
 1.5 26-Jun-1994  briggs PG_CC -> PG_CCB
 1.4 21-Apr-1994  briggs Add '040 stuff from Amiga pte.h.
Also protect against multiple inclusion.
 1.3 22-Feb-1994  briggs Moved PTBASE from 60000000 to 60100000 for PowerBooks. From grantham.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.9.38.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.32.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.24.1 12-Dec-1999  scottr Sync with main branch.
 1.10.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.13 11-Dec-2005  christos merge ktrace-lwp.
 1.12 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.11 09-Apr-1997  thorpej branches: 1.11.58;
regdump() is prototyped in m68k/cpu.h now
 1.10 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 27-Jan-1994  cgd HP300 -> MACHINE
 1.7 08-Jan-1994  cgd stubs which pint to m68k include
 1.6 06-Jan-1994  mycroft Still need old #defines for now.
 1.5 06-Jan-1994  mycroft Implement `struct reg'.
 1.4 08-Dec-1993  mycroft Move #define of NIPCREG outside #fidef.
 1.3 02-Sep-1993  mycroft Ditto.
 1.2 22-May-1993  cgd add rcsids to everything and clean up headers
 1.1 13-May-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.1 13-May-1993  cgd add hp300 kernel files. generic kernel files might need some help...
 1.11.58.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.58.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.58.1 03-Aug-2004  skrll Sync with HEAD
 1.2 09-Feb-2007  ad branches: 1.2.4;
Merge newlock2 to head.
 1.1 22-Dec-2006  ad branches: 1.1.2;
file rwlock.h was initially added on branch newlock2.
 1.1.2.1 22-Dec-2006  ad Pull in CPU specific stubs.
 1.2.4.2 26-Feb-2007  yamt sync with head.
 1.2.4.1 09-Feb-2007  yamt file rwlock.h was added on branch yamt-lazymbuf on 2007-02-26 09:07:17 +0000
 1.6 15-Nov-1996  briggs Remove scsi96 driver.
 1.5 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 08-Jul-1994  briggs Add a constant for masking off the scsi phase from the status register.
 1.2 07-Jul-1994  briggs branches: 1.2.2;
Apparently the registers for the NCR 53c96 in the mac are laid out
the same as they arefor the 5380--15 bytes of padding between each
reg. Define a structure for that here, now.
 1.1 26-Jun-1994  briggs First pass at a header file for the NCR 53C96 driver (still under
construction).
 1.2.2.2 24-Jul-1994  cgd update, as requested by briggs
 1.2.2.1 07-Jul-1994  cgd file scsi96reg.h was added on branch netbsd-1-0 on 1994-07-24 01:23:24 +0000
 1.6 03-May-2003  wiz DMA, not dma nor Dma.
 1.5 12-Apr-1999  pk Quote "AS IS" as in the majority of Carnegy Mellon notices.
 1.4 06-Apr-1999  pk Fix a pasto in copyright text which has been procreating like rabbits..
 1.3 26-Oct-1994  cgd branches: 1.3.26; 1.3.28;
new RCS ID format.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3.28.2 12-Apr-1999  pk branches: 1.3.28.2.2;
Pullup copyright text corrections.
 1.3.28.1 07-Apr-1999  pk Pull up from trunk: copyright text warts.
 1.3.28.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.3.26.1 16-May-1999  scottr Sync with main branch.
 1.1 20-Dec-1994  cgd make the definition of _JBLEN mach. dep. header-dependent.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.1 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.7 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.6 22-Jan-1999  mycroft Standardize format.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 15-Oct-1994  cgd make <stdarg.h> a symlink, and clean up ports' stdarg.h and varargs.h files.
 1.3 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2 11-Dec-2005  christos branches: 1.2.18;
merge ktrace-lwp.
 1.1 11-Jul-2005  christos branches: 1.1.6;
Add m68k sunos_machdep.h
 1.1.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.1.6.1 11-Jul-2005  skrll file sunos_machdep.h was added on branch ktrace-lwp on 2005-11-10 13:57:13 +0000
 1.2.18.2 21-Jun-2006  yamt sync with head.
 1.2.18.1 11-Dec-2005  yamt file sunos_machdep.h was added on branch yamt-lazymbuf on 2006-06-21 14:53:13 +0000
 1.4 19-Dec-2018  maxv Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.3 09-Nov-1999  kleink branches: 1.3.40; 1.3.218;
Rip protection against multiple inclusion from wrapper headers.
 1.2 29-Apr-1999  kleink branches: 1.2.2; 1.2.4; 1.2.6; 1.2.8; 1.2.12;
Pull in the right generic m68k header. (Where was my mind?)
 1.1 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.2.12.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.8.1 15-Nov-1999  fvdl Sync with -current
 1.2.6.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.2.2.3 28-Nov-1999  scottr Sync with main branch.
 1.2.2.2 16-May-1999  scottr Sync with main branch.
 1.2.2.1 29-Apr-1999  scottr file svr4_machdep.h was added on branch scottr-mac68k-wscons on 1999-05-16 22:38:10 +0000
 1.3.218.1 10-Jun-2019  christos Sync with HEAD
 1.3.40.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.3 15-Dec-1993  briggs Change constants and comments to reflect the current MACHINE value.
Define T_BRKPT and T_WATCHPOINT.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.21 01-Apr-2021  simonb Define __HAVE_LEGACY_INTRCNT to indicate this port uses legacy intrcnt
interrupt accounting.
 1.20 20-Jan-2008  joerg branches: 1.20.110; 1.20.112;
Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
 1.19 17-Oct-2007  garbled branches: 1.19.2; 1.19.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.18 14-Jul-2007  ad branches: 1.18.10;
Generic soft interrupts are mandatory.
 1.17 08-Mar-2007  tsutsui branches: 1.17.2; 1.17.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.16 20-Nov-2006  hauke branches: 1.16.4;
Add Timecounter support for mac68k, using the otherwise idle second
timer of VIA1. Passes regression/sys/kern/time regression test.

While we are here, GC leftover prototypes from MI todr integration,
and clean up clockreg.h in the light of "Guide to the Macintosh
Hardware" information.

(Reviewed and okayed by Martin Husemann)
 1.15 20-Sep-2006  gdamore Convert mac68k to generic todr. Thanks to Robert Swindells for testing.
 1.14 11-Dec-2005  christos branches: 1.14.20; 1.14.22;
merge ktrace-lwp.
 1.13 19-Jan-2005  chs branches: 1.13.8;
mac68k no longer abuses cf_unit.
 1.12 28-Feb-2002  simonb branches: 1.12.16; 1.12.24;
Use "#define<tab>".
 1.11 05-Feb-2000  cgd branches: 1.11.8; 1.11.12;
add __BROKEN_CONFIG_UNIT_USAGE #define, becuase these ports do very
wrong things with device configuration data "cf_unit" information.
 1.10 17-Dec-1996  scottr branches: 1.10.22; 1.10.30;
Remove __BROKEN_INDIRECT_CONFIG, since we are no longer broken.
 1.9 05-Dec-1996  cgd First step inn removing config_scan() and the hacks that gave devices
on indirect-config busses a (permanent) softc that they could share
between 'match' and 'attach' routines:

Define __BROKEN_INDIRECT_CONFIG so that old autoconfiguration
interfaces are used, until drivers are converted to use the new
interfaces (actually, converted back to use the _older_ interfaces)
which prohibit indirect configuration devices from receiving a softc
in their match routine that they can share with their attach routine.
 1.8 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7 01-Jul-1995  briggs Remove this define--we're using the new dump type.
 1.6 26-Jun-1995  cgd define __BDEVSW_DUMP_OLD_TYPE for ports where it's true. clean up
some m68k ports inclusion of common header.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 14-Mar-1994  cgd add comment for consistency.
 1.3 10-Jan-1994  briggs Fixup to use m68k headers, now. Thanks, Chris.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.10.30.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.22.1 13-Feb-2000  scottr Sync with main branch.
 1.11.12.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.11.8.1 16-Mar-2002  jdolecek Catch up with -current.
 1.12.24.1 29-Apr-2005  kent sync with -current
 1.12.16.1 24-Jan-2005  skrll Sync with HEAD.
 1.13.8.2 21-Jan-2008  yamt sync with head
 1.13.8.1 30-Dec-2006  yamt sync with head.
 1.14.22.2 10-Dec-2006  yamt sync with head.
 1.14.22.1 22-Oct-2006  yamt sync with head
 1.14.20.2 12-Jan-2007  ad Sync with head.
 1.14.20.1 18-Nov-2006  ad Sync with head.
 1.16.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.10.1 03-Oct-2007  garbled Sync with HEAD
 1.17.2.1 15-Jul-2007  ad Sync with head.
 1.18.10.2 23-Mar-2008  matt sync with HEAD
 1.18.10.1 06-Nov-2007  matt sync with HEAD
 1.19.8.1 23-Jan-2008  bouyer Sync with HEAD.
 1.19.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.20.112.1 03-Apr-2021  thorpej Sync with HEAD.
 1.20.110.1 03-Apr-2021  thorpej Sync with HEAD.
 1.3 17-Jul-2011  joerg Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
 1.2 26-Oct-1994  cgd new RCS ID format.
 1.1 27-Jan-1994  mycroft Pointer to common version.
 1.14 11-Dec-2005  christos merge ktrace-lwp.
 1.13 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.12 28-Jun-1999  briggs branches: 1.12.36;
Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.11 20-Feb-1999  scottr branches: 1.11.2; 1.11.6;
Rename via_shutdown() to via_powerdown() for clarity and consistency.
 1.10 06-Jan-1999  scottr Update video-related RBV constants to reflect reality.
 1.9 06-Jan-1999  scottr G/C rbv_vidstatus() and related constant.
 1.8 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.7 10-Sep-1997  scottr For consistency: VIA_initialize() -> via_init()
 1.6 28-Feb-1997  scottr branches: 1.6.4;
Generalize VIA1 and VIA2 interrupt registration a bit, and do a slight
optimization on the VIA interrupt handlers.
 1.5 29-Oct-1996  briggs branches: 1.5.6;
Add prototype for mac68k_register_scsi_b_irq().
 1.4 07-Jun-1996  briggs Changes from Bill Studenmund to support external clocks on the modem port.
 1.3 05-May-1996  briggs branches: 1.3.4;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 04-Apr-1996  scottr Add v2IRQ0 define for IIci-style internal video.
 1.1 29-Mar-1996  briggs via.h -> machine/viareg.h.
 1.3.4.1 07-Jun-1996  briggs Pull up changes from trunk. Console fix and external serial clock support.
 1.5.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.6.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.11.6.1 01-Jul-1999  thorpej Sync w/ -current.
 1.11.2.1 01-Nov-1999  scottr Sync with main branch.
 1.12.36.1 17-Jan-2005  skrll Sync with HEAD.
 1.3 28-Apr-2008  martin Remove clause 3 and 4 from TNF licenses
 1.2 29-Aug-2007  jmmv branches: 1.2.2; 1.2.4; 1.2.6; 1.2.10; 1.2.16; 1.2.30; 1.2.32; 1.2.34;
Pack all global video-related variables into a structure for clarity.

A comment said that they weren't in a struct for speed reasons but...
this should not affect performance because these variables are mostly
used to set other variables (hence they are read few times).
 1.1 29-Aug-2007  jmmv Move the definition of multiple video-related variables into a new
header file (machine/video.h) so that we can kill all the "manual"
externs spread around the code (which were inconsistent among them).
 1.2.34.1 16-May-2008  yamt sync with head.
 1.2.32.1 18-May-2008  yamt sync with head.
 1.2.30.1 02-Jun-2008  mjf Sync with HEAD.
 1.2.16.2 06-Nov-2007  matt sync with HEAD
 1.2.16.1 29-Aug-2007  matt file video.h was added on branch matt-armv6 on 2007-11-06 23:18:20 +0000
 1.2.10.2 09-Oct-2007  ad Sync with head.
 1.2.10.1 29-Aug-2007  ad file video.h was added on branch vmlocking on 2007-10-09 13:38:06 +0000
 1.2.6.2 03-Sep-2007  jmcneill Sync with HEAD.
 1.2.6.1 29-Aug-2007  jmcneill file video.h was added on branch jmcneill-pm on 2007-09-03 16:47:29 +0000
 1.2.4.2 03-Sep-2007  yamt sync with head.
 1.2.4.1 29-Aug-2007  yamt file video.h was added on branch yamt-lazymbuf on 2007-09-03 14:27:23 +0000
 1.2.2.2 03-Sep-2007  skrll Sync with HEAD.
 1.2.2.1 29-Aug-2007  skrll file video.h was added on branch nick-csl-alignment on 2007-09-03 10:19:09 +0000
 1.46 01-Feb-2020  tsutsui Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.
For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.45 28-Jun-2019  tsutsui branches: 1.45.2; 1.45.4;
Fix lingering page size comments.

Pointed out by christos@ on port-m68k@:
http://mail-index.netbsd.org/port-m68k/2019/06/06/msg000726.html

XXX: we also need MAX_PAGE_SIZE in somewhere for newer jemalloc?
 1.44 02-Feb-2017  rin branches: 1.44.14;
PR port-mac68k/51923
Bump default MAXTSIZ to 32MB for m68k ports, which allos us to use GCC 5.4 on
GENERIC kernels.
Ok jklos
 1.43 02-Feb-2017  rin PR port-mac68k/51923
Remove unused SYSPTSIZE and USRPTSIZE from m68k ports.
Ok jklos
 1.42 08-Feb-2011  rmind branches: 1.42.14; 1.42.32; 1.42.36; 1.42.40;
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.41 06-Nov-2010  uebayasi branches: 1.41.2; 1.41.4;
Remove incomplete, never worked dynamic run-time memory registration
(uvm_page_physload(9)). This functionality will be re-added later.
 1.40 08-Dec-2009  tsutsui branches: 1.40.2; 1.40.4;
Use PGSHIFT from <machine/param.h> for PAGE_SHIFT.
We can assume PGSHIFT is always constant on current
m68k pmap_motorola implementation.
Also fix some leftover HP300 comments on some ports.
 1.39 26-Aug-2009  thorpej Minor tweak to the pv_table management in the Hibler-derived m68k pmaps:
The head of the list is now a pv_header, which contains the first pv_entry
as well as a 16-bit attributes field (replaces the pmap_attributes array
plus the pv_entry::pv_flags field) as a 16-bit count of caller-specified
cache-inhibited mappings.

Tested on hp300 (shared pmap_motorola.c), changes to atari and amiga copies
are purely mechanical.
 1.38 06-Mar-2009  joerg Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
 1.37 10-Jan-2009  tsutsui branches: 1.37.2;
Remove unnecessary "last kernel PT page" mapping.
The lkptpa was required for hp300 (where PA != VA)
to prepare a page PA == VA to turn on the MMU,
and it is not needed for mac68k which has PA == VA
mappings even in kernel text/data/bss. Tested on LC630.
 1.36 11-Dec-2005  christos branches: 1.36.74; 1.36.78; 1.36.86;
merge ktrace-lwp.
 1.35 01-Apr-2005  yamt merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.34 07-Aug-2003  agc branches: 1.34.8; 1.34.10;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.33 02-Apr-2003  thorpej branches: 1.33.2;
Use PAGE_SIZE rather than NBPG.
 1.32 10-Dec-2002  thorpej Use __LDPGSZ (which must be == USRTEXT) as the text address for a.out
executables, and eliminate the USRTEXT constant, which was only used
by the a.out exec code.
 1.31 15-Nov-2001  soren MAXSLP is defined to be a machine-independent scheduling parameter,
so move it into sys/param.h.
 1.30 01-May-2001  thorpej branches: 1.30.2; 1.30.8;
Per discussion w/ chuck and chuck, restructure the md page stuff
to use a structure called "vm_page_md", and use __HAVE_VM_PAGE_MD
and __HAVE_PMAP_PHYSSEG.
 1.29 29-Apr-2001  thorpej Add a VM_MDPAGE_MEMBERS macro that defines pmap-specific data for
each vm_page structure. Add a VM_MDPAGE_INIT() macro to init this
data when pages are initialized by UVM. These macros are mandatory,
but ports may #define them to nothing if they are not needed/used.

This deprecates struct pmap_physseg. As a transitional measure,
allow a port to #define PMAP_PHYSSEG so that it can continue to
use it until its pmap is converted to use VM_MDPAGE_MEMBERS.

Use all this stuff to eliminate a lot of extra work in the Alpha
pmap module (it's smaller and faster now). Changes to other pmap
modules will follow.
 1.28 01-Dec-2000  tsutsui branches: 1.28.2;
Remove unused pcbb() macro.
 1.27 14-Nov-2000  thorpej We use 4K pages on the mac68k. Make PAGE_SIZE and friends into
compile-time constants.
 1.26 11-Feb-2000  thorpej Update for the NKMEMPAGES changes.
 1.25 27-Jan-2000  tsutsui Revert (accidentally removed) MAXSLP macro.
 1.24 26-Jan-2000  tsutsui Remove obsoleted macros.
 1.23 04-Dec-1999  ragge CL* discarding.
 1.22 26-Apr-1999  thorpej branches: 1.22.2; 1.22.8;
Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.
 1.21 07-Apr-1999  scottr vm_size_t -> vsize_t
 1.20 31-Mar-1999  scottr branches: 1.20.4;
The last change wasn't quite enough to build libc during a 'make build'.
Bump DFLDSIZ, too.
 1.19 31-Mar-1999  scottr Bump DFLSSIZ so that we can build libc.so.*, and limit MAXSSIZ independently
of MAXDSIZ.
 1.18 16-Jan-1999  chuck branches: 1.18.2;
MNN is no longer an option
 1.17 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.16 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.15 26-Apr-1998  scottr GC the old MACHINE_NONCONTIG code.
 1.14 26-Apr-1998  scottr Use VM_PSTRAT_BIGFIRST, and add a comment explaining the decision.
 1.13 25-Apr-1998  scottr Missed removal of MACHINE_NONCONTIG. Pointed out by Allen.
 1.12 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.11 23-Jul-1997  scottr GC unused MMSEG definition, from Erik Bertelsen <erik@erik-be.uni-c.dk>.
Closes PR 3898.
 1.10 12-Jul-1997  perry update comment from 1981 on memory and disk prices -- pr-2754 from Curt Sampson
 1.9 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.8 15-Nov-1996  briggs branches: 1.8.4; 1.8.8;
Include MACHINE_NONCONTIG here. It isn't needed on all macs, but it has been
used for all macs for quite some time.
 1.7 21-Jun-1995  briggs Raise MAXTSIZ, double DFLDSIZ and quadruple MAXDSIZ. Lower USRPTSIZE.
Remove unused mapin() macro. Update VM_MAX* macros to look like the
amiga's (easier to read than hp300's).
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 26-Jun-1994  briggs Cleanup some. Deprecate a few defines that are no longer needed.
 1.4 15-Dec-1993  briggs Change constants and comments to reflect the current MACHINE value.
Define T_BRKPT and T_WATCHPOINT.
 1.3 04-Dec-1993  briggs Change USRTEXT to 8192 in vmparam.h.
Add MACHINE_ARCH (m68k) to param.h.
 1.2 29-Nov-1993  briggs Added signal.h for -current. The rest is formatting changes.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.8.8.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.8.4.1 12-Feb-1997  mrg initial work for dynamic swap additions.
 1.18.2.3 13-Feb-2000  scottr Sync with main branch.
 1.18.2.2 12-Dec-1999  scottr Sync with main branch.
 1.18.2.1 16-May-1999  scottr Sync with main branch.
 1.20.4.2 06-Aug-1999  chs take an initial guess at UBC parameters.
 1.20.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.22.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.22.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.22.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.28.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.30.8.3 11-Dec-2002  thorpej Sync with HEAD.
 1.30.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.30.8.1 01-May-2001  nathanw file vmparam.h was added on branch nathanw_sa on 2002-01-08 00:26:02 +0000
 1.30.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.33.2.4 01-Apr-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.10.1 23-Feb-2005  yamt change mac68k's kernel address space layout in order to simplify
interaction between upper layer of the vm during bootstrap.
- move Sysmap to the end of address space.
- move IOBase etc immediately after proc0 uarea.
- tweak virtual_avail/end accordingly.

tested by Chuck Silvers, on his quadra 950.
XXX this breaks other m68k platforms. i'll fix them later.
 1.34.8.1 29-Apr-2005  kent sync with -current
 1.36.86.2 28-Apr-2009  skrll Sync with HEAD.
 1.36.86.1 19-Jan-2009  skrll Sync with HEAD.
 1.36.78.3 11-Mar-2010  yamt sync with head
 1.36.78.2 16-Sep-2009  yamt sync with head
 1.36.78.1 04-May-2009  yamt sync with head.
 1.36.74.1 17-Jan-2009  mjf Sync with HEAD.
 1.37.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.40.4.1 05-Mar-2011  rmind sync with head
 1.40.2.1 26-Apr-2010  uebayasi Remove the unfinished code to add a memory segment after uvm_page_init().
It doesn't even compile.

(In the future, we should allocate struct vm_page [] on the added memory
segment for NUMA's sake.)
 1.41.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.41.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.42.40.1 21-Apr-2017  bouyer Sync with HEAD
 1.42.36.1 20-Mar-2017  pgoyette Sync with HEAD
 1.42.32.1 05-Feb-2017  skrll Sync with HEAD
 1.42.14.1 03-Dec-2017  jdolecek update from HEAD
 1.44.14.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.45.4.1 29-Feb-2020  ad Sync with head.
 1.45.2.1 10-Feb-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #682):

sys/arch/next68k/include/vmparam.h: revision 1.27
sys/arch/mac68k/include/vmparam.h: revision 1.46
sys/arch/sun3/include/vmparam.h: revision 1.38
sys/arch/m68k/include/vmparam.h: revision 1.1
sys/arch/hp300/include/vmparam.h: revision 1.41
sys/arch/m68k/include/Makefile: revision 1.32
sys/arch/amiga/include/vmparam.h: revision 1.48
distrib/sets/lists/comp/ad.m68k: revision 1.63
sys/arch/x68k/include/vmparam.h: revision 1.40
sys/arch/mvme68k/include/vmparam.h: revision 1.38
sys/arch/luna68k/include/vmparam.h: revision 1.23
sys/arch/news68k/include/vmparam.h: revision 1.23
sys/arch/atari/include/vmparam.h: revision 1.34
sys/arch/cesfic/include/vmparam.h: revision 1.19

Add MAX/MIN PAGE_SIZE and PAGE_SHIFT definitions of m68k for jemalloc(3).

Background:
- All m68k ports have fixed PAGE_SIZE value in their kernels,
but each port uses different PAGE_SIZE value (4096 or 8192)
due to historical reasons.
- Currently module(7) binaries are built per each port so
all m68k kernel sources don't support run-time variable PAGE_SIZE.
- MI <uvm/uvm_param.h> assumes that the port supports a variable
PAGE_SIZE on module(7) builds if both MAX_PAGE_SIZE and MIN_PAGE_SIZE
are defined and they have different values.
- On the other hand, jemalloc(3) checks MAX_PAGE_SHIFT in
src/external/bsd/jemalloc/include/jemalloc/internal/jemalloc_internal_defs.h
for internal optimization.
- m68k ports share userland binaries (especially pkgsrc binaries)
among all ports, so we need to define MAX_PAGE_SHIFT as 13 to
support m68k ports where PAGE_SIZE==8192.
(though this would affect only if static binaries built on
4k page hosts are executed on 8k page hosts)

To solve these inconsistency on PAGE_SIZE definitions,
we should have an independent PAGE_SIZE related definitions
for userland, but it requires major reorganization.

For now (especially for netbsd-9) we define MAX/MIN PAGE_SIZE and
PAGE_SHIFT values in <m68k/vmparam.h> only in !defined(_KERNEL) case.

Discussed on source-changes-d@ and tech-kern@ with christos@ and thorpej@:
https://mail-index.netbsd.org/source-changes-d/2020/01/thread1.html#012035
https://mail-index.netbsd.org/tech-kern/2020/01/thread1.html#025954

Should be pulled up to netbsd-9.
 1.2 11-Dec-2005  christos merge ktrace-lwp.
 1.1 08-May-2004  kleink branches: 1.1.2;
Factor out W{CHAR,INT}_{MAX,MIN} into their own header file.
 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 wchar_limits.h was added on branch ktrace-lwp on 2004-08-03 10:37:08 +0000
 1.14 25-Apr-2025  andvar s/cahnge/change/ in comments.
 1.13 29-Mar-2008  tsutsui branches: 1.13.128;
Split softc and device_t for zsc(4) and its children.

XXX we should restructure MI APIs and make it really machine independent.
 1.12 07-Nov-2007  ad branches: 1.12.14;
Merge tty changes from the vmlocking branch.
 1.11 08-Mar-2007  tsutsui branches: 1.11.2; 1.11.18; 1.11.20; 1.11.24; 1.11.26;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.10 04-Mar-2007  christos 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 15-Jan-2005  chs branches: 1.8.10;
de-__P, remove register, ansify, b* -> mem*.
 1.7 07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.6 17-Mar-2002  atatat branches: 1.6.12;
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.5 20-Oct-1997  scottr branches: 1.5.32; 1.5.36;
Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.4 13-Oct-1996  christos backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 07-Jun-1996  briggs Add constants for booter interface.
 1.1 18-May-1996  briggs branches: 1.1.4;
Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.1.4.1 07-Jun-1996  briggs Pull up changes from trunk. Console fix and external serial clock support.
 1.5.36.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.5.32.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.6.12.4 17-Jan-2005  skrll Sync with HEAD.
 1.6.12.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.12.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.12.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.2 15-Nov-2007  yamt sync with head.
 1.8.10.1 03-Sep-2007  yamt sync with head.
 1.9.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.11.26.1 19-Nov-2007  mjf Sync with HEAD.
 1.11.24.1 13-Nov-2007  bouyer Sync with HEAD
 1.11.20.1 08-Nov-2007  matt sync with -HEAD
 1.11.18.1 11-Nov-2007  joerg Sync with HEAD.
 1.11.2.1 03-Dec-2007  ad Sync with HEAD.
 1.12.14.1 03-Apr-2008  mjf Sync with HEAD.
 1.13.128.1 02-Aug-2025  perseant Sync with HEAD
 1.74 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.73 29-Jul-2012  mlelstv branches: 1.73.2;
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.

No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().

Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().

Make cpu_rootconf(9) describe the calling order.
 1.72 13-Jun-2008  cegger branches: 1.72.30; 1.72.36;
use device_lookup_private to get softc and uncascade if blocks
 1.71 12-Feb-2008  joerg branches: 1.71.6; 1.71.8; 1.71.10; 1.71.12; 1.71.14;
Introduce device_find_by_xname and device_find_by_driver_unit to replace
alldevs iterations all over src.

Patch discussed with and improved on suggestioned from cube@.
 1.70 05-Dec-2007  tsutsui Use TAILQ_FIRST(3) and TAILQ_NEXT(3) macro.
 1.69 03-Dec-2007  ad branches: 1.69.2;
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.68 17-Oct-2007  garbled branches: 1.68.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.67 01-Sep-2007  jmmv Let this build if scsi support is not built into the kernel.
 1.66 08-Mar-2007  tsutsui branches: 1.66.2; 1.66.10; 1.66.14; 1.66.18; 1.66.20;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.65 28-Mar-2006  thorpej branches: 1.65.14;
Use device_unit().
 1.64 11-Dec-2005  christos branches: 1.64.4; 1.64.6; 1.64.8; 1.64.10; 1.64.12;
merge ktrace-lwp.
 1.63 09-Jun-2005  rjs branches: 1.63.2;
Pass NULL as second argument to config_rootfound.
 1.62 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.61 23-Oct-2004  thorpej Centralize the declaration of booted_device and booted_partition.
 1.60 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.59 15-Jul-2003  lukem __KERNEL_RCSID()
 1.58 06-Sep-2002  gehenna branches: 1.58.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.57 16-May-2002  thorpej Don't access a scsipi channel's periph table directly; use
scsipi_lookup_periph().
 1.56 27-Apr-2002  shiba branches: 1.56.2;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.55 25-Apr-2001  bouyer branches: 1.55.2; 1.55.8;
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.54 05-Nov-1999  scottr branches: 1.54.6;
Since nothing depends on interrupts during autoconfig proper
any longer, we can finally avoid enabling interrupts until the
end of cpu_configure(). This resolves a long-standing issue that
has caused us trouble several times in the past.
 1.53 17-Sep-1999  thorpej branches: 1.53.2; 1.53.4; 1.53.8;
Centralize the declaration and clearing of `cold'.
 1.52 15-Sep-1999  thorpej Rename the machine-dependent autoconfiguration entry point `cpu_configure()',
and rename config_init() to configure() and call cpu_configure() from there.
 1.51 07-Jun-1999  thorpej Don't pass a nam2blk around at all; just have setroot() and friends reference
dev_name2blk[] directly. Addresses PR #7622 (ITOH Yasufumi), although
in a different way.
 1.50 18-Feb-1999  scottr branches: 1.50.2; 1.50.6;
Add support for the IWM driver.
 1.49 18-Feb-1999  scottr Minor space-tab KNFing.
 1.48 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.47 05-Jul-1998  jonathan Garbage-collect ``needs-flag'' from attributes ether, fddi, arc:
NETHER, NFDDI, NARC are not used anywhere. Remove #include "ether.h",
which had no effect.
Removes clash with "options NATM" for native-ATM network protocol stack.
 1.46 09-Jan-1998  drochner Use of BOOTP or BOOTPARAM can be conntrolled by config option now.
 1.45 26-Nov-1997  scottr Don't attempt to open the ADB device if it hasn't been initialized.
Also, don't allow more than one instance to be configured.
 1.44 01-Nov-1997  scottr From i386: initialize nfs_boot_rfc951 if either NFS_BOOT_BOOTP or
NFS_BOOT_DHCP are defined.
 1.43 10-Sep-1997  scottr Move VIA_initialize() from configure() to locore.s, shortly after
setting up and enabling the MMU. This has the effect of ensuring
that any stray interrupts that get posted before the IPL is lowered
will be handled gracefully, i.e. without an access fault or illegal
instruction exception.
 1.42 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.41 26-Mar-1997  gwr branches: 1.41.2; 1.41.4;
Move findroot/setroot stuff from configure() to cpu_rootconf().
 1.40 14-Feb-1997  scottr Remove incorrect comment re: bootdev
 1.39 31-Jan-1997  thorpej branches: 1.39.2; 1.39.4;
Use new machine-independent setroot().
 1.38 18-Dec-1996  scottr branches: 1.38.2;
Work around another uninitialized variable warning
 1.37 23-Oct-1996  briggs Include ether.h since we're now using NETHER, also use NETHER > 0 not NETHER.
 1.36 21-Oct-1996  scottr Don't try to reference nfsbootdevname if we have no ether devices.
Fixes PR 2860, from Paul Goyette <paul@pgoyette.bdt.com>.
 1.35 13-Oct-1996  christos backout previous kprintf change
 1.34 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.33 04-Oct-1996  scottr Sync with Chris' changes to the alpha setroot() and friends to resolve some
problems with entering "halt" at prompts.
 1.32 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.31 19-Jun-1996  scottr Completely revamp setroot() and friends. Since Chris' version of this code
is close to how I reworked it, I pulled in the (essentially MI) NetBSD/alpha
and added the appropriate support around it.

- No need for the GENERIC kernel config option.
- NFS-mounted root and swap are supported.
- If we can't figure out where the root filesystem is from what the Booter
tells us, ask the user.
- Split the mainbus autoconfig code to a separate file.

Also, update/add copyrights as appropriate.
 1.30 19-Jun-1996  briggs Remove Alice copyright and comment from '92.
 1.29 15-May-1996  briggs Invalidate the pte for the peeked va in bus_peek().
 1.28 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.27 04-Apr-1996  cgd update for the fact that config_found() and config_rootfound() now
return pointers. (Check vs. NULL, rather than just boolean tests.)
 1.26 04-Apr-1996  cgd update for the fact that 'alldevs' is now a TAILQ.
 1.25 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.24 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.23 28-Feb-1996  briggs Changes from Walter Ruetten for P550 support.
 1.22 03-Feb-1996  briggs New delay() implementation from Scott Reynolds (scottr@edsi.org).
Also some minor rearranging of the VIA initialization (init earlier).
 1.21 07-Jan-1996  thorpej New generic disk framework. Highlights:

- New metrics handling. Metrics are now kept in the new
`struct disk'. Busy time is now stored as a timeval, and
transfer count in bytes.

- Storage for disklabels is now dynamically allocated, so that
the size of the disk structure is not machine-dependent.

- Several new functions for attaching and detaching disks, and
handling metrics calculation.

Old-style instrumentation is still supported in drivers that did it before.
However, old-style instrumentation is being deprecated, and will go away
once the userland utilities are updated for the new framework.

For usage and architectural details, see the forthcoming disk(9) manual
page.
 1.20 01-Nov-1995  briggs Remove ser1 from init list.
 1.19 18-Jul-1995  briggs branches: 1.19.2;
Add support for:
GENERIC
RB_ASKNAME
RB_MINIROOT
Also revved up the required version of the booter because we need the
booter fixes to get this functionality.
 1.18 20-Apr-1995  briggs Make mainbus an indirect device--needs more work, but it does function.
 1.17 29-Mar-1995  briggs Nuke FPCOPROC and add fpu device driver and FPU_EMULATE from sun3.
Still need to figure out how to handle this w/ FPSP on 68040's but
since we're not really using the 68040 yet...
 1.16 01-Feb-1995  briggs Explicity return error value in findblkmajor().
 1.15 15-Jan-1995  briggs scsibus_data -> scsibus_softc in device search.
 1.14 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.13 30-Nov-1994  briggs Re-arrange order of a comparison and compensate for change in device
structure locations.
 1.12 27-Nov-1994  briggs Experimental method of getting a scsi unit # from scsi target.
 1.11 26-Oct-1994  cgd new RCS ID format.
 1.10 21-Jul-1994  briggs No longer need/use root_scsi_id. Change audio to asc in probe.
 1.9 08-Jul-1994  lkestel autoconf.c: added ite.
conf.c: added ite and adb.
cons.c: replaced mac* functions with itecn* functions.
machdep.c: ditto.
 1.8 02-Jul-1994  briggs branches: 1.8.2;
The NCR 5380 driver is now called ncrscsi instead of ncr.
 1.7 26-Jun-1994  briggs Add probe for new scsi driver to top level of configuration.
 1.6 02-Feb-1994  briggs Get rid of dkhead/dktail schtuff and add a scheme based on the sparc's.
Umm. Also be smart and don't clobber swapdev so swapping works.
 1.5 30-Jan-1994  briggs DTRT w.r.t. root and boot disk devices. This could still use some work,
but it's a lot better than depending on root being on sd0 (and swapping
if it isn't).
 1.4 11-Jan-1994  briggs Clean up isr stuff.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.8.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.19.2.1 14-Oct-1995  briggs Don't look for ser1.
 1.38.2.2 22-Jan-1997  scottr Biff diff from Jason, and some minor typos fixed by me.
 1.38.2.1 14-Jan-1997  thorpej Snapshot of work-in-progress, committed to private branch.

These changes implement machine-independent root device and file system
selection. Notable features:

- All ports behave in a consistent manner regarding root
device selection.
- No more "options GENERIC"; all kernels have the ability
to boot with RB_ASKNAME to select root device and file system
type.
- Root file system type can be wildcarded; a machine-independent
function will try all possible file systems for the selected
root device until one succeeds.
- If the root file system fails to mount, the operator will
be given the chance to select a new root device and file
system type, rather than having the machine simply panic.
- nfs_mountroot() no longer panics if any part of the NFS
mount process fails; it now returns an error, giving the
operator a chance to recover.
- New, more consistent, config(8) grammar. The constructs:

config netbsd swap generic
config netbsd root on nfs

have been replaced with:

config netbsd root on ? type ?
config netbsd root on ? type nfs

Additionally, the operator may select or wildcard root file
system type in the kernel configuration file:

config netbsd root on cd0a type cd9660

config(8) now requires that a "root" specification be
made. "root" may be wired down or wildcarded. "swap" and
"dump" specifications are optional, and follow previous
semantics.

- config(8) has a new "file-system" keyword, used to configure
file systems into the kernel. Eventually, this will be used
to generate the default vfssw[].

- "options NFSCLIENT" is obsolete, and is replaced by
"file-system NFS". "options NFSSERVER" still exists, since
NFS server support is independent of the NFS file system
client.

- sys/arch/<foo>/<foo>/swapgeneric.c is no longer used, and
will be removed; all information is now generated by config(8).

As of this commit, all ports except arm32 have been updated to use
the new setroot(). Only SPARC, i386, and Alpha ports have been
tested at this time. Port masters should test these changes on their
ports, and report any problems back to me.

More changes are on their way, including RB_ASKNAME support in
nfs_mountroot() (to prompt for server address and path) and, potentially,
the ability to select rarp/bootparam or bootp in nfs_mountroot().
 1.39.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.39.2.1 02-Mar-1997  mrg swapconf() is no more.
 1.41.4.2 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.41.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.41.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.50.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.50.2.3 09-Nov-1999  scottr Sync with main branch.
 1.50.2.2 01-Nov-1999  scottr Repair merge-related damage
 1.50.2.1 01-Nov-1999  scottr Sync with main branch.
 1.53.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.53.4.1 15-Nov-1999  fvdl Sync with -current
 1.53.2.3 29-Mar-2001  bouyer Pass compile-test on i386.
 1.53.2.2 27-Mar-2001  bouyer Convert to thorpej_scsipi (untested).
 1.53.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.54.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.55.8.3 17-Sep-2002  nathanw Catch up to -current.
 1.55.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.55.8.1 25-Apr-2001  nathanw file autoconf.c was added on branch nathanw_sa on 2002-06-20 03:39:27 +0000
 1.55.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.55.2.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.56.2.3 06-Jun-2002  gehenna make this compile.
 1.56.2.2 30-May-2002  gehenna Catch up with -current.
 1.56.2.1 17-May-2002  gehenna Replace the access to devsw table and the hard-coded major with devsw API.
 1.58.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.58.6.5 17-Jan-2005  skrll Sync with HEAD.
 1.58.6.4 02-Nov-2004  skrll Sync with HEAD.
 1.58.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.58.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.58.6.1 03-Aug-2004  skrll Sync with HEAD
 1.63.2.4 27-Feb-2008  yamt sync with head.
 1.63.2.3 07-Dec-2007  yamt sync with head
 1.63.2.2 03-Sep-2007  yamt sync with head.
 1.63.2.1 21-Jun-2006  yamt sync with head.
 1.64.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.64.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.64.8.1 01-Apr-2006  yamt sync with head.
 1.64.6.1 22-Apr-2006  simonb Sync with head.
 1.64.4.1 09-Sep-2006  rpaulo sync with head
 1.65.14.1 12-Mar-2007  rmind Sync with HEAD.
 1.66.20.3 23-Mar-2008  matt sync with HEAD
 1.66.20.2 09-Jan-2008  matt sync with HEAD
 1.66.20.1 06-Nov-2007  matt sync with HEAD
 1.66.18.2 09-Dec-2007  jmcneill Sync with HEAD.
 1.66.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.66.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.66.10.1 03-Oct-2007  garbled Sync with HEAD
 1.66.2.2 03-Dec-2007  ad Sync with HEAD.
 1.66.2.1 09-Oct-2007  ad Sync with head.
 1.68.2.2 18-Feb-2008  mjf Sync with HEAD.
 1.68.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.69.2.1 08-Dec-2007  ad Sync with head.
 1.71.14.1 18-Jun-2008  simonb Sync with head.
 1.71.12.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.71.10.1 04-May-2009  yamt sync with head.
 1.71.8.1 17-Jun-2008  yamt sync with head.
 1.71.6.1 29-Jun-2008  mjf Sync with HEAD.
 1.72.36.1 08-Aug-2012  martin Pull up following revision(s) (requested by mlelstv in ticket #466):
sys/arch/amiga/amiga/autoconf.c: revision 1.113
sys/arch/rs6000/rs6000/autoconf.c: revision 1.4
sys/arch/emips/emips/autoconf.c: revision 1.6
sys/arch/sandpoint/sandpoint/autoconf.c: revision 1.27
sys/arch/evbmips/alchemy/autoconf.c: revision 1.18
sys/arch/sgimips/sgimips/autoconf.c: revision 1.43
sys/arch/atari/atari/autoconf.c: revision 1.63
sys/arch/powerpc/oea/ofw_autoconf.c: revision 1.17
sys/arch/mmeye/mmeye/autoconf.c: revision 1.9
distrib/sets/lists/comp/mi: revision 1.1771
sys/arch/mipsco/mipsco/autoconf.c: revision 1.25
sys/arch/iyonix/iyonix/autoconf.c: revision 1.14
sys/arch/hp300/hp300/autoconf.c: revision 1.100
sys/kern/init_main.c: revision 1.445
sys/arch/pmax/pmax/autoconf.c: revision 1.79
sys/arch/netwinder/netwinder/autoconf.c: revision 1.11
sys/arch/dreamcast/dreamcast/autoconf.c: revision 1.10
sys/arch/ibmnws/ibmnws/autoconf.c: revision 1.12
sys/arch/evbppc/ev64260/autoconf.c: revision 1.17
sys/arch/evbmips/gdium/autoconf.c: revision 1.5
sys/arch/algor/algor/autoconf.c: revision 1.21
share/man/man9/Makefile: revision 1.367
sys/arch/ews4800mips/ews4800mips/autoconf.c: revision 1.9
sys/arch/amigappc/amigappc/autoconf.c: revision 1.5
sys/arch/x86/x86/x86_autoconf.c: revision 1.65
sys/arch/acorn26/acorn26/autoconf.c: revision 1.9
sys/arch/mvmeppc/mvmeppc/autoconf.c: revision 1.13
sys/arch/vax/vax/autoconf.c: revision 1.94
sys/arch/usermode/dev/cpu.c: revision 1.72
sys/arch/evbppc/virtex/autoconf.c: revision 1.5
sys/arch/next68k/next68k/autoconf.c: revision 1.26
sys/arch/mac68k/mac68k/autoconf.c: revision 1.73
sys/arch/ia64/ia64/autoconf.c: revision 1.6
sys/arch/evbppc/obs405/obs405_autoconf.c: revision 1.6
share/man/man9/cpu_rootconf.9: revision 1.7
sys/arch/landisk/landisk/autoconf.c: revision 1.6
sys/arch/evbmips/malta/autoconf.c: revision 1.16
sys/arch/sun3/sun3/autoconf.c: revision 1.76
sys/arch/evbppc/explora/autoconf.c: revision 1.13
sys/arch/sun3/sun3/autoconf.c: revision 1.77
sys/arch/evbmips/loongson/autoconf.c: revision 1.3
sys/arch/evbmips/atheros/autoconf.c: revision 1.11
sys/arch/sparc64/sparc64/autoconf.c: revision 1.188
sys/arch/acorn32/acorn32/autoconf.c: revision 1.18
sys/arch/evbarm/evbarm/autoconf.c: revision 1.13
sys/arch/cobalt/cobalt/autoconf.c: revision 1.30
sys/arch/mvme68k/mvme68k/autoconf.c: revision 1.46
sys/arch/hp700/hp700/autoconf.c: revision 1.48
sys/arch/evbmips/adm5120/autoconf.c: revision 1.5
sys/arch/hpcmips/hpcmips/autoconf.c: revision 1.25
sys/arch/alpha/alpha/autoconf.c: revision 1.52
sys/arch/sparc/sparc/autoconf.c: revision 1.244
sys/arch/evbppc/pmppc/autoconf.c: revision 1.7
sys/arch/bebox/bebox/autoconf.c: revision 1.25
sys/arch/luna68k/luna68k/autoconf.c: revision 1.13
sys/arch/hpcarm/hpcarm/autoconf.c: revision 1.20
sys/arch/evbppc/walnut/autoconf.c: revision 1.21
sys/arch/cesfic/cesfic/autoconf.c: revision 1.26
sys/arch/cats/cats/autoconf.c: revision 1.17
sys/arch/x68k/x68k/autoconf.c: revision 1.67
sys/arch/news68k/news68k/autoconf.c: revision 1.21
sys/arch/arc/arc/autoconf.c: revision 1.34
sys/arch/evbsh3/evbsh3/autoconf.c: revision 1.11
sys/sys/conf.h: revision 1.143
sys/arch/evbmips/rasoc/autoconf.c: revision 1.3
sys/arch/hpcsh/hpcsh/autoconf.c: revision 1.26
sys/arch/sun68k/sun68k/autoconf.c: revision 1.29
sys/arch/evbmips/rmixl/autoconf.c: revision 1.6
sys/arch/zaurus/zaurus/autoconf.c: revision 1.12
sys/arch/xen/x86/autoconf.c: revision 1.15
sys/arch/evbppc/mpc85xx/autoconf.c: revision 1.6
sys/arch/shark/shark/autoconf.c: revision 1.18
sys/arch/prep/prep/autoconf.c: revision 1.25
sys/arch/newsmips/newsmips/autoconf.c: revision 1.36
sys/arch/sbmips/sbmips/autoconf.c: revision 1.8
Do not call setroot() from MD code and from MI code, which has
unwanted sideeffects in the RB_ASKNAME case. This fixes PR/46732.
No longer wrap MD cpu_rootconf(), as hp300 port stores reboot information
as a side effect. Instead call MI rootconf() from MD code which makes
rootconf() now a wrapper to setroot().
Adjust several MD routines to set the global booted_device,booted_partition
variables instead of passing partial information to setroot().
Make cpu_rootconf(9) describe the calling order.
add rootconf(9) as a link to cpu_rootconf(9)
make this compile again
 1.72.30.1 30-Oct-2012  yamt sync with head
 1.73.2.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.32 19-Oct-2013  martin Avoid unused variables
 1.31 28-Apr-2008  martin branches: 1.31.34; 1.31.44; 1.31.50;
Remove clause 3 and 4 from TNF licenses
 1.30 17-Oct-2007  garbled branches: 1.30.16; 1.30.18; 1.30.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.29 01-Sep-2007  jmmv Properly use the return value of a bswap16 call. Caught when building
a kernel with -O0.
 1.28 24-Dec-2005  perry branches: 1.28.30; 1.28.38; 1.28.44; 1.28.48; 1.28.50;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.27 24-Nov-2005  yamt bus_dmamem_map: honour BUS_DMA_NOWAIT. noted by Manuel Bouyer.
bus_space_map: always do NOWAIT allocation as it used to be before yamt-km.

we have too many copies!
 1.26 01-Apr-2005  yamt branches: 1.26.2; 1.26.8;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.25 15-Jan-2005  chs branches: 1.25.2; 1.25.4;
de-__P, remove register, ansify, b* -> mem*.
 1.24 15-Jul-2003  lukem __KERNEL_RCSID()
 1.23 02-Apr-2003  thorpej branches: 1.23.2;
Use PAGE_SIZE rather than NBPG.
 1.22 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.21 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.20 25-Sep-2002  thorpej Don't include <sys/map.h>.
 1.19 30-May-2002  thorpej Don't use multi-line string literals.
 1.18 09-Apr-2002  briggs branches: 1.18.2;
Constify bus_space_write_multi_N() and bus_space_write_region_N().
Addresses PR port-mac68k/16233.
 1.17 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.16 10-Sep-2001  chris branches: 1.16.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.15 24-Apr-2001  thorpej branches: 1.15.2; 1.15.4;
Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.14 21-Apr-2001  thorpej pmap_update() should not be equated with "flush entire TLB", it is
used to process deferred pmap operations. Since these pmaps don't
defer anything, pmap_update() is a noop.
 1.13 16-Nov-2000  scottr branches: 1.13.2;
Enhance readability through consistent function parameter names and KNF.
There are no functional changes.
 1.12 31-Jul-2000  briggs Add bus_space_*_stream_N functions.
 1.11 30-Jul-2000  briggs Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.
 1.10 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.9 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.8 12-Dec-1999  scottr branches: 1.8.4;
Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.7 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.6 08-Jul-1999  thorpej branches: 1.6.2; 1.6.4; 1.6.8;
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.5 26-Mar-1999  mycroft branches: 1.5.4;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.4 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.3 22-Dec-1998  scottr branches: 1.3.2;
vm_offset_t -> {paddr_t, vaddr_t}
 1.2 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.1 27-Mar-1998  scottr Move bus_space implementation to bus_space.c.
 1.3.2.4 12-Dec-1999  scottr Sync with main branch.
 1.3.2.3 28-Nov-1999  scottr Sync with main branch.
 1.3.2.2 01-Nov-1999  scottr Sync with main branch.
 1.3.2.1 16-May-1999  scottr Sync with main branch.
 1.5.4.1 02-Aug-1999  thorpej Update from trunk.
 1.6.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.6.4.1 15-Nov-1999  fvdl Sync with -current
 1.6.2.3 23-Apr-2001  bouyer Sync with HEAD.
 1.6.2.2 22-Nov-2000  bouyer Sync with HEAD.
 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.8.4.1 06-Aug-2000  briggs Pullups approved by thorpej --
Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.

Add bus_space_*_stream_N functions to bus_space.

Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).

There were some bogus assumptions about bus_space_handle_t and some
function calls that didn't match prototypes--fix those here, too.
 1.13.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.15.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.15.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.15.2.3 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.15.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.16.4.6 11-Nov-2002  nathanw Catch up to -current
 1.16.4.5 18-Oct-2002  nathanw Catch up to -current.
 1.16.4.4 20-Jun-2002  nathanw Catch up to -current.
 1.16.4.3 17-Apr-2002  nathanw Catch up to -current.
 1.16.4.2 08-Jan-2002  nathanw Catch up to -current.
 1.16.4.1 10-Sep-2001  nathanw file bus_space.c was added on branch nathanw_sa on 2002-01-08 00:26:02 +0000
 1.18.2.1 14-Jul-2002  gehenna catch up with -current.
 1.23.2.6 11-Dec-2005  christos Sync with head.
 1.23.2.5 01-Apr-2005  skrll Sync with HEAD.
 1.23.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.25.4.1 11-Feb-2005  yamt - use new apis.
- don't leave page mapped at kva being freed.
 1.25.2.1 29-Apr-2005  kent sync with -current
 1.26.8.1 29-Nov-2005  yamt sync with head.
 1.26.2.2 03-Sep-2007  yamt sync with head.
 1.26.2.1 21-Jun-2006  yamt sync with head.
 1.28.50.1 06-Nov-2007  matt sync with HEAD
 1.28.48.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.28.44.1 03-Sep-2007  skrll Sync with HEAD.
 1.28.38.1 03-Oct-2007  garbled Sync with HEAD
 1.28.30.1 09-Oct-2007  ad Sync with head.
 1.30.20.1 16-May-2008  yamt sync with head.
 1.30.18.1 18-May-2008  yamt sync with head.
 1.30.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.31.50.1 18-May-2014  rmind sync with head
 1.31.44.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.31.34.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.50 22-Aug-2019  rin Adjust GMT bias automatically by using data obtained from Mac OS,
unless RTC_OFFSET is set explicitly.
 1.49 08-Feb-2011  rmind branches: 1.49.56;
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.48 12-Dec-2009  tsutsui branches: 1.48.4; 1.48.6; 1.48.8;
Remove `volatile' qualifier from argument types of
struct timeval passed to todr_gettime(9) and todr_settime(9).
We no longer have an ancient and volatile struct timeval `time'
global since we have switched to MI timercounter(9) on all port.

XXX1: some of these RTC drivers still assume 32bit time_t
XXX2: some of these should be rewritten to use todr_[gs]ettime_ymdhms()
XXX3: todr(9) man page doesn't mention todr_[gs]ettime_ymdhms()
 1.47 22-Jul-2008  hauke Having read Frank Kardel's web page again, I think the XXX comment
wrt. the splhigh() guard can go.
 1.46 20-Nov-2006  hauke branches: 1.46.52; 1.46.56; 1.46.58; 1.46.60; 1.46.62;
Add Timecounter support for mac68k, using the otherwise idle second
timer of VIA1. Passes regression/sys/kern/time regression test.

While we are here, GC leftover prototypes from MI todr integration,
and clean up clockreg.h in the light of "Guide to the Macintosh
Hardware" information.

(Reviewed and okayed by Martin Husemann)
 1.45 20-Sep-2006  gdamore Convert mac68k to generic todr. Thanks to Robert Swindells for testing.
 1.44 11-Dec-2005  christos branches: 1.44.20; 1.44.22;
merge ktrace-lwp.
 1.43 15-Jan-2005  chs branches: 1.43.10;
de-__P, remove register, ansify, b* -> mem*.
 1.42 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.41 15-Jul-2003  lukem __KERNEL_RCSID()
 1.40 17-Jan-2003  thorpej branches: 1.40.2;
Merge the nathanw_sa branch.
 1.39 05-Nov-1999  scottr branches: 1.39.12;
Enable interrupts during delay calibration. We pretty much have
to allow this exception so that accurate tuning of delay() can be
done (i.e. avoiding VIA-related wait states and cache effects as
much as possible).

XXX During this narrow window, it is still conceivable that we could
get interrupts from devices other than the VIA timer. Normally this
shouldn't be a problem because interrupt handlers should generally
not be registered until we get to autoconfig. It is, however, a
potential pitfall to be aware of.
 1.38 11-Jun-1999  scottr branches: 1.38.2; 1.38.4; 1.38.8;
Eliminate more overhead in delay(); there's no point in doing the same
thing in both the calibrator function and the actual delay function. At
this point, _delay() does all of the work, so we can garbage collect
dummy_delay() and make _delay() an alternate entry point for delay().

This results in a small (but measurable) improvement on the IIci.
 1.37 09-Jun-1999  scottr Write a new low-level assembly help for delay() and the calibrator. This
eliminates stalls during instruction prefetch and makes the delay
consistent regardless of kernel configuration.
 1.36 07-Oct-1997  scottr branches: 1.36.10; 1.36.12; 1.36.14; 1.36.16;
The annoying message about trusting ourselves to write the PRAM should
really be dependent on DEBUG, not DIAGNOSTIC. While we're here, add
a couple of DEBUG messages to mac68k_calibrate_delay(), and wrap them
all appropriately so that the messages aren't enabled unless we
specifically ask for them (by setting clock_debug).
 1.35 03-Sep-1997  scottr Eliminate the use of the register keyword, and use standard
type names. Also, eliminate an unnecessary DEBUG printf().
 1.34 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.33 28-Feb-1997  scottr branches: 1.33.4;
Convert to generalized VIA interrupt registration
 1.32 15-Jan-1997  perry branches: 1.32.4;
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.31 13-Oct-1996  christos branches: 1.31.2;
backout previous kprintf change
 1.30 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.29 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.28 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.27 12-Mar-1996  scottr Oops; fix typo.
 1.26 12-Mar-1996  scottr KNF.
 1.25 12-Mar-1996  scottr Back out the previous change; we'll trust adjustments to the clock
except on shutdown.
 1.24 23-Feb-1996  briggs PR 2111: Do not update system clock until we can keep more accurate time.
 1.23 22-Feb-1996  scottr Use unsigned variables to calibrate delay_factor.
 1.22 19-Feb-1996  scottr Clear interrupt before enabling in calibrate_delay() (from John P. Wittkoski)
 1.21 19-Feb-1996  scottr Be a bit more careful when setting up the timer for calibrating delay().
 1.20 17-Feb-1996  briggs Make delay() match prototype.
 1.19 03-Feb-1996  briggs New delay() implementation from Scott Reynolds (scottr@edsi.org).
Also some minor rearranging of the VIA initialization (init earlier).
 1.18 02-Feb-1996  mycroft Fix #includes.
 1.17 29-Jan-1996  briggs Fix for delay(usec) for small usec. From Scott Reynolds <scottr@edsi.org>.
 1.16 16-Sep-1995  briggs More changes from walter@ghpc8.ihf.rwth-aachen.de (Walter Ruetten)
for correct handling of timezones and PRAM <-> system time conversion.
 1.15 14-Sep-1995  briggs indentify.
Bring in a few changes from Walter Ruetten (walter@ghpc8.ihf.rwth-aachen.de).
Assume that PRAM time - GMT bias (set in the booter) is the current time
in UTC.
 1.14 25-May-1995  briggs Make a diagnostic message DIAGNOSTIC.
 1.13 15-Feb-1995  briggs Add support from Erik Vogan for reading and writing PRAM. Don't enable
writing yet, though.
 1.12 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.11 03-Dec-1994  briggs Implement a real delay() that at least approximates a usec delay.
 1.10 26-Oct-1994  cgd new RCS ID format.
 1.9 03-Aug-1994  grantham Multiply GMTBIAS by 60; it's in minutes, time is in seconds.
 1.8 02-Aug-1994  grantham To get Greenwich Mean Time, *subtract* the GMTBIAS from our time,
passed in from Booter. (Among its many features, MacBSD provides
time travel.)
 1.7 29-Jul-1994  grantham Use values from Booter to initialize time correctly for machines
without readable PRAM. (IIvx users should be pleased.)
 1.6 10-Jul-1994  briggs Be somewhat better at machine dependence, clean up a hair, and get rid
of addupc.
 1.5 06-May-1994  briggs branches: 1.5.2;
Get things to compile with latest changes.
 1.4 06-Feb-1994  briggs Fixup calls to profclock and softclock.
 1.3 30-Jan-1994  briggs Add a stupid delay() that is little more than a place-holder for a real
implementation.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.5.2.2 11-Aug-1994  mycroft update from trunk
 1.5.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.31.2.1 18-Jan-1997  thorpej Update from trunk.
 1.32.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.33.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.36.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.36.14.1 21-Jun-1999  thorpej Sync w/ -current.
 1.36.12.1 01-Jul-1999  perry pullup 1.36->1.38 (scottr): re-implement delay()
 1.36.10.4 09-Nov-1999  scottr Sync with main branch.
 1.36.10.3 15-Jun-1999  scottr Sync with main branch.
 1.36.10.2 09-Jun-1999  scottr Sync with main branch.
 1.36.10.1 16-May-1999  scottr Sync with main branch.
 1.38.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.38.4.1 15-Nov-1999  fvdl Sync with -current
 1.38.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.39.12.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.39.12.2 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.39.12.1 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.40.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.40.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.40.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.40.2.1 03-Aug-2004  skrll Sync with HEAD
 1.43.10.1 30-Dec-2006  yamt sync with head.
 1.44.22.2 10-Dec-2006  yamt sync with head.
 1.44.22.1 22-Oct-2006  yamt sync with head
 1.44.20.2 12-Jan-2007  ad Sync with head.
 1.44.20.1 18-Nov-2006  ad Sync with head.
 1.46.62.1 19-Oct-2008  haad Sync with HEAD.
 1.46.60.1 28-Jul-2008  simonb Sync with head.
 1.46.58.1 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.46.56.2 11-Mar-2010  yamt sync with head
 1.46.56.1 04-May-2009  yamt sync with head.
 1.46.52.1 28-Sep-2008  mjf Sync with HEAD.
 1.48.8.1 17-Feb-2011  bouyer Sync with HEAD
 1.48.6.1 06-Jun-2011  jruoho Sync with HEAD.
 1.48.4.1 05-Mar-2011  rmind sync with head
 1.49.56.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.9 20-Nov-2006  hauke Better make sure CLK_INTERVAL remains an integer for creative non-default
values of HZ.
 1.8 20-Nov-2006  hauke Add Timecounter support for mac68k, using the otherwise idle second
timer of VIA1. Passes regression/sys/kern/time regression test.

While we are here, GC leftover prototypes from MI todr integration,
and clean up clockreg.h in the light of "Guide to the Macintosh
Hardware" information.

(Reviewed and okayed by Martin Husemann)
 1.7 20-Sep-2006  gdamore Convert mac68k to generic todr. Thanks to Robert Swindells for testing.
 1.6 05-Jun-2001  thorpej branches: 1.6.8; 1.6.40; 1.6.70; 1.6.72;
HZ -> hz
 1.5 01-Apr-1996  scottr branches: 1.5.44;
Make CLK_INTERVAL depend on HZ; update comments to match.
 1.4 01-Feb-1996  briggs Clean up and comment a bit.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.5.44.1 21-Jun-2001  nathanw Catch up to -current.
 1.6.72.2 10-Dec-2006  yamt sync with head.
 1.6.72.1 22-Oct-2006  yamt sync with head
 1.6.70.2 12-Jan-2007  ad Sync with head.
 1.6.70.1 18-Nov-2006  ad Sync with head.
 1.6.40.1 30-Dec-2006  yamt sync with head.
 1.6.8.2 05-Jun-2001  thorpej HZ -> hz
 1.6.8.1 05-Jun-2001  thorpej file clockreg.h was added on branch nathanw_sa on 2001-06-05 05:19:17 +0000
 1.64 26-Jul-2019  rin Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.63 11-Dec-2005  christos branches: 1.63.166;
merge ktrace-lwp.
 1.62 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.61 15-Jul-2003  lukem __KERNEL_RCSID()
 1.60 26-Oct-2002  jdolecek branches: 1.60.6;
now that mem_no is emitted by config(8), there is no reason to keep
copy of more or less identical iskmemdev() for every arch; move the function
to spec_vnop.c, and g/c machine-dependant copies
 1.59 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.58 19-Jul-2002  thorpej Rename cdev_systrace_init() to cdev_clonemisc_init(), so it can
be properly used by any misc. cloning device. While here, correct
a comment to indicate that "open" is the only entry point and that
everything else is handled with fileops.
 1.57 17-Jun-2002  christos MD systrace gluons.
 1.56 27-Apr-2002  shiba branches: 1.56.2;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.55 12-Jan-2002  manu Added clockctl
 1.54 14-Feb-2000  scottr branches: 1.54.8; 1.54.12;
Merge wscons work onto the main development branch.
 1.53 05-Nov-1999  fredb Enable mi Coda driver (PR 8625).
 1.52 01-Nov-1999  scottr Reserve a character device slot for wsdisplay.
 1.51 29-Jul-1999  augustss branches: 1.51.2; 1.51.4; 1.51.6;
Add wsmux device.
(Also add lots of missing chrtoblktbl[] entries.)
 1.50 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.49 18-Feb-1999  scottr branches: 1.49.2; 1.49.4; 1.49.6;
Add support for the IWM driver.
 1.48 18-Feb-1999  scottr Minor space-tab KNFing.
 1.47 13-Nov-1998  oster Updating of bdev's and cdev's to support RAIDframe.
 1.46 23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.45 10-Oct-1998  thorpej Add scsibus entry points to the cdevsw[].
 1.44 13-Oct-1997  scottr Fix an oversight in chrtoblktab[], kindly pointed out by Michael Graff.
 1.43 13-Oct-1997  explorer o Make usage of /dev/random dependant on
pseudo-device rnd # /dev/random and in-kernel generator
in config files.

o Add declaration to all architectures.

o Clean up copyright message in rnd.c, rnd.h, and rndpool.c to include
that this code is derived in part from Ted Tyso's linux code.
 1.42 24-Mar-1997  scottr branches: 1.42.4;
Add se, and make some comsmetic changes for easier maintenance.
 1.41 11-Feb-1997  scottr Add asc character device; kill cdev_grf_init() macro.
 1.40 13-Jan-1997  scottr branches: 1.40.2;
Whoops, forgot to include ipfilter.h
 1.39 13-Jan-1997  scottr Add ipfilter (pseudo-) device.
 1.38 28-Dec-1996  pk branches: 1.38.2;
rename: ramdisk => md
 1.37 21-Nov-1996  scottr Add missing ss, uk, and rd devices to cdevsw
 1.36 07-Sep-1996  mycroft Implement poll(2).
 1.35 05-Sep-1996  mycroft Remove duplicate declarations of LKM functions and macros.
 1.34 19-Jun-1996  briggs Remove Alice copyright.
 1.33 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.32 05-May-1996  briggs Proto for lkmenodev().
 1.31 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.30 14-Mar-1996  christos fdopen -> filedescopen
 1.29 21-Nov-1995  briggs Add rd support at the same address as the Sun3.
 1.28 17-Aug-1995  thorpej Add entries for the ccd.
 1.27 04-Jul-1995  mycroft Make each disk and tape driver define its own read and write functions.
Deprecate rawread() and rawwrite() completely. Remove d_strategy from cdevsw to
force the abstraction barrier.
 1.26 20-Apr-1995  briggs Move to ptytty
Nuke the grf's reset space holder.
 1.25 12-Apr-1995  briggs Fixup from last changes.
Remove clock device.
 1.24 10-Apr-1995  briggs Remove old comment.
 1.23 10-Apr-1995  briggs Remove bogus extra tape cdevsw entry.
Change adb dev init to a mouse dev init.
Remove non-existant clock device stuff.
 1.22 10-Apr-1995  mycroft Minor consistency nits.
 1.21 10-Apr-1995  mycroft Map vnd device from chr to blk.
 1.20 10-Apr-1995  briggs Synchronize with latest changes to hp300 conf.c and give dummy mem
open/close/map routines (map is dummy for now, but should be implemented
when I'm more awake).
 1.19 05-Feb-1995  briggs Clean up cdev for vnd.
 1.18 25-Jan-1995  cgd vn -> vnd renaming, for consistency
 1.17 21-Jan-1995  briggs Add a nullcnpollc() to our constab initializor so we don't get jump to
zero panics when attempting to enter the debugger.
 1.16 22-Dec-1994  briggs Add tun device at cdevsw[24], one up from hp300 location, but we already
have adb at 23.
 1.15 14-Dec-1994  mycroft Remove extra arg to d_open.
 1.14 03-Dec-1994  briggs int -> u_long in ioctl() prototype.
 1.13 14-Nov-1994  christos changed open prototype
 1.12 26-Oct-1994  cgd new RCS ID format.
 1.11 30-Aug-1994  briggs Use vn.h instead of forcing NVN to 0.
 1.10 03-Aug-1994  briggs Clean up a bit. Move ite to 11, generic console to 0. Add lkm stuff
to at least give it a prayer of working...
 1.9 31-Jul-1994  briggs Fixup constab.
 1.8 09-Jul-1994  briggs Some cleanup and get rid of some compiler warnings. Needs more work.
 1.7 09-Jul-1994  briggs Switch to using sys/dev/cons.? instead of old hp-derived generic console.
 1.6 08-Jul-1994  lkestel autoconf.c: added ite.
conf.c: added ite and adb.
cons.c: replaced mac* functions with itecn* functions.
machdep.c: ditto.
 1.5 26-Jun-1994  briggs branches: 1.5.2;
Checkpoint. Will change some with new keyboard/mouse support is added
soon. Still lots of warnings...
Added functions for 4.4-lite.
 1.4 03-Feb-1994  briggs Devices were a mess. They're a little more cleaned-up, now, but there's
more work to be done later to make sure that the devices match up with
critical ones in compat stuff...
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.5.2.2 11-Aug-1994  mycroft update from trunk
 1.5.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.38.2.2 30-Jan-1997  thorpej update from trunk
 1.38.2.1 18-Jan-1997  thorpej Update from trunk.
 1.40.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.42.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.49.6.2 02-Aug-1999  thorpej Update from trunk.
 1.49.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.49.4.1 08-Nov-1999  cgd pull up rev 1.53 from trunk via patch (requested by scottr):
Add Coda support to NetBSD/mac68k.
 1.49.2.8 07-Feb-2000  scottr Add hooks for ite compatibility.
 1.49.2.7 15-Nov-1999  scottr Implement a more straightforward approach to grf emulation.
 1.49.2.6 09-Nov-1999  scottr Sync with main branch.
 1.49.2.5 01-Nov-1999  scottr Sync with main branch.
 1.49.2.4 22-May-1999  scottr Add support for wscons as a console, using evil trickery. To fix this
we'll have to revisit (and rip out) a bunch of things that happen before
the MMU is set up.

As a result, serial consoles now work again.
 1.49.2.3 16-May-1999  scottr Sync with main branch.
 1.49.2.2 11-Mar-1999  scottr We no longer have ite or grf in files.mac68k.
 1.49.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.51.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.51.4.1 15-Nov-1999  fvdl Sync with -current
 1.51.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.54.12.5 11-Nov-2002  nathanw Catch up to -current
 1.54.12.4 17-Sep-2002  nathanw Catch up to -current.
 1.54.12.3 01-Aug-2002  nathanw Catch up to -current.
 1.54.12.2 20-Jun-2002  nathanw Catch up to -current.
 1.54.12.1 28-Feb-2002  nathanw Catch up to -current.
 1.54.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.54.8.3 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.54.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.54.8.1 11-Feb-2002  jdolecek Sync w/ -current.
 1.56.2.3 21-Jul-2002  gehenna catch up with -current.
 1.56.2.2 14-Jul-2002  gehenna catch up with -current.
 1.56.2.1 16-May-2002  gehenna Bye block/character device swicth tables.
 1.60.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.60.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.60.6.1 03-Aug-2004  skrll Sync with HEAD
 1.63.166.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.4 24-Jul-1994  mycroft Clean up deleted files.
 1.3 08-Jul-1994  lkestel autoconf.c: added ite.
conf.c: added ite and adb.
cons.c: replaced mac* functions with itecn* functions.
machdep.c: ditto.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3 24-Jul-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2 05-Apr-1994  mycroft Clean up deleted files.
 1.1 15-Dec-1993  briggs Add files for ddb support. I know they're at least partially broken.
 1.2 05-Apr-1994  mycroft Clean up deleted files.
 1.1 15-Dec-1993  briggs Add files for ddb support. I know they're at least partially broken.
 1.58 03-Apr-2019  christos centralize setdisklabel(9)
 1.57 02-Jan-2008  ad branches: 1.57.98;
Merge vmlocking2 to head.
 1.56 17-Oct-2007  garbled branches: 1.56.2; 1.56.4; 1.56.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.55 08-Oct-2007  ad Merge brelse() changes from the vmlocking branch.
 1.54 05-Mar-2007  tsutsui branches: 1.54.2; 1.54.10; 1.54.18; 1.54.20; 1.54.22;
Add (char *) casts on pointer arith.
 1.53 25-Nov-2006  scw branches: 1.53.4;
Replace the myriad copies of bounds_check_with_label() with a single MI
version.

Add disk_blocksize(9) so that disk drivers can record the physical
block size of a disk if it is different to DEV_BSIZE. Right now this
simply initialises dk_blkshift and dk_byteshift according to the
supplied block size. This information is used in the MI version of
bounds_check_with_label().
 1.52 29-Jan-2006  dsl branches: 1.52.18; 1.52.20;
Make almost everything #include <sys/bswap.h> instead of <machine/bswap.h>
The bswap.h and endian.h files are all rather incestuous, but I want to
get the constant folding stuff into one place - sys/bswap.h
 1.51 11-Dec-2005  christos branches: 1.51.2;
merge ktrace-lwp.
 1.50 09-Jun-2005  rjs branches: 1.50.2;
Add const.
 1.49 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.48 08-Oct-2003  lukem Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
 1.47 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.46 15-Jul-2003  lukem __KERNEL_RCSID()
 1.45 10-May-2003  thorpej branches: 1.45.2;
Change bounds_check_with_label() to take a pointer to the disk structure,
rather than the label itself. This paves the way for some future changes.
 1.44 02-May-2003  dsl Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.43 16-Apr-2003  bouyer Nake return values from bounds_check_with_label() conform to the man
page: -1 for error, 0 for EOF, 1 otherwise. Inspired by an OpenBSD commit
message, pointed out by Miod Vallat in private mail.
vax/mba/hp.c: check return value <= 0, not < 0 to be concistent with how
other places handle return values from bounds_check_with_label().
 1.42 29-Jun-2002  scottr Before reading the (new) Apple Partition Map laid out by sysinst, be sure
to clear the disk label. From Bob Nestor; part 2 of 2 of a fix for
PR 15528.
 1.41 05-Mar-2002  simonb branches: 1.41.6; 1.41.8;
Don't cast argument to ffs() to long.
Per discussion on port-alpha, noticed by Robert Elz.
 1.40 19-Feb-2002  wiz strategy should have an 'r'. Inspired by similar change in OpenBSD.
 1.39 23-Nov-2001  chs macos partition tables appear to use 512 bytes per record rather than
1 sector per record. change the label code to use the same layout
so that CDs with macos partition tables work.
 1.38 14-Jul-2001  scottr branches: 1.38.2; 1.38.6;
Hack writedisklabel() to re-read and analyze the Apple Disk Partition Map
to facilitate sysinst-based modification of the same. From Bob Nestor.
 1.37 20-Nov-2000  chs branches: 1.37.4;
rationalize the use of b_flags for geteblk() buffers.
rather than assigning to the whole field, set or clear individual flags,
which implies that the B_BUSY and B_INVAL flags will remain set.
this allows us to make the assertion in brelse() that B_BUSY is set,
which is the purpose of all this.
 1.36 09-Jun-2000  scottr From Hauke Fath: clean up disklabel support, particularly for
native NetBSD labels.
 1.35 19-May-2000  thorpej branches: 1.35.2;
A foolish consistency; most parts of the kernel use bp->b_data, so
change these from bp->b_un.b_addr to bp->b_data, as well. This also
allows us more flexibility to experiment with other data buffer types
hung off of struct buf.
 1.34 16-May-2000  thorpej Nuke dk_establish() from orbit except from those ports which still use
it to determine the boot device: mvme68k, pc532, macppc, ofppc. Those
platforms should be changed to use device_register(). In the mean time,
those ports defined __BROKEN_DK_ESTABLISH.
 1.33 18-Jan-2000  thorpej Use b_cylinder as defined in sys/buf.h
 1.32 01-May-1999  scottr branches: 1.32.2; 1.32.8;
Fix a problem with bounds_check_with_label(), noted by Greg Oster: we
had been returning (-1) as an error instead of 0. This is the result of
not keeping up with its i386 ancestor, which it was originally derived
from back in 1993. Re-sync.
 1.31 01-May-1999  scottr Rewrite read_mac_label() and friends, simplifying the code considerably
in the process. Less is truly More.
 1.30 30-Jan-1999  scottr branches: 1.30.2; 1.30.4;
Catch up with changes to MBR handling. From Erik Bertelsen in PR 6911.
 1.29 27-Jan-1999  thorpej Use MBR_MAGIC defintions in <sys/disklabel_mbr.h>
 1.28 27-Jan-1999  thorpej Use <sys/disklabel_mbr.h>.
 1.27 19-Jan-1999  scottr Need bswap.h for the bswap32() prototype. From Steve Allen
in PR 6846.
 1.26 30-Oct-1998  scottr Add DOS partition handling, from Ken Nakata in PR 4999, with
only slight tweaking by me.

XXX - does not currently handle NetBSD/i386 or 386BSD/FreeBSD partitions.
 1.25 30-Oct-1998  scottr Enforce a lower bound of (RAW_PART + 1) on the number of partitions
read from the Mac partition table. From Ken Nakata in PR 4999.
 1.24 22-Sep-1998  scottr First pass KNF. This probably needs more work.
 1.23 27-Feb-1998  scottr Remove dpme.h, as it's no longer necessary.
 1.22 26-Nov-1997  briggs Only scan MAXPARTITIONS entries for a free partition table entry.
 1.21 26-Nov-1997  briggs Ignore FWB Component and Apple_Driver_ATA partition types, too.
 1.20 23-Oct-1997  briggs Scan more than MAXPARTITIONS Mac partitions when loading the fake disklabel.
This allows us to use a root and/or user partition that's not one of the
first 8 partitions in the table, and it allows us to fill the fake disklabel.
 1.19 11-Oct-1997  briggs branches: 1.19.2;
Treat an unknown A/UX partition as SCRATCH instead of ignoring it.
 1.18 10-Oct-1997  briggs Ignore partitions of type Apple_Driver43 when filling the fake disklabel.
 1.17 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.16 13-Oct-1996  christos branches: 1.16.10;
backout previous kprintf change
 1.15 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.14 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.13 14-Feb-1996  briggs Get d_npartitions right.
 1.12 11-Feb-1996  briggs Change readdisklabel to check block 0 of the disk for a Macintosh magic
number before attempting to load the Macintosh partition info. If the
first 32-bits of block 0 contain the BSD disklable magic number, treat
it as a NetBSD disklabel.
When loading the Macintosh partition map, check the first 32 partitions
for the root, usr, and swap partitions--instead of the first 8. Still
only allows 8 total partitions for NetBSD use.
 1.11 11-Feb-1996  briggs KNF-ified by Scott Reynolds a long time ago.
 1.10 23-Jul-1995  briggs Minor #def changes.
 1.9 17-Mar-1995  briggs Let's do leave the RAW_PART alone...
 1.8 28-Nov-1994  briggs Add a dk_establish null routine. Clean up some whitespace. Needs a
real overhaul.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 22-Feb-1994  briggs /sbin/disklabel will print out disklabels, so don't be verbose when
doing readdisklabel.
 1.5 10-Feb-1994  briggs New disklabelling from finchm@cray-ymp.acm.stuorg.vt.edu. Cleaned up and
modified somewhat by yours truly. Still need setdisklabel and
writedisklabel at some point--for now, though, it's easier to let MacOS
programs like SilverLining handle this...
 1.4 21-Jan-1994  briggs cpu_*disklabel => *disklabel. This will all be revamped soon, anyway...
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.16.10.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.10.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.19.2.1 27-Oct-1997  mellon Pull rev 1.20 up from trunk
 1.30.4.1 03-May-1999  perry branches: 1.30.4.1.2;
pullup 1.30->1.32 (scottr)
 1.30.4.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.30.2.2 13-Feb-2000  scottr Sync with main branch.
 1.30.2.1 16-May-1999  scottr Sync with main branch.
 1.32.8.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.32.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.32.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.35.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.37.4.4 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.37.4.3 16-Mar-2002  jdolecek Catch up with -current.
 1.37.4.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.37.4.1 03-Aug-2001  lukem update to -current
 1.38.6.5 01-Aug-2002  nathanw Catch up to -current.
 1.38.6.4 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.38.6.3 28-Feb-2002  nathanw Catch up to -current.
 1.38.6.2 08-Jan-2002  nathanw Catch up to -current.
 1.38.6.1 14-Jul-2001  nathanw file disksubr.c was added on branch nathanw_sa on 2002-01-08 00:26:03 +0000
 1.38.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.41.8.1 29-Jun-2002  lukem Pull up revision 1.42 (requested by scottr in ticket #404):
Before reading the (new) Apple Partition Map laid out by sysinst, be sure
to clear the disk label. From Bob Nestor; part 2 of 2 of a fix for
PR 15528.
 1.41.6.1 16-Jul-2002  gehenna catch up with -current.
 1.45.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.45.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.45.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.45.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.45.2.1 03-Aug-2004  skrll Sync with HEAD
 1.50.2.5 21-Jan-2008  yamt sync with head
 1.50.2.4 27-Oct-2007  yamt sync with head.
 1.50.2.3 03-Sep-2007  yamt sync with head.
 1.50.2.2 30-Dec-2006  yamt sync with head.
 1.50.2.1 21-Jun-2006  yamt sync with head.
 1.51.2.1 01-Feb-2006  yamt sync with head.
 1.52.20.1 10-Dec-2006  yamt sync with head.
 1.52.18.1 12-Jan-2007  ad Sync with head.
 1.53.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.54.22.1 14-Oct-2007  yamt sync with head.
 1.54.20.2 09-Jan-2008  matt sync with HEAD
 1.54.20.1 06-Nov-2007  matt sync with HEAD
 1.54.18.1 26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.54.10.1 16-Oct-2007  garbled Sync with HEAD
 1.54.2.1 09-Oct-2007  ad Sync with head.
 1.56.8.1 02-Jan-2008  bouyer Sync with HEAD
 1.56.4.1 31-Dec-2007  ad Make compile with new buffer cache locking scheme.

XXX This should be largely MI, please do not make another clone of disksubr.c.
 1.56.2.1 18-Feb-2008  mjf Sync with HEAD.
 1.57.98.1 10-Jun-2019  christos Sync with HEAD
 1.9 27-Feb-1998  scottr Remove dpme.h, as it's no longer necessary.
 1.8 30-Nov-1997  briggs Add extra FWB driver partition and Apple ATA driver partitions to the list
of partition type that we recognise and skip when filling the fake
disklabel.
 1.7 10-Oct-1997  briggs Ignore partitions of type Apple_Driver43 when filling the fake disklabel.
 1.6 23-Jun-1996  briggs branches: 1.6.10;
Format the NetBSD Id string like it is elsewhere
 1.5 26-Oct-1994  briggs Use u_int32_t and friends. Comment a tiny bit...
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 10-Feb-1994  briggs branches: 1.3.2;
Get rid of local FS_* definitions and add a few more partition strings to
keep from labelling the driver and partition map partitions with new
disklabelling code.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3.2.1 26-Oct-1994  cgd from trunk.
 1.6.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.39 15-Nov-2011  tsutsui Merge copy-and-pasted fpu_probe() function (to share it among more m68k ports).
Tested on TT030, Sun3/80, and X68030.
 1.38 28-Apr-2008  martin branches: 1.38.34;
Remove clause 3 and 4 from TNF licenses
 1.37 17-Oct-2007  garbled branches: 1.37.16; 1.37.18; 1.37.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.36 02-Jun-2007  tsutsui branches: 1.36.10;
Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.35 24-Dec-2005  perry branches: 1.35.30; 1.35.32; 1.35.38;
bare asm -> __asm
 1.34 11-Dec-2005  christos merge ktrace-lwp.
 1.33 09-Jun-2005  rjs branches: 1.33.2;
Add const.
 1.32 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.31 02-Aug-2004  scottr We can't generate an FPU idle frame until we know which one
####we have, so defer this until we've probed the FPU type.
####Fixes PRs 25081 and 26250.
 1.30 15-Jul-2003  lukem branches: 1.30.2;
__KERNEL_RCSID()
 1.29 23-Jun-2003  martin branches: 1.29.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.28 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.27 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.26 14-May-2002  matt Eliminate commons (including many used ones). Clean up variable references.
 1.25 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.24 20-Apr-1998  scottr branches: 1.24.30; 1.24.34;
Correct type of 'nofault', and some whitespace KNFing.
 1.23 12-Jan-1998  thorpej Update for changes to config.
 1.22 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.21 16-Dec-1996  scottr branches: 1.21.10;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.20 09-Dec-1996  thorpej Copyright assigned to The NetBSD Foundation.
 1.19 13-Oct-1996  christos backout previous kprintf change
 1.18 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.17 16-Sep-1996  scottr Convert `fpu_type' to the more consistent `fputype', and use the new
#defines from m68k/include/cpu.h.
 1.16 11-Jun-1996  scottr Fix bounds check for fpu description array.
 1.15 05-May-1996  briggs branches: 1.15.4;
Pass struct fpframe * to m68881_restore().
 1.14 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.13 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.12 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.11 10-Mar-1996  briggs Use label_t instead of jmp_buf and don't include setjmp.h.
 1.10 12-Aug-1995  briggs Get rid of cpu040 for good.
 1.9 21-Jun-1995  briggs Remove warning.
 1.8 10-May-1995  briggs Actually probe for 881 vs. 882. Also add a case for 040, although it's
really lip-service at the moment.
 1.7 06-May-1995  briggs Probe this like the other devices.
 1.6 29-Mar-1995  briggs Nuke FPCOPROC and add fpu device driver and FPU_EMULATE from sun3.
Still need to figure out how to handle this w/ FPSP on 68040's but
since we're not really using the 68040 yet...
 1.5 03-Dec-1994  briggs Handle supervisor/user data differently. Status of functionality
still nil.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 21-Apr-1994  briggs Dump into debugger if DDB and we get an odd coprocessor instruction.
 1.2 27-Feb-1994  briggs Include cop. Also change a bunch of printfs to PRINTF() and define
PRINTF() to nothing.
 1.1 22-Feb-1994  briggs Rudimentary, experimental fpu emulator. Needs lots o' work before it can
move to m68k or even be useful for more than testing purposes...
 1.15.4.1 11-Jun-1996  scottr Pull up from trunk:
>Fix bounds check for fpu description array.
 1.21.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.24.34.3 18-Oct-2002  nathanw Catch up to -current.
 1.24.34.2 20-Jun-2002  nathanw Catch up to -current.
 1.24.34.1 08-Jan-2002  nathanw Catch up to -current.
 1.24.30.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.24.30.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.24.30.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.29.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.29.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.29.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.29.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.29.2.1 03-Aug-2004  skrll Sync with HEAD
 1.30.2.1 02-Aug-2004  tron Pull up revision 1.31 (requested by scottr in ticket #728):
We can't generate an FPU idle frame until we know which one
we have, so defer this until we've probed the FPU type.
 1.33.2.2 03-Sep-2007  yamt sync with head.
 1.33.2.1 21-Jun-2006  yamt sync with head.
 1.35.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.35.32.1 11-Jul-2007  mjf Sync with head.
 1.35.30.1 09-Jun-2007  ad Sync with head.
 1.36.10.1 06-Nov-2007  matt sync with HEAD
 1.37.20.1 16-May-2008  yamt sync with head.
 1.37.18.1 18-May-2008  yamt sync with head.
 1.37.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.38.34.1 17-Apr-2012  yamt sync with head
 1.1 15-Nov-2011  tsutsui branches: 1.1.8;
Merge copy-and-pasted fpu_probe() function (to share it among more m68k ports).
Tested on TT030, Sun3/80, and X68030.
 1.1.8.2 17-Apr-2012  yamt sync with head
 1.1.8.1 15-Nov-2011  yamt file fpu_machdep.c was added on branch yamt-pagecache on 2012-04-17 00:06:36 +0000
 1.23 15-Apr-1997  scottr Use genassym.sh to facilitate cross-compiling.
 1.22 09-Jan-1997  scottr Add CACHE40_ON, for locore
 1.21 07-Jan-1997  scottr Add CPU_XXX macros to assym.h
 1.20 16-Sep-1996  scottr Convert `fpu_type' to the more consistent `fputype', and use the new
#defines from m68k/include/cpu.h.
 1.19 12-Sep-1996  scottr Sync with m68k/cpu.h changes
 1.18 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.17 25-Mar-1996  briggs Fix for more pedantic -W options.
 1.16 27-Feb-1996  briggs Get rid of some unneeded constants.
 1.15 02-Feb-1996  mycroft Don't define _KERNEL here.
 1.14 21-Jun-1995  briggs Cleanup some--needs more pruning.
 1.13 17-May-1995  briggs Some cleanup.
 1.12 29-Mar-1995  briggs Nuke FPCOPROC and add fpu device driver and FPU_EMULATE from sun3.
Still need to figure out how to handle this w/ FPSP on 68040's but
since we're not really using the 68040 yet...
 1.11 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.10 26-Oct-1994  cgd new RCS ID format.
 1.9 07-Jul-1994  briggs branches: 1.9.2;
Add MMU constants.
 1.8 26-Jun-1994  briggs Added new constants. Changed some old. Overhauled includes a bit.
 1.7 06-May-1994  briggs Get things to compile with latest changes.
 1.6 21-Apr-1994  briggs Clean up a good bit. Add a few constants for '040.
 1.5 18-Apr-1994  briggs Get rid of some constants that we don't need.
 1.4 02-Mar-1994  briggs Nuke MAC2... Doesn't need to be here.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.9.2.2 07-Jul-1994  briggs Add MMU constants.
 1.9.2.1 07-Jul-1994  briggs file genassym.c was added on branch netbsd-1-0 on 1994-07-07 00:25:11 +0000
 1.45 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.44 27-Dec-2023  thorpej Define values for the 68030 TT registers in terms of the definitions
in <m68k/mmu_30.h> rather than using magic numbers.
 1.43 27-Dec-2023  thorpej Re-factor the 680x0 Function Code definitions into their own
separate file (as was done on the sun2/sun3 ports ages ago)
and switch everyone to the common header.
 1.42 27-Dec-2023  thorpej Stop using magic numbers for the MMU root pointer attributes and the
Translation Control register, and also get rid of "#if PGSHIFT == ..."
where those magic numbers are used.

Instead, define new macros: MMU51_SRP_BITS, MMU51_CRP_BITS, MMU51_TCR_BITS,
and MMU40_TCR_BITS, in terms of the definitions in mmu_{40,51}.h. These
automagically adapt to 8K and 4K pages based on the machine-specific value
of PGSHIFT.
 1.41 20-Feb-2020  skrll G/C
 1.40 17-Feb-2020  skrll G/C LS{SLEEP,RUN,ONPROC}

LWP status manipulation was moved out of assembly long ago.
 1.39 19-Dec-2018  maxv branches: 1.39.6;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.38 02-Feb-2017  rin branches: 1.38.12; 1.38.14;
PR port-mac68k/51923
Remove unused SYSPTSIZE and USRPTSIZE from m68k ports.
Ok jklos
 1.37 16-Jul-2013  jklos branches: 1.37.8; 1.37.12; 1.37.16;
Added DJMEMCMAX option for recognizing 128 meg SIMMs in Centris and Quadra
610, 650 and 800 systems. From Rob Braun,
http://synack.net/~bbraun/netbsdmac2.html
 1.36 14-Jan-2011  rmind branches: 1.36.8; 1.36.18; 1.36.22;
Retire struct user, remove sys/user.h inclusions. Note sys/user.h header
as obsolete. Remove USER_TO_UAREA/UAREA_TO_USER macros.

Various #include fixes and review by matt@.
 1.35 20-Dec-2010  matt Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.34 10-Dec-2009  rmind branches: 1.34.4;
Rename L_ADDR to L_PCB and amend some comments accordingly.
 1.33 23-Nov-2009  rmind Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.32 20-Sep-2008  tsutsui Remove advertising clause for UCB in various genassym.cf files,
which were derived from genassym.c in 4.4BSD-Lite2 (or 386BSD).
Closes PR misc/39573. Approved by martin@.
 1.31 17-Oct-2007  garbled branches: 1.31.16; 1.31.20; 1.31.22; 1.31.26;
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.30 17-May-2007  rjs branches: 1.30.10;
Start yamt-idlelwp fixes.
 1.29 08-Mar-2007  tsutsui branches: 1.29.2; 1.29.4; 1.29.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.28 11-Dec-2005  christos branches: 1.28.26;
merge ktrace-lwp.
 1.27 04-Nov-2003  dsl branches: 1.27.16;
Remove p_nras from struct proc - use LIST_EMPTY(&p->p_raslist) instead.
Remove p_raslock and rename p_lwplock p_lock (one lock is enough).
Simplify window test when adding a ras and correct test on VM_MAXUSER_ADDRESS.
Avoid unpredictable branch in i386 locore.S
(pad fields left in struct proc to avoid kernel bump)
 1.26 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.25 08-Apr-2003  thorpej branches: 1.25.2;
Use PAGE_SIZE rather than NBPG.
 1.24 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.23 26-Sep-2002  thorpej Remove <sys/map.h>
 1.22 11-May-2002  jdolecek use _KERNEL_OPT rather than _KERNEL && !_LKM
 1.21 29-Nov-2000  jdolecek branches: 1.21.4; 1.21.8;
LKMify
 1.20 21-Nov-2000  tsutsui Define proper macros for FP frame offsets rather than magic numbers.
 1.19 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.18 26-May-2000  thorpej Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor. Test against SONPROC as appropriate rather than
combinations of SRUN and curproc. Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.
 1.17 04-Dec-1999  ragge CL* discarding.
 1.16 31-Oct-1999  scottr Sync trace trap handling with other m68k ports, originated by
ITOH Yasufumi. Coincidentally closes PR 7738.
 1.15 05-Aug-1999  briggs branches: 1.15.2; 1.15.4; 1.15.6;
Define MAC68K_CLOCK_IPL.
 1.14 06-May-1999  kleink SVR4-related typo in previous.
 1.13 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.12 24-Mar-1999  ender branches: 1.12.4;
Garbage collect a bit of old VM missed by the initial pass.
Fix supplied by Dave Huang <khym@bga.com> in PR #7226.
 1.11 01-Oct-1998  thorpej branches: 1.11.6;
Define SYS_compat_13_sigreturn13.
 1.10 30-Sep-1998  thorpej Make sure SYS_exit and SYS___sigreturn14 are defined. Garbage collect
SYS_sigreturn.
 1.9 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.8 20-Apr-1998  scottr Garbage collect the constants we don't need.
 1.7 06-Jan-1998  thorpej Garbage-collect VM_PMAP.
 1.6 06-Jan-1998  thorpej Garbage-collect pm_stchanged.
 1.5 09-Nov-1997  scottr Get rid of MSGBUFPTECNT; fixes PR 4331.
 1.4 27-Oct-1997  briggs struct msgbuf -> struct kern_msgbuf.
 1.3 30-Aug-1997  scottr branches: 1.3.4;
Do run-time determination whether to save the TC value for AV
Macs; this way at least those models can configure intvid0.
From Dave Huang.
 1.2 13-May-1997  gwr branches: 1.2.4;
Eliminate references to vmspace.vm_pmap
 1.1 15-Apr-1997  scottr Use genassym.sh to facilitate cross-compiling.
 1.2.4.1 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.1 27-Oct-1997  mellon Pull rev 1.3 up from trunk (briggs)
 1.11.6.3 12-Dec-1999  scottr Sync with main branch.
 1.11.6.2 01-Nov-1999  scottr Sync with main branch.
 1.11.6.1 16-May-1999  scottr Sync with main branch.
 1.12.4.1 21-Jun-1999  thorpej Sync w/ -current.
 1.15.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.15.4.1 15-Nov-1999  fvdl Sync with -current
 1.15.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.15.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.21.8.6 18-Oct-2002  nathanw Catch up to -current.
 1.21.8.5 05-Oct-2002  gmcgarry Add RAS offsets.
 1.21.8.4 02-Aug-2002  nathanw Don't need SAF_UPCALL anymore.
 1.21.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.21.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.21.8.1 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.21.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.21.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.25.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.25.2.1 03-Aug-2004  skrll Sync with HEAD
 1.27.16.1 03-Sep-2007  yamt sync with head.
 1.28.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.29.10.1 22-May-2007  matt Update to HEAD.
 1.29.4.1 11-Jul-2007  mjf Sync with head.
 1.29.2.1 27-May-2007  ad Sync with head.
 1.30.10.1 06-Nov-2007  matt sync with HEAD
 1.31.26.1 19-Oct-2008  haad Sync with HEAD.
 1.31.22.1 10-Oct-2008  skrll Sync with HEAD.
 1.31.20.2 11-Mar-2010  yamt sync with head
 1.31.20.1 04-May-2009  yamt sync with head.
 1.31.16.1 28-Sep-2008  mjf Sync with HEAD.
 1.34.4.1 05-Mar-2011  rmind sync with head
 1.36.22.1 28-Aug-2013  rmind sync with head
 1.36.18.2 03-Dec-2017  jdolecek update from HEAD
 1.36.18.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.8.1 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.37.16.1 21-Apr-2017  bouyer Sync with HEAD
 1.37.12.1 20-Mar-2017  pgoyette Sync with HEAD
 1.37.8.1 05-Feb-2017  skrll Sync with HEAD
 1.38.14.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.38.14.1 10-Jun-2019  christos Sync with HEAD
 1.38.12.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.39.6.1 29-Feb-2020  ad Sync with head.
 1.3 08-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.36 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.35 19-Jan-2024  thorpej Now that we've agreed on the name "intr_depth", let's agree on the type, too.
 1.34 19-Jan-2024  thorpej Consistently use "intr_depth" as the name of the interrupt depth counter
on m68k platforms.
 1.33 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.32 02-Apr-2021  rin For ports with __HAVE_LEGACY_INTRCNT, turn intrcnt[] and derived
variables into u_int, to match with kern/subr_evcnt.c.
 1.31 21-Jul-2020  rin branches: 1.31.2; 1.31.4;
For GCC8, do not omit frame pointer for intr_dispatch() and via1_intr()
(-fomit-frame-pointer is enabled for -O and higher for GCC8).

This is required by rtclock_intr() which unwinds stack frame of caller!

XXXXXX
We need to get rid of this hackest hack for rtclock_intr(). This problem
was discussed back in 2014:

http://mail-index.netbsd.org/port-mac68k/2014/08/15/msg000595.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000600.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000601.html

However, unfortunately, the problem has been left untouched until today.

The patch attached in the third message works around the problem. But,
it adds hard-coded magic numbers to intr_dispatch() and via1_intr().
For real fix, we should probably reconsider whole interrupt handling.

Anyway, now kernel compiled by GCC8 works fine as far as I can see.
 1.30 19-Feb-2019  mrg convert 'extern long intrnames' to 'extern char intrnames[MAX_INAME_LENGTH]'.
also, assert that MAX_INAME_LENGTH is not larger than eintrnames - intrnames.

fixes gcc 7's object size checker checks. tested by martin@.
 1.29 20-Dec-2010  matt branches: 1.29.60;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.28 19-Jun-2008  tsutsui branches: 1.28.18;
Unify splraiseipl(9) implementation among m68k ports as per
suggestion from isaki@ on port-m68k.

For mac68k:
- rename mac68k_ipls[] to common ipl2psl_table[]
- make makeiplcookie() return PSL bits via ipl2psl_table[]
rather than IPL_FOO indexes
 1.27 28-Apr-2008  martin branches: 1.27.2; 1.27.4;
Remove clause 3 and 4 from TNF licenses
 1.26 05-Dec-2007  tsutsui branches: 1.26.12; 1.26.14; 1.26.16;
Restore ipl settings for AV class Macs.
 1.25 03-Dec-2007  ad branches: 1.25.2;
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.24 08-Mar-2007  tsutsui branches: 1.24.2; 1.24.18; 1.24.20; 1.24.26;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.23 27-Nov-2005  yamt branches: 1.23.26;
implement splraiseipl() for the following ports.
evbppc, evbmips, evbsh3, hp700, mac68k, vax, x68k.
 1.22 16-Jun-2005  jmc branches: 1.22.2; 1.22.8;
Shadowing and const fixes.
 1.21 05-Mar-2005  chs remove some more __P that I missed before.
 1.20 15-Jan-2005  chs branches: 1.20.2; 1.20.4;
de-__P, remove register, ansify, b* -> mem*.
 1.19 15-Jul-2003  lukem __KERNEL_RCSID()
 1.18 27-Sep-2002  provos branches: 1.18.6;
remove trailing \n in panic(). approved perry.
 1.17 12-Apr-2001  thorpej branches: 1.17.2; 1.17.8;
splimp -> splhigh for frobbing the netisr.
 1.16 05-Jul-2000  scottr branches: 1.16.2;
Revert a bit of the last change to make this compile again.
 1.15 02-Jul-2000  cgd Kwality control:
* put #includes of opt headers and headers to get protos used by
net/netisr_dispatch.h in net/netisr.h (if !defined(_LOCORE)) (rather than
in netisr_dispatch.h itself, and potentially nowhere, respectively).
* require netisr.h to be included before netisr_dispatch.h.
* minor additional cleanup of both netisr.h and netisr_dispatch.h.
* clean up uses to remove now-unnecessary header file inclusions, and
local prototypes of the fns.
* convert netisr dispatch implementations which didn't use
netisr_dispatch.h (pc532) to use it.
 1.14 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.13 21-Feb-2000  erh Define the DONETISR macro and use netisr_dispatch.h. This is to cut down on code duplication and to standardize the available NETISRs across all ports.
 1.12 21-Feb-2000  scottr Correct some temporary confusion between the IOPs and the OSS: move
IOP init back to mac68k_init(). We'll deal with the OSS later.
 1.11 21-Feb-2000  scottr Explicitly include headers needed by iopreg.h
 1.10 21-Feb-2000  scottr Initialize VIA/IOP/PSC from intr_init().
 1.9 06-Nov-1999  scottr Change the behavior of spladb() so that it raises the IPL only
high enough to block ADB interrupts.
 1.8 28-Oct-1999  scottr Rearrange a little bit for consistency with spl(9); add splserial()
check to intr_computeipl().
 1.7 04-Aug-1999  thorpej branches: 1.7.2; 1.7.4; 1.7.6;
Use an array for PSL values, rather than individual shortwords, like
the hp300 port.
 1.6 28-Jun-1999  itojun - Call ip6intr if INET6 is defined.
- remove "need-flag" for mac68k esp driver, as it is not used in anywhere
and conflicts with IPsec ESP header.

This should be the only MD change in IPv6 support, except kernel config file.
Very sorry if you have any compilation problem with it (I believe it is okay).
If your favorite arch is not included in here, please add a
call to ip6intr() from softintr handle.
 1.5 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.4 24-Mar-1999  mrg branches: 1.4.4; 1.4.6;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.3 28-Feb-1999  scottr branches: 1.3.2;
Move all IPL setup to intr.c, and do some sanity checking.
 1.2 25-Aug-1998  scottr The return value from intr_dispatch() is no longer necessary.
 1.1 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.3.2.3 09-Nov-1999  scottr Sync with main branch.
 1.3.2.2 01-Nov-1999  scottr Sync with main branch.
 1.3.2.1 16-May-1999  scottr Sync with main branch.
 1.4.6.2 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.4.6.1 28-Jun-1999  itojun KAME/NetBSD 1.4 SNAP kit, dated 19990628.

NOTE: this branch (kame) is used just for refernce. this may not compile
due to multiple reasons.
 1.4.4.1 01-Jul-1999  thorpej Sync w/ -current.
 1.7.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.7.4.1 15-Nov-1999  fvdl Sync with -current
 1.7.2.2 21-Apr-2001  bouyer Sync with HEAD
 1.7.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.16.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.17.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.17.8.1 12-Apr-2001  nathanw file intr.c was added on branch nathanw_sa on 2002-10-18 02:38:22 +0000
 1.17.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.18.6.7 11-Dec-2005  christos Sync with head.
 1.18.6.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.6.5 08-Mar-2005  skrll Sync with HEAD.
 1.18.6.4 17-Jan-2005  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.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.2.1 29-Apr-2005  kent sync with -current
 1.22.8.1 29-Nov-2005  yamt sync with head.
 1.22.2.3 07-Dec-2007  yamt sync with head
 1.22.2.2 03-Sep-2007  yamt sync with head.
 1.22.2.1 21-Jun-2006  yamt sync with head.
 1.23.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.24.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.24.20.1 09-Jan-2008  matt sync with HEAD
 1.24.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.24.2.1 03-Dec-2007  ad Sync with HEAD.
 1.25.2.1 08-Dec-2007  ad Sync with head.
 1.26.16.2 04-May-2009  yamt sync with head.
 1.26.16.1 16-May-2008  yamt sync with head.
 1.26.14.1 18-May-2008  yamt sync with head.
 1.26.12.2 29-Jun-2008  mjf Sync with HEAD.
 1.26.12.1 02-Jun-2008  mjf Sync with HEAD.
 1.27.4.1 27-Jun-2008  simonb Sync with head.
 1.27.2.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.28.18.1 05-Mar-2011  rmind sync with head
 1.29.60.1 10-Jun-2019  christos Sync with HEAD
 1.31.4.1 03-Apr-2021  thorpej Sync with HEAD.
 1.31.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.12 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.11 12-Mar-2007  ad Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
 1.10 24-Dec-2005  perry branches: 1.10.26; 1.10.30;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 15-Jan-2005  chs branches: 1.8.10;
de-__P, remove register, ansify, b* -> mem*.
 1.7 15-Jul-2003  lukem __KERNEL_RCSID()
 1.6 03-Jul-2003  rjs Fix uninitialized variable.
 1.5 01-Jun-2002  lukem branches: 1.5.6;
SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.4 08-Mar-2002  thorpej branches: 1.4.6;
Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.3 30-Jul-2000  briggs branches: 1.3.4; 1.3.8;
Some uncommitted poking around. No functional change.
 1.2 28-Jun-1999  briggs branches: 1.2.2; 1.2.4; 1.2.8;
Include a bit more info about what's not happening with IOP.
 1.1 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.2.8.2 28-Jun-1999  briggs Include a bit more info about what's not happening with IOP.
 1.2.8.1 28-Jun-1999  briggs file iop.c was added on branch scottr-mac68k-wscons on 1999-06-28 04:33:23 +0000
 1.2.4.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.2.2.1 28-Jun-1999  thorpej file iop.c was added on branch chs-ubc2 on 1999-07-01 23:10:01 +0000
 1.3.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.3.8.1 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.3.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.3.4.1 16-Mar-2002  jdolecek Catch up with -current.
 1.4.6.1 14-Jul-2002  gehenna catch up with -current.
 1.5.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.5.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.5.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.5.6.1 03-Aug-2004  skrll Sync with HEAD
 1.8.10.2 03-Sep-2007  yamt sync with head.
 1.8.10.1 21-Jun-2006  yamt sync with head.
 1.10.30.1 13-Mar-2007  ad Sync with head.
 1.10.26.1 24-Mar-2007  yamt sync with head.
 1.3 11-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.2 24-Jul-1994  mycroft Clean up deleted files.
 1.1 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.5 03-Nov-2002  chs merge all the m68k copies of kgdb_machdep.c.
 1.4 29-Jun-2000  mrg branches: 1.4.8;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.3 12-Dec-1999  scottr Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.2 22-Dec-1998  scottr branches: 1.2.2; 1.2.10; 1.2.16;
vm_offset_t -> {paddr_t, vaddr_t}
 1.1 05-May-1998  scottr Add the remaining kgdb pieces from sun3/hp300, with some mac68k-specific
adjustments to initialization.
 1.2.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.2.1 12-Dec-1999  scottr Sync with main branch.
 1.4.8.1 11-Nov-2002  nathanw Catch up to -current
 1.184 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.183 17-Jan-2024  thorpej Make sigcode.s and sunos_sigcode.s build as their own stand-alone files.
 1.182 17-Jan-2024  thorpej Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.
 1.181 16-Jan-2024  thorpej Build m68k/support.s on its own; don't include it from locore.s
 1.180 09-Jan-2024  thorpej Statically-initialize the '851 / '030 protorp with MMU51_SRP_BITS. In
pmap_init(), re-initialize protorp with MMU51_CRP_BITS. Remove the now-
redundant code that does this in each of the m68k platforms.
 1.179 09-Jan-2024  thorpej Remove duplicated / slightly-tweaked loadustp() (load user segment table)
routines from all of the m68k ports using the shared pmap. Instead, in
pmap_init(), set up a function pointer to the appropriate mmu_load_urp*()
function in mmu_subr.s.
 1.178 27-Dec-2023  thorpej Define values for the 68030 TT registers in terms of the definitions
in <m68k/mmu_30.h> rather than using magic numbers.
 1.177 27-Dec-2023  thorpej Stop using magic numbers for the MMU root pointer attributes and the
Translation Control register, and also get rid of "#if PGSHIFT == ..."
where those magic numbers are used.

Instead, define new macros: MMU51_SRP_BITS, MMU51_CRP_BITS, MMU51_TCR_BITS,
and MMU40_TCR_BITS, in terms of the definitions in mmu_{40,51}.h. These
automagically adapt to 8K and 4K pages based on the machine-specific value
of PGSHIFT.
 1.176 25-Dec-2023  thorpej loadustp(): Optimize for the overwhelmingly common case of "not the HP MMU".
Rather than converting the level 1 table address to a page number before
calling loadustp() only to have loadustp() convert it back to an address
for the '851, '030, '040, and '060, instead pass the address and convert
to a page number only in the case of the HP MMU.

This is a wash on HP MMU machines (9000/320 and 9000/350), and saves at
least 4 instructions (2x moveq + 2x lsXl) on every context switch on
everything else.
 1.175 30-May-2022  andvar branches: 1.175.4;
s/identifing/identifying/ and s/multipler/multiplier/ in comments.
 1.174 14-Mar-2021  rin Fix DJMEMCMAX option for Quadra/Centris 650/800.

- Use jeq instead of jra for conditional branch.
- Use cmpl instead of cmp (= cmpw) for int variables.

Now, my Quadra 800 recognizes full 520MB memory!
 1.173 21-Jul-2020  rin branches: 1.173.2;
For GCC8, do not omit frame pointer for intr_dispatch() and via1_intr()
(-fomit-frame-pointer is enabled for -O and higher for GCC8).

This is required by rtclock_intr() which unwinds stack frame of caller!

XXXXXX
We need to get rid of this hackest hack for rtclock_intr(). This problem
was discussed back in 2014:

http://mail-index.netbsd.org/port-mac68k/2014/08/15/msg000595.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000600.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000601.html

However, unfortunately, the problem has been left untouched until today.

The patch attached in the third message works around the problem. But,
it adds hard-coded magic numbers to intr_dispatch() and via1_intr().
For real fix, we should probably reconsider whole interrupt handling.

Anyway, now kernel compiled by GCC8 works fine as far as I can see.
 1.172 21-Jul-2020  rin Align tmpstk to 4-byte boundary as required by System V (ELF) ABI.

Fix GCC8-compiled kernel crash during very early boot stage when
printf decimal numbers; __umoddi3 corrupts stack frame which is not
aligned properly.
 1.171 19-Dec-2018  maxv branches: 1.171.4;
Remove compat_svr4 and compat_svr4_32, as discussed on tech-kern@ recently,
but also as discussed several times in the past.
 1.170 15-Mar-2014  tsutsui branches: 1.170.28; 1.170.30;
Use common m68k/busaddrerr.s for bus error and address error handlers.

No binary changes on GENERIC.
 1.169 09-Mar-2014  tsutsui Remove an instruction for nonexistent 060 branch prediction error accounting.

It's amiga and atari specific and copied from amiga/locore.s
to mac68k/locore.s in rev 1.80, then pasted into other ports.
Note this is harmless because all these ports don't have 68060 variants
(i.e. it's inside #if defined(M68060) block) and mvme68k (which has 68060)
has removed it since the initial import.
 1.168 07-Sep-2013  chs switch to ELF naming for local labels.
 1.167 16-Jul-2013  jklos Added DJMEMCMAX option for recognizing 128 meg SIMMs in Centris and Quadra
610, 650 and 800 systems. From Rob Braun,
http://synack.net/~bbraun/netbsdmac2.html
 1.166 22-Dec-2011  tsutsui branches: 1.166.6; 1.166.10;
Merge m68881_save() and m68881_restore() (using most common mvme68k ones).
All functions are checked by my eyes, and all GENERIC kernels compile.
 1.165 26-Nov-2011  tsutsui branches: 1.165.2;
Make sure to call pflusha before (not after) enabling MMU on
68030/68851 initialization paths.

Pointed out by isaki@ per observation of ATC status on XM6i emulator.
Tested on TT030, HP362, NWS-1750, and X68030 by me.

XXX: probably we can remove existing pflusha or TBIA calls after MMU turned
XXX: on (and before enabling cache) but I leave them as is for now to avoid
XXX: unexcpected side effects.
 1.164 15-Nov-2011  tsutsui Move spread getsfc() and getdfc() functions into common m68k/support.s.

Note:
- ENTRY_NOPROFILE() is okay since they are used only for debug printf
- they are declared to return int so no need to put a return value into %a0
 1.163 08-Feb-2011  rmind branches: 1.163.4;
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.162 20-Dec-2010  matt branches: 1.162.2; 1.162.4;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.161 06-Jun-2010  mrg 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.160 25-Feb-2010  skrll branches: 1.160.2;
s/cpu_fork/cpu_lwp_fork/ in comment.
 1.159 12-Dec-2009  tsutsui branches: 1.159.2;
Allow NetBSD/mac68k kernel work with PGSHIFT==13, i.e. 8KB/page.
Tested on LC630 with 68LC040.
 1.158 11-Dec-2009  tsutsui Move uvm_setpagesize() calls from locore.s to pmap_bootstrap_finalize().
Also explicitly set uvmexp.pagesize to prepare 8KB/page settings.

XXX: There is #ifdef !defined(amiga) && !defined(atari) workaround
XXX: because they have different pmap initialization functions.
 1.157 04-Dec-2009  tsutsui Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Tested on LC630.
 1.156 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.155 11-Jan-2009  tsutsui Fix inverted logic on FPU type check in fpfault(). From OpenBSD.
 1.154 19-Jun-2008  tsutsui branches: 1.154.4;
Unify splraiseipl(9) implementation among m68k ports as per
suggestion from isaki@ on port-m68k.

For mac68k:
- rename mac68k_ipls[] to common ipl2psl_table[]
- make makeiplcookie() return PSL bits via ipl2psl_table[]
rather than IPL_FOO indexes
 1.153 17-Oct-2007  garbled branches: 1.153.16; 1.153.20; 1.153.22; 1.153.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.152 12-Jun-2007  mhitch branches: 1.152.10;
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.151 22-May-2007  rjs Remove two unused global variables.
 1.150 21-May-2007  tsutsui Initialize curlwp as well as lwp0.l_addr right after MMU is enabled.
 1.149 20-May-2007  he Follow the pattern suggested by mhitch for the atari port and
remove inclusion of m68k/m68k/proc_subr.s, restoring the kernel
to a buildable state.
 1.148 08-Mar-2007  tsutsui branches: 1.148.2; 1.148.4; 1.148.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.147 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.146 08-Jan-2007  chs branches: 1.146.2;
in doboot, use "longscratch" as a scratch memory location instead of
something in the (read-only) text section. fixes PR 35068.
 1.145 11-Dec-2005  christos branches: 1.145.20; 1.145.24;
merge ktrace-lwp.
 1.144 04-Mar-2004  nathanw branches: 1.144.14; 1.144.16; 1.144.26; 1.144.28;
Centralize identical copies of proc_trampoline code.

(lots more opportunites here for the bored hacker, such as rei and trap0...)
 1.143 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.142 23-Jun-2003  martin branches: 1.142.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.141 08-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.140 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.139 10-Apr-2002  briggs Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.138 11-Feb-2002  wiz s/seperate/separate/
 1.137 31-Jan-2002  christos Frederic Bruckman spotted a missing _C_LABEL.
 1.136 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.135 22-Jul-2001  wiz branches: 1.135.6;
seperate -> separate
 1.134 30-May-2001  lukem branches: 1.134.2;
add missing #include "opt_kgdb.h"
 1.133 29-Dec-2000  briggs branches: 1.133.2;
Rework the esp driver a little bit to improve performance. This requires
an ugly bit where we record the value of a2 while handling a "nofault" bus
error in locore.s in order to know how far the transaction got before a
disconnect (see esp.c comments for more details on this).
Also get rid of a loop (and delay()!) in the interrupt routine--hinted at
and researched by Chas Williams <chas@cmf.nrl.navy.mil>.
 1.132 26-Nov-2000  jdolecek split m68k SunOS and SVR4-specific sigcode.s code to sunos_sigcode.s
and svr4_sigcode.s respectively
adjust individual m68k port's locore.s to include new sigcode files if
appropriate
 1.131 21-Nov-2000  tsutsui Define proper macros for FP frame offsets rather than magic numbers.
 1.130 20-Aug-2000  thorpej Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it). Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
 1.129 31-May-2000  thorpej branches: 1.129.2;
Add a comment on single-processor systems about p_cpu being initialized
by fork1().
 1.128 26-May-2000  thorpej branches: 1.128.2;
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.127 26-May-2000  thorpej Introduce a new process state distinct from SRUN called SONPROC
which indicates that the process is actually running on a
processor. Test against SONPROC as appropriate rather than
combinations of SRUN and curproc. Update all context switch code
to properly set SONPROC when the process becomes the current
process on the CPU.
 1.126 14-May-2000  minoura defopt FPSP.
 1.125 09-Mar-2000  scottr Back out previous; it's now dead code.
 1.124 04-Mar-2000  scottr Add get_pte_s() to search the supervisor space.
 1.123 06-Nov-1999  scottr Update an outdated comment.
 1.122 05-Nov-1999  scottr Since nothing depends on interrupts during autoconfig proper
any longer, we can finally avoid enabling interrupts until the
end of cpu_configure(). This resolves a long-standing issue that
has caused us trouble several times in the past.
 1.121 31-Oct-1999  scottr Sync trace trap handling with other m68k ports, originated by
ITOH Yasufumi. Coincidentally closes PR 7738.
 1.120 17-Sep-1999  thorpej branches: 1.120.2; 1.120.4; 1.120.6;
Centralize the declaration and clearing of `cold'.
 1.119 05-Aug-1999  briggs Deal with the fact that ipls (specifically mac68k_clockipl) are now in an array.
 1.118 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.117 11-Jun-1999  scottr Eliminate more overhead in delay(); there's no point in doing the same
thing in both the calibrator function and the actual delay function. At
this point, _delay() does all of the work, so we can garbage collect
dummy_delay() and make _delay() an alternate entry point for delay().

This results in a small (but measurable) improvement on the IIci.
 1.116 09-Jun-1999  scottr Tweak previous: use shorter instructions to accomplish the same
#task (minimizes overhead).
 1.115 09-Jun-1999  scottr Write a new low-level assembly help for delay() and the calibrator. This
eliminates stalls during instruction prefetch and makes the delay
consistent regardless of kernel configuration.
 1.114 29-Apr-1999  christos Include opt_compat_sunos.h
 1.113 19-Apr-1999  kleink Add COMPAT_SVR4 for m68k.
 1.112 24-Mar-1999  mrg branches: 1.112.2;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.111 25-Feb-1999  is branches: 1.111.2;
mac68k part of pr 6152 fix, and missing bits for the others
 1.110 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.109 30-Sep-1998  thorpej Garbage collect trap #1 and trap #2 handlers; they're moved to
trap_subr.s
 1.108 30-Sep-1998  thorpej Pull in opt_compat_netbsd.h
 1.107 09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.106 16-Aug-1998  scottr Remove the 'fast' return from intrhand().
 1.105 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.104 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.103 09-Jul-1998  scottr Fix a problem with the reworked reboot code on the IIci: don't try to
reference variables after the MMU is disabled.
 1.102 04-Jul-1998  jonathan defopt DDB.
 1.101 30-Jun-1998  scottr Fix warnings from recent ddb_init() change: handle end and esym
consistently.
 1.100 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.99 24-May-1998  scottr Rewrite doboot() so that it turns off the MMU, rather than relying
on the ROM space being mapped where it would like to be.
 1.98 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.97 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.96 20-Apr-1998  scottr Lay groundwork for KGDB by pulling in the trap 15 handler from hp300.
 1.95 20-Apr-1998  scottr Minor adjustment for genassym.cf change.
 1.94 13-Feb-1998  scottr Make space for want_resched here, like most of the other m68k-based ports.
 1.93 05-Jan-1998  thorpej Fix a bogosity apparently inherited from when the Utah 4.3BSD code base
was converted to use Mach VM for Net2/4.4BSD. The user segment table
pointer was originally stored in the PCB. When Mach VM came along,
however, it was also stored in the pmap, and loaded into the PCB in
pmap_activate(). pmap_activate() would then note that the PCB's USTP
was now in sync with the pmap's USTP, and the low-level context switch
code would use the value from the PCB.

However, pmap_activate() would also load the hardware MMU context if
the pmap was the current pmap (or, in the case where pmaps can be shared,
such as in NetBSD, if the proc was the current proc). The low-level
context switch code would then reload the hardware _again_ using the
USTP from the PCB.

However, the optimization of not calling pmap_activate() if "stchanged"
was false ended up causing some processes to use stale USTP values from
the PCB when the low-level context switch code reloaded the hardware!
This was noticed by using a real vfork(2) (which worked for some time
before failing, surprisingly!)

Since I'm hard pressed to find any real optimization here (since the
hardware was always reloaded once, sometimes twice!), the code now always
calls pmap_activate(), which uses the correct USTP value (the one in the
pmap). The PCB's USTP is now ignored, and should eventually be g/c'd.

Another optimization can actually be performed, and I have added a comment
describing what it is, but have not yet implemented it.

Also note that most of the loadustp() functions where actually incomplete.
This has been corrected. These functions should probably be split up into
MMU-specific operations, and called indirectly, rather than doing constant
run-time decision making based on values that will never change during the
course of a boot's lifetime.
 1.92 01-Jan-1998  thorpej - Make pmap_activate() and pmap_deactivate() take a struct proc *.
- Define active_user_pmap() and use it in the appropriate places (from hp300
port).
 1.91 05-Nov-1997  briggs For level 4 (serial) interrupts: If the handler returns 0, take the
normal rei course. If the handler returns non-zero, just rte.
This should allow better MACE response-time and still keep serial
interrupt overhead to a minimum on older, slower machines.
 1.90 04-Nov-1997  briggs Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.89 10-Sep-1997  scottr branches: 1.89.2;
For consistency: VIA_initialize() -> via_init()
 1.88 10-Sep-1997  scottr Move VIA_initialize() from configure() to locore.s, shortly after
setting up and enabling the MMU. This has the effect of ensuring
that any stray interrupts that get posted before the IPL is lowered
will be handled gracefully, i.e. without an access fault or illegal
instruction exception.
 1.87 03-Sep-1997  scottr Initialize the bus error and address error vectors explicitly for all
CPUs, and set up the VBR just to be certain.
 1.86 30-Aug-1997  scottr Do run-time determination whether to save the TC value for AV
Macs; this way at least those models can configure intvid0.
From Dave Huang.
 1.85 16-Aug-1997  briggs Get the correct fault address on a bus error on a 68040.
 1.84 12-Jul-1997  thorpej branches: 1.84.2;
Remove a comment that has not been applicable for some time.
 1.83 04-Jul-1997  is addql does set condition codes, so we are not allowed to put it in between
the andl and the jeq.
Mea maxima culpa.
 1.82 04-Jul-1997  scottr Optimize the bus error handlers a bit; save a couple cycles by dropping
through a branch rather than taking it in the case of an MMU fault,
which also has the desirable side effect of possibly avoiding an
I-cache miss.
 1.81 29-Jun-1997  scottr Split up CPU-dependent bus error/address error handlers. Mostly from
the Amiga port, but with an extension to save the actual fault
address (in m68k_fault_addr) when we catch a bus error.
 1.80 29-Jun-1997  scottr Get several cleanup chores out of the way. The code is functionally
identical to the previous incarnation.

- Update using m68k asm.h macros
- Move initialization towards the front of the file
- Rename mac68k_buserr_addr to m68k_fault_addr
- Reorganize trap 15 handler, similar in structure to -- though not as
complete as -- the hp300 version
- Reorganize doboot() for easier integration of external cache, and
make room for the latter (#ifdef __notyet__)
- General garbage collection of unused code/data
 1.79 13-May-1997  gwr Eliminate references to vmspace.vm_pmap
 1.78 25-Apr-1997  thorpej Adjust for <m68k/m68k/trap_subr.s>
 1.77 13-Apr-1997  thorpej - Use common mac68k sigcode.
- Garbage-collect icode; hasn't been used in eons.
 1.76 09-Apr-1997  thorpej Use <m68k/m68k/proc_subr.s>
 1.75 16-Mar-1997  thorpej Use <m68k/m68k/support.s>
 1.74 02-Feb-1997  thorpej Garbage-collect extra copypage()
 1.73 09-Jan-1997  scottr Use only FC $1 in TT0 in get_pte(), and map the entire address space. We
can then access the page table entries directly using user data space with
the MOVES instruction. This should resolve the problem on the Duo 2x0
series with hard hangs in this function.

Warning: do not call any function that accesses user data space (FC $1)
from get_pte()!
 1.72 09-Jan-1997  scottr Sync with current 040-related development:

- Figure out what CPU we have, rather than assuming the Booter knows,
and set cputype variable accordingly.
- Carefully rearrange the order of various MMU/ATC operations so as to
eliminate possible side effects. Also, re-order the initial bootstrap
code to make clear what various sections of this code do.
- Adjust to combined initenv()/genenvvars() (the latter has assimilated
the former).
- Add a function code argument to ptest040().
- Use symbolic constants from assym.h where appropriate (and defined).
- Some style cleanup.
 1.71 06-Nov-1996  cgd Fix an inconsistency that came in with Lite: setrq() was renamed to
setrunqueue(), but remrq() was never renamed. Rename remrq() to
remrunqueue().
 1.70 17-Oct-1996  scottr Some changes from hp300 (thanks Jason!):
- Initialize proc0.p_addr just after setting up the kernel stack, to avoid
getting NULL pointers in trap(). Change suggested by Gordon Ross.
- Panic if main() returns.
 1.69 15-Oct-1996  scottr Implement ptest040(), a helper for get_physical().
 1.68 07-Oct-1996  scottr Disable 040 caches in doboot(), and some minor stylistic changes to make
the hand-coded assembly consistent throughout.
 1.67 16-Sep-1996  scottr Convert `fpu_type' to the more consistent `fputype', and use the new
#defines from m68k/include/cpu.h.
 1.66 12-Sep-1996  scottr Sync with m68k/cpu.h changes. Also, test fpu_type instead of mmutype
when handling fp exceptions.
 1.65 15-Jun-1996  briggs port-m68k/2547: wrong bus error detection from is@beverly.rhein.de.
 1.64 09-Jun-1996  briggs Implement suggestion from is -- handle _fpfault differently for 040 and better.
 1.63 17-May-1996  briggs branches: 1.63.4;
Set _kernel_text as recommended by Gordon--set before vector table.
 1.62 08-May-1996  scottr Note that rtclock_intr() could be tweaked, but why it isn't.
 1.61 08-May-1996  briggs Wrap rtclock_intr in splclock()/splx() to make sure that hardclock is running
at splclock. Passed along from Gordon via Scott.
 1.60 14-Mar-1996  scottr Optimize user-side TLB invalidation when !defined(M68020).
 1.59 12-Mar-1996  scottr Use 851-specific instructions only #if defined(M68020).
 1.58 27-Feb-1996  briggs For a bus error in nofault, if it's an 040, load the address from the
correct frame offset. This is required for the 5380 driver to work
properly.
 1.57 11-Feb-1996  briggs Back out last change. Bad karma to initialize the VIA that early.
 1.56 03-Feb-1996  briggs New delay() implementation from Scott Reynolds (scottr@edsi.org).
Also some minor rearranging of the VIA initialization (init earlier).
 1.55 02-Feb-1996  mycroft Fix #includes.
 1.54 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.53 12-Jan-1996  briggs Fixes from PR #1931 w/ minor mod in vm_machdep.c
 1.52 11-Dec-1995  thorpej Move bcopy/ovbcopy/memcpy into m68/m68k/copy.s, which is used by all
m68k ports already anyhow. No use in keeping 6 identical copies of this
function around.
 1.51 10-Oct-1995  briggs Nuke blkclr and use thereof.
 1.50 10-Oct-1995  briggs Get rid of libkern duplicates.
 1.49 18-Sep-1995  briggs Fix a spelling slight. Grab the faulting address if nofault in bus error.
 1.48 16-Sep-1995  briggs Simplify doboot().
 1.47 02-Sep-1995  briggs Very minor cleanup.
 1.46 16-Aug-1995  briggs Load the old MacOS ROMBase value back in before we jump to reset.
 1.45 12-Aug-1995  briggs Fix oversight in last.
 1.44 12-Aug-1995  briggs Get rid of cpu040 for good.
 1.43 09-Aug-1995  briggs Fix a few 040-isms, remove an old comment, and add a few things for the future.
 1.42 17-Jul-1995  briggs Stop recursive jmp0panics.
 1.41 08-Jul-1995  briggs Clean up a lot. Run machdep.c through indent.
Remove a bunch of old debugging code and some dead code.
Put in some new comments. Need more.
 1.40 30-Jun-1995  briggs Ooops.
 1.39 28-Jun-1995  briggs Some random cleanup and some cleanup of the dump routines, modelled on
i386. Untested. Remove old mac68k-specific stack trace code, etc. as
the cleanup.
 1.38 25-Jun-1995  briggs Do something a lot closer to the right thing for FPU_EMULATE/FPSP/040
and subsets thereof.
 1.37 21-Jun-1995  briggs Bring in 040 code from hp300 port.
Remove memory mapping code.
Update cpu_switch and a few other functions from hp300 port.
 1.36 17-May-1995  briggs Add a memcpy entry point as at least a temp fix for compiling with a
recent gcc2 snapshot.
 1.35 29-Mar-1995  briggs Nuke FPCOPROC and add fpu device driver and FPU_EMULATE from sun3.
Still need to figure out how to handle this w/ FPSP on 68040's but
since we're not really using the 68040 yet...
 1.34 22-Feb-1995  briggs Clean up via.c a bit. Still needs lots of work.
 1.33 08-Feb-1995  briggs Trim the interrupt counter space some and add _eintrnames and _eintrcnt
for vmstat.
 1.32 01-Feb-1995  briggs Align sigcode.
 1.31 21-Jan-1995  briggs Fix major brain damage from a while back. Old damage broke jump to zero
panic, leading to mass confusion.
 1.30 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.29 31-Oct-1994  briggs Fixup a couple of missed fixes when updating to hp300/amiga
interpretation of mmutype. Thanks to Lawrence Kesteloot for
catching the first of these.
 1.28 28-Oct-1994  briggs Make this work. Kludge from grantham.
 1.27 26-Oct-1994  cgd new RCS ID format.
 1.26 12-Sep-1994  briggs Snarf chopps changes for bus/addrerr handling.
 1.25 08-Aug-1994  lkestel Added Sysseg as argument to remap_MMU() so it can map the ROMs.
 1.24 01-Aug-1994  lkestel We used to disable the MMU before jumping to the ROM routine to
reset the machine. This doesn't work on some '030s because maybe
not PA == VA where PC is. Now if '030, don't disable MMU, just
use tt0 register to map ROM segment transparently. Also removed
superfluous @ from new get_pte code.
 1.23 31-Jul-1994  briggs Make this assemble... pte_tmp1 -> pte_tmp and remove ref to
serial_boot_echo.
 1.22 31-Jul-1994  lkestel Added get_pte() routine to get a pte from a logical address using ptest.
Cleaned up startup code in a big way. Now calling get_mapping() if
'030 and MMU is on, and post-processing our page tables with remap_MMU().
 1.21 10-Jul-1994  briggs Be somewhat better at machine dependence, clean up a hair, and get rid
of addupc.
 1.20 09-Jul-1994  briggs Comment out macserinit and macinit until we can replace them. They're
for debugging before we have an initialized console, primarily.
 1.19 07-Jul-1994  briggs branches: 1.19.2;
Whoops. Forgot to make rei globl in this copy.
 1.18 07-Jul-1994  briggs Use newer fpsp code. Nuke lots of glue in locore.s, change vectors
directly if FPSP and move back to HP numbering for mmutype which is
used as cputype for FPSP.
 1.17 04-Jul-1994  briggs Make sure TT's are disabled along with the MMU.
TBIA for paranoia's sake.
 1.16 03-Jul-1994  briggs ifdef out FPSP support to avoid having to use fpspnull.
Fix a bogon.
 1.15 02-Jul-1994  briggs Turn off MMU early on '040 machines. Put gray_bars around this in case
it hangs on some machine. (Q700 is mapped PA==LA in MacOS--at least in
this version of the MacOS).
 1.14 26-Jun-1994  briggs Huge, gigantic changes... Including:
68040 support--some by me, much from Amiga...
some cleanup
The hp300 rei
A number of frame-related fixes. Finally all found, I think, thanks to
the sharp eyes/mind of Brad Grantham, Lawrence Kesteloot, and Steve Allen.

The upshot is that we're finally booting again on the machines that
used to work.
 1.13 06-May-1994  briggs Get things to compile with latest changes.
 1.12 21-Apr-1994  briggs Add '040 stuff from Amiga.
Modified TBIA and friends which were all basically flushing everything
to satisfy year-old paranoia.
 1.11 20-Mar-1994  briggs Small mods. Needs lots of cleanup.
Added one change to make sure we get symbols in DDB.
 1.10 22-Feb-1994  briggs Numerous changes by lkestel and grantham to match those in machdep.c.
 1.9 06-Feb-1994  briggs Fixup calls to profclock and softclock.
 1.8 03-Feb-1994  briggs Call hardclock w/ clockframe * instead of clockframe.
 1.7 30-Jan-1994  briggs DTRT w.r.t. root and boot disk devices. This could still use some work,
but it's a lot better than depending on root being on sd0 (and swapping
if it isn't).
 1.6 22-Jan-1994  briggs Ditch ENTRY/ALTENTRY defines and include "m68k/asm.h" instead.
 1.5 22-Jan-1994  briggs ifdef out copyinstr/copyoutstr/... functions that are now defined in copy.s.
 1.4 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.3 02-Dec-1993  briggs Use /**/ instead of ## for concatenation. Other way doesn't work right.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.19.2.4 12-Sep-1994  cgd from trunk, per briggs
 1.19.2.3 11-Aug-1994  mycroft update from trunk
 1.19.2.2 24-Jul-1994  cgd update, as requested by briggs
 1.19.2.1 07-Jul-1994  cgd file locore.s was added on branch netbsd-1-0 on 1994-07-24 01:23:32 +0000
 1.63.4.1 15-Jun-1996  briggs From HEAD:
Implement suggestion from is -- handle _fpfault differently for 040 and better.
 1.84.2.4 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.84.2.3 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.84.2.2 01-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.84.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.89.2.2 23-Nov-1998  cgd Pull up a patch consisting of revs 1.99 and 1.106, backported to 1.3-branch.
Rewrite doboot() so that it turns off the MMU, rather than relying
on the ROM space being mapped where it would like to be. (scottr)
 1.89.2.1 06-Nov-1997  mellon Pull rev 1.90 and 1.91 up from trunk (scottr)
 1.111.2.6 09-Nov-1999  scottr Sync with main branch.
 1.111.2.5 01-Nov-1999  scottr Sync with main branch.
 1.111.2.4 15-Jun-1999  scottr Sync with main branch.
 1.111.2.3 09-Jun-1999  scottr Sync with main branch.
 1.111.2.2 09-Jun-1999  scottr Sync with main branch.
 1.111.2.1 16-May-1999  scottr Sync with main branch.
 1.112.2.3 09-Aug-1999  cgd fix botch in pullup:
>pullup 1.114->1.117 (scottr): re-implement delay()
Requested by briggs.
 1.112.2.2 01-Jul-1999  perry pullup 1.114->1.117 (scottr): re-implement delay()
 1.112.2.1 30-Apr-1999  perry branches: 1.112.2.1.2; 1.112.2.1.4;
pullup 1.113->1.114 (christos): conflicts manually edited
 1.112.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.112.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.112.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.120.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.120.4.1 15-Nov-1999  fvdl Sync with -current
 1.120.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.120.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.120.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.128.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.129.2.1 25-Jan-2001  jhawk Pull up revision 1.133 (requested by briggs):
Improve performance of the pseudo-DMA mode of the esp driver, and handle
residual FIFO data on write.
 1.133.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.134.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.134.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.134.2.3 11-Feb-2002  jdolecek Sync w/ -current.
 1.134.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.134.2.1 03-Aug-2001  lukem update to -current
 1.135.6.6 05-Oct-2002  gmcgarry LWPify. From hp300.
 1.135.6.5 17-Apr-2002  nathanw Catch up to -current.
 1.135.6.4 28-Feb-2002  nathanw Catch up to -current.
 1.135.6.3 08-Jan-2002  nathanw Catch up to -current.
 1.135.6.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.135.6.1 22-Jul-2001  scw file locore.s was added on branch nathanw_sa on 2001-11-18 18:12:02 +0000
 1.142.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.142.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.142.2.1 03-Aug-2004  skrll Sync with HEAD
 1.144.28.1 09-Jan-2007  tron Pull up following revision(s) (requested by chs in ticket #1626):
sys/arch/mac68k/mac68k/locore.s: revision 1.146
in doboot, use "longscratch" as a scratch memory location instead of
something in the (read-only) text section. fixes PR 35068.
 1.144.26.1 09-Jan-2007  tron Pull up following revision(s) (requested by chs in ticket #1626):
sys/arch/mac68k/mac68k/locore.s: revision 1.146
in doboot, use "longscratch" as a scratch memory location instead of
something in the (read-only) text section. fixes PR 35068.
 1.144.16.2 03-Sep-2007  yamt sync with head.
 1.144.16.1 26-Feb-2007  yamt sync with head.
 1.144.14.1 09-Jan-2007  tron Pull up following revision(s) (requested by chs in ticket #1626):
sys/arch/mac68k/mac68k/locore.s: revision 1.146
in doboot, use "longscratch" as a scratch memory location instead of
something in the (read-only) text section. fixes PR 35068.
 1.145.24.2 18-Jun-2007  liamjfoy Pull up following revision(s) (requested by mhitch in ticket #728):
sys/arch/mvme68k/mvme68k/locore.s: revision 1.98
sys/arch/mac68k/mac68k/trap.c: revision 1.128
sys/arch/next68k/next68k/locore.s: revision 1.48
sys/arch/mac68k/mac68k/locore.s: revision 1.152
sys/arch/sun3/sun3/locore.s: revision 1.88
sys/arch/sun2/sun2/locore.s: revision 1.19
sys/arch/sun2/sun2/trap.c: revision 1.32
sys/arch/m68k/m68k/db_trace.c: revision 1.51
sys/arch/mvme68k/mvme68k/trap.c: revision 1.90
sys/arch/news68k/news68k/trap.c: revision 1.53
sys/arch/luna68k/luna68k/locore.s: revision 1.27
sys/arch/atari/atari/locore.s: revision 1.99
sys/arch/sun3/sun3/trap.c: revision 1.130
sys/arch/x68k/x68k/trap.c: revision 1.89
sys/arch/next68k/next68k/trap.c: revision 1.67
sys/arch/x68k/x68k/locore.s: revision 1.79
sys/arch/news68k/news68k/locore.s: revision 1.43
sys/arch/luna68k/luna68k/trap.c: revision 1.46
sys/arch/hp300/hp300/locore.s: revision 1.140
sys/arch/cesfic/cesfic/locore.s: revision 1.15
sys/arch/cesfic/cesfic/trap.c: revision 1.35
sys/arch/m68k/m68k/trap_subr.s: revision 1.12
sys/arch/amiga/amiga/locore.s: revision 1.143
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.145.24.1 09-Jan-2007  tron branches: 1.145.24.1.2;
Pull up following revision(s) (requested by chs in ticket #345):
sys/arch/mac68k/mac68k/locore.s: revision 1.146
in doboot, use "longscratch" as a scratch memory location instead of
something in the (read-only) text section. fixes PR 35068.
 1.145.24.1.2.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.145.20.1 12-Jan-2007  ad Sync with head.
 1.146.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.148.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.148.10.1 22-May-2007  matt Update to HEAD.
 1.148.4.1 11-Jul-2007  mjf Sync with head.
 1.148.2.2 15-Jul-2007  ad Sync with head.
 1.148.2.1 27-May-2007  ad Sync with head.
 1.152.10.1 06-Nov-2007  matt sync with HEAD
 1.153.24.1 27-Jun-2008  simonb Sync with head.
 1.153.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.153.20.3 11-Aug-2010  yamt sync with head.
 1.153.20.2 11-Mar-2010  yamt sync with head
 1.153.20.1 04-May-2009  yamt sync with head.
 1.153.16.2 17-Jan-2009  mjf Sync with HEAD.
 1.153.16.1 29-Jun-2008  mjf Sync with HEAD.
 1.154.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.159.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.159.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.160.2.2 05-Mar-2011  rmind sync with head
 1.160.2.1 03-Jul-2010  rmind sync with head
 1.162.4.1 17-Feb-2011  bouyer Sync with HEAD
 1.162.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.163.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.163.4.1 17-Apr-2012  yamt sync with head
 1.165.2.1 18-Feb-2012  mrg merge to -current.
 1.166.10.2 18-May-2014  rmind sync with head
 1.166.10.1 28-Aug-2013  rmind sync with head
 1.166.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.170.30.1 10-Jun-2019  christos Sync with HEAD
 1.170.28.1 26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.171.4.1 27-Apr-2021  martin Pull up following revision(s) (requested by rin in ticket #1255):

sys/arch/mac68k/mac68k/locore.s: revision 1.174

Fix DJMEMCMAX option for Quadra/Centris 650/800.
- Use jeq instead of jra for conditional branch.
- Use cmpl instead of cmp (= cmpw) for int variables.

Now, my Quadra 800 recognizes full 520MB memory!
 1.173.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.175.4.1 27-Jun-2024  martin Pull up following revision(s) (requested by rin in ticket #724
to fix build fallout on the branch):

sys/arch/m68k/m68k/compat_16_sigreturn14.s: revision 1.6
sys/arch/mvme68k/mvme68k/locore.s: revision 1.129
sys/arch/news68k/news68k/locore.s: revision 1.84
sys/arch/hp300/hp300/locore.s: revision 1.183
sys/arch/m68k/m68k/compat_13_sigreturn13.s: revision 1.8
sys/arch/m68k/m68k/sigreturn.s: file removal
sys/arch/m68k/include/pte_motorola.h: revision 1.10
sys/arch/atari/atari/locore.s: revision 1.125
sys/arch/amiga/amiga/locore.s: revision 1.169
sys/arch/sun2/sun2/locore.s: revision 1.37
sys/arch/next68k/next68k/locore.s: revision 1.84
sys/arch/x68k/x68k/locore.s: revision 1.130
sys/arch/sun3/sun3x/locore.s: revision 1.77
sys/arch/cesfic/cesfic/locore.s: revision 1.45
sys/arch/m68k/conf/files.m68k: revision 1.53
sys/arch/sun3/sun3/locore.s: revision 1.109
sys/arch/luna68k/luna68k/locore.s: revision 1.81
sys/arch/mac68k/mac68k/locore.s: revision 1.182

Define PTE used in the pmap module int terms of the bit definitions
in mmu_{51,40}.h.

Make compat_13_sigreturn13.s and compat_16_sigreturn14.s build as their
own stand-alone files and G/C the now-empty sigreturn.s.
 1.7 21-Jun-1995  briggs Put page mapping code into a C module.
Remove old 040 version of page mapping--new way handles 040, too.
Derived from hp300 pmap_boostrap.c.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 10-Jul-1994  briggs Be somewhat better at machine dependence, clean up a hair, and get rid
of addupc.
 1.4 04-Jul-1994  briggs branches: 1.4.2;
A few things that I think are probably bogus, but I'm getting a lot
farther, now...
 1.3 02-Jul-1994  briggs Getting a lot closer. Took out a lot of debugging output.
 1.2 29-Jun-1994  briggs Still not working, but getting closer. Lots of debugging stuff left in
here.
 1.1 26-Jun-1994  briggs Checkpoint. Preliminary code for bootstrapping on the 68040 macs.
 1.4.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.4 16-Sep-1997  scottr Clean up comments.
 1.3 14-May-1996  briggs branches: 1.3.12;
Some updates from Bob Nestor <rnestor@metronet.com> to get the Performa 550
working again. I broke it when I moved the ROM mapping so it was no
longer mapped on a friendly address boundary. Some cleanup.
 1.2 16-Aug-1995  briggs Fix comments. .space 0x1000 was accidentally left commented so it
still is--just explicitly, now.
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.3.12.1 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.371 24-Sep-2025  rin mac68k: get_mapping: Appease GCC14 -Warray-bounds, otherwise NFC
 1.370 14-Sep-2024  nat Add support for poweroff on PowerBook 1xx.

This excludes the PowerBook 150 and 190, which are more similar to the 500
series.
 1.369 07-Jun-2024  nat branches: 1.369.2;
Relax the video size sanity check.

If stride and height are defined, compute the required size.

Fixes external video on my Powerbook 160.

A similar approach is done for macfb - should the mv_len == 0 an appropriate
value is calculated.
 1.368 02-Jun-2024  andvar fix various typos in word `interrupt', mainly in comments.
 1.367 10-Feb-2024  andvar s/indicies/indices/ in comments.
 1.366 03-Jan-2024  thorpej get_physical(): Use bit defs from <m68k/mmu_40.h>
 1.365 23-Sep-2023  andvar pass just l param to exec_aout_prep_oldzmagic instead of l->l_proc.

In a huge "merge ktrace-lwp." commit struct proc was changed by struct lwp.
seemingly all 68k ports just replaced p with l, however mac68k changed to
refer to l->l_proc. I assume it was accidental leftover during refactoring.

fixes COMPAT_NOMID enabled build for mac68k.
 1.364 26-Dec-2022  nat Sanity check and set the framebuffer length if necessary.

Addresses PR 57126.
 1.363 09-Oct-2021  tsutsui Call cnpollc(9) before cngetc(9) as the cons(9) man page says.

Currently most ports do nothing in cnpollc(9), but this is required to
handle wskbd(9) .set_leds op in cngetc(9) properly, at least on luna68k.
 1.362 28-Apr-2021  rin Change sccA address for Quadra 800 from base + 0xc000 to 0xc020.

The H/W partially decodes its address, and sccA is available at
offsets 0xc000, 0xc020, .... The functionality is same, but Mac
toolbox ROM routines use 0xc020, and QEMU for Quadra 800 only
supports this address.

Thanks Mark Cave-Ayland for discussion, who is working on NetBSD
support to QEMU for Quadra 800!
 1.361 28-Apr-2021  rin Make mac68k_set_io_offsets() a little bit cleaner:

- Via1Base is always ``base'' for all supported models.
- Set sccA and SCSIBase for each model of MACH_CLASSQ class.
- Some style fixes.

No functional changes intended.
 1.360 26-Feb-2021  rin branches: 1.360.4;
Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
 1.359 26-Feb-2021  rin Sort opt_*.h. No binary changes.
 1.358 11-Jun-2020  ad branches: 1.358.2;
uvm_availmem(): give it a boolean argument to specify whether a recent
cached value will do, or if the very latest total must be fetched. It can
be called thousands of times a second and fetching the totals impacts not
only the calling LWP but other CPUs doing unrelated activity in the VM
system.
 1.357 31-Dec-2019  ad Rename uvm_free() -> uvm_availmem().
 1.356 21-Dec-2019  ad uvmexp.free -> uvm_free()
 1.355 18-Aug-2019  rin 0x%p ---> %p
 1.354 18-Aug-2019  rin We've switched to 8KB page.

XXX
pullup to netbsd-9
 1.353 26-Jul-2019  rin branches: 1.353.2;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.352 07-Nov-2017  christos branches: 1.352.4;
Don't define ELFSIZE
 1.351 15-Aug-2017  maya Remove dead code. it isn't possible to do non-__ELF__ build
 1.350 03-Apr-2017  christos branches: 1.350.4;
PR/52134: David Binderman: Fix loop bounds checking.
 1.349 30-Aug-2015  uebayasi branches: 1.349.2; 1.349.4;
Use makeoptions_COPY_SYMTAB via opt_copy_symtab.h in sources. Remove a hack
to set -DCOPY_SYMTAB from sys/conf/Makefile.kern.inc. Remove unnecessary
dependencies too.
 1.348 17-Aug-2014  joerg branches: 1.348.2;
Reorganize symbol table embedding. The existing option SYMTAB_SPACE is
replaced by the make option COPY_SYMTAB set to any value. The copy of
the symbol table is no longer put into a buffer in kern_ksyms.o, but a
small helper object. This object is build first with a dummy size, then
the kernel is linked to compute the real dimension of the symbol table
buffer. After that, the helper object is rebuild and the kernel linked
again.
 1.347 24-Mar-2014  christos use cpu_{g,s}etmodel
 1.346 16-Jul-2013  jklos Added DJMEMCMAX option for recognizing 128 meg SIMMs in Centris and Quadra
610, 650 and 800 systems. From Rob Braun,
http://synack.net/~bbraun/netbsdmac2.html
 1.345 04-Aug-2012  martin branches: 1.345.2; 1.345.4;
No need to statically initialize physmem here, it is set to the correct
value in pmap_bootstrap(), which is early enough.
Tested on my Centris 660AV.
 1.344 27-Jul-2012  matt Remove safepri and use IPL_SAFEPRI instead. This may be defined in a MD
header file (if not, a value of 0 is assmued).
 1.343 27-Jan-2012  para converting extent(9) from malloc(9) to kmem(9)
preceding kmem-vmem-pool-uvm patch

releng@ acknowledged
 1.342 12-Dec-2011  mrg implement bdev_size(9) wrapper around d_psize() routine, so we can take
the device lock in relevant places. avoid doing so while actually dumping.

tested i386 crash dumps still work, and that all touched files compile.

fixes PR#45705.
 1.341 12-Jun-2011  rmind branches: 1.341.2; 1.341.6;
Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.340 16-May-2011  tsutsui branches: 1.340.2;
- merge and move pasted m68k MD setreg() functions into m68k/m68k_machdep.c
- move m68881_save() and m68881_restore() declarations into <m68k/m68k.h>

Briefly tested and no obvious breakage on atari, sun3, and x68k.
 1.339 04-Mar-2011  joerg Refactor ps_strings access. Based on PK_32, write either the normal
version or the 32bit compat layout in execve1. Introduce a new function
copyin_psstrings for reading it back from userland and converting it to
the native layout. Refactor procfs to share most of the code with the
kern.proc_args sysctl handler.

This material is based upon work partially supported by
The NetBSD Foundation under a contract with Joerg Sonnenberger.
 1.338 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.337 17-Jan-2011  tsutsui branches: 1.337.2;
Explicitly include <machine/pcb.h> for struct pcb.
 1.336 16-Oct-2010  tsutsui branches: 1.336.2;
Prepare empty module_init_md() for options MODULAR for all other m68k ports.
 1.335 08-Feb-2010  joerg branches: 1.335.2;
Remove separate mb_map. The nmbclusters is computed at boot time based
on the amount of physical memory and limited by NMBCLUSTERS if present.
Architectures without direct mapping also limit it based on the kmem_map
size, which is used as backing store. On i386 and ARM, the maximum KVA
used for mbuf clusters is limited to 64MB by default.

The old default limits and limits based on GATEWAY have been removed.
key_registered_sb_max is hard-wired to a value derived from 2048
clusters.
 1.334 10-Dec-2009  matt branches: 1.334.2;
Change u_long to vaddr_t/vsize_t in exec code where appropriate (mostly
involves setregs and vmcmds). Should result in no code differences.
 1.333 23-Nov-2009  rmind Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.332 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.331 15-Aug-2009  matt Include <sys/exec_aout.h> explicitly instead of relying on <sys/exec.h> to
do it for us.
 1.330 18-Mar-2009  cegger bcopy -> memcpy
 1.329 18-Mar-2009  cegger bzero -> memset
 1.328 13-Feb-2009  apb Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
 1.327 21-Jan-2009  he branches: 1.327.2;
Re-adapt to the changed return types for major() and minor().
 1.326 11-Jan-2009  martin Use PRIu64 format to printf major() and minor() values.
 1.325 30-Nov-2008  martin As discussed on tech-kern: mutex_init is too heavyweight for early bootstrap
phases, so move the initialization of the ksyms mutex back into main via
a function called ksyms_init. Rename the existing (but quite different)
ksyms_init* variations into ksyms_addsyms_elf() and ksyms_addsyms_explicit()
and adapt machdep code accordingly.
 1.324 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.323 11-Nov-2008  dyoung It is not appropriate to call pmf_system_shutdown(9) from
doshutdownhooks(9): shutdown hooks registered by shutdownhook_establish(9)
expect to be called with interrupts disabled, but shutdown hooks
registered with pmf_device_register1(9) expect to be called with
interrupts enabled. So I have made two changes:

1 Do not call pmf_system_shutdown() from doshutdownhooks(). Instead,
change every call to doshutdownhooks() to a call to doshutdownhooks()
followed by a call to pmf_system_shutdown(). No functional change
is intended by this change.

2 Make i386 re-enable interrupts briefly while it calls
pmf_system_shutdown(). I leave it to others either to fix the
other ports, or to factor out some MI shutdown code, as joerg@
suggests, and fix that. Note that a functional change *is* intended
by this change.

I hope that this patch will stop us from flip-flopping between
calling doshutdownhooks() and pmf_system_shutdown() sometimes with
and sometimes without interrupts enabled.
 1.322 14-Sep-2008  tsutsui branches: 1.322.2;
Remove ancient workaround hacks for gcc 2.7.2.
 1.321 02-Jul-2008  ad branches: 1.321.2;
Replce exec_map with a pool. Proposed on tech-kern@, reviewed by chs@.
 1.320 17-Oct-2007  garbled branches: 1.320.16; 1.320.20; 1.320.22; 1.320.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.319 29-Aug-2007  jmmv Pack all global video-related variables into a structure for clarity.

A comment said that they weren't in a struct for speed reasons but...
this should not affect performance because these variables are mostly
used to set other variables (hence they are read few times).
 1.318 29-Aug-2007  jmmv Move the definition of multiple video-related variables into a new
header file (machine/video.h) so that we can kill all the "manual"
externs spread around the code (which were inconsistent among them).
 1.317 29-Aug-2007  jmmv Split the global videosize variable into videowidth and videoheight:
makes the code clearer and avoids multiple parts of it having to know
how videosize was encoded.
 1.316 02-Jun-2007  tsutsui branches: 1.316.4; 1.316.8; 1.316.10;
Rather than attaching fpu as a usual device during cpu_configure(9),
initialize it explicitly in identifycpu() (before cpu_configure(9))
because after yamt-idlelwp merge savectx() is called before
cpu_configure(9) and it requires fputype initialized properly,
otherwise a kernel fails in savectx() if a machine doesn't have an FPU.
 1.315 21-May-2007  tsutsui curlwp can't be NULL so no need to check it.
 1.314 05-Mar-2007  tsutsui branches: 1.314.2; 1.314.4; 1.314.10;
Allocate msgbufaddr in pmap_bootstrap.c where it's initilized,
and move its declaration into <m68k/pmap_motorola.h>.
 1.313 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.312 28-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.311 09-Feb-2007  ad branches: 1.311.2;
Merge newlock2 to head.
 1.310 20-Nov-2006  hauke Add Timecounter support for mac68k, using the otherwise idle second
timer of VIA1. Passes regression/sys/kern/time regression test.

While we are here, GC leftover prototypes from MI todr integration,
and clean up clockreg.h in the light of "Guide to the Macintosh
Hardware" information.

(Reviewed and okayed by Martin Husemann)
 1.309 21-Oct-2006  mrg in cpu_dumpconf(), don't panic() if we can't bdevsw_lookup() the
dumpdev. this occurs when we try to set the dumpdev to a device
with no driver loaded. this fixes PR#34872.

in sys_swapctl, if bdevsw_lookup() fails, set dumpdev = NODEV
before calling cpu_dumpconf(). (this also fixes PR#34872.)

XXX: cpu_dumpconf() should probably be changed to take a dumpdev
XXX: and return an error in such cases, but that is a much more
XXX: intrusive change.

XXX2: this is only run-tested on sparc64 and compile tested on a
XXX2: couple of platforms.
 1.308 24-Dec-2005  perry branches: 1.308.20; 1.308.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.307 11-Dec-2005  christos merge ktrace-lwp.
 1.306 30-Oct-2005  chs fix crash dumps on m68k platforms, cpu_kcore_hdr_t is larger than
512 bytes now so we need a bigger buffer. PR 26958.
 1.305 16-Jun-2005  jmc branches: 1.305.2; 1.305.4;
Shadowing and const fixes.
 1.304 25-Apr-2005  lukem Move the MI printing of `copyright' to the MD cpu_startup() code
where the printing of `version' is already performed.
This has the benefit of allowing the copyright to be available
via dmesg(8) on platforms which need the `msgbuf' to be setup
in cpu_startup() before printed output is remembered.
 1.303 05-Mar-2005  chs branches: 1.303.2;
remove some more __P that I missed before.
 1.302 11-Feb-2005  yamt remove uvm_map_protect from cpu_startup of several ports.
- they shouldn't be needed with the current fault handler.
- they causes assertion failure with the recent vm_map implementation.

discussed on tech-kern@. reviewed by Chuck Silvers.
PR/29179 from Julio M. Merino Vidal.
 1.301 15-Jan-2005  chs branches: 1.301.2; 1.301.4;
de-__P, remove register, ansify, b* -> mem*.
 1.300 14-Dec-2004  christos Move the definition of sccA from zc.c to machdep.c and always initialize it.
This way we save a mess of #ifdefs. XXX: This code is disgusting. Drivers
should not communicate with the rest of the kernel by means of global variables.
 1.299 02-Aug-2004  scottr We can't generate an FPU idle frame until we know which one
##we have, so defer this until we've probed the FPU type.
##Fixes PRs 25081 and 26250.
 1.298 02-Aug-2004  scottr Bus and address error handlers are set up long before we get
to initcpu(); no need to do it again.
 1.297 24-Mar-2004  atatat branches: 1.297.2;
Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
 1.296 13-Feb-2004  wiz Uppercase CPU, plural is CPUs.
 1.295 30-Dec-2003  pk Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes). It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms. Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
 1.294 04-Dec-2003  atatat Dynamic sysctl.

Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al. Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded. Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment. I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
 1.293 27-Sep-2003  cl Cast through (void *) to appease gcc3.
 1.292 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.291 15-Jul-2003  lukem __KERNEL_RCSID()
 1.290 29-Jun-2003  fvdl branches: 1.290.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.289 28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.288 10-May-2003  thorpej Back out the following chagne:
http://mail-index.netbsd.org/source-changes/2003/05/08/0068.html

There were some side-effects that I didn't anticipate, and fixing them
is proving to be more difficult than I thought, do just eject for now.
Maybe one day we can look at this again.

Fixes PR kern/21517.
 1.287 08-May-2003  thorpej Simplify the way the bounds of the managed kernel virtual address
space is advertised to UVM by making virtual_avail and virtual_end
first-class exported variables by UVM. Machine-dependent code is
responsible for initializing them before main() is called. Anything
that steals KVA must adjust these variables accordingly.

This reduces the number of instances of this info from 3 to 1, and
simplifies the pmap(9) interface by removing the pmap_virtual_space()
function call, and removing two arguments from pmap_steal_memory().

This also eliminates some kludges such as having to burn kernel_map
entries on space used by the kernel and stolen KVA.

This also eliminates use of VM_{MIN,MAX}_KERNEL_ADDRESS from MI code,
this giving MD code greater flexibility over the bounds of the managed
kernel virtual address space if a given port's specific platforms can
vary in this regard (this is especially true of the evb* ports).
 1.286 26-Apr-2003  ragge Call ksyms_init() instead of ddb_init() in case of
NKSYMS || defined(DDB) || defined(LKM)
 1.285 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.284 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.283 06-Jan-2003  wiz interrupt with two rs.
 1.282 04-Nov-2002  itohy Dump DDB_* and SYMTAB_SPACE options to opt_ddbparam.h rather than opt_ddb.h.
These options are used in limited files but #include "opt_ddb.h" are
everywhere, and changing them caused almost full recompilation.
 1.281 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.280 19-Sep-2002  ragge Do not include <sys/clist.h>, it's not used in NetBSD at all.
 1.279 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.278 25-Aug-2002  thorpej Make nbuf, nswbuf, and bufpages unsigned. Make all operations on these
variables unsigned, and update places where their values are printed.
 1.277 30-May-2002  thorpej Don't use multi-line string literals.
 1.276 28-May-2002  scottr Mark kernel text read-only, except for the low memory variables used by
the Macintosh ToolBox. Originally committed in rev 1.273.
 1.275 28-May-2002  scottr Add entries for remaining PowerBook Duo models originally
committed in rev 1.273.
 1.274 28-May-2002  scottr Back out unintended changes from previous commit.
 1.273 21-May-2002  scottr Don Bruder's extensive debug output provided in PR 16907 showed that
intvid didn't find the frame buffer on his PB 170 in NetBSD 1.5. This is
because the PowerBook 140/145+145B/170 entries in intvid_info[] were
entered into the table directly from the corresponding hardware tech
notes. Unfortunately, the actual frame buffer is mapped at an offset
of 32 KB from the base of the region (at least when in 32-bit mode).

Since all 4 of these systems have identical video configurations, I'm
updating the rest to match.
 1.272 27-Apr-2002  shiba branches: 1.272.2;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.271 31-Mar-2002  shiba Add PowerBook 190CS entries.
 1.270 22-Mar-2002  shiba fixed attach fail intvid in PowerBook Duo 210,230.
these machine works with multi user mode.

References:http://developer.apple.com/techpubs/hardware/Developer_Notes/
Macintosh_CPUs-68K_Portable/PowerBook_Duo_System.pdf
http://developer.apple.com/techpubs/hardware/Developer_Notes/
Macintosh_CPUs-68K_Portable/PowerBook_150.pdf

Submitted: Daishi Kato <daishi@axlight.com>
Tested: Kazuyuki Inanaga <happyday@pp.iij4u.or.jp>
 1.269 20-Mar-2002  christos kill remaining PS_STRINGS instances.
 1.268 06-Mar-2002  tsutsui Change type of dumpmag to u_int32_t since it is actually
a 32bit unsigned magic number.
As per discussion on tech-kern, and fixes port-sparc64/11949.
 1.267 20-Nov-2001  chs support both ELF and a.out symbols for DDB.
 1.266 20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.265 10-Sep-2001  chris branches: 1.265.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.264 02-Jun-2001  chs branches: 1.264.2; 1.264.4;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.263 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.262 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.261 18-Apr-2001  thorpej toupper() exists in libkern now.
 1.260 15-Mar-2001  chs 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.259 05-Dec-2000  scottr branches: 1.259.2;
Don't reference a zs-specific variable unless NZSC is not zero.
Fixes PR 11566.
 1.258 13-Sep-2000  thorpej Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
 1.257 02-Jul-2000  scottr Add video hardware info for the Performa 550 and Macintosh TV.
 1.256 02-Jul-2000  cgd Kwality control:
* put #includes of opt headers and headers to get protos used by
net/netisr_dispatch.h in net/netisr.h (if !defined(_LOCORE)) (rather than
in netisr_dispatch.h itself, and potentially nowhere, respectively).
* require netisr.h to be included before netisr_dispatch.h.
* minor additional cleanup of both netisr.h and netisr_dispatch.h.
* clean up uses to remove now-unnecessary header file inclusions, and
local prototypes of the fns.
* convert netisr dispatch implementations which didn't use
netisr_dispatch.h (pc532) to use it.
 1.255 01-Jul-2000  mrg fix wrong comment.
 1.254 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.253 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.252 05-Jun-2000  jhawk branches: 1.252.2;
Do not clear msgbufenabled in dumpsys(). Dump messages will now go to
the message buffer. This can be invaluable in debugging if the dump
fails (assuming a persistant message buffer)
 1.251 26-May-2000  thorpej branches: 1.251.2;
First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.250 20-Mar-2000  scottr Revert to the old practice of always setting up MRG, even if we don't
need it for ADB. Besides the misleading message at autoconf time,
MRG is sometimes useful for things other than ADB.
 1.249 09-Mar-2000  scottr The last change has proven unreliable. Attack the problem differently;
assume that the address we have is the correct PA if we can't
figure it out by groveling. This time it really (yes, really)
works on the PowerBook 14x/16x/170.
 1.248 04-Mar-2000  scottr Two changes to facilitate (better) PowerBook 1xx support:

- Use a mask to account for address space "wrapping"
- Check supervisor data space if we can't find a PTE in user data space
 1.247 21-Feb-2000  scottr Use constants defined in viareg.h to set value of VIA2.
 1.246 21-Feb-2000  scottr Correct some temporary confusion between the IOPs and the OSS: move
IOP init back to mac68k_init(). We'll deal with the OSS later.
 1.245 21-Feb-2000  scottr Explicitly include headers needed by iopreg.h
 1.244 21-Feb-2000  scottr Initialize VIA/IOP/PSC from intr_init(). While here, re-order headers
to match KNF.
 1.243 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.242 19-Jan-2000  thorpej Move callout initialization to a single location; no need to duplicate
that code all over the place.
 1.241 19-Jan-2000  msaitoh check whether tv_usec >= 1000000
 1.240 04-Dec-1999  ragge CL* discarding.
 1.239 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.238 17-Sep-1999  thorpej branches: 1.238.2; 1.238.4; 1.238.8;
Centralize the declaration and clearing of `cold'.
 1.237 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.236 26-Jun-1999  briggs Quadra 900/950 SCC-compatibility serial support is at an offset of 0x20
bytes from the base SCC address. With this change, serial console works
on my Q950 if the MacOS control panel is used.
 1.235 26-May-1999  thorpej Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.
 1.234 24-May-1999  thorpej Make this compile again.
 1.233 20-May-1999  lukem * convert to using MI allocsys(). most ports were using an MD allocsys(),
although a couple still used the old pre-4.4-lite (?) mechanism.
* use format_bytes() to format the various printf()s that print out memory sizes
 1.232 03-May-1999  scottr Move initialization of the iomem extent struct from mac68k_set_io_offset()
to mac68k_init(), so that we're through frobbing the MMU in special ways
by the time we get there. While it doesn't actually cause a problem with
the current structure of our initialization code, it probably would have
in the future.
 1.231 26-Apr-1999  thorpej Garbage-collect the VM_MBUF_SIZE constant. Instead, use the size
(nmbclusters * mclbytes), so that the right amount of KVA space is
allocated if those variables are patched.
 1.230 25-Apr-1999  simonb g/c REAL_CLISTS.
 1.229 11-Apr-1999  chs add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.
 1.228 07-Apr-1999  scottr vm_size_t -> vsize_t
 1.227 01-Apr-1999  thorpej branches: 1.227.2;
Don't call configure() from cpu_startup().
 1.226 27-Mar-1999  briggs Make this compile again--pass access_type just the same as prot.
 1.225 26-Mar-1999  mycroft Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.224 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.223 28-Feb-1999  scottr branches: 1.223.2;
Move all IPL setup to intr.c, and do some sanity checking.
 1.222 27-Feb-1999  scottr defopt BUFCACHE and BUFPAGES.
 1.221 27-Feb-1999  scottr Fix tyop in last.
 1.220 27-Feb-1999  scottr Support the BUFCACHE option.
 1.219 20-Feb-1999  scottr Handle RB_POWEROFF appropriately.
 1.218 20-Feb-1999  scottr Rename via_shutdown() to via_powerdown() for clarity and consistency.
 1.217 09-Jan-1999  thorpej Garbage-collect `mbutl'.
 1.216 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.215 26-Oct-1998  scottr Whoops! When looking at the return value from ptest040(), be sure
to handle the case of a TTx register hit.
 1.214 19-Oct-1998  tron Defopt SYSVMSG, SYSVSEM and SYSVSHM.
 1.213 27-Aug-1998  scottr Add on-board video information for the LC III, and a guess
at the LC II based on similar machines mentioned in the dev note.
 1.212 25-Aug-1998  scottr Implement splaudio().
 1.211 22-Aug-1998  scottr Take a stab at support for the PowerBook 190/190cs, based on comparison
with other PowerBook hardware. They seem to be most closely related
to the PowerBook 500-series, but have an internal IDE disk instead.

NOTE: only external SCSI disks have a chance of working, at this
point. Nothing has officially changed with regard to IDE support
(yet).
 1.210 12-Aug-1998  scottr Be ever so slightly more careful when determining where and what size
the frame buffer is.
 1.209 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.208 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.207 08-Jul-1998  thorpej Define one page free list, and put all pages on it.
 1.206 07-Jul-1998  scottr Fix compile errors: #if DDB -> #ifdef DDB
 1.205 05-Jul-1998  jonathan * defopt COMPAT_{09,10,11,12,13} and COMPAT_NOMID.
TODO: revisit interaction between native compat and emul compat usage.
 1.204 05-Jul-1998  jonathan defopt NS, NSIP.
 1.203 05-Jul-1998  jonathan defopt ISO TPIP.
 1.202 05-Jul-1998  jonathan defopt INET, NETATALK.
 1.201 04-Jul-1998  jonathan defopt DDB.
 1.200 30-Jun-1998  scottr Fix warnings from recent ddb_init() change: handle end and esym
consistently.
 1.199 09-Jun-1998  tv Change ddb_init() for a.out to provision for kernels which are not booted by
the current 'bootblock' method, like the Shark, which preloads and preformats
the symbol table right in the boot code.
 1.198 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.197 24-May-1998  scottr Rewrite doboot() so that it turns off the MMU, rather than relying
on the ROM space being mapped where it would like to be.
 1.196 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.195 05-May-1998  scottr Add the remaining kgdb pieces from sun3/hp300, with some mac68k-specific
adjustments to initialization.
 1.194 01-May-1998  scottr Quiet an (imo bogus) warning from gcc 2.8.1 regarding braces and
if-else statements. Change suggested by Taras Ivanenko in PR 5334.
 1.193 26-Apr-1998  scottr GC the old MACHINE_NONCONTIG code.
 1.192 26-Apr-1998  scottr Handle avail_start properly when setting up physical RAM segments.
Also, remove a KGDB-related piece that got committed prematurely.
 1.191 24-Apr-1998  scottr Replace outdated comment regarding the physical segment list in
mac68k_init() with something more appropriate. Also, remove an
extraneous but fortunately harmless line of code.
 1.190 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.189 24-Apr-1998  scottr Garbage collection. (Wow, some of this stuff was _old_.)
 1.188 24-Apr-1998  scottr Make get_mapping() create a sorted segment list, coalescing
adjoining regions (except for the segment starting at the address
we loaded the kernel). This simplifies cpu_init_kcore_hdr()
considerably, but the real win will be with MACHINE_NEW_NONCONTIG.
 1.187 10-Apr-1998  scottr If we know the location and size of the on-board video buffer,
don't bother to try and suck the information out of the Mac OS page
tables.
 1.186 27-Mar-1998  scottr Move bus_space implementation to bus_space.c.
 1.185 24-Feb-1998  scottr A change ripped out of i386/machdep.c:
--
When allocating bus space in bus_space_alloc(), use EX_FAST to find
the first fit in the map. The previous behavior violated the principle
of least surprise (especially annoying when you're debugging space allocation
problems). Suggested by Chris Demetriou.
 1.184 24-Feb-1998  scottr ROM vectors and related information needed to support the Performa 588
(and quite probably all LC/Performa 580/588 models). Thanks to
Yasuhiro Endoh for providing the necessary data.
 1.183 24-Feb-1998  scottr The code compiled in by the MADHATTER option is now standard issue. While
here, do a bunch of KNF, particularly whitespace issues.
 1.182 23-Feb-1998  scottr Remove the limit on bufpages we picked up from i386 in 1993
(which was removed from that port not long after), as it's not
an especially meaningful test.

Also, bump the number of swap buffers allocated to 3/4 the amount
of file i/o buffers (taken from the Amiga port).
 1.181 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.180 19-Feb-1998  thorpej Disable the message buffer during crash dumps by clearing msgbufenabled,
not msgbufmapped.
 1.179 24-Jan-1998  mycroft When dumping, print out the device number as major,minor.
 1.178 17-Jan-1998  scottr Add entries to the intvid_info table that are equivalent to
the (in)famous MADHATTER patch. The only one that has been
tested is the Q700, however, so the rest are conditionalized
on the MADHATTER option until they can be verified.
 1.177 13-Jan-1998  scottr Update for bus.h changes.
 1.176 04-Dec-1997  tv Standardize COMPAT_SUNOS -- remove all references to
sunos_exec_aout_makecmds() in machdep.c for various architectures and put
it in exec_conf.c like the other emulations; rename exec.h to
sunos_exec.h.
 1.175 13-Nov-1997  veego if NARP -> if NARP > 0
 1.174 04-Nov-1997  briggs Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.173 27-Oct-1997  briggs Change Q630 type to class-Q2. It's quite similar to the P575.
 1.172 22-Oct-1997  briggs Lost changes from 1.168 somewhere along the line.
 1.171 20-Oct-1997  scottr branches: 1.171.2;
Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.170 17-Oct-1997  briggs Move sys/sysctl.h to be after vm/vm.h.
 1.169 05-Oct-1997  thorpej Copyright assigned to The NetBSD Foundation.
 1.168 02-Oct-1997  briggs port-mac68k/4175: Need to add support for 33 MHz LC475/Q605.
Fix applied. Thanks to David Johnston for the PR and the reminder.
 1.167 21-Sep-1997  leo atari_round_page() -> m68k_round_page(). My fault, sorry...
 1.166 19-Sep-1997  leo Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.165 16-Sep-1997  scottr Add a comment about the sccA address on the IIfx.
 1.164 16-Sep-1997  scottr Check booter flags for a bit that tells us whether we should construct
bootdev from the SCSI ID passed in via the Booter's environment.
(Does the right thing for older versions of the Booter.)
 1.163 12-Sep-1997  mycroft Set the status word as well, and remove a bogus comment.
 1.162 12-Sep-1997  mycroft Always initialize all registers in setregs().
 1.161 11-Sep-1997  mycroft Fix execve(2) and *setregs() interfaces so emulations can set registers in a
more correct way. (See tech-kern.)
 1.160 10-Sep-1997  scottr Add ROM vectors and I/O info for the IIfx.
 1.159 03-Sep-1997  scottr When identifying the CPU, print the scaled factor resulting from
calibration of the delay() loop.
 1.158 14-Aug-1997  scottr More machine support:

- Add entries for the LC520, Color Classic, and PB150 to intvid_info[].
- Make the PB150 a Duo-class machine, as it seems to work better this way.

Now that we're doing the latter, it points out something I missed a long
time ago when I added Duo support: CLASSDUO was being ignored in
mac68k_set_io_offsets().

PowerBook 150 changes and bug fix provided by Dave Huang <khym@bga.com>
in PR 3970.
 1.157 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.156 07-Aug-1997  scottr Add the Classic II to intvid_info[]
 1.155 12-Jul-1997  scottr branches: 1.155.2;
Remove a stowaway that got in on the last commit.
 1.154 12-Jul-1997  scottr Fix from Dave Huang <khym@bga.com> for my exception vector botch for
the '040 and '060 in initcpu(). "D'oh!"
 1.153 11-Jul-1997  scottr Cosmetic changes to intvid_info[] initialization
 1.152 29-Jun-1997  scottr Fix tyop in last; will link 040-enabled kernels now.
 1.151 29-Jun-1997  scottr Split up CPU-dependent bus error/address error handlers. Mostly from
the Amiga port, but with an extension to save the actual fault
address (in m68k_fault_addr) when we catch a bus error.
 1.150 29-Jun-1997  scottr Garbage collect bad{,b,w,l}addr()
 1.149 12-Jun-1997  mrg bring mrg-vm-swap2 onto mainilne.
 1.148 10-Jun-1997  veego s/mac68k_round_page/m68k_round_page/ s/mac68k_trunc_page/m68k_trunc_page/
 1.147 08-Jun-1997  veego Initialize machine from MACHINE.
 1.146 23-Apr-1997  scottr branches: 1.146.2;
Implement new crash dump format. Mostly taken from hp300, extended to
support multiple physical RAM segments by me. Garbage collect functions
obsoleted by this change.
 1.145 16-Apr-1997  scottr Organize cpu_reboot() like hp300; this allows us to behave less
surprisingly if the power off sequence doesn't work as expected,
and simplifies the code a little. Fix the doboot() prototype
to quash a warning from gcc.
 1.144 14-Apr-1997  scottr Use the new opt_mrg_adb.h header.
 1.143 11-Apr-1997  scottr Use common m68k sig_machdep.c, removing our local copies of these.
 1.142 09-Apr-1997  thorpej Garbage-collect regdump() and friends.
 1.141 08-Apr-1997  scottr Clean up unused code, KNF bus_probe()
 1.140 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.139 03-Apr-1997  christos Add netatalk netisr
 1.138 27-Mar-1997  thorpej Don't allocate mclrefcnt[]; it's dead and gone.
 1.137 26-Mar-1997  gwr Renames: /dumpconf/cpu_dumpconf/, /boot/cpu_reboot/
 1.136 15-Mar-1997  briggs Specify SONIC for 040 powerbooks and for CLASSQ and CLASSQ2 machines.
 1.135 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.134 14-Feb-1997  scottr Use MAKEBOOTDEV macro to construct bootdev
 1.133 14-Feb-1997  scottr Implement bus_space_alloc() and bus_space_free(), borrowed from i386.
 1.132 11-Feb-1997  scottr branches: 1.132.2;
Initialize and use extent manager for bus space mapping functions.
Tweak bus_space_{tag,handle}_t types slightly to facilitate this.
 1.131 10-Feb-1997  scottr Add console bell callback support
 1.130 03-Feb-1997  scottr branches: 1.130.2;
Implement basic bus space access macros/functions.

Note: we currently do not use the extent manager.
 1.129 09-Jan-1997  scottr Sync with current 040-related development:

- Combine initenv() and getenvvars().
- Hardwire some PowerBook internal video addresses, from Takashi Hamada.
- When printing out the machine model/CPU, use the new cputype variable
instead of the Booter's PROCESSOR environment variable.
- Use new ptest040() function code argument (though for now, the MMU is
disabled on the 040).
- Revert previous change in get_physical() that seems to have broken
some machines; use an ADD instead of an OR when determining the PA.
- Some (very minor) style cleanup of asm code.
 1.128 19-Nov-1996  scottr Kill the conspa variable, and use mac68k_vidphys instead. Where we used
to initialize conspa was invalid on non-040 machines, since we don't
know which MMU we're using on those, yet. On the other hand, by the time
we get to check_video() on the 040 machines, the MMU has been disabled.
Compromise: get the video PA in setmachdep() on the 040, and in
check_video() on the others. (This is not optimal. *sigh*)
 1.127 05-Nov-1996  scottr LC III+/Performa 460 series use same vectors as the LC III.
Verified by Bob Nestor and Pete Nush.
 1.126 29-Oct-1996  briggs Flag Q900/950 as having a second scsi controller.
 1.125 28-Oct-1996  briggs Most 040 models have scsi regs at base + 0x10000, not base + 0xf000
like the Q700.
 1.124 23-Oct-1996  briggs Set SCSIBase properly on Quadras. Separate out CLASSAV. From Dave Huang
<khym@bga.com>.
Also fix COMPAT_NOMID to compile again.
 1.123 21-Oct-1996  scottr Fix a raft of printf format strings and some declaration problems for
the case where we define DEBUG. From Erik Bertelsen, closes PR 2871.
 1.122 15-Oct-1996  scottr Several 68040/68LC040-related changes; we're not there yet, but this
brings us closer to basic operation.

- Verified/updated ROM vector entries for many systems, and new vector
table entries for LC 520, LC 575/577/578, and Quadra 950
- Implement a new machine class (MACH_CLASSQ2) for the LC 575 series
- Use the ptest040() helper function in get_physical().

Also, in straytrap(), only enter the debugger #ifdef DDB.
 1.121 13-Oct-1996  christos backout previous kprintf change
 1.120 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.119 07-Oct-1996  scottr Update ROM vectors for PB 500
 1.118 27-Sep-1996  scottr Add ROM vectors for the LC III, verified by Mike DeLima
<miked@netrover.com>.
 1.117 18-Sep-1996  briggs Don't allow get_physical to attempt get_pte if mmutype is 68040.
(At least until get_pte works on the 040).
 1.116 16-Sep-1996  scottr Convert `fpu_type' to the more consistent `fputype', and use the new
#defines from m68k/include/cpu.h.
 1.115 09-Aug-1996  mrg Change reboot(2) to take two arguments: bootopt like normal and also
a boot string for firmware that can do this, such as the SPARC and
the sun3 models. It is currently silently ignored on all other
hardware now, however. The MD function "boot()" has been changed to
also take a char *.
 1.114 06-Aug-1996  scottr Make the calculation of the PA returned by get_physical() agree with the
comment immediately preceding it: We have to take the most significant
"numbits" from the returned value "ph", and the rest from our addr. The
addition used previously introduced a carry which was causing great
difficulty in determining the correct PA of the framebuffer VA passed in
by the booter.
 1.113 05-Aug-1996  scottr Initialize conspa so ite_match() can attach to the proper device.
 1.112 04-Aug-1996  scottr MRG vectors for the Quadra 630, from Jason Godfrey <jason@primenet.com> and
Bob Nestor <rnestor@metronet.com> (verified by Jason).
 1.111 04-Aug-1996  scottr Be much more careful with setting up the MRG ROM vectors. If we are using
a serial console and the PRAM read/write code happens to use the ADB ROM
vectors, we will have problems because the ADB hasn't been initialized.
For now, the only class of machines that we will set these up on regardless
of whether we are on a serial console or not is the original II series (II,
IIx, and IIcx). Others can come later.
 1.110 21-Jun-1996  scottr Test for serial console in adb_init() early, and abort if we're using it.
Initiialize ROM vectors regardless of this so that the PRAM RTC read and
write work regardless of whether a serial console is in use.
 1.109 11-Jun-1996  scottr Add missing cpu model info for Powerbook 500, and correct the ROM
vectors for the same.
 1.108 07-Jun-1996  briggs Disable ROM vectors if booting from either serial console. PR#2525.
 1.107 07-Jun-1996  briggs Patches from Bill Studenmund to get serial default settings from the booter.
 1.106 04-Jun-1996  briggs Some more constants from Bob Nestor--MacTV ADB works, now.
 1.105 25-May-1996  briggs Patches from Dave Huang (khym@bga.com) to get MRG ADB working on his 660av.
 1.104 22-May-1996  briggs Remove some dead code, as suggested by scottr, and clone a new machine
class off of the powerbook for the Duos. They apparently use an RBV-like
chip for the VIA2.
 1.103 18-May-1996  christos branches: 1.103.4;
- remove cpu_exec_prep_oldzmagic and use exec_aout_prep_oldzmagic
 1.102 15-May-1996  briggs Set mac68k_vidphys outside of get_mapping() so the II and others will
get the default value correctly.
 1.101 14-May-1996  briggs Some updates from Bob Nestor <rnestor@metronet.com> to get the Performa 550
working again. I broke it when I moved the ROM mapping so it was no
longer mapped on a friendly address boundary. Some cleanup.
 1.100 10-May-1996  briggs Get rid of the NuBus Superspace kludge--it should no longer be necessary
or even desirable.
 1.99 08-May-1996  briggs Initial cut at some ROM entry points for the MacTV.
 1.98 07-May-1996  briggs A MacTV owner says that the MacTV is a repackaged Performa 550. Note this.
 1.97 06-May-1996  briggs Do not print out the nubus ranges. We only use them for finding wierd
internal video locations. Perhaps we can get rid of that in the future,
too.
 1.96 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.95 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.94 01-Apr-1996  scottr Move the I/O map kludge for II-class machines into the MRG init code. No
effective change, but this is more correct and averts some potential
problems.
 1.93 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.92 12-Mar-1996  scottr Don't sync the RTC at shutdown time.
 1.91 28-Feb-1996  briggs Changes from Walter Ruetten for P550 support.
 1.90 11-Feb-1996  briggs Correct ROM vectors for the LC 475.
 1.89 03-Feb-1996  briggs New delay() implementation from Scott Reynolds (scottr@edsi.org).
Also some minor rearranging of the VIA initialization (init earlier).
 1.88 02-Feb-1996  mycroft Fix #includes.
 1.87 15-Jan-1996  briggs Updates from Kelly Campbell <camk@ksu.ksu.edu> for some ROM addresses.
 1.86 12-Jan-1996  briggs Fixes from PR #1931 w/ minor mod in vm_machdep.c
 1.85 09-Jan-1996  briggs Add some more first guesses at some machines.
 1.84 04-Jan-1996  jtc Changed name of sigaltstack's ss_base field to ss_sp to match XPG4.2 and
traditional usage.
 1.83 18-Dec-1995  briggs The IIci also needs an sccClkConst of 115200 instead of 122400.
 1.82 21-Nov-1995  briggs Back the sccClkConst off to 115200 for several classes of machines.
 1.81 14-Nov-1995  briggs Add call to doshutdownhooks() before we attempt to reboot.
 1.80 07-Oct-1995  mycroft Prefix names of system call implementation functions with `sys_'.
 1.79 04-Oct-1995  briggs Include ether.h to get NETHER.
 1.78 02-Oct-1995  briggs Wrap call to arpintr() in NETHER to avoid unresolved external if no ether
devices are present. Suggested by Paul Goyette (paul@pgoyette.bdt.com).
 1.77 21-Sep-1995  briggs MACCCLASSIC is Color classic. And it's more like an LC than hopeless.
 1.76 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.75 19-Sep-1995  briggs Wrap only the message in ifdef DIAGNOSTIC.
 1.74 18-Sep-1995  briggs Correct jClkNoMem address for C650 from
nick@csua.berkeley.edu via Walter Ruetten.
 1.73 17-Sep-1995  briggs Change HwCfgFlags4 to something a bit more mnemonic.
 1.72 17-Sep-1995  briggs Add rom vector for LCIII from Peter Kohler (kohler@ife.ee.ethz.ch)
via Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>.
 1.71 16-Sep-1995  briggs Map in the VIA space for the bloody Mac II ROMs that directly reference
a hardware address. Also map in the ROM space before we call doboot().
 1.70 16-Sep-1995  briggs Fixes from walter@ghpc8.ihf.rwth-aachen.de (Walter Ruetten)
to use ROM routines to read and write PRAM times, etc..
 1.69 14-Sep-1995  briggs Honor new MACH_CLASSIIvx.
 1.68 03-Sep-1995  briggs Clean up a bit.
 1.67 02-Sep-1995  briggs Optimize accesses to VIA2 a bit.
Force SCSI driver to register interrupt functions and remove default
handlers.
Bring in a few changes from
Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>--more to come later.
Define VIA interrupt functions as returning void, not long.
 1.66 01-Sep-1995  mycroft SA_ONSTACK --> SS_ONSTACK
 1.65 24-Aug-1995  briggs Don't panic on NMI and only take notice if DDB.
 1.64 16-Aug-1995  briggs Missing cast and semicolon in last.
 1.63 16-Aug-1995  briggs Load the old MacOS ROMBase value back in before we jump to reset.
 1.62 12-Aug-1995  briggs Get rid of cpu040 for good.
 1.61 09-Aug-1995  briggs We need to set cpu040 for just a while longer.
 1.60 06-Aug-1995  briggs Remove cpu040 use from here. It should only be used at boot time.
Take out old method for determining load address for IIci/si.
Set all but IIsi/ci to use a clock initialization value of 115200 (not
the baud rate... ;-).
 1.59 04-Aug-1995  briggs Get rid of int_video_{start,length} and wierd nubus mapping.
 1.58 02-Aug-1995  briggs Get rid of reference to Debugger().
 1.57 02-Aug-1995  briggs Add kludge for LC video and change IIvx to assume 1MB of VRAM if we can't
figure out how much there really is.
 1.56 18-Jul-1995  briggs Add support for:
GENERIC
RB_ASKNAME
RB_MINIROOT
Also revved up the required version of the booter because we need the
booter fixes to get this functionality.
 1.55 08-Jul-1995  briggs Clean up a lot. Run machdep.c through indent.
Remove a bunch of old debugging code and some dead code.
Put in some new comments. Need more.
 1.54 06-Jul-1995  briggs If SYMTAB_SPACE is defined, set esym to be the same as end.
Fixup my IIvx kludge again.
 1.53 05-Jul-1995  briggs Stupid programmer error in IIvx kludge.
 1.52 04-Jul-1995  briggs First cut at a kludge for IIvx internal video.
 1.51 04-Jul-1995  briggs Move SCSIBase from scsi.c.
 1.50 04-Jul-1995  paulus Add code to netintr to call pppintr
 1.49 30-Jun-1995  briggs Fix straytrap(). Update a few values in the ROM table.
 1.48 28-Jun-1995  briggs Some random cleanup and some cleanup of the dump routines, modelled on
i386. Untested. Remove old mac68k-specific stack trace code, etc. as
the cleanup.
 1.47 25-Jun-1995  briggs Patches from Walter Ruetten (walter@ghpc8.ihf.rwth-aachen.de)
and Daniel Risacher (magnus@mit.edu). Apparently with some
helpful discussion from John Wittkoski (jpw@insoft.com).
This works on my IIcx and IIsi. Still needs a bit of cleaning up.
 1.46 21-Jun-1995  briggs A number of clean-up related changes and a few changes relating to
the new mapping. "real mem" is now correct for MACHINE_NONCONTIG
machines. MACHINE_NONCONTIG conditionals have been removed--only
support that case, now.
 1.45 17-May-1995  briggs Set A2 to PS_STRINGS in setregs().
 1.44 30-Apr-1995  briggs Don't set mrg vectors if we're using the serial console--this allows
machines w/ non-working desktop bus to actually get on with booting.
 1.43 23-Apr-1995  briggs Make these compile again.
 1.42 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.41 22-Apr-1995  briggs Use vfs_shutdown().
 1.40 19-Apr-1995  briggs 'twould help to unmount the filesystems, wouldn't it?
 1.39 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.38 29-Mar-1995  briggs Nuke FPCOPROC and add fpu device driver and FPU_EMULATE from sun3.
Still need to figure out how to handle this w/ FPSP on 68040's but
since we're not really using the 68040 yet...
 1.37 26-Mar-1995  briggs sun3 fixes for COMPAT_SUNOS.
 1.36 01-Mar-1995  briggs Clean up via.c a good bit--still needs more. Get rid of some timing stuff
that we aren't using at all anymore.
 1.35 15-Feb-1995  briggs Add support from Erik Vogan for reading and writing PRAM. Don't enable
writing yet, though.
 1.34 01-Feb-1995  briggs Yank current sendsig, sunos_sendsig, sigreturn, sunos_sigreturn from amiga.
Don't dump regs/mem on debugger switch.
Cleanup dumpmem() a bit.
 1.33 21-Jan-1995  briggs Fixup for COMPAT_SUNOS. sun_ -> sunos_ and much from amiga folks.
 1.32 15-Jan-1995  briggs Fix minor compile warning.
 1.31 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.30 31-Oct-1994  briggs sendsig() and sun_sendsig() code to u_long.
 1.29 26-Oct-1994  cgd new RCS ID format.
 1.28 20-Oct-1994  cgd update for new syscall args description mechanism
 1.27 08-Aug-1994  lkestel Some machines (e.g., IIcx) have '030 and map all of memory (4 gigs) with
the MMU. Added sanity checking in the get_mapping() call to catch this
and stop at the end of RAM. Now available RAM is min of booter-specified
amount and what the MMU maps.

Also added remap_rom() ifdef'ed out which uses early termination pte's
to map 8 megs of ROM.
 1.26 31-Jul-1994  briggs serial_console passed in from booter.
 1.25 31-Jul-1994  lkestel Added get_physical() to get physical address from logical address according
to MMU; get_mapping() to figure out how RAM and NuBus space is mapped;
remap_kernel() to remap the kernel page tables in case they were split
across memory banks; remap_nubus() to map internal video into NuBus space
where MacOS had it; and remap_MMU() to call the above.
 1.24 29-Jul-1994  grantham Use values from Booter to initialize time correctly for machines
without readable PRAM. (IIvx users should be pleased.)
 1.23 25-Jul-1994  briggs if DDB -> ifdef DDB to be consistent at suggestion from Steve Allen
(wormey@eskimo.com).
Also cleaned up the comments a bit for consinit().
 1.22 21-Jul-1994  briggs Add ASCBase to offsets initialized in setmachdep(). Change comment for
cpu_model (slightly).
 1.21 10-Jul-1994  briggs Be somewhat better at machine dependence, clean up a hair, and get rid
of addupc.
 1.20 09-Jul-1994  briggs Switch to using sys/dev/cons.? instead of old hp-derived generic console.
 1.19 08-Jul-1994  lkestel autoconf.c: added ite.
conf.c: added ite and adb.
cons.c: replaced mac* functions with itecn* functions.
machdep.c: ditto.
 1.18 02-Jul-1994  briggs branches: 1.18.2;
Get rid of exec_aout.h inclusion.
 1.17 29-Jun-1994  briggs Only do some of these mods on the first pass.
 1.16 26-Jun-1994  briggs Lots of changes/cleanup. Note some additions for 4.4-lite and some
more functionality for setmachdep. Grantham suggests that maybe
function tables or some such would be a better way to handle some of
these machine-dependent function--I concur that that would be TRT.
 1.15 06-May-1994  briggs Get things to compile with latest changes.
 1.14 22-Apr-1994  briggs Make external definition for cpu040.
trap.c: Fix dumb (but compilable and linkable) typo.
 1.13 21-Apr-1994  briggs Add NETISR_ARP from hp300
Add some basic, preliminary stuff for Q700 support.
 1.12 18-Apr-1994  briggs Avail mem comes from elsewhere, now.
 1.11 20-Mar-1994  briggs Changes to allow kernel debugger symbols.
 1.10 01-Mar-1994  briggs Add a bunch of machine types. Not that we support them, but it's at least
polite to know what you're dealing with.
 1.9 27-Feb-1994  briggs Basic changes for compat_sunos--copied from amiga.
 1.8 22-Feb-1994  briggs Numerous changes from grantham and lkestel--including:
* A method to interpret passed environment variables in from the
booter.
* MACHINE_NONCONTIG stuff.
* Debugging aids.
 1.7 30-Jan-1994  briggs Switch from DELAY to delay.
 1.6 20-Jan-1994  briggs A field name in a structure changed. So we did, too.
 1.5 13-Jan-1994  briggs Allocate exec_map.
 1.4 11-Jan-1994  briggs Some generic clean-up. Get rid of old debugging code. Fix exec to work
with new changes by cgd. Fixup includes. Get rid of initcpu(). Change
code using struct myframe to use struct frame. Some gratuitous
reformatting and get rid of C version of copyinstr().
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.18.2.2 11-Aug-1994  mycroft update from trunk
 1.18.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.103.4.6 26-Jan-1997  rat Pullup request from Scott Reynolds.

1.126->1.127: LC III+/Performa 460 series use same vectors as the LC III.
1.117->1.118: Add ROM vectors for the LC III
 1.103.4.5 11-Jun-1996  scottr Pull up from trunk:
>Add missing cpu model info for Powerbook 500, and correct the ROM
>vectors for the same.
 1.103.4.4 07-Jun-1996  briggs This file got truncated somehow--bring in from trunk.
 1.103.4.3 07-Jun-1996  briggs Pull up changes from trunk. Console fix and external serial clock support.
 1.103.4.2 07-Jun-1996  briggs Bring in last changes from -current. ADB fixes for MacTV and serial state
from the booter.
 1.103.4.1 01-Jun-1996  scottr Pull up version 1.105 from the main branch; Duo/AV fixes.
 1.130.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.132.2.1 12-Feb-1997  mrg don't allocate swap map in allocsys.
 1.146.2.1 04-May-1997  mrg re-merge mrg-vm-swap into -current, and call it mrg-vm-swap2.
 1.155.2.6 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.155.2.5 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.155.2.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.155.2.3 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.155.2.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.155.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.171.2.11 23-Nov-1998  cgd pull up rev 1.215 from trunk (scottr)
 1.171.2.10 23-Nov-1998  cgd pull up rev 1.206 from trunk (scottr)
 1.171.2.9 23-Nov-1998  cgd kill bogus line in previous commit caused by bogus pullup request.
 1.171.2.8 23-Nov-1998  cgd pull up (at least parts of) revs 1.183, 1.184, 1.211, 1.213 from trunk
via patch. (scottr)
 1.171.2.7 23-Nov-1998  cgd pull up patch to set boot-time flags based on the BOOTHOWTO variable passed
in by the boot blocks. Done differently in -current. (scottr)
 1.171.2.6 23-Nov-1998  cgd Pull up a patch consisting of revs 1.211, backported to 1.3-branch.
Rewrite doboot() so that it turns off the MMU, rather than relying
on the ROM space being mapped where it would like to be. (scottr)
 1.171.2.5 05-May-1998  mycroft Pull up 1.187, per request of scottr.
 1.171.2.4 29-Jan-1998  mellon Pull up 1.178 (scottr)
 1.171.2.3 15-Nov-1997  mellon Pull rev 1.175 up from trunk (veego)
 1.171.2.2 06-Nov-1997  mellon Pull rev 1.173 and 1.174 up from trunk (scottr)
 1.171.2.1 23-Oct-1997  mellon Pull up rev 1.172 from main trunk
 1.223.2.10 13-Feb-2000  scottr Sync with main branch.
 1.223.2.9 12-Dec-1999  scottr Sync with main branch.
 1.223.2.8 28-Nov-1999  scottr Sync with main branch.
 1.223.2.7 01-Nov-1999  scottr Sync with main branch.
 1.223.2.6 15-Jun-1999  scottr Sync with main branch.
 1.223.2.5 22-May-1999  scottr Add support for wscons as a console, using evil trickery. To fix this
we'll have to revisit (and rip out) a bunch of things that happen before
the MMU is set up.

As a result, serial consoles now work again.
 1.223.2.4 16-May-1999  scottr Sync with main branch.
 1.223.2.3 18-Mar-1999  scottr Rearrange console attachment slightly for sanity's sake.
 1.223.2.2 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.223.2.1 05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.227.2.3 08-Jul-1999  perry last pullup on the branch was corrupt -- this fixes it. (fix from briggs)
 1.227.2.2 01-Jul-1999  perry pullup 1.235->1.236 (briggs)
 1.227.2.1 16-Apr-1999  chs branches: 1.227.2.1.2; 1.227.2.1.4;
pull up 1.228 -> 1.229:
add a `flags' argument to uvm_pagealloc_strat().
define a flag UVM_PGA_USERESERVE to allow non-kernel object
allocations to use pages from the reserve.
use the new flag for allocations in pmap modules.
 1.227.2.1.4.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.227.2.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.227.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.238.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.238.4.1 15-Nov-1999  fvdl Sync with -current
 1.238.2.4 21-Apr-2001  bouyer Sync with HEAD
 1.238.2.3 27-Mar-2001  bouyer Sync with HEAD.
 1.238.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.238.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.251.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.252.2.2 06-Jun-2002  he Pull up revisions 1.273-1.274 (requested by fredb):
Restore video console support in PowerBook 140/145+145B/170.
Fixes PR#16907.
 1.252.2.1 13-Sep-2000  scottr Pull up rev 1.257 from scottr:
Add video hardware info for the Performa 550/Macintosh TV.
 1.259.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.259.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.264.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.264.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.264.2.5 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.264.2.4 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.264.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.264.2.2 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.264.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.265.4.16 07-Jan-2003  thorpej Sync with HEAD.
 1.265.4.15 11-Nov-2002  nathanw Catch up to -current
 1.265.4.14 18-Oct-2002  nathanw Catch up to -current.
 1.265.4.13 05-Oct-2002  gmcgarry p_addr -> l_addr
 1.265.4.12 17-Sep-2002  nathanw Catch up to -current.
 1.265.4.11 27-Aug-2002  nathanw Catch up to -current.
 1.265.4.10 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.265.4.9 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.265.4.8 20-Jun-2002  nathanw Catch up to -current.
 1.265.4.7 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.265.4.6 17-Apr-2002  nathanw Catch up to -current.
 1.265.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.265.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.265.4.3 02-Dec-2001  scw If an FPU is available, call m68k_make_fpu_idle_frame() to generate
a reference FPU idle frame.
 1.265.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.265.4.1 10-Sep-2001  scw file machdep.c was added on branch nathanw_sa on 2001-11-18 18:12:02 +0000
 1.272.2.4 31-Aug-2002  gehenna catch up with -current.
 1.272.2.3 14-Jul-2002  gehenna catch up with -current.
 1.272.2.2 30-May-2002  gehenna Catch up with -current.
 1.272.2.1 17-May-2002  gehenna Replace the access to devsw table and the hard-coded major with devsw API.
 1.290.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.290.2.8 08-Mar-2005  skrll Sync with HEAD.
 1.290.2.7 15-Feb-2005  skrll Sync with HEAD.
 1.290.2.6 17-Jan-2005  skrll Sync with HEAD.
 1.290.2.5 18-Dec-2004  skrll Sync with HEAD.
 1.290.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.290.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.290.2.2 03-Aug-2004  skrll Sync with HEAD
 1.290.2.1 02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.297.2.1 02-Aug-2004  tron Pull up revision 1.299 (requested by scottr in ticket #728):
We can't generate an FPU idle frame until we know which one
we have, so defer this until we've probed the FPU type.
 1.301.4.2 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.301.4.1 12-Feb-2005  yamt sync with head.
 1.301.2.1 29-Apr-2005  kent sync with -current
 1.303.2.1 01-Nov-2005  tron Pull up following revision(s) (requested by chs in ticket #923):
sys/arch/next68k/next68k/machdep.c: revision 1.73
sys/arch/luna68k/luna68k/machdep.c: revision 1.42
sys/arch/hp300/hp300/machdep.c: revision 1.184
sys/arch/amiga/amiga/machdep.c: revision 1.193
sys/arch/x68k/x68k/machdep.c: revision 1.129
sys/arch/mac68k/mac68k/machdep.c: revision 1.306
sys/arch/news68k/news68k/machdep.c: revision 1.61
sys/arch/mvme68k/mvme68k/machdep.c: revision 1.113
sys/arch/atari/atari/atari_init.c: revision 1.63
fix crash dumps on m68k platforms, cpu_kcore_hdr_t is larger than
512 bytes now so we need a bigger buffer. PR 26958.
 1.305.4.1 02-Nov-2005  yamt sync with head.
 1.305.2.4 03-Sep-2007  yamt sync with head.
 1.305.2.3 26-Feb-2007  yamt sync with head.
 1.305.2.2 30-Dec-2006  yamt sync with head.
 1.305.2.1 21-Jun-2006  yamt sync with head.
 1.308.22.2 10-Dec-2006  yamt sync with head.
 1.308.22.1 22-Oct-2006  yamt sync with head
 1.308.20.3 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.308.20.2 12-Jan-2007  ad Sync with head.
 1.308.20.1 18-Nov-2006  ad Sync with head.
 1.311.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.314.10.3 03-Oct-2007  garbled Sync with HEAD
 1.314.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.314.10.1 22-May-2007  matt Update to HEAD.
 1.314.4.1 11-Jul-2007  mjf Sync with head.
 1.314.2.3 09-Oct-2007  ad Sync with head.
 1.314.2.2 09-Jun-2007  ad Sync with head.
 1.314.2.1 27-May-2007  ad Sync with head.
 1.316.10.1 06-Nov-2007  matt sync with HEAD
 1.316.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.316.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.320.24.1 03-Jul-2008  simonb Sync with head.
 1.320.22.4 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.320.22.3 18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.320.22.2 14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.320.22.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.320.20.3 11-Mar-2010  yamt sync with head
 1.320.20.2 19-Aug-2009  yamt sync with head.
 1.320.20.1 04-May-2009  yamt sync with head.
 1.320.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.320.16.2 28-Sep-2008  mjf Sync with HEAD.
 1.320.16.1 02-Jul-2008  mjf Sync with HEAD.
 1.321.2.2 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.321.2.1 19-Oct-2008  haad Sync with HEAD.
 1.322.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.322.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.322.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.327.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.334.2.2 22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.334.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.335.2.3 31-May-2011  rmind sync with head
 1.335.2.2 05-Mar-2011  rmind sync with head
 1.335.2.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.336.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.337.2.2 05-Mar-2011  bouyer Sync with HEAD
 1.337.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.340.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.341.6.1 18-Feb-2012  mrg merge to -current.
 1.341.2.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.341.2.2 30-Oct-2012  yamt sync with head
 1.341.2.1 17-Apr-2012  yamt sync with head
 1.345.4.2 18-May-2014  rmind sync with head
 1.345.4.1 28-Aug-2013  rmind sync with head
 1.345.2.2 03-Dec-2017  jdolecek update from HEAD
 1.345.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.348.2.2 28-Aug-2017  skrll Sync with HEAD
 1.348.2.1 22-Sep-2015  skrll Sync with HEAD
 1.349.4.1 21-Apr-2017  bouyer Sync with HEAD
 1.349.2.2 26-Apr-2017  pgoyette Sync with HEAD
 1.349.2.1 20-Jul-2016  pgoyette Adapt the machine/arch dependent code to the new {b,c}devsw reference
counting.

XXX Most of these will require testing by someone other than myself, as
I have a limited selection of hardware!
 1.350.4.1 27-Apr-2017  pgoyette Restore all work from the former pgoyette-localcount branch (which is
now abandoned doe to cvs merge botch).

The branch now builds, and installs via anita. There are still some
problems (cgd is non-functional and all atf tests time-out) but they
will get resolved soon.
 1.352.4.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.352.4.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.353.2.3 28-Apr-2021  martin Pull up following revision(s) (requested by rin in ticket #1258):

sys/arch/mac68k/mac68k/machdep.c: revision 1.361
sys/arch/mac68k/mac68k/machdep.c: revision 1.362

Make mac68k_set_io_offsets() a little bit cleaner:
- Via1Base is always ``base'' for all supported models.
- Set sccA and SCSIBase for each model of MACH_CLASSQ class.
- Some style fixes.

No functional changes intended.

Change sccA address for Quadra 800 from base + 0xc000 to 0xc020.

The H/W partially decodes its address, and sccA is available at
offsets 0xc000, 0xc020, .... The functionality is same, but Mac
toolbox ROM routines use 0xc020, and QEMU for Quadra 800 only
supports this address.
 1.353.2.2 27-Apr-2021  martin Pull up following revision(s) (requested by rin in ticket #1256):

sys/arch/mac68k/mac68k/machdep.c: revision 1.360
sys/arch/mac68k/conf/GENERIC: revision 1.234
sys/arch/mac68k/conf/files.mac68k: revision 1.131

Add MAC68K_MEMSIZE option to hard-code memory size in MB, instead of
that given by Booter. Work around Booter bug by which max memory is
restricted to 255MB.
 1.353.2.1 18-Aug-2019  martin Pull up following revision(s) (requested by rin in ticket #87):

sys/arch/mac68k/mac68k/machdep.c: revision 1.354

We've switched to 8KB page.

XXX
pullup to netbsd-9
 1.358.2.1 03-Apr-2021  thorpej Sync with HEAD.
 1.360.4.1 13-May-2021  thorpej Sync with HEAD.
 1.369.2.1 02-Aug-2025  perseant Sync with HEAD
 1.74 05-Feb-2024  andvar fix various typos in comments.
 1.73 18-Oct-2014  snj src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.72 12-Feb-2012  matt branches: 1.72.6;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.71 01-Nov-2009  snj branches: 1.71.12; 1.71.16;
Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.70 18-Mar-2009  he Correct a bzero() -> memset conversion.
 1.69 18-Mar-2009  cegger bzero -> memset
 1.68 05-Jan-2008  ad branches: 1.68.10; 1.68.18; 1.68.24;
Fix includes.
 1.67 03-Dec-2007  ad branches: 1.67.6;
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.66 08-Mar-2007  tsutsui branches: 1.66.2; 1.66.18; 1.66.20; 1.66.26;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.65 07-Mar-2007  tsutsui Remove lines not intended to commit in the previous.
 1.64 07-Mar-2007  tsutsui Add missed '*', use or add (char *) where pointer arithmetics are needed.
 1.63 05-Mar-2007  dogcow semimechanically convert 'void foo' -> 'void *foo', as part of the continuing
caddr_t fallout.
 1.62 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.61 09-Sep-2006  tsutsui branches: 1.61.6;
Remove %fp and %a6 from a clobber description in __asm() statement.
It shouldn't be clobbered and there is nothing for compiler to do
in that case anyway as gcc4 complains.
 1.60 07-Jun-2006  he branches: 1.60.6;
Get rid of an instance of lvalue casts by using a pair of helper vars.
 1.59 24-Dec-2005  perry branches: 1.59.4; 1.59.6; 1.59.8; 1.59.14;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.58 11-Dec-2005  christos merge ktrace-lwp.
 1.57 16-Jun-2005  jmc branches: 1.57.2;
Shadowing and const fixes.
 1.56 22-May-2005  christos No 0x in front of %p...
 1.55 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.54 28-Oct-2003  fredb Fix that last warning in a prettier (and less befuddling) way, as
suggested by Dave Huang.
 1.53 27-Oct-2003  fredb Fix a befuddling error from gcc.
 1.52 28-Sep-2003  cl Cast through (void *) to appease gcc3.
 1.51 15-Jul-2003  lukem __KERNEL_RCSID()
 1.50 27-Sep-2002  provos branches: 1.50.6;
remove trailing \n in panic(). approved perry.
 1.49 30-May-2002  thorpej Don't use multi-line string literals.
 1.48 20-Nov-2001  chs branches: 1.48.8;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.47 15-Nov-2000  scottr branches: 1.47.4; 1.47.8;
As was the original intent a long, long time ago -- but in this galaxy, and
in fact on this planet -- generate a SIGILL for user-mode A-line traps.
The core of this change is taken verbatim from PR 10511, submitted by
Christian Bauer.
 1.46 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.45 25-Jun-2000  mrg remove some redundant <vm/vm_xxx.h> includes
 1.44 12-Jun-1999  ender branches: 1.44.2; 1.44.12;
Change the annoying printf() of 2 backspaces to a space followed by a
backspace for aesthetics.
 1.43 10-Jan-1999  scottr branches: 1.43.6;
Parenthesize a few expressions uncovered by -Wpointer-arith.
 1.42 29-Sep-1998  scottr Simplify the asm constraints in mrg_aline_super(), in order to
less thoroughly confuse the compiler when used without -O. Fixes
PR 5496.
 1.41 12-Sep-1998  scottr Don't add IOBase to sccA; it's an address, not an offset.
Pointed out by Paul Goyette.
 1.40 07-Jul-1998  scottr Fix compile errors: #if DDB -> #ifdef DDB
 1.39 04-Jul-1998  jonathan defopt DDB.
 1.38 21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.37 11-Aug-1997  scottr branches: 1.37.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.36 10-Jul-1997  scottr branches: 1.36.2;
Update for vm/lock.h -> sys/lock.h change
 1.35 12-May-1997  scottr Add en implementation of the Deferred Task Manager, contributed by Paul
Goyette <paul@pgoyette.bdt.com>.
 1.34 14-Apr-1997  scottr Use the new opt_mrg_adb.h header.
 1.33 08-Apr-1997  scottr Fix typo: MRG_DEBUG -> MRG_ADB
 1.32 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.31 01-Mar-1997  scottr Allow A1 to be used for passing arguments to ROM routines. Also, clean up
debugging printf() formats. From Allen Briggs and Paul Goyette.
 1.30 18-Dec-1996  scottr branches: 1.30.6;
Correct asm operands in mrg_Delay(); it has one output operand, and no
input operands. This corrects an uninitialized variable warning, and
may also explain some erratic behavior of the MRG ADB; gcc could throw
away the value of the `ticks' variable (but I haven't traced through
any ROMs, myself).
 1.29 30-Oct-1996  briggs Fix spelling error in panic. Double since of ResHndls[]. Use I/O kludge on
all systems, not just CLASSII--A bunch of Quadras apparently have hardcoded
I/O addresses in the ROMs, too.
 1.28 13-Oct-1996  christos backout previous kprintf change
 1.27 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.26 05-Aug-1996  briggs Fix improperly terminated comment. Noticed by brg@dgate.org (Brian Gaeke).
 1.25 25-May-1996  briggs Patches from Dave Huang (khym@bga.com) to get MRG ADB working on his 660av.
 1.24 15-May-1996  briggs branches: 1.24.4;
Add register use constraints to a bunch of asm() statements.
 1.23 14-May-1996  briggs Some updates from Bob Nestor <rnestor@metronet.com> to get the Performa 550
working again. I broke it when I moved the ROM mapping so it was no
longer mapped on a friendly address boundary. Some cleanup.
 1.22 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.21 01-Apr-1996  scottr Move the I/O map kludge for II-class machines into the MRG init code. No
effective change, but this is more correct and averts some potential
problems.
 1.20 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.19 28-Feb-1996  briggs Changes from Walter Ruetten for P550 support.
 1.18 01-Oct-1995  briggs Surround Debugger(); with #if DDB. Different fix than encl. for PR#1553.
 1.17 20-Sep-1995  briggs Fix a few oversights. From Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>
 1.16 17-Sep-1995  briggs Change HwCfgFlags4 to something a bit more mnemonic.
 1.15 17-Sep-1995  briggs Fixes from Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>
to avoid panic()s when we read the PRAM values while ROM
vectors are missing.
 1.14 16-Sep-1995  briggs Fixes from walter@ghpc8.ihf.rwth-aachen.de (Walter Ruetten)
to use ROM routines to read and write PRAM times, etc..
 1.13 14-Sep-1995  briggs Clean up message a tad.
 1.12 04-Sep-1995  briggs Fix a goof in the latest changes.
 1.11 03-Sep-1995  briggs Enable ADB interrupts unconditionally if not using setup_egret().
 1.10 03-Sep-1995  briggs Clean up some.
 1.9 03-Sep-1995  briggs Changes from Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>.
This forces the need for booter version 1.8.
 1.8 02-Aug-1995  briggs Use panic() instead of printf();Debugger();
 1.7 04-Jul-1995  briggs Clean up some types.
 1.6 30-Jun-1995  briggs Clean up a tad.
 1.5 25-Jun-1995  briggs Patches from Walter Ruetten (walter@ghpc8.ihf.rwth-aachen.de)
and Daniel Risacher (magnus@mit.edu). Apparently with some
helpful discussion from John Wittkoski (jpw@insoft.com).
This works on my IIcx and IIsi. Still needs a bit of cleaning up.
 1.4 21-Jun-1995  briggs Add function to reconfigure addresses when ROM is remapped.
 1.3 08-Apr-1995  briggs Put in a dummy PostEvent trap and enable ADB interrupts for IIci. From
Paul Goyette (paul@pgoyette.bdt.com).
I went ahead and removed the conditional around setting the ADB interrupt
enable. I don't expect Apple will have changed this on any other models
as it's the same on all documented models.
 1.2 26-Mar-1995  briggs Don't MRG_TEST the tracing if MRG_TRACE isn't defined. From
Paul Goyette (paul@pgoyette.bdt.com).
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.24.4.1 01-Jun-1996  scottr Pull up version 1.25 from the main branch; AV fixes.
 1.30.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.36.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.37.4.3 23-Nov-1998  cgd pull up rev 1.42 from trunk (scottr)
 1.37.4.2 23-Nov-1998  cgd pull up rev 1.41 from trunk (scottr)
 1.37.4.1 23-Nov-1998  cgd pull up rev 1.40 from trunk (scottr)
 1.43.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.44.12.1 15-Nov-2000  tv Pullup 1.47 [scottr]:
As was the original intent a long, long time ago -- but in this galaxy, and
in fact on this planet -- generate a SIGILL for user-mode A-line traps.
The core of this change is taken verbatim from PR 10511, submitted by
Christian Bauer.
 1.44.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.44.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.47.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.47.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.47.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.47.4.3 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.47.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.47.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.48.8.1 14-Jul-2002  gehenna catch up with -current.
 1.50.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.50.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.50.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.50.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.50.6.1 03-Aug-2004  skrll Sync with HEAD
 1.57.2.5 21-Jan-2008  yamt sync with head
 1.57.2.4 07-Dec-2007  yamt sync with head
 1.57.2.3 03-Sep-2007  yamt sync with head.
 1.57.2.2 30-Dec-2006  yamt sync with head.
 1.57.2.1 21-Jun-2006  yamt sync with head.
 1.59.14.1 19-Jun-2006  chap Sync with head.
 1.59.8.2 14-Sep-2006  yamt sync with head.
 1.59.8.1 26-Jun-2006  yamt sync with head.
 1.59.6.1 07-Jun-2006  kardel Sync with head.
 1.59.4.1 09-Sep-2006  rpaulo sync with head
 1.60.6.1 18-Nov-2006  ad Sync with head.
 1.61.6.1 12-Mar-2007  rmind Sync with HEAD.
 1.66.26.2 18-Feb-2008  mjf Sync with HEAD.
 1.66.26.1 08-Dec-2007  mjf Sync with HEAD.
 1.66.20.1 09-Jan-2008  matt sync with HEAD
 1.66.18.1 09-Dec-2007  jmcneill Sync with HEAD.
 1.66.2.1 03-Dec-2007  ad Sync with HEAD.
 1.67.6.1 08-Jan-2008  bouyer Sync with HEAD
 1.68.24.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.68.18.1 28-Apr-2009  skrll Sync with HEAD.
 1.68.10.2 11-Mar-2010  yamt sync with head
 1.68.10.1 04-May-2009  yamt sync with head.
 1.71.16.1 18-Feb-2012  mrg merge to -current.
 1.71.12.1 17-Apr-2012  yamt sync with head
 1.72.6.1 03-Dec-2017  jdolecek update from HEAD
 1.20 18-Apr-2024  andvar s/resoure/resource/ in comments.
 1.19 01-Nov-2009  snj Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.18 04-Mar-2007  christos branches: 1.18.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.17 24-Dec-2005  perry branches: 1.17.26;
bare asm -> __asm
 1.16 11-Dec-2005  christos merge ktrace-lwp.
 1.15 03-Jun-2005  rjs branches: 1.15.2;
Add const.
 1.14 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.13 09-Dec-2001  briggs branches: 1.13.16;
Register prefixes for tron()/troff() macros.
 1.12 15-Nov-2000  scottr branches: 1.12.4; 1.12.8;
As was the original intent a long, long time ago -- but in this galaxy, and
in fact on this planet -- generate a SIGILL for user-mode A-line traps.
The core of this change is taken verbatim from PR 10511, submitted by
Christian Bauer.
 1.11 12-May-1997  scottr branches: 1.11.24; 1.11.34;
Whoops; here's the rest of the Deferred Task Manager changes.
 1.10 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.9 25-May-1996  briggs Patches from Dave Huang (khym@bga.com) to get MRG ADB working on his 660av.
 1.8 14-May-1996  briggs branches: 1.8.4;
Some updates from Bob Nestor <rnestor@metronet.com> to get the Performa 550
working again. I broke it when I moved the ROM mapping so it was no
longer mapped on a friendly address boundary. Some cleanup.
 1.7 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.6 28-Feb-1996  briggs Changes from Walter Ruetten for P550 support.
 1.5 17-Sep-1995  briggs Change HwCfgFlags4 to something a bit more mnemonic.
 1.4 16-Sep-1995  briggs Fixes from walter@ghpc8.ihf.rwth-aachen.de (Walter Ruetten)
to use ROM routines to read and write PRAM times, etc..
 1.3 03-Sep-1995  briggs Clean up a bit.
 1.2 02-Sep-1995  briggs Optimize accesses to VIA2 a bit.
Force SCSI driver to register interrupt functions and remove default
handlers.
Bring in a few changes from
Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>--more to come later.
Define VIA interrupt functions as returning void, not long.
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.8.4.1 01-Jun-1996  scottr Pull up version 1.9 from the main branch; AV fixes.
 1.11.34.1 15-Nov-2000  tv Pullup 1.12 [scottr]:
As was the original intent a long, long time ago -- but in this galaxy, and
in fact on this planet -- generate a SIGILL for user-mode A-line traps.
The core of this change is taken verbatim from PR 10511, submitted by
Christian Bauer.
 1.11.24.1 22-Nov-2000  bouyer Sync with HEAD.
 1.12.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.12.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.13.16.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.16.1 17-Jan-2005  skrll Sync with HEAD.
 1.15.2.2 03-Sep-2007  yamt sync with head.
 1.15.2.1 21-Jun-2006  yamt sync with head.
 1.17.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.18.44.1 11-Mar-2010  yamt sync with head
 1.22 01-Nov-2009  snj Drop 3rd and 4th clauses. Approved by Brad Grantham (copyright holder).
 1.21 04-Mar-2007  christos branches: 1.21.44;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.20 30-May-2002  thorpej branches: 1.20.22; 1.20.60;
Make this work with an ISO C preprocessor.
 1.19 20-Nov-2001  chs branches: 1.19.8;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.18 15-Nov-2000  scottr branches: 1.18.4; 1.18.8;
As was the original intent a long, long time ago -- but in this galaxy, and
in fact on this planet -- generate a SIGILL for user-mode A-line traps.
The core of this change is taken verbatim from PR 10511, submitted by
Christian Bauer.
 1.17 21-Feb-1998  scottr branches: 1.17.16; 1.17.26;
Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.16 12-May-1997  scottr Add en implementation of the Deferred Task Manager, contributed by Paul
Goyette <paul@pgoyette.bdt.com>.
 1.15 15-Apr-1997  scottr Use opt_mrg_adb.h header (missed in previous commit)
 1.14 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 25-May-1996  briggs Patches from Dave Huang (khym@bga.com) to get MRG ADB working on his 660av.
 1.10 14-May-1996  briggs branches: 1.10.4;
Some updates from Bob Nestor <rnestor@metronet.com> to get the Performa 550
working again. I broke it when I moved the ROM mapping so it was no
longer mapped on a friendly address boundary. Some cleanup.
 1.9 28-Feb-1996  briggs Changes from Walter Ruetten for P550 support.
 1.8 02-Feb-1996  mycroft assym.s -> assym.h
(Some ports did this already.)
 1.7 17-Sep-1995  briggs Change HwCfgFlags4 to something a bit more mnemonic.
 1.6 16-Sep-1995  briggs Fixes from walter@ghpc8.ihf.rwth-aachen.de (Walter Ruetten)
to use ROM routines to read and write PRAM times, etc..
 1.5 03-Sep-1995  briggs Clean up a bit.
 1.4 02-Sep-1995  briggs Optimize accesses to VIA2 a bit.
Force SCSI driver to register interrupt functions and remove default
handlers.
Bring in a few changes from
Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>--more to come later.
Define VIA interrupt functions as returning void, not long.
 1.3 02-Aug-1995  briggs Use panic() instead of printf();Debugger();
 1.2 08-Jul-1995  briggs Clean up a lot. Run machdep.c through indent.
Remove a bunch of old debugging code and some dead code.
Put in some new comments. Need more.
 1.1 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.10.4.1 01-Jun-1996  scottr Pull up version 1.11 from the main branch; AV fixes.
 1.17.26.1 15-Nov-2000  tv Pullup 1.18 [scottr]:
As was the original intent a long, long time ago -- but in this galaxy, and
in fact on this planet -- generate a SIGILL for user-mode A-line traps.
The core of this change is taken verbatim from PR 10511, submitted by
Christian Bauer.
 1.17.16.1 22-Nov-2000  bouyer Sync with HEAD.
 1.18.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.18.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.18.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.18.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.8.1 14-Jul-2002  gehenna catch up with -current.
 1.20.60.1 12-Mar-2007  rmind Sync with HEAD.
 1.20.22.1 03-Sep-2007  yamt sync with head.
 1.21.44.1 11-Mar-2010  yamt 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 05-Jun-2011  matt branches: 1.21.68;
struct device * -> device_t, struct cfdata * -> cfdata_t
CFATTACH_DECL(*, sizeof(struct device), -> CFATTACH_DECL_NEW(&, 0
 1.20 28-Apr-2008  martin branches: 1.20.22; 1.20.28; 1.20.32;
Remove clause 3 and 4 from TNF licenses
 1.19 11-Dec-2005  christos branches: 1.19.74; 1.19.76; 1.19.78;
merge ktrace-lwp.
 1.18 26-Aug-2005  drochner s/locdesc_t/int/g
 1.17 30-Jun-2005  drochner branches: 1.17.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.16 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.15 15-Jul-2003  lukem __KERNEL_RCSID()
 1.14 02-Oct-2002  thorpej branches: 1.14.6;
Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 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.11 13-Apr-2002  briggs Fixes and changes from Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>.
* Clean up after briggs@ changes to support bus_dma.
* Add support for reading sMemory resources from nubus cards.
* Add support for old cards with only the board rsrc (NatSemi NB-GPIB, e.g.)
* Add a few more card identifiers.
 1.10 10-Apr-2002  briggs Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.9 12-Jan-1998  thorpej branches: 1.9.30; 1.9.34;
Update for changes to config.
 1.8 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.7 17-Dec-1996  scottr branches: 1.7.10;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.6 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.5 21-Oct-1996  briggs Fix two bugs noticed by Taras Ivanenko <ivanenko@ctpa03.mit.edu>
via.c: don't allow spl to remain at splhigh on error.
mainbus.c: Make sure that variable is initialized.
 1.4 13-Oct-1996  christos backout previous kprintf change
 1.3 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.2 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.1 19-Jun-1996  scottr Completely revamp setroot() and friends. Since Chris' version of this code
is close to how I reworked it, I pulled in the (essentially MI) NetBSD/alpha
and added the appropriate support around it.

- No need for the GENERIC kernel config option.
- NFS-mounted root and swap are supported.
- If we can't figure out where the root filesystem is from what the Booter
tells us, ask the user.
- Split the mainbus autoconfig code to a separate file.

Also, update/add copyrights as appropriate.
 1.7.10.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.9.34.2 18-Oct-2002  nathanw Catch up to -current.
 1.9.34.1 17-Apr-2002  nathanw Catch up to -current.
 1.9.30.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.9.30.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.14.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.14.6.4 17-Jan-2005  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.17.2.1 21-Jun-2006  yamt sync with head.
 1.19.78.1 16-May-2008  yamt sync with head.
 1.19.76.1 18-May-2008  yamt sync with head.
 1.19.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.20.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.20.28.1 06-Jun-2011  jruoho Sync with HEAD.
 1.20.22.1 12-Jun-2011  rmind sync with head
 1.21.68.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.21.68.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.21.68.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.21.68.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.21.68.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.68.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.42 12-Jun-2011  rmind Welcome to 5.99.53! Merge rmind-uvmplock branch:

- Reorganize locking in UVM and provide extra serialisation for pmap(9).
New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
kernel-lock on some ports). Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
 1.41 08-Feb-2011  rmind branches: 1.41.2;
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.40 19-Dec-2008  cegger branches: 1.40.4; 1.40.6; 1.40.8; 1.40.10;
use M_ZERO on malloc() and remove subsequent bzero().
 1.39 05-Mar-2007  tsutsui branches: 1.39.40; 1.39.44; 1.39.52;
Remove an unnecessary cast and use (char *) on pointer arith.
 1.38 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.37 11-Dec-2005  christos branches: 1.37.26;
merge ktrace-lwp.
 1.36 15-Jan-2005  chs branches: 1.36.10;
de-__P, remove register, ansify, b* -> mem*.
 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 __KERNEL_RCSID()
 1.33 02-Apr-2003  thorpej branches: 1.33.2;
Use PAGE_SIZE rather than NBPG.
 1.32 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.31 06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.30 27-Feb-2002  christos branches: 1.30.8;
- Use DEV_ constants, instead of documenting the numbers!
- Delete cdev_decl(mm); where appropriate, and other hand-crufting [hi powerpc!]
 1.29 10-Sep-2001  chris branches: 1.29.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.28 24-Apr-2001  thorpej branches: 1.28.2; 1.28.4;
Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.27 29-Jun-2000  mrg branches: 1.27.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.26 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.25 12-Dec-1999  scottr branches: 1.25.4;
Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.24 04-Dec-1999  ragge CL* discarding.
 1.23 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.22 27-Mar-1999  mycroft branches: 1.22.8; 1.22.10; 1.22.14;
Oops; vm_offset_t -> vaddr_t.
 1.21 26-Mar-1999  mycroft Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.20 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.19 10-Feb-1999  kleink branches: 1.19.2;
Use of casts as lvalues is a GNU C extension; rearrange slightly.
 1.18 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.17 19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.16 10-Nov-1998  scottr Only allow access to physical RAM.
 1.15 07-May-1998  kleink Fix some arithmetics lossage on typeless pointers.
 1.14 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.13 10-Jun-1997  veego branches: 1.13.8;
s/mac68k_btop/m68k_btop/
 1.12 02-Feb-1997  thorpej zeropage -> devzeropage, and make it static.
 1.11 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.10 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.9 10-Apr-1995  mycroft Add mmopen(), mmclose(), and mmmmap() where appropriate. Lock vmmap when
needed. Make types consistent.
 1.8 10-Apr-1995  briggs Synchronize with latest changes to hp300 conf.c and give dummy mem
open/close/map routines (map is dummy for now, but should be implemented
when I'm more awake).
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 07-Jul-1994  briggs branches: 1.6.2;
Cast vmmap in call to pmap_enter() to satisfy compiler.
 1.5 26-Jun-1994  briggs MIN/MAX -> min/max
 1.4 06-May-1994  briggs Get things to compile with latest changes.
 1.3 18-Apr-1994  briggs Include cop.
Nuke vm_statistics.h
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.6.2.2 07-Jul-1994  briggs Cast vmmap in call to pmap_enter() to satisfy compiler.
 1.6.2.1 07-Jul-1994  briggs file mem.c was added on branch netbsd-1-0 on 1994-07-07 00:28:15 +0000
 1.13.8.1 23-Nov-1998  cgd pull up rev 1.16 from trunk (scottr)
 1.19.2.3 12-Dec-1999  scottr Sync with main branch.
 1.19.2.2 28-Nov-1999  scottr Sync with main branch.
 1.19.2.1 16-May-1999  scottr Sync with main branch.
 1.22.14.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.22.10.1 15-Nov-1999  fvdl Sync with -current
 1.22.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.25.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.27.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.28.4.2 10-Oct-2001  fvdl Convert all remaining devices.
 1.28.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.28.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.28.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.28.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.29.4.4 11-Nov-2002  nathanw Catch up to -current
 1.29.4.3 17-Sep-2002  nathanw Catch up to -current.
 1.29.4.2 28-Feb-2002  nathanw Catch up to -current.
 1.29.4.1 10-Sep-2001  nathanw file mem.c was added on branch nathanw_sa on 2002-02-28 04:10:37 +0000
 1.30.8.1 17-May-2002  gehenna Add the character device switch.
 1.33.2.4 17-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.36.10.1 03-Sep-2007  yamt sync with head.
 1.37.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.39.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.39.44.1 04-May-2009  yamt sync with head.
 1.39.40.2 17-Jan-2009  mjf Sync with HEAD.
 1.39.40.1 29-Mar-2008  mjf Add a mem_init() function for each architecture that requests a device
node for /dev/mem, /dev/null, /dev/zero, etc.

This will disappear when I move this code (and others) to be a
pseudo-device. When we have machine-independent mem code this will all be
unnecessary anyway.
 1.40.10.1 17-Feb-2011  bouyer Sync with HEAD
 1.40.8.1 06-Jun-2011  jruoho Sync with HEAD.
 1.40.6.1 18-Mar-2010  rmind Unify /dev/{mem,kmem,zero,null} implementations in MI code. Based on patch
from Joerg Sonnenberger, proposed on tech-kern@, in February 2008.

Work and depression still in progress.
 1.40.4.1 30-Oct-2010  uebayasi Implement pmap_physload_device(9) to replace xmd(4) MD backend.
Implement pmap_mmap(9) and use it from mem(4) and xmd(4).
 1.41.2.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.3 11-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3 08-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3 08-Jan-1994  mycroft Clean up deleted files.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.92 05-Nov-2002  chs merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.91 03-Nov-2002  chs merge pmap.h for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.90 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.89 14-Oct-2002  chs merge pte.h for m68k w/ motorola or compatible MMU
(only 4k-page platforms so far).
 1.88 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.87 22-May-2002  drochner Subtract vm_map_min(kernel_map) from kernel virtual addresses to get offsets
into kernel_object where this was missing.
This is a no-op on ports where VM_MIN_KERNEL_ADDRESS==0, ie all but
cesfic.
Confirmed and corrected by Chuck Silvers.
 1.86 08-Mar-2002  thorpej branches: 1.86.6;
Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map). Try to deal with this:

* Group all information about the backend allocator for a pool in a
separate structure. The pool references this structure, rather than
the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
to become available, but will still fail if it cannot callocate KVA
space for the pages. If this happens, carefully drain all pools using
the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
some pages, and use that information to make draining easier and more
efficient.
* Get rid of PR_URGENT. There was only one use of it, and it could be
dealt with by the caller.

From art@openbsd.org.
 1.85 02-Jan-2002  chs pmap_page_protect(VM_PROT_NONE) must remove all mappings in the PV list,
even if they are wired. we need to be able to remove all mappings to
pages that are being freed due to (eg.) file truncation.
 1.84 16-Dec-2001  tsutsui Fix comments for ref-count of PT pages.
 1.83 13-Dec-2001  chs change the reference-counting of PT pages to start from zero instead of
one, so that we don't mess up the global count of wired pages by having
the page's wire_count be non-zero when we free the page.
pointed out by Michael Hitch.
 1.82 24-Nov-2001  isaki fix typo s/68551/68851/ in a comment.
 1.81 19-Nov-2001  chs allocate and free page table pages explicitly instead of abusing
uvm_fault_wire(). this allows us to make pt_map non-pageable,
but we need to be careful in pmap_remove() not to attempt to
reference PTEs after the PTP has been freed.
 1.80 29-Sep-2001  chs branches: 1.80.4;
fix typo in pmap_kremove() which was invalidating the wrong TLB entry.
from Hiroki Tanikawa in PR 14099.
 1.79 10-Sep-2001  chris Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.78 04-Aug-2001  chs branches: 1.78.2;
implement pmap_k{enter_pa,remove}() correctly.
remove various checks for impossible conditions.
other misc cleanup.
 1.77 02-Jun-2001  chs branches: 1.77.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.76 26-May-2001  chs replace vm_page_t with struct vm_page *.
 1.75 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.74 22-Apr-2001  thorpej Remove pmap_kenter_pgs(). It was never really adopted by
anything, and the interface itself wasn't as flexible as
callers would have probably liked.
 1.73 21-Apr-2001  thorpej #define away pmap_update() in <machine/pmap.h> so that no function
call overhead is incurred as we start sprinkling pmap_update() calls
throughout the source tree (no pmaps currently defer operations, but
we are adding the infrastructure to allow them to do so).
 1.72 21-Apr-2001  thorpej pmap_update() should not be equated with "flush entire TLB", it is
used to process deferred pmap operations. Since these pmaps don't
defer anything, pmap_update() is a noop.
 1.71 15-Mar-2001  chs 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.70 12-Feb-2001  briggs branches: 1.70.2;
Rip the guts out of pmap_remove() and create pmap_do_remove(), called with
a flag that determines whether or not wired mapping should be removed.
pmap_collect() calls pmap_do_remove() without this flag, and pmap_remove()
calls with it.
Pointed out on port-mac68k with suggested fix from chs.
 1.69 14-Jan-2001  thorpej splimp() -> splvm()
 1.68 13-Sep-2000  thorpej Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
 1.67 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.66 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.65 26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
* Remove the casts to vaddr_t from the round_page() and trunc_page() macros to
make them type-generic, which is necessary i.e. to operate on file offsets
without truncating them.
* In due course, cast pointer arguments to these macros to an appropriate
integral type (paddr_t, vaddr_t).

Originally done by Chuck Silvers, updated by myself.
 1.64 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.63 12-Sep-1999  chs branches: 1.63.2; 1.63.4; 1.63.8;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.62 08-Jul-1999  thorpej Fix typos in previous.
 1.61 08-Jul-1999  thorpej 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.60 17-Jun-1999  thorpej pmap_change_wiring() -> pmap_unwire().
 1.59 17-Jun-1999  thorpej Remove pmap_pageable(); no pmap implements it, and it is not really useful,
because pmap_enter()/pmap_change_wiring() (soon to be pmap_unwire())
communicate the information in greater detail.
 1.58 15-Jun-1999  thorpej Don't (ab)use uvm_map_pageable() to allocate PT pages. Instead, do
some internal reference counting on PT pages. We still allocate them
with the page fault routine (a wire-fault, now), but no longer free
PT pages from pmap_pageable().
 1.57 26-May-1999  thorpej Change the vm_map's "entries_pageable" member to a r/o flags member, which
has PAGEABLE and INTRSAFE flags. PAGEABLE now really means "pageable",
not "allocate vm_map_entry's from non-static pool", so update all map
creations to reflect that. INTRSAFE maps are maps that are used in
interrupt context (e.g. kmem_map, mb_map), and thus use the static
map entry pool (XXX as does kernel_map, for now). This will eventually
change now these maps are locked, as well.
 1.56 02-May-1999  scottr Remove a (harmless) duplicated line.
 1.55 22-Apr-1999  chs in pmap_pageable(), rather than marking a PT page as not modified
to trick the pagedaemon into freeing it later, just unmap the page
and free it immediately. fixes PR 7337.
 1.54 07-Apr-1999  scottr Cleanup: GC unused externs, and some KNF.
 1.53 05-Apr-1999  scottr Pull in the many and various hp300 pmap changes that Jason's done
so far this year. There are very few appreciable differences left
between this code and the hp300 version.
 1.52 27-Mar-1999  mycroft branches: 1.52.2;
Fix a bug in pmap_collect_pv(), even though nobody currently uses it:
When we put a page on the collection list, we must subtract NPVPPG from the
total free count: one for each pv_entry that's free in that page, and one for
each free pv_entry in other pages that we're going to eat by moving the ones
in the page being collected.
 1.51 27-Mar-1999  mycroft Oops; forgot to change some pmap_enter() calls.
 1.50 26-Mar-1999  mycroft Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.49 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.48 25-Feb-1999  is branches: 1.48.2;
mac68k part of pr 6152 fix, and missing bits for the others
 1.47 22-Dec-1998  scottr vm_offset_t -> {paddr_t, vaddr_t}
 1.46 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.45 27-May-1998  scottr In pmap_check_wiring(), be careful to use uvm_map_lookup_entry() if we're
using UVM. Notice by Hauke Fath, no PR generated.
 1.44 27-May-1998  scottr PG_PTPAGE is only useful if !UVM. Noted by Hauke Fath in
PR 5462.
 1.43 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.42 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.41 19-May-1998  thorpej It is no longer necessary for pmap_pinit() and pmap_release() to be
pmap interface functions, as NetBSD no longer uses statically allocated
pmaps (except for the kernel pmap, which is special-cased anyhow).
 1.40 26-Apr-1998  scottr Correct thinko in last commit
 1.39 26-Apr-1998  scottr GC the old MACHINE_NONCONTIG code.
 1.38 25-Apr-1998  scottr Conditionalize some code that is only needed in the MACHINE_NONCONTIG
case. Eventually we'll want to GC this.
 1.37 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.36 31-Jan-1998  ross In some hp300-derived pmaps, in pmap_page_protect(), don't walk off the
end of the list of physical->virtual entires into NULL space if the last
entry is (mysteriously) wired in the pmap. Add a DEBUG printf on alpha.
 1.35 06-Jan-1998  thorpej Garbage-collect pm_stchanged; it's not used by anything.
 1.34 06-Jan-1998  thorpej Garbage-collect use of the PCB's copy of the user segment table pointer.
 1.33 01-Jan-1998  thorpej - Make pmap_activate() and pmap_deactivate() take a struct proc *.
- Define active_user_pmap() and use it in the appropriate places (from hp300
port).
 1.32 10-Jun-1997  veego branches: 1.32.8;
s/mac68k_trunc_page/m68k_trunc_page/ s/mac68k_btop/m68k_btop/
s/mac68k_ptob/m68k_ptob/
 1.31 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.30 02-Feb-1997  scottr copypage() is now declared in m68k/cpu.h
 1.29 02-Feb-1997  thorpej Use zeropage() in pmap_zero_page()
 1.28 21-Oct-1996  scottr Fix a raft of printf format strings and some declaration problems for
the case where we define DEBUG. From Erik Bertelsen, closes PR 2871.
 1.27 13-Oct-1996  christos backout previous kprintf change
 1.26 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.25 07-May-1996  briggs No mac has a VAC.
 1.24 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.23 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.22 03-Dec-1995  briggs Fix from Niklas Hallqvist / Chuck Cranor / Michael Hitch / OpenBSD to avoid
integer overflow in initial pmap setup. Triggerred by high values for
maxusers.
 1.21 10-Oct-1995  briggs Nuke blkclr and use thereof.
 1.20 16-Sep-1995  briggs Fix segment table reference bug (from Michael Hitch).
 1.19 08-Jul-1995  briggs Clean up a lot. Run machdep.c through indent.
Remove a bunch of old debugging code and some dead code.
Put in some new comments. Need more.
 1.18 22-Jun-1995  briggs Add avail_end to keep ps and friends happy. Possibly a short-term fix.
 1.17 21-Jun-1995  briggs Lots of changes from hp300.
Removed MACHINE_NONCONTIG conditionals. Only support that
configuration, now.
Some cleanup.
 1.16 10-Apr-1995  mycroft Bring back pmap_kernel(), for now always inlined as a pointer to
kernel_pmap_store.
 1.15 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.14 26-Oct-1994  cgd new RCS ID format.
 1.13 08-Aug-1994  lkestel Added ifdef'ed out code to map the ROM in pmap_init(). Might be enabled
later if we decide to use the ROM's for anything.
 1.12 31-Jul-1994  lkestel Removed two useless variables. (hole_start, hole_end)
 1.11 31-Jul-1994  lkestel Added support for MACHINE_NONCONTIG for IIsi and IIci machines. Similar
to i386's, but more flexible to handle awkward MacOS maps. pmap_collect()
is noop'ed out for now.
 1.10 26-Jun-1994  briggs branches: 1.10.2;
mmap -> pmap_mmap.
extiobase -> NuBusBase
intiobase -> IOBase
some other minor changes.
 1.9 22-Apr-1994  briggs Make external definition for cpu040.
trap.c: Fix dumb (but compilable and linkable) typo.
 1.8 21-Apr-1994  briggs '040 changes from Amiga.
 1.7 18-Apr-1994  briggs Include cop.
Nuke vm_statistics.h
Don't try to use PAGE_SIZE in pmap_bootstrap. It's now a reference
to a variable that won't be set until vm_set_page_size() is called
in vm_mem_init().
 1.6 06-Apr-1994  briggs Don't define DEBUG by default.
 1.5 22-Feb-1994  briggs Changes by lkestel for MACHINE_NONCONTIG. I haven't tested them, but
they'll come in handy for the IIci and friends.
 1.4 11-Jan-1994  briggs Yank a reference to a variable that bit the dust.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.10.2.1 11-Aug-1994  mycroft update from trunk
 1.32.8.1 07-Feb-1998  mellon Pull up 1.36 (ross)
 1.48.2.4 28-Nov-1999  scottr Sync with main branch.
 1.48.2.3 01-Nov-1999  scottr Sync with main branch.
 1.48.2.2 15-Jun-1999  scottr Sync with main branch.
 1.48.2.1 16-May-1999  scottr Sync with main branch.
 1.52.2.2 26-Apr-1999  perry branches: 1.52.2.2.2;
pullup 1.54->1.55 (chuq)
 1.52.2.1 21-Apr-1999  perry pullup 1.52->1.54 (scottr): sync to hp300 pmap
 1.52.2.2.2.2 02-Aug-1999  thorpej Update from trunk.
 1.52.2.2.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.63.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.63.4.1 15-Nov-1999  fvdl Sync with -current
 1.63.2.5 23-Apr-2001  bouyer Sync with HEAD.
 1.63.2.4 27-Mar-2001  bouyer Sync with HEAD.
 1.63.2.3 12-Mar-2001  bouyer Sync with HEAD.
 1.63.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.63.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.70.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.70.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.77.2.6 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.77.2.5 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.77.2.4 16-Mar-2002  jdolecek Catch up with -current.
 1.77.2.3 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.77.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.77.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.78.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.80.4.11 11-Nov-2002  nathanw Catch up to -current
 1.80.4.10 18-Oct-2002  nathanw Catch up to -current.
 1.80.4.9 05-Oct-2002  gmcgarry Missing brace.
 1.80.4.8 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.80.4.7 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.80.4.6 20-Jun-2002  nathanw Catch up to -current.
 1.80.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.80.4.4 08-Jan-2002  nathanw Catch up to -current.
 1.80.4.3 04-Dec-2001  scw Missed a s/proc/lwp/ with DEBUG defined.
Noted by Gregory McGarry in a commit messsage for hp300.
 1.80.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.80.4.1 29-Sep-2001  scw file pmap.c was added on branch nathanw_sa on 2001-11-18 18:12:03 +0000
 1.86.6.1 30-May-2002  gehenna Catch up with -current.
 1.97 08-Apr-2025  nat Move high back an additional 7 pages to fix crashing on kernels with
ascaudio(4) enabled.

Memory in this region is used by the EASC on some machines and mapping
this memory can lead to crashes and dmesg corruption.

As posted to tech-kern:
https://mail-index.netbsd.org/tech-kern/2024/10/24/msg029804.html

With enhancements as suggested by abs@.
 1.96 24-Jul-2021  andvar branches: 1.96.16;
Fix all remaining typos, mainly in comments but also in few definitions and log messages, reported by me in PR kern/54889.
Also fixed some additional typos in comments, found on review of same files or typos.
 1.95 18-Aug-2019  rin branches: 1.95.12;
0x%p ---> %p
 1.94 16-Jul-2013  jklos branches: 1.94.32;
Added DJMEMCMAX option for recognizing 128 meg SIMMs in Centris and Quadra
610, 650 and 800 systems. From Rob Braun,
http://synack.net/~bbraun/netbsdmac2.html
 1.93 10-Feb-2012  mhitch branches: 1.93.6; 1.93.10;
The recent kmem changes allocate a large kernel address space before
pmap_init() is called, and the initial kernel PT pages aren't enough
for the allocations pmap_init(). This fails because pmap_kenter_pa()
tries to allocate a new kernel PT page and traps because the pmap has
not been initialized. When computing the number if initial kernel PT
pages, include enough to allow kmem to map the physical memory. This
should fix PR/45915. OK by releng@. One mac68k system has been verified
to boot. Volunteers to test the others welcome. Amigas with at least
up to 128MB of memory were OK, but larger memory will need some adjusting.
 1.92 02-Jan-2011  tsutsui branches: 1.92.8; 1.92.12;
Tidy up common comments. (Yes, too many dup code...)
 1.91 02-Jan-2011  tsutsui Pull code that maps the kernel segment table cache invalidated for 040/060,
to reduce diffs from other m68k ports.

Tested on LC630 (with 68LC040) upto single user.
 1.90 02-Jan-2011  tsutsui Misc cosmetics to reduce diff among hp300 derived m68k ports.
XXX: too many quirks to merge...
 1.89 06-Jun-2010  mrg 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.88 02-Mar-2010  tsutsui branches: 1.88.2;
A variable protostfree is only declared for M68040 or M68060 kernels,
so it should also be wrapped with #ifdef M68040/#endif in MD sources.

Fixes build error on SMALLRAM kernel, reported by hauke@.
 1.87 11-Dec-2009  tsutsui branches: 1.87.2;
Use appropriate macro during pmap initialization:
- use SYSMAP_VA, SEGSHIFT for Sysmap address and table entries
- use TIA_SIZE, TIB_SIZE for sizes of table entries

Now page size dependent numbers are almost replaced with proper macro.

Tested on atari, hp300, and news68k.
 1.86 06-Dec-2009  tsutsui Move initialization of protection_codes[] and kernel_pmap()
from MD pmap bootstrap sources to common pmap_bootstrap_finalize().

Tested on atari, hp300, mac68k, and news68k.

XXX: Why is protection_codes[] array initialized at run time?
 1.85 06-Dec-2009  tsutsui Sync MMU table initialization with amiga and atari a bit:

- for 040/060, move L2 descs for Sysptmap from the last L2 block in segment
table pages to the contiguous block with ones for segment table mappings

- for 020/030, invalidate ste and pte entries separately since
ste size (TIA_SIZE) and pte size (TIB_SIZE) could be different
on 8KB/page systems

Tested on hp300 (040), mac68k (LC040), and news68k (030)
(and untested on others).

XXX: some more stuff in pmap_bootstrap.c could be moved into
XXX: common pmap_bootstrap_finalize()?
 1.84 05-Dec-2009  tsutsui Use proper macro, variable names, types, and assignments for readability.
 1.83 04-Dec-2009  tsutsui Allocate lwp0upa (PA of lwp0 uarea) right after kernel rather than
between other page tables to use different mappings for ste/pte pages
as well as amiga and atari. Should resolve XXX comments in next68k and x68k.

Tested on hp300 and mac68k.
 1.82 04-Dec-2009  tsutsui No need to initialize lwp0 u-area in pmap_bootstrap()
since it will be done in pmap_bootstrap_finalize().
 1.81 04-Dec-2009  tsutsui Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Tested on LC630.
 1.80 27-Nov-2009  rmind - Use uvm_lwp_setuarea() instead of directly setting address to lwp_t::l_addr.
- Replace most remaining uses of l_addr with uvm_lwp_getuarea() or lwp_getpcb().
- Amend assembly in ports where it accesses PCB via struct user.
- Rename L_ADDR to L_PCB in few places. Reduce sys/user.h inclusions.
 1.79 26-Nov-2009  matt Kill proc0paddr. Use lwp0.l_addr instead.
 1.78 11-Aug-2009  matt Remove all declarations of physmem from sys/arch. Add an include of
<sys/systm.h> to the one file that did not already contain it.
This now means that physmem can be changed by updating systm.h and uvm_page.c
(excluding fixing printfs)
 1.77 17-Jan-2009  tsutsui Move extern decls for Sysseg, Sysptmap, Sysptsize, mem_size, virtual_avail,
virtual_end, and protection_codes[] to common <m68k/pmap_motorola.h>,
and also make protection_codes[] unsigned.

XXX: avail_start and avail_end should also be moved, but it causes
XXX: -Wshadow warnings in uvm/uvm_page.c:uvm_page_physload() and
XXX: I don't have a good idea of alternative names for now.
 1.76 10-Jan-2009  tsutsui Remove unnecessary "last kernel PT page" mapping.
The lkptpa was required for hp300 (where PA != VA)
to prepare a page PA == VA to turn on the MMU,
and it is not needed for mac68k which has PA == VA
mappings even in kernel text/data/bss. Tested on LC630.
 1.75 28-Dec-2008  tsutsui Use the global kernel_pmap_ptr pointer in each MD pmap_bootstrap.c
(where MMU is not enabled yet) and make kernel_pmap_store static again.
Also consistently use uintptr_t on address conversion in RELOC() macro.

Tested on hp300 (PA != VA) and news68k (PA == VA).
 1.74 17-Oct-2007  garbled branches: 1.74.16; 1.74.20; 1.74.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.73 29-Aug-2007  jmmv Pack all global video-related variables into a structure for clarity.

A comment said that they weren't in a struct for speed reasons but...
this should not affect performance because these variables are mostly
used to set other variables (hence they are read few times).
 1.72 29-Aug-2007  jmmv Move the definition of multiple video-related variables into a new
header file (machine/video.h) so that we can kill all the "manual"
externs spread around the code (which were inconsistent among them).
 1.71 29-Aug-2007  jmmv Split the global videosize variable into videowidth and videoheight:
makes the code clearer and avoids multiple parts of it having to know
how videosize was encoded.
 1.70 01-Aug-2007  dogcow branches: 1.70.2; 1.70.4;
remove historical include no longer needed; fixes build breakage.
 1.69 18-May-2007  tsutsui branches: 1.69.2; 1.69.4;
Update comments to sync yamt-km merge (Sysmap has been moved).

See also:
http://mail-index.netbsd.org/source-changes/2005/02/23/0004.html
 1.68 05-Mar-2007  tsutsui branches: 1.68.2; 1.68.4; 1.68.10;
Allocate msgbufaddr in pmap_bootstrap.c where it's initilized,
and move its declaration into <m68k/pmap_motorola.h>.
 1.67 05-Mar-2007  tsutsui - add missed '*'
- vmmap is (char *) in pmap_motorola.h
 1.66 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.65 20-Nov-2006  hauke branches: 1.65.4;
Add Timecounter support for mac68k, using the otherwise idle second
timer of VIA1. Passes regression/sys/kern/time regression test.

While we are here, GC leftover prototypes from MI todr integration,
and clean up clockreg.h in the light of "Guide to the Macintosh
Hardware" information.

(Reviewed and okayed by Martin Husemann)
 1.64 11-Dec-2005  christos branches: 1.64.20; 1.64.22;
merge ktrace-lwp.
 1.63 01-Apr-2005  yamt branches: 1.63.2;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.62 05-Feb-2005  chs always map kernel text read-only.
 1.61 15-Jan-2005  chs branches: 1.61.2; 1.61.4;
de-__P, remove register, ansify, b* -> mem*.
 1.60 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.59 15-Jul-2003  lukem __KERNEL_RCSID()
 1.58 02-Apr-2003  thorpej branches: 1.58.2;
Use PAGE_SIZE rather than NBPG.
 1.57 05-Nov-2002  chs merge pmap.c for all 4k-page motorola-MMU (or compatible) m68k platforms.
 1.56 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.55 30-May-2001  lukem branches: 1.55.2; 1.55.8;
add missing #include "opt_kgdb.h"
 1.54 29-Jun-2000  mrg branches: 1.54.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.53 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.52 12-Dec-1999  scottr Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.51 02-May-1999  scottr branches: 1.51.2; 1.51.8;
g/c some useless calculation on avail_remaining after its last reference.
 1.50 07-Apr-1999  scottr Turn avail_next, avail_range, and avail_remaining into local variables. Also,
change vm_size_t -> vsize_t.
 1.49 27-Mar-1999  briggs branches: 1.49.2;
Allow this to compile if NZSC is 0.
 1.48 22-Dec-1998  scottr branches: 1.48.2;
vm_offset_t -> {paddr_t, vaddr_t}
 1.47 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.46 07-Jul-1998  scottr Account for an offset frame buffer address. This change is somewhat
different than the one supplied by Paul Goyette in PR 5702, but
has the same effect.
 1.45 04-Jul-1998  jonathan defopt DDB.
 1.44 30-Jun-1998  scottr Fix warnings from recent ddb_init() change: handle end and esym
consistently.
 1.43 24-May-1998  scottr Rewrite doboot() so that it turns off the MMU, rather than relying
on the ROM space being mapped where it would like to be.
 1.42 26-Apr-1998  scottr GC several unused NuBus-related variable. While here, do some KNFing.
 1.41 24-Apr-1998  scottr From Allen: deal with avail_end correctly. This is simple
with the recent modifications to get_mapping() which caused it to
maintain a sorted segment list.
 1.40 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.39 01-Dec-1997  scottr We don't do old-style miniroots anymore.
 1.38 20-Oct-1997  scottr branches: 1.38.2;
Convert to MI 8530 SCC driver, from Bill Studenmund. The new front end
also supports DTR/CTS flow control.
 1.37 19-Sep-1997  leo Implement the kernel part of pr-1891. This allows for a more flexible sized
msgbuf. Note that old 'dmesg' and 'syslogd' binaries will continue running,
though old 'dmesg' binaries will output a few bytes of junk at the start of
the buffer, and will miss a few bytes at the end of the buffer.
 1.36 04-Sep-1997  scottr Back out last commit; it interfered with NuBus video, and will
have to be reworked.
 1.35 03-Sep-1997  scottr Two video-related changes:

- Only set mac68k_vidphys if we're on a machine that we couldn't get
the Mac OS memory map.
- If we could get the Mac OS memory map, use the framebuffer size found
by get_mapping() rather than the size calculated using the Booter
environment.
 1.34 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.33 19-Jun-1997  scottr branches: 1.33.4;
Mask off page offset when building a pte for mapping the
framebuffer; from Walter Ruetten, closes PR 3147.
 1.32 10-Jun-1997  veego s/mac68k_round_page/m68k_round_page/ s/mac68k_trunc_page/m68k_trunc_page/
s/mac68k_btop/m68k_btop/ s/mac68k_ptob/m68k_ptob/
 1.31 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.30 07-Jan-1997  scottr If 040 MMU is enabled, attempt to get memory mapping. (At present, this
can't happen because we've faked a disabled MMU.)
 1.29 15-Oct-1996  scottr BSD -> NetBSD
 1.28 13-Oct-1996  christos backout previous kprintf change
 1.27 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.26 18-May-1996  briggs Serial driver with interface to a slightly modified version of the machine-
independent z8530 driver. When that driver is updated, the local copy
of those files may be removed. From Bill Studenmund.
Compiler warnings fixed by me.
 1.25 15-May-1996  briggs Set mac68k_vidphys outside of get_mapping() so the II and others will
get the default value correctly.
 1.24 14-May-1996  briggs Add a short comment.
 1.23 06-May-1996  briggs Add 1 page slop to the video length. Only reset mac68k_vidlog if non-zero.
 1.22 06-May-1996  briggs Do not allocate NuBus space at boot time. Do allocate enough space for
the console video, though.
 1.21 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.20 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.19 27-Feb-1996  briggs Use IOBase instead of INTIOBASE.
 1.18 10-Feb-1996  briggs Make a message more verbose for folks who try to boot in 24-bit mode.
 1.17 02-Oct-1995  briggs Add offset to mac68k_vidlog as suggested by chas@ohm.nrl.navy.mil.
 1.16 28-Sep-1995  briggs Always announce it when loading miniroot.
 1.15 27-Sep-1995  briggs Patch from Theo to finish clearing 040 kernel page tables.
 1.14 09-Aug-1995  briggs Make sure we don't remap video/serial before we're done writing to it.
 1.13 04-Aug-1995  briggs Get rid of int_video_{start,length} and wierd nubus mapping.
 1.12 23-Jul-1995  briggs Some debugging code added.
 1.11 19-Jul-1995  briggs Use get_mapping only if 030 and MMU enabled. Otherwise, fake it.
 1.10 18-Jul-1995  briggs Add support for:
GENERIC
RB_ASKNAME
RB_MINIROOT
Also revved up the required version of the booter because we need the
booter fixes to get this functionality.
 1.9 08-Jul-1995  briggs Take out bogus message.
 1.8 08-Jul-1995  briggs Clean up a lot. Run machdep.c through indent.
Remove a bunch of old debugging code and some dead code.
Put in some new comments. Need more.
 1.7 06-Jul-1995  briggs Panic if we don't know how to relocate the video address.
 1.6 06-Jul-1995  briggs Fix (last?) bug in the IIvx kludge.
 1.5 04-Jul-1995  briggs First cut at a kludge for IIvx internal video.
 1.4 28-Jun-1995  briggs Some random cleanup and some cleanup of the dump routines, modelled on
i386. Untested. Remove old mac68k-specific stack trace code, etc. as
the cleanup.
 1.3 25-Jun-1995  briggs Get the units right...
 1.2 22-Jun-1995  briggs Add avail_end to keep ps and friends happy. Possibly a short-term fix.
 1.1 21-Jun-1995  briggs Put page mapping code into a C module.
Remove old 040 version of page mapping--new way handles 040, too.
Derived from hp300 pmap_boostrap.c.
 1.33.4.4 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.3 06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.2 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.38.2.2 23-Nov-1998  cgd pull up rev 1.46 from trunk, via patch. (scottr)
 1.38.2.1 23-Nov-1998  cgd Pull up a patch consisting of rev 1.43, backported to 1.3-branch.
Rewrite doboot() so that it turns off the MMU, rather than relying
on the ROM space being mapped where it would like to be. (scottr)
 1.48.2.4 12-Dec-1999  scottr Sync with main branch.
 1.48.2.3 23-May-1999  scottr Refine the check for physical RAM segment sanity so that it stands a
chance of working on the IIci and IIsi. (I wonder how this managed
to work after I put in code to sort the segments some time back...)
 1.48.2.2 16-May-1999  scottr Sync with main branch.
 1.48.2.1 08-Mar-1999  scottr Add output-side support, using existing intvid/macvid support.
 1.49.2.1 21-Apr-1999  perry branches: 1.49.2.1.2;
pullup 1.49->1.50 (scottr): sync to hp300 pmap
 1.49.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.51.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.51.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.54.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.55.8.3 11-Nov-2002  nathanw Catch up to -current
 1.55.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.55.8.1 30-May-2001  nathanw file pmap_bootstrap.c was added on branch nathanw_sa on 2002-10-18 02:38:25 +0000
 1.55.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.58.2.6 01-Apr-2005  skrll Sync with HEAD.
 1.58.2.5 06-Feb-2005  skrll Sync with HEAD.
 1.58.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.58.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.58.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.58.2.1 03-Aug-2004  skrll Sync with HEAD
 1.61.4.4 28-Feb-2005  yamt sync some whitespace and comments among m68k pmap_bootstrap variants.
no functional changes.
 1.61.4.3 23-Feb-2005  yamt remove redundant initialization of l2 descriptors.
 1.61.4.2 23-Feb-2005  yamt change mac68k's kernel address space layout in order to simplify
interaction between upper layer of the vm during bootstrap.
- move Sysmap to the end of address space.
- move IOBase etc immediately after proc0 uarea.
- tweak virtual_avail/end accordingly.

tested by Chuck Silvers, on his quadra 950.
XXX this breaks other m68k platforms. i'll fix them later.
 1.61.4.1 12-Feb-2005  yamt sync with head.
 1.61.2.1 29-Apr-2005  kent sync with -current
 1.63.2.2 03-Sep-2007  yamt sync with head.
 1.63.2.1 30-Dec-2006  yamt sync with head.
 1.64.22.1 10-Dec-2006  yamt sync with head.
 1.64.20.1 12-Jan-2007  ad Sync with head.
 1.65.4.1 12-Mar-2007  rmind Sync with HEAD.
 1.68.10.2 03-Oct-2007  garbled Sync with HEAD
 1.68.10.1 22-May-2007  matt Update to HEAD.
 1.68.4.1 11-Jul-2007  mjf Sync with head.
 1.68.2.3 09-Oct-2007  ad Sync with head.
 1.68.2.2 20-Aug-2007  ad Sync with HEAD.
 1.68.2.1 27-May-2007  ad Sync with head.
 1.69.4.2 03-Sep-2007  skrll Sync with HEAD.
 1.69.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.69.2.1 07-Aug-2007  matt Sync with HEAD.
 1.70.4.1 06-Nov-2007  matt sync with HEAD
 1.70.2.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.74.28.1 19-Jan-2009  skrll Sync with HEAD.
 1.74.20.4 11-Aug-2010  yamt sync with head.
 1.74.20.3 11-Mar-2010  yamt sync with head
 1.74.20.2 19-Aug-2009  yamt sync with head.
 1.74.20.1 04-May-2009  yamt sync with head.
 1.74.16.1 17-Jan-2009  mjf Sync with HEAD.
 1.87.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.87.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.88.2.2 05-Mar-2011  rmind sync with head
 1.88.2.1 03-Jul-2010  rmind sync with head
 1.92.12.1 18-Feb-2012  mrg merge to -current.
 1.92.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.92.8.1 17-Apr-2012  yamt sync with head
 1.93.10.1 28-Aug-2013  rmind sync with head
 1.93.6.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.94.32.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.95.12.1 01-Aug-2021  thorpej Sync with HEAD.
 1.96.16.1 02-Aug-2025  perseant Sync with HEAD
 1.25 02-Dec-2020  wiz comparision -> comparison
 1.24 19-Jun-2020  tsutsui branches: 1.24.2;
KNF.
 1.23 26-Mar-2014  christos kill sprintf
 1.22 21-Jun-2006  rjs branches: 1.22.96; 1.22.106; 1.22.112;
Rename shadowing time variable.
 1.21 11-Dec-2005  christos branches: 1.21.4; 1.21.8; 1.21.16;
merge ktrace-lwp.
 1.20 29-Oct-2005  christos Fix more debug const fallout from Hauke Fath.
 1.19 15-Jul-2003  lukem branches: 1.19.16; 1.19.18;
__KERNEL_RCSID()
 1.18 28-Jun-1999  briggs branches: 1.18.36;
Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.17 21-Feb-1998  scottr branches: 1.17.8; 1.17.12;
Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.16 11-Nov-1997  scottr Fix typo in last change that causes lossage depending on
whether the MRG_ADB option is used or not.
 1.15 07-Nov-1997  scottr Update from John Wittkoski: bug fixes for Cuda support.
 1.14 11-Aug-1997  scottr branches: 1.14.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.13 14-Apr-1997  scottr branches: 1.13.4;
Use the new opt_mrg_adb.h header.
 1.12 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.11 21-Oct-1996  scottr Fix a raft of printf format strings and some declaration problems for
the case where we define DEBUG. From Erik Bertelsen, closes PR 2871.
 1.10 13-Oct-1996  christos backout previous kprintf change
 1.9 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.8 31-Mar-1996  scottr Make this compile again by including <sys/types.h>
 1.7 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.6 17-Sep-1995  briggs Fix from Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>
to prevent his last changes from causing a panic if some
values are not filled in in the ROM vector table.
 1.5 15-Feb-1995  briggs Add support from Erik Vogan for reading and writing PRAM. Don't enable
writing yet, though.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.13.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.14.4.2 12-Nov-1997  mellon Pull rev 1.16 up from trunk (scottr)
 1.14.4.1 11-Nov-1997  mellon Pull rev 1.15 up from trunk (scottr)
 1.17.12.1 01-Jul-1999  thorpej Sync w/ -current.
 1.17.8.1 01-Nov-1999  scottr Sync with main branch.
 1.18.36.4 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.18.36.1 03-Aug-2004  skrll Sync with HEAD
 1.19.18.1 02-Nov-2005  yamt sync with head.
 1.19.16.1 21-Jun-2006  yamt sync with head.
 1.21.16.1 13-Jul-2006  gdamore Merge from HEAD.
 1.21.8.1 26-Jun-2006  yamt sync with head.
 1.21.4.1 09-Sep-2006  rpaulo sync with head
 1.22.112.1 18-May-2014  rmind sync with head
 1.22.106.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.96.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 14-Dec-2020  thorpej Sync w/ HEAD.
 1.7 11-Dec-2005  christos merge ktrace-lwp.
 1.6 05-Mar-2005  chs remove some more __P that I missed before.
 1.5 15-Jan-2005  chs branches: 1.5.2; 1.5.4;
de-__P, remove register, ansify, b* -> mem*.
 1.4 08-Apr-1997  scottr branches: 1.4.58;
Updates from John Wittkoski for new ADB driver.
 1.3 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.2 16-Feb-1995  briggs Fix copyright, add CVS version, and cleanup comments.
 1.1 15-Feb-1995  briggs Add support from Erik Vogan for reading and writing PRAM. Don't enable
writing yet, though.
 1.4.58.2 08-Mar-2005  skrll Sync with HEAD.
 1.4.58.1 17-Jan-2005  skrll Sync with HEAD.
 1.5.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.5.2.1 29-Apr-2005  kent sync with -current
 1.10 23-May-2022  andvar s/boundries/boundaries/, s/itterate/iterate/ and few more typos.
 1.9 07-Sep-2013  chs switch to ELF naming for local labels.
 1.8 20-Nov-2001  chs branches: 1.8.156; 1.8.166; 1.8.172;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.7 21-Feb-1998  scottr branches: 1.7.30; 1.7.34;
Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.6 15-Apr-1997  scottr Use opt_mrg_adb.h header (missed in previous commit)
 1.5 08-Apr-1997  scottr Updates from John Wittkoski for new ADB driver.
 1.4 28-Sep-1995  briggs Fix PR 1514 from Walter Ruetten.
 1.3 16-Sep-1995  briggs Fixes from walter@ghpc8.ihf.rwth-aachen.de (Walter Ruetten)
to use ROM routines to read and write PRAM times, etc..
 1.2 21-Jun-1995  briggs Don't use constants for addresses. VA != PA...
 1.1 15-Feb-1995  briggs Add support from Erik Vogan for reading and writing PRAM. Don't enable
writing yet, though.
 1.7.34.1 08-Jan-2002  nathanw Catch up to -current.
 1.7.30.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.8.172.1 18-May-2014  rmind sync with head
 1.8.166.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.8.156.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.4 14-Nov-2004  christos Eliminate copies of functions that do nothing.
 1.3 15-Jul-2003  lukem __KERNEL_RCSID()
 1.2 18-Jan-2001  tv branches: 1.2.24;
No-op commit to force update to a non-"-kk" revision.
 1.1 17-Jan-2001  fvdl branches: 1.1.2;
Add machdep file for procfs. Currently only used for linux-style
/proc/cpuinfo (only active when procfs is mounted with -o linux).
For ports other than the i386 this currently produces an empty
string.
 1.1.2.2 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.1.2.1 17-Jan-2001  bouyer file procfs_machdep.c was added on branch thorpej_scsipi on 2001-01-18 09:22:40 +0000
 1.2.24.4 29-Nov-2004  skrll Sync with HEAD.
 1.2.24.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.2.24.2 18-Sep-2004  skrll Sync with HEAD.
 1.2.24.1 03-Aug-2004  skrll Sync with HEAD
 1.11 23-Jul-2019  rin PR port-mac68k/24883

Support DMA xfer for SCSI adapter of AV Mac (660/840AV), written by
Michael Zucca.

This improves disk I/O performance by nearly one order of magnitude.
In addition, interrupt storm due to heavy disk PIO is resolved.

I'm deeply grateful to Michael Zucca for his analysis of DMA engine
and submission of PR. I also thank Izumi Tsutsui (useful comments on
port-mac68k@) and Martin Husemann (test on 660AV).
 1.10 11-Dec-2005  christos branches: 1.10.166;
merge ktrace-lwp.
 1.9 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.8 26-Mar-2004  wiz Update David Huang's email address in the license
per his request in PR 24907.
 1.7 15-Jul-2003  lukem __KERNEL_RCSID()
 1.6 28-Jun-1999  briggs branches: 1.6.36;
Add some constants from Linux/mac68k to note SCC, floppy, and SCSI registers.
Add some code, inspired by Linux/mac68k, to shutdown all DMA on the PSC
at startup and to disable and clear all interrupts except the SCC.
 1.5 12-Aug-1998  scottr branches: 1.5.6; 1.5.10;
New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.4 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.3 19-Dec-1997  scottr spurintr() is a low-level interrupt handler, and must not
be called by C code! Spotted by Bill Studenmund, who also provided
#the substance of this change.
 1.2 07-Nov-1997  briggs NetBSD RCSIds.
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.3 20-Dec-1997  perry pullup from trunk (scott)
 1.1.2.2 12-Nov-1997  mellon Pull rev 1.2 up from trunk (briggs)
 1.1.2.1 04-Nov-1997  mellon file psc.c was added on branch netbsd-1-3 on 1997-11-12 02:17:37 +0000
 1.5.10.1 01-Jul-1999  thorpej Sync w/ -current.
 1.5.6.1 01-Nov-1999  scottr Sync with main branch.
 1.6.36.4 17-Jan-2005  skrll Sync with HEAD.
 1.6.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.6.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.6.36.1 03-Aug-2004  skrll Sync with HEAD
 1.10.166.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.2 22-Apr-1995  christos Removed sunos_machdep.c
 1.1 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.11 31-Jan-1997  thorpej This file is obsolete; this information is now generated by config(8).
 1.10 19-Jun-1996  scottr Completely revamp setroot() and friends. Since Chris' version of this code
is close to how I reworked it, I pulled in the (essentially MI) NetBSD/alpha
and added the appropriate support around it.

- No need for the GENERIC kernel config option.
- NFS-mounted root and swap are supported.
- If we can't figure out where the root filesystem is from what the Booter
tells us, ask the user.
- Split the mainbus autoconfig code to a separate file.

Also, update/add copyrights as appropriate.
 1.9 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.8 18-Mar-1996  scottr Update to NetBSD 1.1B struct cfdriver naming conventions.
 1.7 09-Aug-1995  briggs Don't go bonkers if we don't have a real swap device.
 1.6 18-Jul-1995  briggs Add support for:
GENERIC
RB_ASKNAME
RB_MINIROOT
Also revved up the required version of the booter because we need the
booter fixes to get this functionality.
 1.5 26-Oct-1994  cgd new RCS ID format.
 1.4 26-Jun-1994  briggs ufs_mountroot -> ffs_mountroot
 1.3 03-Feb-1994  briggs Cleanup include refs.
 1.2 30-Jan-1994  briggs Use a real swapgeneric.c instead of a place filler. This works with the
changes to autoconf.c...
 1.1 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.2 01-Mar-1995  mycroft Clean up deleted files.
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.20 03-Nov-2002  chs use a merged sys_machdep.c for all the motorola-MMU m68k platforms.
 1.19 28-Oct-2002  chs untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.18 13-Dec-2000  jdolecek branches: 1.18.8;
g/c obsolete vtrace(2) stuff
 1.17 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.16 12-Dec-1999  scottr Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.15 28-Nov-1999  scottr Use a bitwise-and to test CC_IPURGE, not a logical-and. This could have led
to flushing the entire cache unnecessarily.
 1.14 28-Nov-1999  scottr Sync cachectl1() implementation with other m68k ports.
 1.13 26-Feb-1999  is branches: 1.13.2; 1.13.4; 1.13.10; 1.13.16;
synchronize types, and s/curproc/p/ in one forgotten place
 1.12 25-Feb-1999  is mac68k part of pr 6152 fix, and missing bits for the others
 1.11 19-Jan-1999  thorpej No need for <sys/mtio.h>
 1.10 25-Feb-1998  perry note second parm of sysarch() is now void *, + trivial KNF, etc.
 1.9 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.8 02-Feb-1996  mycroft Fix #includes.
 1.7 10-Oct-1995  briggs sysarch -> sys_sysarch
 1.6 21-Sep-1995  briggs Need sys/mount.h for fhandle_t.
 1.5 19-Sep-1995  thorpej Make system calls conform to a standard prototype and bring those
prototypes into scope.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 20-Oct-1994  cgd update for new syscall args description mechanism
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.13.16.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.13.10.2 05-Jan-2001  bouyer Sync with HEAD
 1.13.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.4.2 16-Dec-1999  he Apply patch (from scottr):
Correct minor problem in previous pull-up, preventing compilation
of the kernel.
 1.13.4.1 29-Nov-1999  he Pull up revisions 1.14 and 1.15 (reqyested by scottr):
Fix i-cache/d-cache synchronization for M68040 cpus (see M68040
UM p.4-10). Makes regress/sys/kern/sigtramp work even on M68040.
Fix a typo which caused excessive cache flushes.
 1.13.2.3 12-Dec-1999  scottr Sync with main branch.
 1.13.2.2 28-Nov-1999  scottr Sync with main branch.
 1.13.2.1 28-Nov-1999  scottr Sync with main branch.
 1.18.8.4 11-Nov-2002  nathanw Catch up to -current
 1.18.8.3 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.18.8.2 29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.18.8.1 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.154 20-Jan-2024  thorpej Largely unify the <machine/cpu.h> headers on the m68k platforms.
 1.153 05-Oct-2023  ad Arrange to update cached LWP credentials in userret() rather than during
syscall/trap entry, eliminating a test+branch on every syscall/trap.

This wasn't possible in the 3.99.x timeframe when l->l_cred came about
because there wasn't a reliable/timely way to force an ONPROC LWP running on
a remote CPU into the kernel (which is just about the only new thing in
this scheme).
 1.152 25-Sep-2021  tsutsui Call cnpollc(9) before cngetc(9) as the cons(9) man page says.

Affects only inside #ifdef DEBUG part on "trap during panic" in trap.c
derived from hp300.
 1.151 10-Aug-2020  rin Fix siginfo support for amiga, mac68k, and sun3:

- T_ZERODIV is integer divide by zero. Therefore, ksi_code should be
FPE_INTDIV, not FPE_FLTDIV.

- Set ksi_addr for SIGTRAP. Also, set TRAP_BRKPT or TRAP_TRACE to
ksi_code appropriately.

This fixes some tests in lib/libc/sys and lib/libc/gen.

XXX
Apply similar fixes to other m68k ports.
 1.150 21-Nov-2019  ad mi_userret(): take care of calling preempt(), set spc_curpriority directly,
and remove MD code that does the same.
 1.149 06-Apr-2019  thorpej Overhaul the API used to fetch and store individual memory cells in
userspace. The old fetch(9) and store(9) APIs (fubyte(), fuword(),
subyte(), suword(), etc.) are retired and replaced with new ufetch(9)
and ustore(9) APIs that can return proper error codes, etc. and are
implemented consistently across all platforms. The interrupt-safe
variants are no longer supported (and several of the existing attempts
at fuswintr(), etc. were buggy and not actually interrupt-safe).

Also augmement the ucas(9) API, making it consistently available on
all plaforms, supporting uniprocessor and multiprocessor systems, even
those that do not have CAS or LL/SC primitives.

Welcome to NetBSD 8.99.37.
 1.148 18-Feb-2019  thorpej Refactor the 68040 writeback() from each m68k port's trap handler into a
shared copy: m68040_writeback(). It is essentially a copy of the Atari
version, with some minor cosmetic tweaks and one small performance optimization
from the mvme68k port.

Tested by rjs@ on a Quadra 950. (Thanks!)
 1.147 03-Mar-2015  martin branches: 1.147.18;
Handle EINVAL in the fault path and send SIGBUS on mmap'd access past EOF.
 1.146 19-Feb-2012  rmind branches: 1.146.2; 1.146.16;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.145 08-Feb-2011  rmind branches: 1.145.4; 1.145.8;
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.144 17-Jan-2011  tsutsui branches: 1.144.2;
Explicitly include <machine/pcb.h> for struct pcb.
 1.143 20-Dec-2010  matt branches: 1.143.2;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.142 07-Jul-2010  chs implement ucas_* for m68k.
 1.141 06-Jun-2010  mrg 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.140 20-Mar-2010  chs fix copy{in,out}{,str}() to return the error returned by uvm_fault().
fixes PR 41813.
 1.139 23-Nov-2009  rmind branches: 1.139.2; 1.139.4;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.138 26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.137 18-Mar-2009  cegger bcopy -> memcpy
 1.136 27-Jan-2009  martin branches: 1.136.2;
Centralize fpu exception to siginfo code encoding for all m68k archs,
fixes a failure in the lib/libc/ieeefp/except regression test.
 1.135 11-Jan-2009  martin Decode the fpu status bits into siginfo code values when signaling fpu
traps. This makes us pass all of our ieee regression tests.
 1.134 15-Oct-2008  wrstuden branches: 1.134.2; 1.134.4;
Merge wrstuden-revivesa into HEAD.
 1.133 24-Apr-2008  ad branches: 1.133.2; 1.133.4; 1.133.8;
Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
 1.132 03-Dec-2007  ad branches: 1.132.14; 1.132.16;
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.131 05-Nov-2007  ad branches: 1.131.2;
Don't set l_usrpri / spc_curpriority here. mi_userret() does it.
 1.130 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.129 01-Sep-2007  mhitch branches: 1.129.4;
68030 and 68040 processors consider the read portion of a read-modify-write
transfer as a write to ensure the memory is writable before starting any
transfer. The fault status information does not reflect this in the 'read'
status bit (i.e. it shows up as a read access), so faults with a RMW access
to non-writable memory was not getting the correct protection. The page would
be read-only and the instruction would fault over and over.

A specific example is when a process forks, and the child process attempts
to execute a RMW access to a data page, which is read-only because it's CoP
Copy-On-Write.

When checking if the page needs to be writablek, also check the locked transfer
and treat any locked transfer as a write.

68060 already handled this correctly, since it has separate read and write
fault bits, and both are set on a RMW access and the trap code was checking
the write status bit.

Fixes PR#36848.
 1.128 12-Jun-2007  mhitch branches: 1.128.4; 1.128.8; 1.128.10;
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.127 21-May-2007  tsutsui curlwp can't be NULL so no need to check it.
 1.126 17-May-2007  rjs Start yamt-idlelwp fixes.
 1.125 08-Mar-2007  tsutsui branches: 1.125.2; 1.125.4; 1.125.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.124 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.123 28-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.122 09-Feb-2007  ad branches: 1.122.2;
Merge newlock2 to head.
 1.121 23-Jul-2006  ad branches: 1.121.4; 1.121.8; 1.121.10;
Use the LWP cached credentials where sane.
 1.120 19-Jul-2006  ad - Hold a reference to the process credentials in each struct lwp.
- Update the reference on syscall and user trap if p_cred has changed.
- Collect accounting flags in the LWP, and collate on LWP exit.
 1.119 15-May-2006  yamt include kauth.h for kauth_cred_geteuid.
 1.118 14-May-2006  elad integrate kauth.
 1.117 15-Mar-2006  drochner branches: 1.117.2;
adapt to uvm_fault() interface cleanup: kill the useless 3rd argument
 1.116 11-Dec-2005  christos branches: 1.116.4; 1.116.6; 1.116.8; 1.116.10;
merge ktrace-lwp.
 1.115 29-Oct-2005  christos Fix more debug const fallout from Hauke Fath.
 1.114 03-Jun-2005  rjs branches: 1.114.2; 1.114.4;
Add const.
 1.113 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.112 28-Aug-2004  jdolecek use uvm_grow() to update stack segment size on stack page fault instead
of MD code
 1.111 14-Mar-2004  cl add kernel part of concurrency support for SA on MP systems
- move per VP data into struct sadata_vp referenced from l->l_savp
* VP id
* lock on VP data
* LWP on VP
* recently blocked LWP on VP
* queue of LWPs woken which ran on this VP before sleep
* faultaddr
* LWP cache for upcalls
* upcall queue
- add current concurrency and requested concurrency variables
- make process exit run LWP on all VPs
- make signal delivery consider all VPs
- make timer events consider all VPs
- add sa_newsavp to allocate new sadata_vp structure
- add sa_increaseconcurrency to prepare new VP
- make sys_sa_setconcurrency request new VP or wakeup idle VP
- make sa_yield lower current concurrency
- set sa_cpu = VP id in upcalls
- maintain cached LWPs per VP
 1.110 08-Nov-2003  tsutsui Remove obsolete comments about curproc.
 1.109 02-Nov-2003  cl Extend the #ifdef M68040 so that the `sig' variable declaration is moved
in as well, as it's otherwise not used. (from atari/atari/trap.c and
x68k/x68k/trap.c)
 1.108 31-Oct-2003  cl Reduce code duplication by adding mi_userret() in sys/userret.h
containing signal posting, kernel-exit handling and sa_upcall processing.

XXX the pc532, sparc, sparc64 and vax ports should have their
XXX userret() code rearranged to use this.
 1.107 08-Oct-2003  thorpej * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
result of a trap. Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap. Expands to 0 if the ksiginfo_t was
not the result of a trap. This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern. Reviewed and OK's by Christos.
 1.106 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.105 17-Sep-2003  cl add MD part of SA/pthread pagefault handling on all m68k ports
 1.104 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.103 15-Jul-2003  lukem __KERNEL_RCSID()
 1.102 23-Jun-2003  martin branches: 1.102.2;
Make sure to include opt_foo.h if a defflag option FOO is used.
 1.101 02-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.100 17-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.99 28-Oct-2002  chs branches: 1.99.2;
untangle includes a bit:
don't include cpu.h in pmap.h, nor cacheops.h in cpu.h. instead,
include cpu.h and cacheops.h in just those .c files that need them.
 1.98 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.97 14-Feb-2002  chs allow writing to write-only mappings. fixes PR 3493.
 1.96 10-Sep-2001  chris branches: 1.96.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.95 02-Jun-2001  chs branches: 1.95.2; 1.95.4;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.94 30-May-2001  lukem add missing #include "opt_kgdb.h"
 1.93 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.92 15-Mar-2001  chs 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.91 17-Jan-2001  thorpej branches: 1.91.2;
Remove local declaration of softclock().
 1.90 17-Jan-2001  ender Fix softclock prototype.
 1.89 15-Jan-2001  thorpej Make softclock a generic soft interrupt of the API is available,
adding the requisite void * argument to softclock().
 1.88 22-Dec-2000  jdolecek split off thread specific stuff from struct sigacts to struct sigctx, leaving
only signal handler array sharable between threads
move other random signal stuff from struct proc to struct sigctx

This addresses kern/10981 by Matthew Orgass.
 1.87 19-Dec-2000  scw Unification of the m68k syscall() function.
 1.86 21-Nov-2000  tsutsui s/struct const sysent/const struct sysent/

(BTW, luna68k was missed in emul/execsw changes?)
 1.85 21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.84 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.83 27-Jun-2000  mrg remove redudant <vm/pmap.h> includes. <vm/pmap.h> -> <uvm/uvm_pmap.h>
 1.82 06-Jun-2000  soren defopt SYSCALL_DEBUG.
 1.81 27-May-2000  sommerfeld branches: 1.81.2;
Reduce use of curproc in several places:

- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

- Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

- Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

- ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

- move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

- simplify interface to ktrwrite()
 1.80 26-May-2000  thorpej First sweep at scheduler state cleanup. Collect MI scheduler
state into global and per-CPU scheduler state:

- Global state: sched_qs (run queues), sched_whichqs (bitmap
of non-empty run queues), sched_slpque (sleep queues).
NOTE: These may collectively move into a struct schedstate
at some point in the future.

- Per-CPU state, struct schedstate_percpu: spc_runtime
(time process on this CPU started running), spc_flags
(replaces struct proc's p_schedflags), and
spc_curpriority (usrpri of processes on this CPU).

- Every platform must now supply a struct cpu_info and
a curcpu() macro. Simplify existing cpu_info declarations
where appropriate.

- All references to per-CPU scheduler state now made through
curcpu(). NOTE: this will likely be adjusted in the future
after further changes to struct proc are made.

Tested on i386 and Alpha. Changes are mostly mechanical, but apologies
in advance if it doesn't compile on a particular platform.
 1.79 24-May-2000  thorpej Use preempt(), not an open-coded equivalent (which won't be
equivalent for long).
 1.78 12-Dec-1999  scottr Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.77 05-Dec-1999  ragge clrnd()/clbase() discarding.
 1.76 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.75 31-Oct-1999  scottr Sync trace trap handling with other m68k ports, originated by
ITOH Yasufumi. Coincidentally closes PR 7738.
 1.74 08-Jul-1999  thorpej branches: 1.74.2; 1.74.4; 1.74.6;
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.73 06-Apr-1999  scottr Include zsc.h so that SCC soft interrupts have a chance. Fixes PR 7313.
 1.72 27-Mar-1999  briggs branches: 1.72.2;
Only handle SIR_SERIAL if NZSC > 0.
 1.71 26-Mar-1999  mycroft Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.70 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.69 18-Mar-1999  chs if uvm_fault() fails with KERN_RESOURCE_SHORTAGE, send a SIGKILL
and print a message about it. this will be used to recover from
out-of-swap conditions.
 1.68 22-Dec-1998  scottr branches: 1.68.2;
vm_offset_t -> {paddr_t, vaddr_t}
 1.67 15-Dec-1998  itohy Added COMPAT_LINUX support.
 1.66 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.65 01-Oct-1998  thorpej Adapt to signal changes.
 1.64 04-Jul-1998  jonathan defopt DDB.
 1.63 25-Jun-1998  thorpej defopt COMPAT_SUNOS
 1.62 25-Jun-1998  thorpej defopt KTRACE
 1.61 27-May-1998  scottr If DEBUG, make sure to pull in the prototype for cngetc(). Noticed
by Hauke Fath, no PR generated.
 1.60 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.59 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.58 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.57 20-Apr-1998  scottr More kgdb groundwork pulled from hp300. While I'm in here,
correct some type-related problems and eliminate the register
qualifier.
 1.56 13-Feb-1998  scottr Avoid declaring the "astpending" and "want_resched" globals in cpu.h,
as this breaks C++ code that happens to indirectly include this header.
Both Matthias Scheler and I noticed this, independently.

This problem notably does not affect the atari and sun3/sun3x ports,
which have already implemented a similar solution.
 1.55 07-Nov-1997  scottr Update from John Wittkoski: bug fixes for Cuda support.
 1.54 07-Aug-1997  scottr branches: 1.54.2; 1.54.4;
Make the diagnostic panic message when we don't have a pcb consistent
with the message one normally gets when the kernel panics due to
some other unhandled trap.
 1.53 25-Jun-1997  briggs branches: 1.53.4;
Fix from camk@telecom.ksu.edu (Kelly Campbell), via Ken Nakata, for a
problem causing SIGSEGVs under FP emulation on the 68LC040. The size
for the type 4 exception frame was not properly defined.
 1.52 20-May-1997  scottr Adjust for previous m68k/pcb.h change
 1.51 19-May-1997  veego Fix lossage from the latest vm_pmap changes.
 1.50 12-May-1997  scottr Add en implementation of the Deferred Task Manager, contributed by Paul
Goyette <paul@pgoyette.bdt.com>.
 1.49 09-Apr-1997  thorpej regdump() takes a struct trapframe *
 1.48 09-Apr-1997  scottr Sigh. Bracket a label used only #ifdef COMPAT_SUNOS.
 1.47 08-Apr-1997  scottr Add 'done' symbol for last change. (oops.)
 1.46 07-Apr-1997  scottr Fix SunOS user trace trap handling, from Gordon.
 1.45 20-Jan-1997  scottr Kill uninitialized variable warning in trap(), plus mir KNFing
 1.44 31-Dec-1996  scottr branches: 1.44.2;
Sync COMPAT_SUNOS trace trap handling with other m68k ports; no
functional change.
 1.43 09-Nov-1996  briggs Dump out type, code, v on panic for no pcb in trap().
 1.42 21-Oct-1996  scottr Fix a raft of printf format strings and some declaration problems for
the case where we define DEBUG. From Erik Bertelsen, closes PR 2871.
 1.41 17-Oct-1996  scottr Changes from the hp300 trap.c:

- Fix up usage of MBD_ISPID(). (from Jason Thorpe)
- Be careful not to deref bad pointers in the MMU fault handler. (ditto)
- Ensure trap() never deals with a NULL proc, and if our proc has
no pcb, punt. (Suggested by Gordon Ross)
 1.40 13-Oct-1996  christos backout previous kprintf change
 1.39 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.38 07-Sep-1996  mycroft Use SIGBUS iff we get a legitimate bus fault. Use SIGSEGV for page protection
violations (per Solaris, SVR4, AIX, Linux, Irix, and SunOS).
 1.37 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.36 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.35 14-Mar-1996  scottr Back out previous change; kernel longjmp() has 1 arg.
 1.34 10-Mar-1996  briggs Pass 2nd arg to longjmp--even though it's ignored.
 1.33 15-Oct-1995  briggs SUNOS_SYS_sunos_sigreturn -> SUNOS_SYS_
sigreturn.
 1.32 31-Aug-1995  briggs branches: 1.32.2;
In child_return(), pass oticks of 0 to userret() instead of p->p_sticks to
avoid slighting the child of a timer tick if it gets one after starting.
Thanks go to cgd for noticing this.
 1.31 30-Jul-1995  briggs Differentiate printf for illegal instruction/fpu traps in kernel mode.
 1.30 25-Jun-1995  briggs Do something a lot closer to the right thing for FPU_EMULATE/FPSP/040
and subsets thereof.
 1.29 21-Jun-1995  briggs Lots of changes from hp300.
Removed MACHINE_NONCONTIG conditionals. Only support that
configuration, now.
Some cleanup.
 1.28 23-Apr-1995  briggs Make these compile again.
 1.27 22-Apr-1995  christos Fixed comparison in SYS__syscall to be against sysent instead of
p->p_emul->e_sysent [Thanks Charles for pointing this out].
I think that this code needs to be fixed anyway for emulations where
SYS_syscall is not the same number as the NetBSD one (0)... (Only the
alpha port so far?)
 1.26 22-Apr-1995  christos - added sunos_machdep.c for sun3, atari, amiga and mac68k.
- changed machdep.c and trap.c to use struct emul.
- remove ep_setup references.
- added struct emul to all emulations.
 1.25 29-Mar-1995  briggs Nuke FPCOPROC and add fpu device driver and FPU_EMULATE from sun3.
Still need to figure out how to handle this w/ FPSP on 68040's but
since we're not really using the 68040 yet...
 1.24 26-Mar-1995  cgd invoke ktrsyscall with (vp, code, argsize, args) as args.
 1.23 09-Mar-1995  mycroft Fix last arg to scdebug_ret().
 1.22 09-Mar-1995  mycroft Fix some types:
* code, args, and rval should use register_t.
* argsize should be a size_t.
Undo some of the differences between this syscall() and the hp300 version.
 1.21 01-Feb-1995  briggs Fixup sc_debug parameters.
Simplify indexing into systab a hair (from Amiga).
 1.20 21-Jan-1995  briggs %s/sun_/sunos_/g and grab a few comments from amiga trap.c.
 1.19 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.18 29-Nov-1994  briggs SUN_SYS_sigreturn -> SUNOS_SYS_sigreturn
 1.17 27-Nov-1994  briggs sun_syscall.h -> sunos_syscall.h
 1.16 26-Oct-1994  cgd new RCS ID format.
 1.15 20-Oct-1994  cgd update for new syscall args description mechanism
 1.14 10-Jul-1994  briggs Be somewhat better at machine dependence, clean up a hair, and get rid
of addupc.
 1.13 26-Jun-1994  briggs branches: 1.13.2;
Massive changes--largely culled from Amiga version.
 1.12 06-May-1994  briggs Get things to compile with latest changes.
 1.11 22-Apr-1994  briggs Make external definition for cpu040.
trap.c: Fix dumb (but compilable and linkable) typo.
 1.10 21-Apr-1994  briggs Almost a copy from Amiga.
 1.9 06-Apr-1994  briggs Some cleanup--largely from amiga/trap.c. "Do" __syscall...
 1.8 27-Feb-1994  briggs Basic changes for compat_sunos--copied from amiga.
 1.7 22-Feb-1994  briggs Comment out stacknquit() so we actually get to the panic on a fault.
 1.6 06-Feb-1994  briggs Fixup calls to profclock and softclock.
 1.5 03-Feb-1994  briggs Fixup include references.
 1.4 11-Jan-1994  briggs TRAP_TYPES macro to trap_types variable.
Yank some VIA initialization. Seemed to cause some problems.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.13.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.32.2.2 15-Oct-1995  briggs sersir() -> zssoft(0).
 1.32.2.1 15-Oct-1995  briggs SUNOS_SYS_sunos_sigreturn -> SUNOS_SYS_sigreturn.
 1.44.2.1 30-Jan-1997  thorpej update from trunk
 1.53.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.54.4.1 11-Nov-1997  mellon Pull rev 1.55 up from trunk (scottr)
 1.54.2.1 08-Sep-1997  thorpej Significantly restructure the way signal state for a process is stored.
Rather than using bitmasks to redundantly store the information kept
in the process's sigacts (because the sigacts was kept in the u-area),
hang sigacts directly off the process, and access it directly.

Simplify signal setup code tremendously by storing information in
the sigacts as an array of struct sigactions, rather than in a different
format, since userspace uses sigactions.

Make sigacts sharable by adding reference counting.
 1.68.2.4 12-Dec-1999  scottr Sync with main branch.
 1.68.2.3 28-Nov-1999  scottr Sync with main branch.
 1.68.2.2 01-Nov-1999  scottr Sync with main branch.
 1.68.2.1 16-May-1999  scottr Sync with main branch.
 1.72.2.1 07-Apr-1999  scottr branches: 1.72.2.1.2;
Pull up rev 1.73 from the trunk. Fixes PR 7313.
 1.72.2.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.72.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.74.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.74.4.1 15-Nov-1999  fvdl Sync with -current
 1.74.2.7 27-Mar-2001  bouyer Sync with HEAD.
 1.74.2.6 11-Feb-2001  bouyer Sync with HEAD.
 1.74.2.5 18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.74.2.4 05-Jan-2001  bouyer Sync with HEAD
 1.74.2.3 08-Dec-2000  bouyer Sync with HEAD.
 1.74.2.2 22-Nov-2000  bouyer Sync with HEAD.
 1.74.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.81.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.91.2.2 21-Jun-2001  nathanw Catch up to -current.
 1.91.2.1 09-Apr-2001  nathanw Catch up with -current.
 1.95.4.1 01-Oct-2001  fvdl Catch up with -current.
 1.95.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.95.2.2 16-Mar-2002  jdolecek Catch up with -current.
 1.95.2.1 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.96.4.12 07-Jan-2003  thorpej In the SA universe, the switch-to-this-LWP decision is made at a
different level than where preempt() calls are made, which renders
the "newlwp" argument useless. Replace it with a "more work to do"
boolean argument. Returning to userspace preempt() calls pass 0.
"Voluntary" preemptions in e.g. uiomove() pass 1. This will be used
to indicate to the SA subsystem that the LWP is not yet finished in
the kernel.

Collapse the SA vs. non-SA cases of preempt() together, making the
conditional code block much smaller, and don't call sa_preempt() if
more work is to come.

NOTE: THIS IS NOT A COMPLETE FIX TO THE preempt()-in-uiomove() PROBLEM
THAT CURRENTLY EXISTS FOR SA PROCESSES.
 1.96.4.11 11-Nov-2002  nathanw Catch up to -current
 1.96.4.10 18-Oct-2002  nathanw Catch up to -current.
 1.96.4.9 05-Oct-2002  gmcgarry Pull in SA headers.
 1.96.4.8 26-Sep-2002  nathanw Change "if (l->l_flag & L_SA_UPCALL)" to "while (l->l_flag & L_SA_UPCALL)"
in userret() functions or equivalent, to permit delivery of multiple upcalls
in a single kernel entry.

XXX It's getting crowded in here. Collapsing posting signals, upcalls, and
XXX kernel-exit handling into one mechanism would be nice.
 1.96.4.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.96.4.6 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.96.4.5 28-Feb-2002  nathanw Catch up to -current.
 1.96.4.4 17-Dec-2001  nathanw cpu_upcall() -> sa_upcall_userret().
 1.96.4.3 25-Nov-2001  scw Deal with `want_resched' with trap()'s T_ASTFLT case where it belongs
instead of in userret().
 1.96.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.96.4.1 10-Sep-2001  scw file trap.c was added on branch nathanw_sa on 2001-11-18 18:12:03 +0000
 1.99.2.2 19-Dec-2002  gmcgarry Whitespace
 1.99.2.1 18-Dec-2002  gmcgarry Merge pcred and ucred, and poolify. TBD: check backward compatibility
and factor-out some higher-level functionality.
 1.102.2.6 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.102.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.102.2.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.102.2.3 18-Sep-2004  skrll Sync with HEAD.
 1.102.2.2 03-Sep-2004  skrll Sync with HEAD
 1.102.2.1 03-Aug-2004  skrll Sync with HEAD
 1.114.4.1 02-Nov-2005  yamt sync with head.
 1.114.2.6 07-Dec-2007  yamt sync with head
 1.114.2.5 15-Nov-2007  yamt sync with head.
 1.114.2.4 03-Sep-2007  yamt sync with head.
 1.114.2.3 26-Feb-2007  yamt sync with head.
 1.114.2.2 30-Dec-2006  yamt sync with head.
 1.114.2.1 21-Jun-2006  yamt sync with head.
 1.116.10.2 19-Apr-2006  elad sync with head - hopefully this will work
 1.116.10.1 08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.116.8.3 11-Aug-2006  yamt sync with head
 1.116.8.2 24-May-2006  yamt sync with head.
 1.116.8.1 01-Apr-2006  yamt sync with head.
 1.116.6.2 01-Jun-2006  kardel Sync with head.
 1.116.6.1 22-Apr-2006  simonb Sync with head.
 1.116.4.1 09-Sep-2006  rpaulo sync with head
 1.117.2.1 24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.121.10.2 23-Sep-2007  wrstuden Sync with somewhat-recent netbsd-4.
 1.121.10.1 03-Sep-2007  wrstuden Sync w/ NetBSD-4-RC_1
 1.121.8.2 11-Sep-2007  msaitoh Pull up following revision(s) (requested by mhitch in ticket #866):
sys/arch/atari/atari/trap.c: 1.92
sys/arch/mac68k/mac68k/trap.c: 1.129
sys/arch/amiga/amiga/trap.c: 1.116
sys/arch/mvme68k/mvme68k/trap.c: 1.91
sys/arch/news68k/news68k/trap.c: 1.54
sys/arch/sun3/sun3/trap.c: 1.131
sys/arch/next68k/next68k/trap.c: 1.68
sys/arch/luna68k/luna68k/trap.c: 1.47
sys/arch/cesfic/cesfic/trap.c: 1.36
sys/arch/x68k/x68k/trap.c: 1.90
sys/arch/hp300/hp300/trap.c: 1.132
68030 and 68040 processors consider the read portion of a read-modify-write
transfer as a write to ensure the memory is writable before starting any
transfer. The fault status information does not reflect this in the 'read'
status bit (i.e. it shows up as a read access), so faults with a RMW access
to non-writable memory was not getting the correct protection. The page would
be read-only and the instruction would fault over and over.
A specific example is when a process forks, and the child process attempts
to execute a RMW access to a data page, which is read-only because it's CoP
Copy-On-Write.
When checking if the page needs to be writablek, also check the locked transfer
and treat any locked transfer as a write.
68060 already handled this correctly, since it has separate read and write
fault bits, and both are set on a RMW access and the trap code was checking
the write status bit.
Fixes PR#36848.
 1.121.8.1 18-Jun-2007  liamjfoy Pull up following revision(s) (requested by mhitch in ticket #728):
sys/arch/mvme68k/mvme68k/locore.s: revision 1.98
sys/arch/mac68k/mac68k/trap.c: revision 1.128
sys/arch/next68k/next68k/locore.s: revision 1.48
sys/arch/mac68k/mac68k/locore.s: revision 1.152
sys/arch/sun3/sun3/locore.s: revision 1.88
sys/arch/sun2/sun2/locore.s: revision 1.19
sys/arch/sun2/sun2/trap.c: revision 1.32
sys/arch/m68k/m68k/db_trace.c: revision 1.51
sys/arch/mvme68k/mvme68k/trap.c: revision 1.90
sys/arch/news68k/news68k/trap.c: revision 1.53
sys/arch/luna68k/luna68k/locore.s: revision 1.27
sys/arch/atari/atari/locore.s: revision 1.99
sys/arch/sun3/sun3/trap.c: revision 1.130
sys/arch/x68k/x68k/trap.c: revision 1.89
sys/arch/next68k/next68k/trap.c: revision 1.67
sys/arch/x68k/x68k/locore.s: revision 1.79
sys/arch/news68k/news68k/locore.s: revision 1.43
sys/arch/luna68k/luna68k/trap.c: revision 1.46
sys/arch/hp300/hp300/locore.s: revision 1.140
sys/arch/cesfic/cesfic/locore.s: revision 1.15
sys/arch/cesfic/cesfic/trap.c: revision 1.35
sys/arch/m68k/m68k/trap_subr.s: revision 1.12
sys/arch/amiga/amiga/locore.s: revision 1.143
Pass a frame pointer to trap() rather than the 'entire frame' trick. Gcc4
was optimizing away modifications to the frame contents (it's not nice to
trick gcc). Pass the pointer as the first argument to reduce the number
of places that would be changed otherwise. Fixes the getcwd regression
test on most m68k ports.
 1.121.4.2 06-Feb-2007  ad Make amiga & mac68k compile.
 1.121.4.1 30-Jan-2007  ad Remove support for SA. Ok core@.
 1.122.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.125.10.3 03-Oct-2007  garbled Sync with HEAD
 1.125.10.2 26-Jun-2007  garbled Sync with HEAD.
 1.125.10.1 22-May-2007  matt Update to HEAD.
 1.125.4.1 11-Jul-2007  mjf Sync with head.
 1.125.2.4 03-Dec-2007  ad Sync with HEAD.
 1.125.2.3 09-Oct-2007  ad Sync with head.
 1.125.2.2 15-Jul-2007  ad Sync with head.
 1.125.2.1 27-May-2007  ad Sync with head.
 1.128.10.2 09-Jan-2008  matt sync with HEAD
 1.128.10.1 06-Nov-2007  matt sync with HEAD
 1.128.8.3 09-Dec-2007  jmcneill Sync with HEAD.
 1.128.8.2 06-Nov-2007  joerg Sync with HEAD.
 1.128.8.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.128.4.1 03-Sep-2007  skrll Sync with HEAD.
 1.129.4.1 13-Nov-2007  bouyer Sync with HEAD
 1.131.2.1 08-Dec-2007  mjf Sync with HEAD.
 1.132.16.1 18-May-2008  yamt sync with head.
 1.132.14.2 17-Jan-2009  mjf Sync with HEAD.
 1.132.14.1 02-Jun-2008  mjf Sync with HEAD.
 1.133.8.1 19-Oct-2008  haad Sync with HEAD.
 1.133.4.4 30-Jun-2008  wrstuden Change how we make SA threads not generate upcalls. Instead of clearing
LW_SA, use a private flag, LP_SA_NOBLOCK, that we set when we want
to not generate upcalls. This means we do NOT need to lock (l)
(ourselves) to set it.

Adjust tests that look at LW_SA. Now, we are an upcall-generating
lwp if ((l->l_flag & LW_SA) && (~l->l_pflag & LP_SA_NOBLOCK)).

Introduce code pattern to set & remember this:

f = ~l->l_pflag & LP_SA_NOBLOCK;
l->l_pflag |= LP_SA_NOBLOCK;

...

/* f is now LP_SA_NOBLOCK if it wasn't set in l_pflag before */

l->l_pflag ^= f;

I updated a lot of the trap handlers to do trap handling iff LP_SA_NOBLOCK
is not set. I tried to figure out if the trap handler could be triggered
for user-based faults as opposed to kernel faults to user addresses, and
only look at LP_SA_NOBLOCK for the latter.

Above is a result of discussions with rmind at to reduce lock twiddling.

Also, per same discussions, add locking to sys_sa_preempt(). p_lock is
the lock we want.

Also, per same discussions, remove use of LSSUSPENDED as a thread state.
We needed to use it when we were emulating the 4.X and previous behavior
of hiding cached threads. For the moment, we now have them instead
remain visible to all and have them sleeping on the "lwpcache" wait
channel.

sa_newcachelwp(): sa_putcachelwp() wants savp_mutex held, not p_lock.

Tweak some comments.
 1.133.4.3 22-Jun-2008  wrstuden Re-add cpu_upcall() and page fault code. i386 kernels now compile.
They don't boot, but that seems to be a consequence of current from the
day this branch was started.
 1.133.4.2 14-May-2008  wrstuden Per discussion with ad at n dot o, revert signal mask handling
changes.

The l_sigstk changes are most likely totally un-needed as SA will
never use a signal stack - we send an upcall (or will as other
diffs are brought in).

The l_sigmask changes were too controvertial. In all honesty, I
think it's probably best to revert them. The main reason they were
there is the fact that in an SA process, we don't mask signals per
kernel thread, we mask them per user thread. In the kernel, we want
them all to get turned into upcalls. Thus the normal state of
l_sigmask in an SA process is for it to always be empty.

While we are in the process of delivering a signal, we want to
temporarily mask a signal (so we don't recursively exhaust our
upcall stacks). However signal delivery is rare (important, but
rare), and delivering back-to-back signals is even rarer. So rather
than cause every user of a signal mask to be prepared for this very
rare case, we will just add a second check later in the signal
delivery code. Said change is not in this diff.

This also un-compensates all of our compatability code for dealing
with SA. SA is a NetBSD-specific thing, so there's no need for
Irix, Linux, Solaris, SVR4 and so on to cope with it.

As previously, everything other than kern_sa.c compiles in i386
GENERIC as of this checkin. I will switch to ALL soon for compile
testing.
 1.133.4.1 10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.133.2.3 11-Aug-2010  yamt sync with head.
 1.133.2.2 11-Mar-2010  yamt sync with head
 1.133.2.1 04-May-2009  yamt sync with head.
 1.134.4.1 02-Feb-2009  snj Pull up following revision(s) (requested by martin in ticket #332):
sys/arch/amiga/amiga/trap.c: revision 1.122
sys/arch/atari/atari/trap.c: revision 1.99
sys/arch/cesfic/cesfic/trap.c: revision 1.43
sys/arch/hp300/hp300/trap.c: revision 1.140
sys/arch/luna68k/luna68k/trap.c: revision 1.55
sys/arch/m68k/include/signal.h: revision 1.25
sys/arch/m68k/m68k/sig_machdep.c: revision 1.41
sys/arch/mac68k/mac68k/trap.c: revision 1.136 via patch
sys/arch/mvme68k/mvme68k/trap.c: revision 1.98
sys/arch/news68k/news68k/trap.c: revision 1.60
sys/arch/next68k/next68k/trap.c: revision 1.75
sys/arch/sun2/sun2/trap.c: revision 1.37
sys/arch/sun3/sun3/trap.c: revision 1.136
sys/arch/x68k/x68k/trap.c: revision 1.97
Centralize fpu exception to siginfo code encoding for all m68k archs,
fixes a failure in the lib/libc/ieeefp/except regression test.
 1.134.2.3 28-Apr-2009  skrll Sync with HEAD.
 1.134.2.2 03-Mar-2009  skrll Sync with HEAD.
 1.134.2.1 19-Jan-2009  skrll Sync with HEAD.
 1.136.2.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.139.4.3 05-Mar-2011  rmind sync with head
 1.139.4.2 03-Jul-2010  rmind sync with head
 1.139.4.1 30-May-2010  rmind sync with head
 1.139.2.2 17-Aug-2010  uebayasi Sync with HEAD.
 1.139.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.143.2.1 06-Jun-2011  jruoho Sync with HEAD.
 1.144.2.1 17-Feb-2011  bouyer Sync with HEAD
 1.145.8.1 24-Feb-2012  mrg sync to -current.
 1.145.4.1 17-Apr-2012  yamt sync with head
 1.146.16.1 06-Apr-2015  skrll Sync with HEAD
 1.146.2.1 03-Dec-2017  jdolecek update from HEAD
 1.147.18.2 08-Apr-2020  martin Merge changes from current as of 20200406
 1.147.18.1 10-Jun-2019  christos Sync with HEAD
 1.18 01-Oct-2023  andvar remove unncessary leading space in #ifdef FPSP block.
remove one trailing whitespace.
 1.17 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.16 11-Dec-2005  christos branches: 1.16.100; 1.16.106; 1.16.108;
merge ktrace-lwp.
 1.15 22-Sep-2003  cl SA_SIGINFO support for m68k (port specific changes)
 1.14 28-Jun-1999  briggs branches: 1.14.36;
Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.13 04-Oct-1998  thorpej branches: 1.13.6; 1.13.10;
Sigh, we are going to have to burn a vector for Just Sigreturn again,
for now, until we have a more generic {get,set}context(). Update the
comment for trap #3 accordingly.
 1.12 30-Sep-1998  thorpej If !COMPAT_13, make trap #1 produce an illegal instruction. Fix the comment
for trap #2 to reflect that it's the trace trap.
 1.11 30-Sep-1998  thorpej Note that trap #1 is compat_13_sigreturn, and give trap #3 to syscalls
which require special handling, e.g. sigreturn on m68k.

This differs from the old sigreturn trap in that we require the syscall
number to be in register d0, just like the regular syscall entry point.
This will allow sigreturn to be versioned in the future without the need
to allocate another trap vector.
 1.10 12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.9 03-Sep-1997  scottr Don't initialize the bus error and address error vectors; as we do that
in the startup code already.
 1.8 29-Jun-1997  scottr branches: 1.8.4;
Remove unused (#ifdef'ed) vector 0 initalizer
 1.7 28-Jun-1997  scottr Use <m68k/include/asm.h>.
 1.6 21-Jan-1995  briggs Fix major brain damage from a while back. Old damage broke jump to zero
panic, leading to mass confusion.
 1.5 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.4 26-Oct-1994  cgd new RCS ID format.
 1.3 07-Jul-1994  briggs branches: 1.3.2;
Use newer fpsp code. Nuke lots of glue in locore.s, change vectors
directly if FPSP and move back to HP numbering for mmutype which is
used as cputype for FPSP.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.3.2.2 07-Jul-1994  briggs Use newer fpsp code. Nuke lots of glue in locore.s, change vectors
directly if FPSP and move back to HP numbering for mmutype which is
used as cputype for FPSP.
 1.3.2.1 07-Jul-1994  briggs file vectors.s was added on branch netbsd-1-0 on 1994-07-07 00:27:13 +0000
 1.8.4.1 04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.13.10.1 01-Jul-1999  thorpej Sync w/ -current.
 1.13.6.1 01-Nov-1999  scottr Sync with main branch.
 1.14.36.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.14.36.2 18-Sep-2004  skrll Sync with HEAD.
 1.14.36.1 03-Aug-2004  skrll Sync with HEAD
 1.16.108.1 17-Feb-2011  bouyer Sync with HEAD
 1.16.106.1 06-Jun-2011  jruoho Sync with HEAD.
 1.16.100.1 05-Mar-2011  rmind sync with head
 1.77 28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.76 21-Jul-2020  rin For GCC8, do not omit frame pointer for intr_dispatch() and via1_intr()
(-fomit-frame-pointer is enabled for -O and higher for GCC8).

This is required by rtclock_intr() which unwinds stack frame of caller!

XXXXXX
We need to get rid of this hackest hack for rtclock_intr(). This problem
was discussed back in 2014:

http://mail-index.netbsd.org/port-mac68k/2014/08/15/msg000595.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000600.html
http://mail-index.netbsd.org/port-mac68k/2014/08/17/msg000601.html

However, unfortunately, the problem has been left untouched until today.

The patch attached in the third message works around the problem. But,
it adds hard-coded magic numbers to intr_dispatch() and via1_intr().
For real fix, we should probably reconsider whole interrupt handling.

Anyway, now kernel compiled by GCC8 works fine as far as I can see.
 1.75 11-Dec-2005  christos merge ktrace-lwp.
 1.74 05-Mar-2005  chs remove some more __P that I missed before.
 1.73 15-Jan-2005  chs branches: 1.73.2; 1.73.4;
de-__P, remove register, ansify, b* -> mem*.
 1.72 15-Jul-2003  lukem __KERNEL_RCSID()
 1.71 21-Feb-2000  scottr branches: 1.71.28;
Use constants defined in viareg.h to set value of VIA2.
 1.70 28-Jun-1999  briggs branches: 1.70.2;
Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.69 20-Feb-1999  scottr branches: 1.69.2; 1.69.6;
Rename via_shutdown() to via_powerdown() for clarity and consistency.
 1.68 06-Jan-1999  scottr G/C rbv_vidstatus() and related constant.
 1.67 22-Oct-1998  scottr Defopt ALTXBUTTONS, DISABLE_EXT_CACHE, and ZS_CONSOLE_ABORT.
 1.66 01-Jul-1998  scottr Undo a thinko in the various VIA2 isr loops: increment
bitnum inside the loop, not as part of the condition.
 1.65 26-Apr-1998  scottr Generalize add_nubus_intr() a little more. Also, complete KNFing.
 1.64 25-Apr-1998  scottr Attempt to clear stray NuBus interrupts in the default slot
interrupt handler.
 1.63 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.62 10-Sep-1997  scottr For consistency: VIA_initialize() -> via_init()
 1.61 09-Sep-1997  scottr Define, implement, and use oss_intr().
 1.60 04-Apr-1997  briggs branches: 1.60.4;
Mask off 'internal slot' in check to see if we should enable nubus intrs.
 1.59 15-Mar-1997  scottr Defer enabling NuBus slot interrupts until all slots have been probed
and drivers attached. This removes the need for the MAC68K_BROKEN_VIDEO
option. From Allen Briggs.
 1.58 04-Mar-1997  scottr The previous optimization of the interrupt handlers was a bit too
agressive. Being a little more conservative pays the biggest dividend.
 1.57 03-Mar-1997  scottr Fix part of last change: don't mask off the high bit of the VIA IER until
the interrupt has been unflagged. Problem noticed by Paul Goyette.
 1.56 28-Feb-1997  scottr Generalize VIA1 and VIA2 interrupt registration a bit, and do a slight
optimization on the VIA interrupt handlers.
 1.55 07-Jan-1997  scottr branches: 1.55.6;
Don't unlock the NuBus on PowerBooks; this bit controls the Power Manager
chip on these machines. From Takashi Hamada.
 1.54 02-Nov-1996  scottr Remove include of ncr96scsi.h, since it's now an artifact, and the
unused include of ncrscsi.h while we're here.
 1.53 29-Oct-1996  briggs Add a function to install an interrupt handler for 2nd scsi bus (Q900/950).
Take a guess that it's at via2, bit 0 (where 5380 DRQ is).
 1.52 21-Oct-1996  briggs Fix two bugs noticed by Taras Ivanenko <ivanenko@ctpa03.mit.edu>
via.c: don't allow spl to remain at splhigh on error.
mainbus.c: Make sure that variable is initialized.
 1.51 16-Oct-1996  scottr External cache card on the IIci is enabled by default;
use DISABLE_EXT_CACHE to turn it off.
 1.50 13-Oct-1996  christos backout previous kprintf change
 1.49 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.48 21-Jun-1996  scottr Minor style cleanup (avoid goto); no functional change.
 1.47 07-Jun-1996  briggs Fix typo.
 1.46 07-Jun-1996  briggs Changes from Bill Studenmund to support external clocks on the modem port.
 1.45 01-Jun-1996  scottr Minor cosmetic cleanup left over from reverting interrupt handlers
 1.44 25-May-1996  briggs Clear via2 interrupts before processing, too. It is up to the drivers to clear
any interrupts that are flagged during processing.
 1.43 21-May-1996  briggs branches: 1.43.2;
Apparently the MRG ADB code becomes unstable if we handle via1 interrupts
properly, so go back to unflagging them all before processing any via1
interrupts. Perhaps this can be changed back when we get ADB code that
does not rely on the ROMs?
 1.42 21-May-1996  briggs Actually clear the interrupt on the RBV.
 1.41 20-May-1996  scottr Due to the latching effect of the 6522 (VIA) chip, we need to unflag
interrupts only after the condition that caused the interrupt has been
cleared. This is a particular problem with the 5380 SCSI controller,
since the Mac glue logic may raise (e.g.) the SCSI DRQ interrupt a number
of times during the course of a normal transfer. By waiting to unflag it,
we effectively ignore all but the first.
 1.40 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.39 23-Apr-1996  scottr Handle internal video interrupts on RBV-based machines differently so
that Ethernet cards have a chance to work. In particular, this change
has been tested on the IIci, IIsi, and LCIII. The crucial info behind
this code was the result of a lot of work by Julian Bean.
 1.38 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.37 11-Feb-1996  briggs Remove via_inited, as it is unused.
 1.36 03-Feb-1996  briggs Implement mac68k_register_via1_t1_irq(). Also, remove via_inited warning.
 1.35 24-Jan-1996  briggs Change an &= to an & -- the former stopped working for some reason
that I need to delve into when I have time.
 1.34 28-Sep-1995  briggs Simplify nubus interrupt routines a bit.
 1.33 18-Sep-1995  briggs Optimize the via interrupt processing routines a tad. From
chas@ohm.nrl.navy.mil (Charles J. Williams).
 1.32 12-Sep-1995  briggs Update a comment.
 1.31 04-Sep-1995  briggs Make VIA2 interrupts pass an argument in and let the scsi_register_*_intr
functions use that, too.
 1.30 02-Sep-1995  briggs Optimize accesses to VIA2 a bit.
Force SCSI driver to register interrupt functions and remove default
handlers.
Bring in a few changes from
Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>--more to come later.
Define VIA interrupt functions as returning void, not long.
 1.29 01-Sep-1995  briggs Process via2/rbv interrupts from low bit to high bit.
 1.28 25-Aug-1995  briggs Change VIA2:vPCR setting to allow scsi IRQ and DRQ.
 1.27 14-Aug-1995  briggs Be more vocal about interrupts that we don't expect.
Include ncrscsi.h and ncr96scsi.h.
 1.26 30-Jul-1995  briggs delay(7) instead of delay(20) seems sufficient
 1.25 27-Jul-1995  briggs get rbv_nubus_intr working--at least on the IIsi.
 1.24 17-Jul-1995  briggs Get IIsi ethernet almost working. Still misses a number of interrupts.
 1.23 08-Jul-1995  briggs Clean up a lot. Run machdep.c through indent.
Remove a bunch of old debugging code and some dead code.
Put in some new comments. Need more.
 1.22 01-Jul-1995  briggs Use flags for scsi interrupts. clean up a small bit.
 1.21 20-Jun-1995  briggs Fix a typo that's gone unnoticed for a long time. Noticed by Brian
Gaeke (brg@dgate.org).
 1.20 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.19 21-Apr-1995  briggs Separate nubus interrupt registry and enablement.
 1.18 13-Apr-1995  briggs Update interrupts to use (void *client_data) instead of (int unit) as
parameter to interrupt function.
 1.17 08-Apr-1995  briggs Actually set the vectors for RBV as well as VIA2.
Don't go to spl4 when we have an ADB interrupt.
Turn off video interrupts on the SE/30.
 1.16 25-Mar-1995  briggs add_nubus_intr takes int (*)(), not void (*)().
Fix slot interrupts more.
 1.15 23-Mar-1995  briggs Handle VIA2 (RBV?) better. Speed up interrupt processing (which had a
negative impact on the ethernet timeouts). This is still not correct,
but I am unsure what is correct. We can, apparently, get a nubus
interrupt without any slots showing an interrupt condition. Ick. This
does not always happen before we apparently lose an interrupt, either
(see last (chronological) log message for if_ae.c).
Someone with a fresh set of eyes should probably look at this, but it's
cobbled together to (mostly) work.
 1.14 20-Mar-1995  briggs Modify handling of via2 interrupts. Ethernet is much more reliable
for me, now (one problem down, anyway).
 1.13 01-Mar-1995  briggs Clean up via.c a good bit--still needs more. Get rid of some timing stuff
that we aren't using at all anymore.
 1.12 22-Feb-1995  briggs Clean up via.c a bit. Still needs lots of work.
 1.11 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.10 26-Oct-1994  cgd new RCS ID format.
 1.9 10-Jul-1994  briggs Be somewhat better at machine dependence, clean up a hair, and get rid
of addupc.
 1.8 26-Jun-1994  briggs branches: 1.8.2;
Change some constants to better values/don't use constants as much.
 1.7 22-Feb-1994  briggs Changes by grantham for RBV support.
 1.6 06-Feb-1994  briggs Fixup calls to profclock and softclock.
 1.5 11-Jan-1994  briggs TRAP_TYPES macro to trap_types variable.
Yank some VIA initialization. Seemed to cause some problems.
 1.4 21-Dec-1993  briggs Use address instead of slot for add_nubus_intr. This whole interrupt
scheme should probably be taken out and shot.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.8.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.43.2.3 07-Jun-1996  briggs Fix typo: from trunk.
 1.43.2.2 07-Jun-1996  briggs Pull up changes from trunk. Console fix and external serial clock support.
 1.43.2.1 31-May-1996  scottr Pull up version 1.44 from the main branch.
>Clear via2 interrupts before processing, too. It is up to the drivers to clear
>any interrupts that are flagged during processing.
 1.55.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.60.4.1 16-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.69.6.1 01-Jul-1999  thorpej Sync w/ -current.
 1.69.2.1 01-Nov-1999  scottr Sync with main branch.
 1.70.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.71.28.5 08-Mar-2005  skrll Sync with HEAD.
 1.71.28.4 17-Jan-2005  skrll Sync with HEAD.
 1.71.28.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.71.28.2 18-Sep-2004  skrll Sync with HEAD.
 1.71.28.1 03-Aug-2004  skrll Sync with HEAD
 1.73.4.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.73.2.1 29-Apr-2005  kent sync with -current
 1.16 29-Mar-1996  briggs via.h -> machine/viareg.h and some other prototyping fixes.
 1.15 03-Feb-1996  briggs New delay() implementation from Scott Reynolds (scottr@edsi.org).
Also some minor rearranging of the VIA initialization (init earlier).
 1.14 04-Sep-1995  briggs Make VIA2 interrupts pass an argument in and let the scsi_register_*_intr
functions use that, too.
 1.13 02-Sep-1995  briggs Optimize accesses to VIA2 a bit.
Force SCSI driver to register interrupt functions and remove default
handlers.
Bring in a few changes from
Walter Ruetten <walter@ghpc8.ihf.rwth-aachen.de>--more to come later.
Define VIA interrupt functions as returning void, not long.
 1.12 17-Jul-1995  briggs Cleanup a bit.
 1.11 13-Apr-1995  briggs Update interrupts to use (void *client_data) instead of (int unit) as
parameter to interrupt function.
 1.10 25-Mar-1995  briggs add_nubus_intr takes int (*)(), not void (*)().
Fix slot interrupts more.
 1.9 23-Mar-1995  briggs Handle VIA2 (RBV?) better. Speed up interrupt processing (which had a
negative impact on the ethernet timeouts). This is still not correct,
but I am unsure what is correct. We can, apparently, get a nubus
interrupt without any slots showing an interrupt condition. Ick. This
does not always happen before we apparently lose an interrupt, either
(see last (chronological) log message for if_ae.c).
Someone with a fresh set of eyes should probably look at this, but it's
cobbled together to (mostly) work.
 1.8 03-Dec-1994  briggs Mac ROM Glue changes from grantham@tenon.com.
 1.7 26-Oct-1994  cgd new RCS ID format.
 1.6 09-Jul-1994  briggs Add some macros for new adb stuff from Brad Grantham.
 1.5 26-Jun-1994  briggs branches: 1.5.2;
Change some constants to better values/don't use constants as much.
 1.4 22-Feb-1994  briggs Some modifications by grantham to handle the RBV chip which emulates some
VIA2 functinos.
 1.3 15-Dec-1993  briggs Cleanup. Use mac68k_xxx macros instead of macII, etc. Cleanup via.h.
Add minimal support for ddb.
BIG CHANGE: Use proper offsets for new gas in locore.s!!!
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.5.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.56 20-Oct-2002  chs merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.55 04-Mar-2002  simonb Don't need to declare phys_map - it is declared in <uvm/uvm_extern.h>.
 1.54 26-Feb-2002  simonb Purge CLSIZE, CLSIZELOG2 and MCLOFSET.
Be consistant in the way that MSIZE, MCLSHIFT, MCLBYTES and NMBCLUSTERS
are defined.
Remove old VM constants from cesfic port.
Bump MSIZE to 256 on mipsco (the only one that wasn't already 256).
 1.53 10-Sep-2001  chris branches: 1.53.4;
Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.52 23-Aug-2001  chs branches: 1.52.2;
add a missing pmap_update().
 1.51 04-Aug-2001  chs use pmap_k* in pagemove() (ie. for buffer cache pages)
and in vmapbuf() and vunmapbuf() (since there's no VAC on this platform).
 1.50 02-Jun-2001  chs branches: 1.50.2;
replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.49 24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.48 29-Jun-2000  mrg branches: 1.48.2;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.47 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.46 28-May-2000  thorpej Rather than starting init and creating kthreads by forking and then
doing a cpu_set_kpc(), just pass the entry point and argument all
the way down the fork path starting with fork1(). In order to
avoid special-casing the normal fork in every cpu_fork(), MI code
passes down child_return() and the child process pointer explicitly.

This fixes a race condition on multiprocessor systems; a CPU could
grab the newly created processes (which has been placed on a run queue)
before cpu_set_kpc() would be performed.
 1.45 20-Jan-2000  sommerfeld branches: 1.45.2;
Fix PR9240: comment above cpu_fork() out of synch with reality on most ports.
(comment change only, but was wrong for more than just i386).
 1.44 04-Dec-1999  ragge CL* discarding.
 1.43 13-Nov-1999  thorpej Update for pmap_enter() API change. No functional difference.
 1.42 08-Jul-1999  thorpej branches: 1.42.2; 1.42.4; 1.42.8;
Fix typo in previous.
 1.41 08-Jul-1999  thorpej 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.40 26-May-1999  thorpej Generally update the comment above vunmapbuf().
 1.39 26-May-1999  thorpej Generally update the comment above the vmapbuf() implementations.
 1.38 14-May-1999  nisimura - Adjust descriptive comment of cpu_fork() which returns nothing and
returns once.
- Minor fixes in mips/vm_machdep.c.
 1.37 13-May-1999  thorpej Allow the caller to specify a stack for the child process. If NULL,
the child inherits the stack pointer from the parent (traditional
behavior). Like the signal stack, the stack area is secified as
a low address and a size; machine-dependent code accounts for stack
direction.

This is required for clone(2).
 1.36 06-Apr-1999  scottr Sync with hp300.
 1.35 26-Mar-1999  mycroft branches: 1.35.2;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.34 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.33 22-Dec-1998  scottr branches: 1.33.2;
vm_offset_t -> {paddr_t, vaddr_t}
 1.32 11-Nov-1998  thorpej Changes to support fork_kthread():
- cpu_set_kpc() now takes void *arg third argument, passed to the
entry point.
- cpu_fork() allows parent to be non-curproc iff parent is proc0.
When forking non-curproc, assume its state has already been saved.
- Adjust various pieces of machine-dependent code to account of all of this.
 1.31 09-Sep-1998  thorpej In cpu_coredump(), use MID_MACHINE rather than MID_* (whatever it expands
to).
 1.30 09-Sep-1998  thorpej Adjust for the new "reaper" kernel thread: do not free the vmspace and
u-area in machine-dependent code. Instead, call exit2() to schedule
the reaper to free them for us, once it is safe to do so (i.e. we are
no longer running on the dead proc's vmspace and stack).
 1.29 28-Jul-1998  thorpej Don't cast the null residual pointer passed to vn_rdwr().
 1.28 24-Apr-1998  scottr Checkpoint of UVM work to date. This includes a fully-functioning
MACHINE_NEW_NONCONTIG interface implementation, which is now enabled
on all systems. Thanks to Jason Thorpe for his work on the hp300 port,
from which most of the code used here was derived.

XXX In spite of the fact that it works on the hp300, UVM does not (yet)
work well under load on mac68k.
 1.27 13-Apr-1998  scottr Make type explicit for egcs, from Erik Bertelsen in PR 5288.
While we're here, kill register qualifier and other KNF.
 1.26 06-Jan-1998  thorpej Garbage-collect PMAP_ACTIVATE() call here; it's no longer necessary.
 1.25 11-Oct-1997  scottr Address PR 4120 by synchronizing v{,un}mapbuf() with the i386 vm_machdep.c,
v 1.27, pulling in changes made there by Charles Hannum. Also, incorporate
a few tweaks made by Gordon W. Ross in the sun3 version of this change.
 1.24 20-May-1997  scottr branches: 1.24.4;
Adjust for previous m68k/pcb.h change
 1.23 19-May-1997  veego Fix lossage from the latest vm_pmap changes.
 1.22 15-Mar-1997  briggs Move physaccess/physunaccess prototypes.
 1.21 16-Sep-1996  scottr Convert `fpu_type' to the more consistent `fputype', and use the new
#defines from m68k/include/cpu.h.
 1.20 05-May-1996  briggs Remove extra prototype.
 1.19 05-May-1996  briggs Move a few prototypes into machine/cpu.h.
 1.18 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.17 24-Apr-1996  scottr Sync with prototype changes
 1.16 05-Feb-1996  christos vm prototype changes
 1.15 12-Jan-1996  briggs Fixes from PR #1931 w/ minor mod in vm_machdep.c
 1.14 09-Dec-1995  mycroft cpu_fork() now returns void.
 1.13 21-Jun-1995  briggs Lots of changes from hp300.
Removed MACHINE_NONCONTIG conditionals. Only support that
configuration, now.
Some cleanup.
 1.12 20-Apr-1995  briggs Grab the sun3 cpu_coredump().
 1.11 10-Apr-1995  mycroft kernel_pmap --> pmap_kernel()
 1.10 01-Feb-1995  briggs Pull Amiga implementation of pagemove(). Seems mo' better.
 1.9 26-Oct-1994  cgd new RCS ID format.
 1.8 26-Jun-1994  briggs Update for 4.4-lite.
 1.7 06-May-1994  briggs Get things to compile with latest changes.
 1.6 22-Apr-1994  briggs Make external definition for cpu040.
trap.c: Fix dumb (but compilable and linkable) typo.
 1.5 21-Apr-1994  briggs Include cop.
Add '040 stuff from Amiga.
 1.4 06-Apr-1994  briggs Bug pointed out by chopps (thanks!)
We were also lacking another copy in cpu_fork() for the struct mdproc.
 1.3 01-Mar-1994  briggs Get rid of some compiler warnings.
 1.2 29-Nov-1993  briggs Update from 0.9-ish to -current. Including a switch to use config.new.
The new functions (ptrace, etc) are stubbed.
Some cleanup, too.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.24.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.33.2.6 13-Feb-2000  scottr Sync with main branch.
 1.33.2.5 12-Dec-1999  scottr Sync with main branch.
 1.33.2.4 28-Nov-1999  scottr Sync with main branch.
 1.33.2.3 01-Nov-1999  scottr Sync with main branch.
 1.33.2.2 15-Jun-1999  scottr Sync with main branch.
 1.33.2.1 16-May-1999  scottr Sync with main branch.
 1.35.2.1 21-Apr-1999  perry branches: 1.35.2.1.2;
pullup 1.35->1.36 (scottr): sync to hp300 pmap
 1.35.2.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.35.2.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.42.8.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.42.4.1 15-Nov-1999  fvdl Sync with -current
 1.42.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.45.2.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.48.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.50.2.3 16-Mar-2002  jdolecek Catch up with -current.
 1.50.2.2 13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.50.2.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.52.2.1 01-Oct-2001  fvdl Catch up with -current.
 1.53.4.8 11-Nov-2002  nathanw Catch up to -current
 1.53.4.7 12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.53.4.6 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.53.4.5 01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.53.4.4 28-Feb-2002  nathanw Catch up to -current.
 1.53.4.3 08-Dec-2001  thorpej cpu_fork() -> cpu_lwp_fork(). This logically forks an LWP, not a
complete process. As noted by Gregory McGarry on tech-kern.
 1.53.4.2 18-Nov-2001  scw MD Scheduler Activation bits for Mac68k.

XXX: I'm unable to even compile-test these changes since Mac68k hasn't
XXX: transitioned to ELF, and I don't have a -current m68k a.out toolchain
XXX: handy.
 1.53.4.1 10-Sep-2001  scw file vm_machdep.c was added on branch nathanw_sa on 2001-11-18 18:12:04 +0000
 1.11 19-Dec-2020  thorpej malloc(9) -> kmem(9)
 1.10 03-Sep-2018  riastradh branches: 1.10.12;
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.9 25-Jul-2014  dholland branches: 1.9.26; 1.9.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.8 16-Mar-2014  dholland branches: 1.8.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.7 27-Oct-2012  chs branches: 1.7.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.6 31-Jan-2012  hauke branches: 1.6.6;
Employ the two free 16 bit timers of the Hurdler Centronics Parallel
Interface card's Z8536 CIO for Timecounter support.

Builds, should work, but not testable yet because of pmap breakage.
 1.5 13-May-2011  rmind branches: 1.5.4; 1.5.8;
Replace some ltsleep() uses with kpause() and tsleep().
 1.4 10-Sep-2008  christos branches: 1.4.12; 1.4.18; 1.4.24;
replace \xa0 with space from Andy Shevchenko
 1.3 11-Jun-2008  cegger branches: 1.3.2; 1.3.4;
use device_lookup_private to get softc
 1.2 23-May-2008  hauke branches: 1.2.2; 1.2.4; 1.2.6;
Fix NetBSD version tag.
 1.1 22-May-2008  hauke Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.2.6.1 18-Jun-2008  simonb Sync with head.
 1.2.4.3 17-Jun-2008  yamt sync with head.
 1.2.4.2 04-Jun-2008  yamt sync with head
 1.2.4.1 23-May-2008  yamt file cpi_nubus.c was added on branch yamt-pf42 on 2008-06-04 02:04:48 +0000
 1.2.2.4 28-Sep-2008  mjf Sync with HEAD.
 1.2.2.3 29-Jun-2008  mjf Sync with HEAD.
 1.2.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.1 23-May-2008  mjf file cpi_nubus.c was added on branch mjf-devfs2 on 2008-06-02 13:22:22 +0000
 1.3.4.1 19-Oct-2008  haad Sync with HEAD.
 1.3.2.3 24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.3.2.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.3.2.1 11-Jun-2008  wrstuden file cpi_nubus.c was added on branch wrstuden-revivesa on 2008-06-23 05:02:12 +0000
 1.4.24.1 06-Jun-2011  jruoho Sync with HEAD.
 1.4.18.1 31-May-2011  rmind sync with head
 1.4.12.2 04-May-2009  yamt sync with head.
 1.4.12.1 10-Sep-2008  yamt file cpi_nubus.c was added on branch yamt-nfs-mp on 2009-05-04 08:11:27 +0000
 1.5.8.1 18-Feb-2012  mrg merge to -current.
 1.5.4.3 22-May-2014  yamt sync with head.

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

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.5.4.2 30-Oct-2012  yamt sync with head
 1.5.4.1 17-Apr-2012  yamt sync with head
 1.6.6.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.6.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.7.2.1 18-May-2014  rmind sync with head
 1.8.2.1 10-Aug-2014  tls Rebase.
 1.9.28.1 10-Jun-2019  christos Sync with HEAD
 1.9.26.1 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.10.12.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.4 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.3 31-Jan-2012  hauke branches: 1.3.6;
Employ the two free 16 bit timers of the Hurdler Centronics Parallel
Interface card's Z8536 CIO for Timecounter support.

Builds, should work, but not testable yet because of pmap breakage.
 1.2 23-May-2008  hauke branches: 1.2.2; 1.2.4; 1.2.8; 1.2.22; 1.2.40; 1.2.44;
Fix NetBSD version tag.
 1.1 22-May-2008  hauke Added driver for the Creative Systems Inc. Hurdler CPI parallel printer card.
Timecounter support for the Z8536 counters A + B is not complete, yet.

Reviewed by Martin Husemann.
 1.2.44.1 18-Feb-2012  mrg merge to -current.
 1.2.40.2 30-Oct-2012  yamt sync with head
 1.2.40.1 17-Apr-2012  yamt sync with head
 1.2.22.2 04-May-2009  yamt sync with head.
 1.2.22.1 23-May-2008  yamt file cpi_nubusvar.h was added on branch yamt-nfs-mp on 2009-05-04 08:11:27 +0000
 1.2.8.2 23-Jun-2008  wrstuden Add files to branch that were added on -current.

After this, all that's left of update is to merge some changes
that had conflicts.
 1.2.8.1 23-May-2008  wrstuden file cpi_nubusvar.h was added on branch wrstuden-revivesa on 2008-06-23 05:02:12 +0000
 1.2.4.2 04-Jun-2008  yamt sync with head
 1.2.4.1 23-May-2008  yamt file cpi_nubusvar.h was added on branch yamt-pf42 on 2008-06-04 02:04:48 +0000
 1.2.2.2 02-Jun-2008  mjf Sync with HEAD.
 1.2.2.1 23-May-2008  mjf file cpi_nubusvar.h was added on branch mjf-devfs2 on 2008-06-02 13:22:22 +0000
 1.3.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.79 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.78 28-Feb-2016  rjs Set sc_dev field of softc.

Should pullup to 7.
 1.77 25-Oct-2013  martin branches: 1.77.4; 1.77.6;
Simplify
 1.76 27-Oct-2012  chs branches: 1.76.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.75 17-Oct-2007  garbled branches: 1.75.54; 1.75.64;
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.74 30-Aug-2007  jmmv Fix typo in comment.
 1.73 05-Mar-2007  he branches: 1.73.2; 1.73.10; 1.73.14; 1.73.18; 1.73.20;
Use a char* helper variable for pointer arithmetic.
 1.72 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.71 06-Dec-2006  hauke branches: 1.71.2;
Support for four nubus video cards:

Formac ProNitron 80.IVb (1024x768/8)
Relax 19" Model 200 (1024x768/8)
Apple Monochrome Video Card (640x480/1)
VillageTronic Mac Picasso 320 (up to 1920x1080/up to 24)

Nubus identifiers for Creative Solutions parallel & serial cards,
and a Becton Dickinson data acquisition card.
 1.70 24-Dec-2005  perry branches: 1.70.20; 1.70.22;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.69 11-Dec-2005  christos merge ktrace-lwp.
 1.68 15-Jan-2005  chs branches: 1.68.10;
de-__P, remove register, ansify, b* -> mem*.
 1.67 15-Jul-2003  lukem __KERNEL_RCSID()
 1.66 02-Oct-2002  thorpej branches: 1.66.6;
Use CFATTACH_DECL().
 1.65 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.64 30-May-2002  thorpej Don't use multi-line string literals.
 1.63 20-Nov-2001  chs branches: 1.63.8;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.62 22-Jan-2001  briggs branches: 1.62.4; 1.62.8;
Clear interrupts on the RasterOps PaintBoard Prism GT 1.0. From
Alastair Bridgewater <nyef@softhome.net>.
 1.61 22-Jan-2001  briggs Handle interrupts on the Radius DirectColor/GX (id 0x27c). From
Alastair Bridgewater <nyef@softhome.net>.
 1.60 09-Dec-2000  briggs Clear interrupts on the Apple "Boogie" card. Information grovelling
and testing by Lucas Lay.
 1.59 30-Jul-2000  briggs Update hack to point to bus_space_handle base address.
 1.58 26-Jul-2000  briggs Remove advertising clause with my name.
 1.57 18-Mar-2000  scottr branches: 1.57.4;
Add the RasterOps 24MxTV; this card operates in the same manner as two
other RasterOps boards we already handle. Information provided by
Greg Kerr.
 1.56 14-Feb-2000  scottr Merge wscons work onto the main development branch.
 1.55 14-Jun-1999  briggs branches: 1.55.2;
Clear interrupts on a Radius GS/C card. Thanks go to Yasufumi Suzuki
<yattin@sco.bekkoame.ne.jp> for doing the MacsBug "leg"work for me.
 1.54 10-Jun-1999  briggs Use information from Kensuke Ogawa <kenogawa@festa.or.jp> to disable
interrupts on a Micron Exceed color video card.
 1.53 30-May-1999  briggs PR 7021 from Yoshihisa Sugimoto <sugimoto@sums.shiga-med.ac.jp>:
Clear interrupt properly on the RasterOps 24XLTV. Same as the 24LX.
 1.52 20-Sep-1998  scottr branches: 1.52.6; 1.52.8; 1.52.10; 1.52.12;
Make this compile again, as pointed out by Paul Goyette.
 1.51 18-Sep-1998  scottr Interrupt handling for the MicroConversions 2124NB II, from Paul Goyette.
 1.50 17-Aug-1998  briggs Update comment after cut and paste.
 1.49 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.48 09-Aug-1998  briggs Support video interrupt for GrandVimage 17iL video card.
 1.47 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.46 02-Jun-1998  scottr Store the PA of the framebuffer in the softc. This eliminates the need
for the sc_phys callback; we can just store the PA in the grfbus attach
args, rather than a function pointer, which simplifies the code nicely.
 1.45 23-May-1998  briggs Handle video interrupts for the Radius PrecisionColor 24X card. Thanks for
sleuthing and testing go to Robert Oelkers <windcatcher@earthlink.net>.
 1.44 07-May-1998  briggs Handle the interrupt for the Vimage graphics adapter. Thanks to
Sadamu Gohyakuda <joyhiro@joyful.gr.jp> for remote testing.
 1.43 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.42 26-Apr-1998  briggs Deal with the video interrupt for the RasterOps 8/24XLi. Thanks for the
information go to Tadashi Ueda <ng6t-ued@asahi-net.or.jp>.
 1.41 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.40 24-Apr-1998  briggs Add interrupt support for two more video cards: the Formac color card II
and the Radius PrecisionColor 24Xp. Thanks to <falk.stern@luene.net> and
<Mario_Magliocco@broder.com> for their remote sleuthing and testing.
 1.39 12-Jan-1998  thorpej Update for changes to config.
 1.38 03-Dec-1997  briggs Thanks to Paul Goyette <paul@whooppee.com> for a patch to clear the
interrupt properly on a SuperMac Spectrum/8 Series III, and thanks
to Dan McMahill for loaning the card to Paul.
I modified Paul's patch somewhat to change grfmv_intr_generic_{1,4}
to grfmv_intr_generic_write{1,4} and added grfmv_intr_generic_or4 to
handle this card.
 1.37 01-Dec-1997  scottr Correct a comment from previous commit.
 1.36 30-Nov-1997  briggs Support for the Lapis ProColorServer 8 PDS on the SE/30. This prevents
hangs when trying to use this video card in conjunction with an ethernet
card. Thanks to David Condon <david@apk.net> for information and testing.
 1.35 25-Oct-1997  briggs Handle interrupts on E-Machines Futura-SX. From Paul Goyette, PR 4348.
 1.34 09-Oct-1997  briggs branches: 1.34.2;
Clear interrupts properly on the Radius PrecisionColor 8.
Thanks for the info go to Andrew MacGibbon <andrew-m@cs.auckland.ac.nz>
 1.33 15-Aug-1997  briggs Add interrupt handler for SuperMac GFX.
Tested by Kai-Yew Lum <kaiyewl@engin.umich.edu> back in May.
 1.32 14-Aug-1997  scottr Recognize the Sigma Designs ColorMax card, and handle the interrupt. Code
provided by Brian Foley <bfoley@gpo.iol.ie> via Allen Briggs, updated for
bus.h by me.
 1.31 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.30 03-Aug-1997  scottr Fix grf{i,m}v_phys() prototypes.
 1.29 03-Aug-1997  scottr Overhaul grf drivers to correct recent problems with X and dt
(address error faults), as well as other reported problems:

- Simplify grfmv_phys() to work like grfiv_phys(), and eliminate the
second argument to both, as we don't use it anyway.
- Handle fbbase and fboff consistently throughout. Closes PR 3862.
- Eliminate grfaddr() by pulling it into grfmmap(), which is the
only place it was used, previously.
- grfmap() now gets the physical address of the framebuffer from
the appropriate driver, rather than try to compute it by itself.
Be careful with aligning the base to a page address and increase
the length of the mapped region appropriately. Closes PR 2867.
 1.28 26-Jul-1997  scottr branches: 1.28.2;
Add support for Macintosh Display Card, using information provided
by Taras Ivanenko <ivanenko@ctpa03.mit.edu> in PR 3862. (The PR
is still open, due to an unresolved issue regarding the fbbase
field.)
 1.27 01-Jul-1997  scottr Add support for Portrait Video Card. From SUNAGAWA Keiki
<kei_sun@ba2.so-net.or.jp> in PR 3821.
 1.26 12-May-1997  scottr Convert several interrupt handlers to bus space model, removing some
XXX's. Also, fix a bug in grfmv_intr_generic() that I found and
confirmed with Allen.
 1.25 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.24 03-May-1997  briggs Support for clearing interrupts on a Rasterops Colorboard 364.
Thanks go to Michel Chalufour <michelc@tiac.net> for grovelling around for
me.
 1.23 02-May-1997  briggs Thanks to Tobias Beal <tbeal41@maine.maine.edu>, we can clear interrupts
on at least one Radius Precisioncolor 8 board.
 1.22 01-May-1997  briggs Clear the interrupts properly on an E-Machines Futura II LX and make a wild
guess at clearing them on a Futura II SX/DSP and RasterOps ColorBoard 364.
Thanks to Michel Chalufour <michelc@tiac.net> for loaning me the II LX.
 1.21 14-Apr-1997  scottr Purely cosmetic cleanup:

- Remove unused `register' modifier on declarations
- Reverse the sense of some tests to make the code more clear
- Type casts per KNF
- Move a static variable into the only function that uses it (perhaps
we can eliminate it entirely, someday?)
 1.20 10-Apr-1997  briggs Ignore SE/30 faux-video card.
 1.19 01-Apr-1997  briggs Add DrHW for RasterOps CB264--From Scott Reynolds--and link it in to the
proper interrupt routine.
 1.18 01-Apr-1997  briggs - Support DAFB machines mo' better. Actually detect if a monitor is
present and initialize a few things. No color support, yet.
- Properly disable interrupts for DAFB.
- Rearrange for better nubus display card interrupt support. Only register
an interrupt if we know how to clear it.
- Complain if we don't know about a given display card and can not install
an interrupt handler.
- Change MYSTERY stuff to cb264--still need to get the DrSW so we can
actually call the routine to clear an interrupt from this card.
 1.17 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.16 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.15 16-Dec-1996  scottr branches: 1.15.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.14 13-Oct-1996  christos backout previous kprintf change
 1.13 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.12 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.11 19-May-1996  scottr branches: 1.11.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.10 06-May-1996  briggs Set sc_slot--we need it later.
 1.9 06-May-1996  briggs Do not depend on the nubus being mapped in one huge segment.
 1.8 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.7 24-Aug-1995  briggs Some code to support a vector passed in from booter 1.8.
 1.6 06-Jul-1995  briggs Add another routine for the grf display-specific drivers to return a physical
address.
 1.5 02-Jul-1995  briggs Set and use new fboff element from grfmode structure.
 1.4 30-Jun-1995  briggs Fix oversight.
 1.3 21-Jun-1995  briggs Make no assumptions about the absolute address of nubus cards.
 1.2 06-May-1995  briggs Get rid of a printf() that got left behind in the probe.
 1.1 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.11.4.1 05-Aug-1996  jtc Pulled up from rev 1.12 by request from Scott Reynolds
 1.15.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.28.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.34.2.2 01-Dec-1997  mellon Pull rev 1.36 and 1.37 up from trunk (briggs) (reviewed by mellon)
 1.34.2.1 26-Oct-1997  mellon Pull rev 1.35 up from trunk (briggs)
 1.52.12.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.52.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.52.8.2 14-Dec-2000  he Pull up revision 1.60 (requested by briggs):
Clear interrupts on the Apple "Boogie" card.
 1.52.8.1 21-Jun-1999  perry pullup 1.52->1.53 (briggs)
 1.52.6.2 15-Jun-1999  scottr Sync with main branch.
 1.52.6.1 11-Mar-1999  scottr First cut at grf emulation. Neither GRFIOCMAP nor mmap'ing a wsdisplay device
work, though several other grf ioctls are properly emulated.
 1.55.2.3 11-Feb-2001  bouyer Sync with HEAD.
 1.55.2.2 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.55.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.57.4.2 14-Dec-2000  he Pull up revision 1.60 (requested by briggs):
Clear interrupts on the Apple "Boogie" card.
 1.57.4.1 06-Aug-2000  briggs Pullups approved by thorpej --
Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.

Add bus_space_*_stream_N functions to bus_space.

Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).

There were some bogus assumptions about bus_space_handle_t and some
function calls that didn't match prototypes--fix those here, too.
 1.62.8.3 18-Oct-2002  nathanw Catch up to -current.
 1.62.8.2 20-Jun-2002  nathanw Catch up to -current.
 1.62.8.1 08-Jan-2002  nathanw Catch up to -current.
 1.62.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.62.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.62.4.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.63.8.1 14-Jul-2002  gehenna catch up with -current.
 1.66.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.66.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.66.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.66.6.1 03-Aug-2004  skrll Sync with HEAD
 1.68.10.3 03-Sep-2007  yamt sync with head.
 1.68.10.2 30-Dec-2006  yamt sync with head.
 1.68.10.1 21-Jun-2006  yamt sync with head.
 1.70.22.1 10-Dec-2006  yamt sync with head.
 1.70.20.1 12-Jan-2007  ad Sync with head.
 1.71.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.73.20.1 06-Nov-2007  matt sync with HEAD
 1.73.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.73.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.73.10.1 03-Oct-2007  garbled Sync with HEAD
 1.73.2.1 09-Oct-2007  ad Sync with head.
 1.75.64.3 03-Dec-2017  jdolecek update from HEAD
 1.75.64.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.75.64.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.75.54.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.75.54.1 30-Oct-2012  yamt sync with head
 1.76.2.1 18-May-2014  rmind sync with head
 1.77.6.1 19-Mar-2016  skrll Sync with HEAD
 1.77.4.1 12-Feb-2020  martin Pull up following revision(s) (requested by tsutsui in ticket #1721):

sys/arch/mac68k/nubus/grf_nubus.c: revision 1.78

Set sc_dev field of softc.
Should pullup to 7.
 1.44 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.43 05-Feb-2020  skrll Trailing whitespace
 1.42 05-Feb-2020  skrll Adopt <net/if_stats.h>
 1.41 16-Jan-2009  tsutsui branches: 1.41.66; 1.41.72;
Split device_t/softc, missed on MI dp8390nic changes 10 months ago.
Also use aprint_*(), and remove unnecessary casts against void * variables.

Tested by John Klos on port-mac68k, and should be pulled up to netbsd-5.
 1.40 04-Apr-2008  hauke branches: 1.40.4; 1.40.12; 1.40.14;
Go all the way, and use the new accessor function for the device_xname field.
 1.39 02-Apr-2008  hauke Fall-out from splitting device_t and softc for the dp8390 softc.
 1.38 29-Mar-2006  thorpej branches: 1.38.62;
Use device_cfdata().
 1.37 11-Dec-2005  christos branches: 1.37.4; 1.37.6; 1.37.8; 1.37.10; 1.37.12;
merge ktrace-lwp.
 1.36 03-Jun-2005  rjs branches: 1.36.2;
Add const.
 1.35 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.34 15-Jul-2003  lukem __KERNEL_RCSID()
 1.33 02-Oct-2002  thorpej branches: 1.33.6;
Use CFATTACH_DECL().
 1.32 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.31 12-Feb-2001  thorpej branches: 1.31.4; 1.31.8;
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.30 30-Jul-2000  briggs Remove unsupported Focus hardware--this is now probed in if_sm_nubus.
 1.29 29-Sep-1999  scottr branches: 1.29.2; 1.29.12;
Add support for the Macintosh LC Ethernet Adapter, from Ken'ichi Ishizaka.
This was erroneously recognized as an 8390-based card, where in fact it is
using the 83932 (SONIC) controller.
 1.28 27-Sep-1998  scottr branches: 1.28.6; 1.28.8;
Add support for the TFL LAN Inc. E410/E420 PDS cards. Based on code
from Ken Nakata in PR 6199, which was in turn derived from code from
Haru Maruyama <h-maru @ da2.so-net.ne.jp>.
 1.27 12-Aug-1998  scottr Support Cabletron Ethernet card, from John Marohn in PR 5762.
 1.26 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.25 25-Apr-1998  scottr Garbage collect the second (slot number) parameter to NuBus interrupt
handlers. (Only slot_ignore() and slot_noint() need this, and we already
have a place to put this information.) Adjust add_nubus_intr() so that if
the client_data arg is specified as NULL, pass the slot number as
client_data to the interrupt handler.
 1.24 02-Nov-1997  thorpej Adjust for ifmedia-related changes to dp8390 driver.
 1.23 17-Oct-1997  briggs branches: 1.23.2;
Make this compile again.
 1.22 15-Oct-1997  thorpej Pulldown from marc-pcmcia branch: adapt to changes in the MI dp8390 driver.
 1.21 10-Oct-1997  scottr Remove advertising clause.
 1.20 26-Sep-1997  briggs Add another Dayna card to the Apple-compa. list.
Define a constant for the SuperMac Spectrum/24 series III display card.
Thanks go to Luca Falzoni <falzoni@jetai.unipv.it> for trying out the
code for the Dayna ethernet support.
 1.19 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.18 11-May-1997  scottr branches: 1.18.4;
Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.17 01-May-1997  briggs Treat drhw 118 and 119 the same for Apple ethernet cards.
 1.16 30-Apr-1997  scottr Fix typo in last change.
 1.15 30-Apr-1997  scottr Adjust to use16bit -> dcr_reg change in MI driver.
 1.14 29-Apr-1997  scottr Use the new MI 8390 driver, and garbage collect.
 1.13 22-Apr-1997  scottr Remove obsolete drsw diagnostic
 1.12 10-Apr-1997  briggs Changes from Bob Nestor to come closer to supporting his Apple SONIC-based
nubus card.
 1.11 19-Mar-1997  scottr Several more changes to move us toward MI-ness:

- Use more consistent and portable types in the softc.
- Map registers using an array of bus_size_t offsets, and set up the
mapping in the attach code (thanks to Jason Thorpe for suggesting
this!).
- Disable the ae-specific watchdog, which is no longer necessary in
the general case.

Still remaining: split out functions used to copy data to/from the
card, and retain a way to have a local driver name with the MI code.
 1.10 18-Mar-1997  briggs Help this compile and get the nubus address into myaddr instead of
sc->sc_arpcom.ac_enaddr.
 1.9 17-Mar-1997  scottr Some cards we identify as InterLAN cards do not seem to have the MAC
address in the configuration ROM. For these, fall back to the old method
if we can't find the expected sResource record.
 1.8 15-Mar-1997  scottr Defer enabling NuBus slot interrupts until all slots have been probed
and drivers attached. This removes the need for the MAC68K_BROKEN_VIDEO
option. From Allen Briggs.
 1.7 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.6 10-Mar-1997  scottr branches: 1.6.2;
Add missing call to ae_nb_get_enaddr(), from <kei_sun@ba2.so-net.or.jp>.
Fixes PR 3312.
 1.5 28-Feb-1997  scottr Define aesetup() to return an int, so that the attach function can
determine whether there was an error (if so, we unmap the slot space
for this device). Use this functionality to tell the attach function
that we couldn't clear the card's buffer.

Also in aesetup(), eliminate the bogus repetition of the error message
we print when the buffer clear actually fails. Noticed by Hauke Fath.
 1.4 28-Feb-1997  scottr Move the NuBus-specific watchdog function from if_ae.c to if_ae_nubus.c,
and allow the attach function to override the default watchdog. Also,
do some minor cosmetic surgery (rename bus space tags/handles and some
KNFing I missed the first time around).
 1.3 25-Feb-1997  scottr Move bus-independent setup code back into if_ae.c; enable the use of
configuration flags. For NuBus cards, attempt to find the MAC address
in the declaration ROM resources.
 1.2 24-Feb-1997  scottr Add support for the Kinetics EtherPort SE/30, from Ken Nakata.
 1.1 24-Feb-1997  scottr Split out the NuBus attachment code, and convert to bus.h
 1.6.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.18.4.5 14-Oct-1997  thorpej Mark this interface as enabled right from the get-go.
 1.18.4.4 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.4.3 14-Oct-1997  thorpej Adapt to changes in the generic DP8390 driver.
 1.18.4.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.18.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.23.2.1 05-Nov-1997  thorpej Pull up from trunk: update for ifmedia changes to dp8390.c
 1.28.8.1 27-Jun-2000  he Pull up revision 1.29 (requested by scottr):
Add support for the Macintosh LC Ethernet Adapter. This was
previously erroneously recognized as an 8390-based card, where
in fact it is using the 83932 (SONIC) controller.
 1.28.6.1 01-Nov-1999  scottr Sync with main branch.
 1.29.12.1 06-Aug-2000  briggs Pullup approved by thorpej --
Add nubus-based SMC91cxx ethernet support for the mac68k.
 1.29.2.2 12-Mar-2001  bouyer Sync with HEAD.
 1.29.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.31.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.31.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.33.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.6.4 17-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.36.2.1 21-Jun-2006  yamt sync with head.
 1.37.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.37.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.37.8.1 01-Apr-2006  yamt sync with head.
 1.37.6.1 22-Apr-2006  simonb Sync with head.
 1.37.4.1 09-Sep-2006  rpaulo sync with head
 1.38.62.3 17-Jan-2009  mjf Sync with HEAD.
 1.38.62.2 02-Jun-2008  mjf Sync with HEAD.
 1.38.62.1 03-Apr-2008  mjf Sync with HEAD.
 1.40.14.1 17-Jan-2009  snj Pull up following revision(s) (requested by tsutsui in ticket #280):
sys/arch/mac68k/nubus/if_ae_nubus.c: revision 1.41
Split device_t/softc, missed on MI dp8390nic changes 10 months ago.
Also use aprint_*(), and remove unnecessary casts against void *
variables.
Tested by John Klos on port-mac68k, and should be pulled up to netbsd-5.
 1.40.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.40.4.1 04-May-2009  yamt sync with head.
 1.41.72.1 29-Feb-2020  ad Sync with head.
 1.41.66.1 08-Apr-2020  martin Merge changes from current as of 20200406
 1.35 18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.34 04-Feb-2020  skrll Trailing whitespace
 1.33 04-Feb-2020  skrll Adopt <net/if_stats.h>
 1.32 29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.31 21-Oct-2019  msaitoh branches: 1.31.2;
if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
 1.30 13-Sep-2019  msaitoh if_flags is neither int nor short. It's unsigned short.
 1.29 05-Feb-2019  msaitoh branches: 1.29.4;
Remove very old IFF_NOTRAILERS flag.
 1.28 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.27 26-Jun-2018  msaitoh branches: 1.27.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.26 29-Jul-2017  riastradh branches: 1.26.2;
Avoid memory leak in netdock_get.

If top is null, this is the first time through and nothing else will
free m.

From Ilja Van Sprundel.
 1.25 15-Dec-2016  ozaki-r branches: 1.25.8;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

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

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

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

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

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

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

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

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

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.22 27-Oct-2012  chs branches: 1.22.12; 1.22.14; 1.22.16; 1.22.20;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.21 05-Apr-2010  joerg branches: 1.21.8; 1.21.14; 1.21.18; 1.21.20; 1.21.22;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.20 19-Jan-2010  pooka branches: 1.20.2; 1.20.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

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

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.19 07-Nov-2008  dyoung *** Summary ***

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

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

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

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

Return consistent, appropriate error codes from network drivers.

Improve readability. KNF.

*** Details ***

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Let ifioctl_common() handle SIOCGIFADDR.

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

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

bzero -> memset. Delete unnecessary casts to void *. Use
sockaddr_in_init() and sockaddr_in6_init(). Compare pointers with
NULL instead of "testing truth". Replace some instances of (type
*)0 with NULL. Change some K&R prototypes to ANSI C, and join
lines.
 1.18 04-Apr-2008  hauke branches: 1.18.4; 1.18.10; 1.18.12;
Go all the way, and use the new accessor function for the device_xname field.
 1.17 02-Apr-2008  hauke Fall-out from splitting device_t and softc for the dp8390 softc.
 1.16 17-Oct-2007  garbled branches: 1.16.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.15 01-Sep-2007  jmmv Fix build after dyoung's changes.
 1.14 01-Sep-2007  dyoung Change a bazillion occurrences of code resembling this,

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

if (error == ENETRESET) {

to this,

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

which does the same thing.

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

Use ifreq_getaddr() twice in es(4).

Whitespace nits.
 1.13 05-Mar-2007  he branches: 1.13.2; 1.13.10; 1.13.14; 1.13.18; 1.13.20;
Use a char* for pointer arithmetic.
 1.12 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.11 24-Dec-2005  perry branches: 1.11.26;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.10 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.9 11-Dec-2005  christos merge ktrace-lwp.
 1.8 03-Jun-2005  rjs branches: 1.8.2;
Add const.
 1.7 30-Jan-2005  thorpej Eliminate use of M_HASFCS.
 1.6 15-Jan-2005  chs branches: 1.6.2; 1.6.4;
de-__P, remove register, ansify, b* -> mem*.
 1.5 30-Oct-2004  thorpej When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.4 15-Jul-2003  lukem branches: 1.4.4;
__KERNEL_RCSID()
 1.3 02-Oct-2002  thorpej branches: 1.3.6;
Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 19-Jun-2002  itojun branches: 1.1.2; 1.1.4; 1.1.6;
netdock* - ethernet driver for Asante NetDock/Newer Ether MicroDock.
by Daishi Kato <daishi@axlight.com>
test/stabilization by Takeo Kuwata <tkuwata@virus.kyoto-u.ac.jp>
 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 19-Jun-2002  jdolecek file if_netdock_nubus.c was added on branch kqueue on 2002-09-06 08:36:58 +0000
 1.1.4.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.4.2 01-Aug-2002  nathanw Catch up to -current.
 1.1.4.1 19-Jun-2002  nathanw file if_netdock_nubus.c was added on branch nathanw_sa on 2002-08-01 02:42:22 +0000
 1.1.2.2 16-Jul-2002  gehenna catch up with -current.
 1.1.2.1 19-Jun-2002  gehenna file if_netdock_nubus.c was added on branch gehenna-devsw on 2002-07-16 08:40:11 +0000
 1.3.6.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.3.6.6 04-Feb-2005  skrll Sync with HEAD.
 1.3.6.5 17-Jan-2005  skrll Sync with HEAD.
 1.3.6.4 02-Nov-2004  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.4.1 24-Jan-2005  he Pull up revision 1.5 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.6.4.1 12-Feb-2005  yamt sync with head.
 1.6.2.1 29-Apr-2005  kent sync with -current
 1.8.2.2 03-Sep-2007  yamt sync with head.
 1.8.2.1 21-Jun-2006  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.20.1 06-Nov-2007  matt sync with HEAD
 1.13.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.13.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.13.10.1 03-Oct-2007  garbled Sync with HEAD
 1.13.2.1 09-Oct-2007  ad Sync with head.
 1.16.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.16.16.2 02-Jun-2008  mjf Sync with HEAD.
 1.16.16.1 03-Apr-2008  mjf Sync with HEAD.
 1.18.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.18.10.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.18.4.3 11-Aug-2010  yamt sync with head.
 1.18.4.2 11-Mar-2010  yamt sync with head
 1.18.4.1 04-May-2009  yamt sync with head.
 1.20.4.1 30-May-2010  rmind sync with head
 1.20.2.1 30-Apr-2010  uebayasi Sync with HEAD.
 1.21.22.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.21.20.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.21.18.2 03-Dec-2017  jdolecek update from HEAD
 1.21.18.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.21.14.1 12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1472):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.21.8.1 30-Oct-2012  yamt sync with head
 1.22.20.1 11-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.22.16.1 11-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.22.14.4 28-Aug-2017  skrll Sync with HEAD
 1.22.14.3 05-Feb-2017  skrll Sync with HEAD
 1.22.14.2 09-Jul-2016  skrll Sync with HEAD
 1.22.14.1 19-Mar-2016  skrll Sync with HEAD
 1.22.12.1 11-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1468):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.24.2.1 07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.25.8.2 24-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1416):

sys/dev/ic/i82586.c: revision 1.86
sys/arch/arm/ep93xx/epe.c: revision 1.45
sys/dev/pcmcia/if_cnw.c: revision 1.66
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.31
sys/dev/qbus/if_il.c: revision 1.36
sys/dev/pcmcia/if_ray.c: revision 1.95
sys/dev/qbus/if_qt.c: revision 1.24

if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
 1.25.8.1 05-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #181):
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26
Avoid memory leak in netdock_get.
If top is null, this is the first time through and nothing else will
free m.
From Ilja Van Sprundel.
 1.26.2.2 06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.26.2.1 28-Jul-2018  pgoyette Sync with HEAD
 1.27.2.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.27.2.1 10-Jun-2019  christos Sync with HEAD
 1.29.4.1 23-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #371):

sys/dev/ic/i82586.c: revision 1.86
sys/arch/arm/ep93xx/epe.c: revision 1.45
sys/dev/pcmcia/if_cnw.c: revision 1.66
sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.31
sys/arch/arm/sunxi/sunxi_can.c: revision 1.2
sys/dev/qbus/if_il.c: revision 1.36
sys/dev/pcmcia/if_ray.c: revision 1.95
sys/dev/qbus/if_qt.c: revision 1.24

if_ipackets is incremented in can_input(), so don't increment it in
sunxi_can_rx_intr to prevent double count. OK'd by bouyer@.

if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
 1.31.2.1 29-Feb-2020  ad Sync with head.
 1.10 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.9 12-Feb-2012  matt branches: 1.9.6;
Change old-style function defintions to C89 prototypes.

Approved by releng.
 1.8 11-Dec-2005  christos branches: 1.8.112; 1.8.116;
merge ktrace-lwp.
 1.7 03-Jun-2005  rjs Add const.
 1.6 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.5 15-Jul-2003  lukem __KERNEL_RCSID()
 1.4 02-Oct-2002  thorpej branches: 1.4.6;
Use CFATTACH_DECL().
 1.3 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.2 01-Aug-2000  briggs branches: 1.2.2; 1.2.4; 1.2.8; 1.2.12;
Remove hack for unswapped read/write_multi in swapped space.
Driver now uses read/write_multi_stream_2.
 1.1 30-Jul-2000  briggs M.d. glue for nubus SMC 91cxx-based cards--including Focus Interlan and
AsanteFAST.
 1.2.12.1 18-Oct-2002  nathanw Catch up to -current.
 1.2.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.2.4.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.2.4.1 01-Aug-2000  bouyer file if_sm_nubus.c was added on branch thorpej_scsipi on 2000-11-20 20:12:25 +0000
 1.2.2.2 06-Aug-2000  briggs Pullup approved by thorpej --
Add nubus-based SMC91cxx ethernet support for the mac68k.
 1.2.2.1 01-Aug-2000  briggs file if_sm_nubus.c was added on branch netbsd-1-5 on 2000-08-06 12:56:19 +0000
 1.4.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.4.6.4 17-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.8.116.1 18-Feb-2012  mrg merge to -current.
 1.8.112.2 30-Oct-2012  yamt sync with head
 1.8.112.1 17-Apr-2012  yamt sync with head
 1.9.6.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.30 20-Feb-2021  rin sn(4): Add rnd(9) support.
 1.29 23-Apr-2008  tsutsui branches: 1.29.102;
Split softc/device_t and misc cleanup for sn(4).
 1.28 17-Oct-2007  garbled branches: 1.28.16; 1.28.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.27 10-Jun-2007  tsutsui branches: 1.27.10;
Switch mac68k's sn(4) Ethernet to MI SONIC driver.

Tested with Apple Ethernet CS Twisted-Pare Card on LC630 by me
and Quadra 650 on-board Ethernet by hauke@.
NuBus based cards and PowerBook variants are still untested.
 1.26 11-Dec-2005  christos branches: 1.26.30; 1.26.32; 1.26.38;
merge ktrace-lwp.
 1.25 03-Jun-2005  rjs branches: 1.25.2;
Add const.
 1.24 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.23 15-Jul-2003  lukem __KERNEL_RCSID()
 1.22 02-Oct-2002  thorpej branches: 1.22.6;
Use CFATTACH_DECL().
 1.21 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.20 29-Sep-1999  scottr branches: 1.20.16; 1.20.20;
Add support for the Macintosh LC Ethernet Adapter, from Ken'ichi Ishizaka.
This was erroneously recognized as an 8390-based card, where in fact it is
using the 83932 (SONIC) controller.
 1.19 05-Jul-1998  jonathan branches: 1.19.8; 1.19.10;
defopt INET, NETATALK.
 1.18 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.17 26-Oct-1997  briggs The 16- and 32-bit Apple card types got reversed somehow.
 1.16 11-Aug-1997  scottr branches: 1.16.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.15 26-Jun-1997  scottr branches: 1.15.4;
Identify and use the Apple Twisted Pair NB card properly, from PR 3789
submitted by Denny Gentry <denny1@home.com>; investigation on the hardware
done by Bob Nestor.
 1.14 15-Jun-1997  scottr Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.13 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.12 01-May-1997  briggs Treat drhw 118 and 119 the same for Apple ethernet cards.
 1.11 30-Apr-1997  scottr Remove dependency on if_aereg.h for vendor constants; these are really
driver-, not architecture-specific.
 1.10 22-Apr-1997  scottr Remove obsolete drsw diagnostic; make formatting consistent; KNF.
 1.9 22-Apr-1997  briggs Make sure that we unmap the space that we mapped if we can't identify the card.
 1.8 22-Apr-1997  briggs Initialize 'offset' to make gcc happy.
 1.7 14-Apr-1997  briggs Use an offset parameter when loading the reg_map--some cards use the "other"
16 bits of the words.
 1.6 13-Apr-1997  briggs Oops. We do not want to unmap something that we've used bus_space_subregion
to get.
 1.5 13-Apr-1997  briggs Some updates based on information from Bob Nestor <rnestor@metronet.com>
about his SONIC-T LC/PDS card.
 1.4 10-Apr-1997  briggs Changes from Denny Gentry <denny1@home.com>:
Change in the way receive buffer areas are handled. Before we gave
the chip 16 buffers, each 1536 bytes (big enough for one packet).
Now we're handing the chip 8 buffers, each 4 Kbytes, and letting
the chip fit as many packets as it can in each one. This should
help keep it from running out of buffer space. Also make some of
the performance-crucial routines inline. It made no measurable
difference except to make me feel better

Changes from Bob Nestor <rnestor@metronet.com> to get closer to support
for his Apple SONIC-based nubus card.

Changes from me to try to get SONIC's MAC address from MacOS settings if
we can't read the PROM space.
 1.3 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.2 16-Mar-1997  is On request from Allen Briggs, converted this to new ARP
system. Somebody should actually test if this compiles (and works) on
Mac68k... I only carefully checked cvs diff -u.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.15.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.16.4.1 27-Oct-1997  mellon Pull rev 1.17 up from trunk (briggs)
 1.19.10.1 27-Jun-2000  he Pull up revision 1.20 (requested by scottr):
Add support for the Macintosh LC Ethernet Adapter. This was
previously erroneously recognized as an 8390-based card, where
in fact it is using the 83932 (SONIC) controller.
 1.19.8.1 01-Nov-1999  scottr Sync with main branch.
 1.20.20.1 18-Oct-2002  nathanw Catch up to -current.
 1.20.16.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.22.6.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.22.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.22.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.6.1 03-Aug-2004  skrll Sync with HEAD
 1.25.2.1 03-Sep-2007  yamt sync with head.
 1.26.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.26.32.1 11-Jul-2007  mjf Sync with head.
 1.26.30.1 15-Jul-2007  ad Sync with head.
 1.27.10.1 06-Nov-2007  matt sync with HEAD
 1.28.18.1 18-May-2008  yamt sync with head.
 1.28.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.29.102.1 03-Apr-2021  thorpej Sync with HEAD.
 1.68 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.67 24-Apr-2021  thorpej branches: 1.67.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.66 08-Jan-2019  jdolecek branches: 1.66.14;
no need to include <machine/param.h> if <sys/param.h> already included
 1.65 18-Oct-2014  snj branches: 1.65.18; 1.65.20;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.64 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.63 17-Dec-2008  cegger branches: 1.63.14; 1.63.24;
kill MALLOC and FREE macros.
 1.62 07-Mar-2007  tsutsui branches: 1.62.40; 1.62.44; 1.62.52;
Change variables which are used to read byte stream data
from (void *) to (char *).
 1.61 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.60 11-Dec-2005  christos branches: 1.60.26;
merge ktrace-lwp.
 1.59 03-Jun-2005  rjs branches: 1.59.2;
Add const.
 1.58 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.57 15-Jul-2003  lukem __KERNEL_RCSID()
 1.56 01-Jan-2003  thorpej branches: 1.56.2;
Use aprint_normal() for cfprint routines.
 1.55 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.54 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.53 13-Apr-2002  briggs Fixes and changes from Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>.
* Clean up after briggs@ changes to support bus_dma.
* Add support for reading sMemory resources from nubus cards.
* Add support for old cards with only the board rsrc (NatSemi NB-GPIB, e.g.)
* Add a few more card identifiers.
 1.52 10-Apr-2002  briggs Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.51 20-Aug-2001  wiz branches: 1.51.6;
"wierd" is weird.
 1.50 31-Jul-2000  briggs branches: 1.50.4;
Fix code to read a string from the nubus board--it was not terminating
the string properly when the string on the board is longer than the
pre-allocated space.
 1.49 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.48 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.47 23-Aug-1999  thorpej branches: 1.47.2;
Garbage-collect reference to <sys/dmap.h>.
 1.46 01-Jun-1999  briggs Add debug routine as an aid for working out new nubus cards.
 1.45 02-Jun-1998  scottr branches: 1.45.8; 1.45.12;
An inability to map a slot's address space may be a normal condition --
for instance, on-board video may live here. Make the complaint about
this a DEBUG rather than a DIAGNOSTIC message.
 1.44 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.43 13-Jan-1998  scottr Update for bus.h changes.
 1.42 12-Jan-1998  thorpej Update for changes to config.
 1.41 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.40 15-Jul-1997  scottr branches: 1.40.2;
In nubus_print(), always print the NuBus slot number. Also, refine it so
that when no driver matches, our output is a little more consistent with
existing practice.
 1.39 14-Jul-1997  scottr Clean up some DIAGNOSTIC messages: use %x to display the slot number.
 1.38 13-May-1997  scottr Update a recently-added comment re: bytelanes values.
 1.37 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.36 23-Apr-1997  briggs On video devices, if we're loading non-default resource values, save the
resource ID. Thanks to Paul Goyette <paul@pgoyette.bdt.com> for spotting
this one.
 1.35 22-Apr-1997  scottr #ifdef DIAGNOSTIC, print the NuBus type fields for unrecognized boards.
 1.34 10-Apr-1997  briggs Some patches from Bob Nestor <rnestor@metronet.com> and myself to edge
toward support for an Apple SONIC-based ethernet card. Some cards, like
his, were being missed and/or probed like video cards!
 1.33 15-Mar-1997  scottr Defer enabling NuBus slot interrupts until all slots have been probed
and drivers attached. This removes the need for the MAC68K_BROKEN_VIDEO
option. From Allen Briggs.
 1.32 28-Feb-1997  scottr Remove duplicate <machine/bus.h> include that crept in.
 1.31 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.30 22-Feb-1997  scottr Make this compile again; missed this file when fixing nubus.h errors.
 1.29 17-Dec-1996  scottr branches: 1.29.6;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.28 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.27 21-Oct-1996  scottr Fix a raft of printf format strings and some declaration problems for
the case where we define DEBUG. From Erik Bertelsen, closes PR 2871.
 1.26 13-Oct-1996  christos backout previous kprintf change
 1.25 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.24 27-Aug-1996  cgd change cfprint_t type definition to take a const char *, rather than
a char *, because that's what was really intended, and because
if the print function modifies the string, various things could become
unhappy (so the string should _not_ be modified).
 1.23 08-May-1996  scottr Make this compile if DEBUG is defined.
 1.22 07-May-1996  briggs Clean up an error printf() and use proper macro.
 1.21 06-May-1996  briggs Ooops. Remove debugging printf().
 1.20 06-May-1996  briggs Do not depend on the nubus being mapped in one huge segment.
 1.19 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.18 04-Apr-1996  scottr Make this compile again; will need to deal with matchbyname() later, though.
 1.17 01-Apr-1996  briggs Clean up for higher warning level.
 1.16 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.15 12-Jan-1996  briggs Fixes from PR #1931 w/ minor mod in vm_machdep.c
 1.14 04-Aug-1995  briggs Nuke int_video_start in favor of consistent use of mac68k_vidlog.
Don't find the internal video more than once.
Probe for internal video before nubus instead of after.
 1.13 30-Jul-1995  briggs Fix the internal video probe again.
 1.12 21-Jun-1995  briggs Add some debugging (conditional on DEBUG). Add a more correct probe for
internal video. Clean up nubusprint() a bit.
 1.11 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.10 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.9 12-Apr-1995  briggs Make nubus indirect. Duh.
 1.8 26-Oct-1994  cgd new RCS ID format.
 1.7 26-Jun-1994  briggs Don't assume NuBus is at NBBASE. We might remap it.
 1.6 23-Feb-1994  briggs Do a cleaner probe. This still needs lots of work, but will work on
reasonable cards...
 1.5 22-Feb-1994  briggs Minor tweaks to prevent hangs and other bad behavior... Needs much more
work now that we have more info (Designing Cards and Drivers for the
Macintosh Family Hardware.
 1.4 30-Jan-1994  briggs Just playing include-cop.
 1.3 21-Dec-1993  briggs Update ethernet driver to use config.new. At least, it's a first stab
working from mycroft's magnum changes to if_ed.c.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.29.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.40.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.45.12.1 21-Jun-1999  thorpej Sync w/ -current.
 1.45.8.2 01-Nov-1999  scottr Repair merge-related damage
 1.45.8.1 01-Nov-1999  scottr Sync with main branch.
 1.47.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.50.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.50.4.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.50.4.1 25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.51.6.4 03-Jan-2003  thorpej Sync with HEAD.
 1.51.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.51.6.2 17-Apr-2002  nathanw Catch up to -current.
 1.51.6.1 20-Aug-2001  nathanw file nubus.c was added on branch nathanw_sa on 2002-04-17 00:03:39 +0000
 1.56.2.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.56.2.4 17-Jan-2005  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.59.2.1 03-Sep-2007  yamt sync with head.
 1.60.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.62.52.1 19-Jan-2009  skrll Sync with HEAD.
 1.62.44.1 04-May-2009  yamt sync with head.
 1.62.40.1 17-Jan-2009  mjf Sync with HEAD.
 1.63.24.2 03-Dec-2017  jdolecek update from HEAD
 1.63.24.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.63.14.1 30-Oct-2012  yamt sync with head
 1.65.20.1 10-Jun-2019  christos Sync with HEAD
 1.65.18.1 18-Jan-2019  pgoyette Synch with HEAD
 1.66.14.1 21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.67.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.66 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.65 04-Mar-2009  hauke branches: 1.65.12; 1.65.22;
Add Nubus IDs for the Atto SiliconExpress IV, an isp1000 based
fast/wide SCSI adapter.
 1.64 07-Mar-2007  tsutsui branches: 1.64.44; 1.64.52; 1.64.58;
Change variables which are used to read byte stream data
from (void *) to (char *).
 1.63 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.62 06-Dec-2006  hauke branches: 1.62.2;
Support for four nubus video cards:

Formac ProNitron 80.IVb (1024x768/8)
Relax 19" Model 200 (1024x768/8)
Apple Monochrome Video Card (640x480/1)
VillageTronic Mac Picasso 320 (up to 1920x1080/up to 24)

Nubus identifiers for Creative Solutions parallel & serial cards,
and a Becton Dickinson data acquisition card.
 1.61 11-Dec-2005  christos branches: 1.61.20; 1.61.22;
merge ktrace-lwp.
 1.60 03-Jun-2005  rjs branches: 1.60.2;
Add const.
 1.59 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.58 25-Apr-2004  rjs Add the TI microExplorer card.
 1.57 13-Apr-2002  briggs branches: 1.57.10;
Fixes and changes from Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>.
* Clean up after briggs@ changes to support bus_dma.
* Add support for reading sMemory resources from nubus cards.
* Add support for old cards with only the board rsrc (NatSemi NB-GPIB, e.g.)
* Add a few more card identifiers.
 1.56 10-Apr-2002  briggs Use m68k/m68k/cacheops.[ch]
Use m68k/m68k/bus_dma.c
- Add mainbus_attach_args with bus_space_tag_t and bus_dma_tag_t.
- Use passed-in tags for nubus scan.
 1.55 22-Jan-2001  briggs branches: 1.55.4; 1.55.8;
Clear interrupts on the RasterOps PaintBoard Prism GT 1.0. From
Alastair Bridgewater <nyef@softhome.net>.
 1.54 22-Jan-2001  briggs Handle interrupts on the Radius DirectColor/GX (id 0x27c). From
Alastair Bridgewater <nyef@softhome.net>.
 1.53 08-Dec-2000  briggs Do not define the same symbol with two different values. PR#11664.
 1.52 05-Dec-2000  briggs Add the DrHw Apple 24AC "Boogie" video card.
Thanks to Lucas Lay <segfault@mac.com> for digging it up.
 1.51 05-Dec-2000  briggs Add defines for:
Apple WGS SCSI / cache card
FWB JackHammer SCSI card
 1.50 26-Jul-2000  briggs Add Sigma Designs L-View and AsanteFAST product codes.
 1.49 18-Mar-2000  scottr branches: 1.49.4;
Add the RasterOps 24MxTV; this card operates in the same manner as two
other RasterOps boards we already handle. Information provided by
Greg Kerr.
 1.48 14-Jun-1999  briggs branches: 1.48.2;
Clear interrupts on a Radius GS/C card. Thanks go to Yasufumi Suzuki
<yattin@sco.bekkoame.ne.jp> for doing the MacsBug "leg"work for me.
 1.47 10-Jun-1999  briggs Note that 0x146 is a Micron Exceed.
 1.46 01-Jun-1999  briggs Add define for another ethernet card (Nuvolink)
Wrap nubus_scan_slot() prototype in #ifdef DEBUG.
 1.45 30-May-1999  briggs PR 7021 from Yoshihisa Sugimoto <sugimoto@sums.shiga-med.ac.jp>:
Clear interrupt properly on the RasterOps 24XLTV. Same as the 24LX.
 1.44 27-Sep-1998  scottr branches: 1.44.6; 1.44.8; 1.44.10; 1.44.12;
Add support for the TFL LAN Inc. E410/E420 PDS cards. Based on code
from Ken Nakata in PR 6199, which was in turn derived from code from
Haru Maruyama <h-maru @ da2.so-net.ne.jp>.
 1.43 15-Sep-1998  scottr Add the DrHw value for the MicroConversions 2124NB II display adapter,
from Paul Goyette.
 1.42 17-Aug-1998  briggs Update comment after cut and paste.
 1.41 12-Aug-1998  scottr Support Cabletron Ethernet card, from John Marohn in PR 5762.
 1.40 09-Aug-1998  briggs Support video interrupt for GrandVimage 17iL video card.
 1.39 23-May-1998  briggs Handle video interrupts for the Radius PrecisionColor 24X card. Thanks for
sleuthing and testing go to Robert Oelkers <windcatcher@earthlink.net>.
 1.38 07-May-1998  briggs New video card: Vimage by Interware Co., Ltd.
Define constants for the PLI QuickSCSI nubus board.
 1.37 26-Apr-1998  briggs Deal with the video interrupt for the RasterOps 8/24XLi. Thanks for the
information go to Tadashi Ueda <ng6t-ued@asahi-net.or.jp>.
 1.36 24-Apr-1998  briggs Add interrupt support for two more video cards: the Formac color card II
and the Radius PrecisionColor 24Xp. Thanks to <falk.stern@luene.net> and
<Mario_Magliocco@broder.com> for their remote sleuthing and testing.
 1.35 03-Dec-1997  briggs Thanks to Paul Goyette <paul@whooppee.com> for a patch to clear the
interrupt properly on a SuperMac Spectrum/8 Series III, and thanks
to Dan McMahill for loaning the card to Paul.
I modified Paul's patch somewhat to change grfmv_intr_generic_{1,4}
to grfmv_intr_generic_write{1,4} and added grfmv_intr_generic_or4 to
handle this card.
 1.34 30-Nov-1997  briggs Support for the Lapis ProColorServer 8 PDS on the SE/30. This prevents
hangs when trying to use this video card in conjunction with an ethernet
card. Thanks to David Condon <david@apk.net> for information and testing.
 1.33 25-Oct-1997  briggs Handle interrupts on E-Machines Futura-SX. From Paul Goyette, PR 4348.
 1.32 09-Oct-1997  briggs branches: 1.32.2;
Clear interrupts properly on the Radius PrecisionColor 8.
Thanks for the info go to Andrew MacGibbon <andrew-m@cs.auckland.ac.nz>
 1.31 26-Sep-1997  briggs Add another Dayna card to the Apple-compa. list.
Define a constant for the SuperMac Spectrum/24 series III display card.
Thanks go to Luca Falzoni <falzoni@jetai.unipv.it> for trying out the
code for the Dayna ethernet support.
 1.30 15-Aug-1997  briggs Add interrupt handler for SuperMac GFX.
Tested by Kai-Yew Lum <kaiyewl@engin.umich.edu> back in May.
 1.29 14-Aug-1997  scottr Recognize the Sigma Designs ColorMax card, and handle the interrupt. Code
provided by Brian Foley <bfoley@gpo.iol.ie> via Allen Briggs, updated for
bus.h by me.
 1.28 15-Jul-1997  scottr branches: 1.28.2;
Add DrHw value for the Macintosh Display Card
 1.27 01-Jul-1997  scottr Add support for Portrait Video Card. From SUNAGAWA Keiki
<kei_sun@ba2.so-net.or.jp> in PR 3821.
 1.26 11-May-1997  scottr Implement new NuBus slot space mapping/probing code, utilizing bus.h (and
our MD bus_space_probe() extension). This has several side effects:

- NuBus drivers must map and unmap slot space, rather than relying
on this happening before they are attached.
- Functions exported to NuBus drivers from nubus.c now need to be
supplied with a bus space tag/handle pair.
- Old bus map/peek functions can be garbage collected, as can pmap
support for the same.

Because of some current limitations of the bus space specification, we
are violating the abstraction in grf_mv (NuBus grf driver). All such
violations are clearly marked /* XXX */, and must be addressed when
the specification is updated.
 1.25 02-May-1997  briggs Thanks to Tobias Beal <tbeal41@maine.maine.edu>, we can clear interrupts
on at least one Radius Precisioncolor 8 board.
 1.24 01-May-1997  briggs Treat drhw 118 and 119 the same for Apple ethernet cards.
 1.23 01-May-1997  briggs Add in a couple more board types.
 1.22 10-Apr-1997  briggs Ignore SE/30 faux-video card.
 1.21 10-Apr-1997  briggs Comment video cards and add define for SuperMac Thunder/24.
 1.20 10-Apr-1997  briggs Changes from Bob Nestor to come closer to supporting his Apple SONIC-based
nubus card.
 1.19 01-Apr-1997  briggs Add DrHW for RasterOps CB264--From Scott Reynolds--and link it in to the
proper interrupt routine.
 1.18 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.17 24-Feb-1997  scottr NUBUS_SLOT_TO_PADDR -> NUBUS_SLOT2PA
 1.16 19-Feb-1997  scottr Add a bus space tag field to nubus_attach_args
 1.15 17-Dec-1996  scottr branches: 1.15.6;
Define struct nubus_attach_args
 1.14 07-May-1996  briggs Get rid of some old, now meaningless macros.
 1.13 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.12 12-Jan-1996  briggs Patch to at least recognise FOCUS EtherLAN. From Erik Bertelson
<erik@sockdev.uni-c.dk>
 1.11 24-Sep-1995  briggs Add Technology Works ethernet card. From
Kazunari Nakamura <kazu@nkk.co.jp>.
 1.10 25-Aug-1995  briggs Add constants for CSI's communications card.
 1.9 30-Jul-1995  briggs Fix the internal video probe again.
 1.8 01-Jul-1995  briggs Fix buglet that was missed when converting nubus to non pa==va mapping.
 1.7 21-Jun-1995  briggs Make NUBUS_BASE_TO_SLOT and reverse not depend on VA==PA for NuBus.
Add constant for DRSW_FARALLON.
 1.6 05-May-1995  briggs Add some code/defines to differentiate Asante and Interlan/Gator cards
correctly with the new nubus code.
 1.5 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.4 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.3 26-Oct-1994  cgd new RCS ID format.
 1.2 29-Nov-1993  briggs Update to current work in progress. This includes an update to
use config.new.
Numerous updates to console so it works better on the SE/30 screen.
Some nice changes from Brad Parker for handling NuBUS and an ethernet
driver that I haven't worked on, yet.
 1.1 29-Sep-1993  briggs branches: 1.1.1;
Initial revision
 1.1.1.1 29-Sep-1993  briggs The current MacBSD architecture sub-directory for NetBSD-0.9--more or
less. It needs some help to get to be -current. Support for minimal
hardware on the SE/30, II, IIx, and IIcx exists.
 1.15.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.28.2.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.2 29-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.28.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.32.2.2 01-Dec-1997  mellon Pull rev 1.34 up from trunk (briggs) (reviewed by mellon)
 1.32.2.1 26-Oct-1997  mellon Pull rev 1.33 up from trunk (briggs)
 1.44.12.1 30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

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

synchronization to latest KAME will take place on HEAD branch soon.
 1.44.10.1 21-Jun-1999  thorpej Sync w/ -current.
 1.44.8.2 14-Dec-2000  he Pull up revision 1.52 (requested by briggs):
Add the DrHw Apple 24AC "Boogie" video card.
 1.44.8.1 21-Jun-1999  perry pullup 1.44->1.45 (briggs)
 1.44.6.1 01-Nov-1999  scottr Repair merge-related damage
 1.48.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.48.2.3 13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.48.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.48.2.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.49.4.2 14-Dec-2000  he Pull up revision 1.52 (requested by briggs):
Add the DrHw Apple 24AC "Boogie" video card.
 1.49.4.1 07-Aug-2000  briggs pullup revision 1.50, approved by thorpej.
Define constants for AsanteFAST and Sigma Designs L*View cards.
 1.55.8.1 17-Apr-2002  nathanw Catch up to -current.
 1.55.4.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.57.10.5 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.57.10.4 17-Jan-2005  skrll Sync with HEAD.
 1.57.10.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.57.10.2 18-Sep-2004  skrll Sync with HEAD.
 1.57.10.1 03-Aug-2004  skrll Sync with HEAD
 1.60.2.2 03-Sep-2007  yamt sync with head.
 1.60.2.1 30-Dec-2006  yamt sync with head.
 1.61.22.1 10-Dec-2006  yamt sync with head.
 1.61.20.1 12-Jan-2007  ad Sync with head.
 1.62.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.64.58.1 13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.64.52.1 28-Apr-2009  skrll Sync with HEAD.
 1.64.44.1 04-May-2009  yamt sync with head.
 1.65.22.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.65.12.1 30-Oct-2012  yamt sync with head
 1.60 09-Apr-2025  nat Demistify some magic...

While here exclude the second variant of EASC from attaching.

No functional change intended.
 1.59 13-Jan-2025  riastradh mac68k/asc: Nix trailing whitespace.

No functional change intended.
 1.58 12-Oct-2017  flxd branches: 1.58.40;
Exclude Enhanced Apple Sound Chip (EASC) without support for wavetable mode
used by asc(4).
 1.57 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.56 16-Mar-2014  dholland branches: 1.56.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.55 25-Oct-2013  martin Remove not yet used stuff
 1.54 27-Oct-2012  chs branches: 1.54.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.53 15-Jun-2008  tsutsui branches: 1.53.30; 1.53.40;
Make this compile (fix an unused variable).
 1.52 13-Jun-2008  cegger use device_lookup_private to get softc
 1.51 17-Oct-2007  garbled branches: 1.51.16; 1.51.18; 1.51.20; 1.51.22; 1.51.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.50 09-Jul-2007  ad branches: 1.50.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.49 04-Mar-2007  christos branches: 1.49.2; 1.49.4; 1.49.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.48 24-Jan-2007  hubertf branches: 1.48.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.47 11-Dec-2005  christos branches: 1.47.20;
merge ktrace-lwp.
 1.46 15-Jan-2005  chs branches: 1.46.10;
de-__P, remove register, ansify, b* -> mem*.
 1.45 15-Jul-2003  lukem __KERNEL_RCSID()
 1.44 23-Oct-2002  jdolecek branches: 1.44.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.43 10-Oct-2002  jdolecek replace the somewhat strange poll routine with standard nopoll() (a.k.a
seltrue())
 1.42 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.41 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.40 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.39 30-Jul-2000  briggs branches: 1.39.2; 1.39.4; 1.39.8; 1.39.16;
Fixup for bogus assumptions about bus_space_handle_t.
 1.38 02-Jul-2000  scottr Avoid attaching on the Mac TV, as this system seems to not be
completely backward compatible to the II-series sound hardware.
 1.37 29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.36 27-Jun-2000  mrg remove redudant <vm/pmap.h> includes. <vm/pmap.h> -> <uvm/uvm_pmap.h>
 1.35 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.34 23-Mar-2000  thorpej branches: 1.34.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.33 08-Jul-1999  thorpej branches: 1.33.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.32 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.31 22-Apr-1999  ender Disable ASC interrupt enabling for now. We don't currently use it, and
it seems to be causing hangs at attach time on LCII's.
 1.30 22-Dec-1998  scottr branches: 1.30.2; 1.30.4;
vm_offset_t -> {paddr_t, vaddr_t}
 1.29 19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.28 15-Aug-1998  scottr Initialize and enable an interrupt handler, which currently doesn't
actually do anything.
 1.27 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.26 13-Jan-1998  scottr Update for bus.h changes.
 1.25 12-Jan-1998  thorpej Update for changes to config.
 1.24 10-Oct-1997  scottr Remove advertising clause.
 1.23 16-Sep-1997  scottr Set up base address of ASC for IIfx, per GtMFH.
 1.22 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.21 10-Jun-1997  veego branches: 1.21.4;
s/mac68k_btop/m68k_btop/
 1.20 24-Feb-1997  scottr Update copyright and license.
 1.19 13-Feb-1997  scottr Remove redundant info from bus_space_map() diagnostic in ascattach()
 1.18 11-Feb-1997  scottr Add a bus space tag field to obio_attach args, initialize it in
obio_search(), and use it in the ASC driver. Thanks to Jason for
pointing this out. Minor KNFing while I'm here.
 1.17 11-Feb-1997  scottr Complete revamp of Apple Sound Chip support. The ASC can now be accessed
as a real device whose registers and buffers are available through mmap(2),
which makes further development of the driver considerably less painful.
 1.16 03-Feb-1997  scottr branches: 1.16.2;
Convert to bus.h; this removes the need for the ASCBase global.
 1.15 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.14 09-Nov-1996  briggs Check to make sure that ASCBase is accessable before claiming that we
have an Apple Sound Chip. Make sure that we have configured the device
before allowing accesses to ASC memory. Among other things, this
prevents the 660AV and 840AV from getting a kernel bus error when trying
to beep on the console.
 1.13 13-Oct-1996  christos backout previous kprintf change
 1.12 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.11 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.10 17-Mar-1996  thorpej New device attachment scheme:

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

- new "attach" directive for files.*. May specify the name of
the cfattach structure, so that devices may be easily attached
to parents with different autoconfiguration semantics.
 1.9 01-Nov-1995  briggs Remove bogus assignment.
 1.8 21-Sep-1995  briggs Fix warning and use __P for prototypes.
 1.7 21-Apr-1995  briggs First pass of KNFication. Needs more.
 1.6 26-Oct-1994  cgd new RCS ID format.
 1.5 21-Jul-1994  briggs Make this into more of a device so it can be probed and attached. Nuke
RCS/CVS Log. Make ASCBase an offset instead of an absolute.
 1.4 26-Jun-1994  briggs branches: 1.4.2;
Minor mods. Get rid of constants, or update to use a better default
value.
 1.3 06-May-1994  briggs Missed some warnings...
 1.2 06-May-1994  briggs Clean up some warnings, mainly w/ timeout().
 1.1 21-Dec-1993  briggs Add basic sound support and a beeping (instead of flashing) console...
from Brad Grantham.
 1.4.2.1 24-Jul-1994  cgd update, as requested by briggs
 1.16.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.21.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.4.2 22-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.21.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.30.4.1 23-Apr-1999  perry branches: 1.30.4.1.2;
pullup 1.30->1.31 (Colin Wood)
 1.30.4.1.2.3 02-Aug-1999  thorpej Update from trunk.
 1.30.4.1.2.2 01-Jul-1999  thorpej Sync w/ -current.
 1.30.4.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.30.2.2 01-Nov-1999  scottr Sync with main branch.
 1.30.2.1 16-May-1999  scottr Sync with main branch.
 1.33.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.34.4.3 13-Sep-2000  scottr Pull up rev 1.38 from scottr:
Avoid attaching the asc driver on the Macintosh TV, since it seems
to not be completely backwards compatible with the II-series hardware.
 1.34.4.2 06-Aug-2000  briggs Pullups approved by thorpej --
Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.

Add bus_space_*_stream_N functions to bus_space.

Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).

There were some bogus assumptions about bus_space_handle_t and some
function calls that didn't match prototypes--fix those here, too.
 1.34.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.39.16.1 17-May-2002  gehenna Add device switch.
 1.39.8.3 11-Nov-2002  nathanw Catch up to -current
 1.39.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.39.8.1 17-Sep-2002  nathanw Catch up to -current.
 1.39.4.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.39.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.39.4.2 18-Jun-2002  jdolecek use cdev_decl(), make compile
 1.39.4.1 12-Sep-2001  thorpej Add noop kqueue entry point.
 1.39.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.44.6.5 25-Jan-2005  skrll Adapt to branch.
 1.44.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.44.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.44.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.44.6.1 03-Aug-2004  skrll Sync with HEAD
 1.46.10.3 03-Sep-2007  yamt sync with head.
 1.46.10.2 26-Feb-2007  yamt sync with head.
 1.46.10.1 21-Jun-2006  yamt sync with head.
 1.47.20.1 01-Feb-2007  ad Sync with head.
 1.48.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.49.10.1 03-Oct-2007  garbled Sync with HEAD
 1.49.4.1 11-Jul-2007  mjf Sync with head.
 1.49.2.1 15-Jul-2007  ad Sync with head.
 1.50.10.1 06-Nov-2007  matt sync with HEAD
 1.51.24.1 18-Jun-2008  simonb Sync with head.
 1.51.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.51.20.1 04-May-2009  yamt sync with head.
 1.51.18.1 17-Jun-2008  yamt sync with head.
 1.51.16.1 29-Jun-2008  mjf Sync with HEAD.
 1.53.40.3 03-Dec-2017  jdolecek update from HEAD
 1.53.40.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.53.40.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.53.30.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.53.30.1 30-Oct-2012  yamt sync with head
 1.54.2.1 18-May-2014  rmind sync with head
 1.56.2.1 10-Aug-2014  tls Rebase.
 1.58.40.1 02-Aug-2025  perseant Sync with HEAD
 1.18 05-Jun-2025  nat Fix full duplex recording for the later version of the EASC.

The status reported for fifo a is inverted on the later version of the EASC.
 1.17 04-Jun-2025  nat Fix independent volumes when operating in full-duplex mode.
 1.16 04-Jun-2025  nat ascaudio(4) now works full duplex! :)

ASC (non enhanced) has only been tested in an emulation though.
 1.15 15-May-2025  nat Smaller recording block size.

Fixes an issue with audio blocks being skipped especially when the recording
samplerate did not match the hw capabilities.
 1.14 14-May-2025  nat Missing whitespace.
 1.13 14-May-2025  nat Rearrange.
 1.12 14-May-2025  nat Remove unused code.
 1.11 14-May-2025  nat Add support for 22kHz recording.
 1.10 12-May-2025  nat Add software volume scaling to recording.
 1.9 12-May-2025  nat Return initial block of silence when starting recording.
 1.8 12-May-2025  nat Set non compressed mode for recording.
 1.7 12-May-2025  nat Add code to configure the Digitally Filtered Audio Chip.

This was the missing puzzle piece to audio recording on the Macintosh.

It is currently experimental and use caution when testing!

It should work on most machines expecpt the PowerBook 5xx and similar
due to the fact they configure the dafc via the power manager.
 1.6 12-May-2025  nat Add independent audio recording volume control.
 1.5 09-Apr-2025  nat Move version identifiers to ascreg.h

No functional change intended.
 1.4 13-Jan-2025  riastradh mac68k/asc: Nix trailing whitespace.

No functional change intended.
 1.3 12-Jan-2025  nat Overhaul of ascaudio(4).

Simpler interrrupt function.
Volume control works properly on different variants of EASCs.
Alternate FIFOs identified for some EASCs.

Recording still does not work as yet as microphone audio needs to be routed
to the sound chip. However attempting to record should no longer cause a
lockup or panic.
 1.2 13-Oct-2024  nat Match against an EASC chip that reports a different version id.
 1.1 13-Mar-2024  nat branches: 1.1.2;
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.1.2.1 02-Aug-2025  perseant Sync with HEAD
 1.3 14-May-2025  nat Add support for 22kHz recording.
 1.2 12-May-2025  nat Add independent audio recording volume control.
 1.1 13-Mar-2024  nat branches: 1.1.2;
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.1.2.1 02-Aug-2025  perseant Sync with HEAD
 1.5 12-May-2025  nat Add code to configure the Digitally Filtered Audio Chip.

This was the missing puzzle piece to audio recording on the Macintosh.

It is currently experimental and use caution when testing!

It should work on most machines expecpt the PowerBook 5xx and similar
due to the fact they configure the dafc via the power manager.
 1.4 09-Apr-2025  nat Move version identifiers to ascreg.h

No functional change intended.
 1.3 13-Jan-2025  riastradh mac68k/asc: Nix trailing whitespace.

No functional change intended.
 1.2 12-Jan-2025  nat Overhaul of ascaudio(4).

Simpler interrrupt function.
Volume control works properly on different variants of EASCs.
Alternate FIFOs identified for some EASCs.

Recording still does not work as yet as microphone audio needs to be routed
to the sound chip. However attempting to record should no longer cause a
lockup or panic.
 1.1 13-Mar-2024  nat branches: 1.1.2;
Apple Sound Chip audio support for 68k Macintoshoes.

This provies a sound device and support for wsbell(4).

Manual page to be added in a followup commit.

As posted to port-mac68k.
 1.1.2.1 02-Aug-2025  perseant Sync with HEAD
 1.8 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.7 06-Sep-2002  gehenna branches: 1.7.146; 1.7.156;
Merge the gehenna-devsw branch into the trunk.

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

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

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

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

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

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

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

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

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.6 26-Jun-2000  simonb branches: 1.6.2; 1.6.4; 1.6.8; 1.6.16;
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.5 23-Mar-2000  thorpej branches: 1.5.4;
New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.4 10-Oct-1997  scottr branches: 1.4.16;
Remove advertising clause.
 1.3 24-Feb-1997  scottr branches: 1.3.4;
Update copyright and license.
 1.2 11-Feb-1997  scottr Complete revamp of Apple Sound Chip support. The ASC can now be accessed
as a real device whose registers and buffers are available through mmap(2),
which makes further development of the driver considerably less painful.
 1.1 05-May-1996  briggs branches: 1.1.6;
Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.1.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.16.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.4.1 30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.6.16.1 19-May-2002  gehenna Remove unnecessary prototype.
 1.6.8.1 17-Sep-2002  nathanw Catch up to -current.
 1.6.4.2 10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.6.4.1 18-Jun-2002  jdolecek use cdev_decl(), make compile
 1.6.2.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.7.156.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.7.146.1 30-Oct-2012  yamt sync with head
 1.64 15-Aug-2022  rin Rework avdma to fix PR port-mac68k/56131 as well as add synchronous
transfer support.

According to analysis by Michael Zucca, PSC (DMAC for Quadra/Centris AV)
seems to require that DMA buffer is
(1) aligned to 16-byte boundaries, and
(2) multiple of 16 bytes in size.
If the buffer does not satisfy these constraints, esp.c rev 1.63 and
prior carry out partial PIO to align or shave off it.

However, partial PIO does not always work correctly for combination of
NCR53C94 and PSC, which results in failures observed as port-mac68k/56131.

Also, PIO spoils synchronous transfer, which is timing critical.

Therefore, for buffers that do not satisfy the boundary conditions,
completely stop using PIO and use DMA with ``bounce'' buffers.

This fixes port-mac68k/56131 and enables sync transfer as a big bonus.

Note that bounce DMA does not hurt performance at all. For filesystem
and swap I/O, buffers always satisfy the constraints above, and bounce
DMA is necessary only
(a) when disk is attached, or
(b) for special utilities like fsck(8) or fdisk(8),
as far as I can tell.

Also:

- Stop providing ``DMA-friendly'' sc_imess and sc_omess; transfer for
MSGIN or MSGOUT does not almost certainly satisfy boundary condition
(2). Again, this does not affect performance at all.

- SCSI bus frequency is 20MHz (i.e., 5MB/s for sync transfer) for AV
models, according to ``Quadra 840AV Service Source''.
 1.63 15-Aug-2022  rin Remove stray newline. No binary changes.
 1.62 15-Aug-2022  rin For avdma, bus_dmamap_create(9) with nsegments = 1, as PSC supports
only one physically contiguous segment in a single DMA transaction.

Slightly improves performance.
 1.61 15-Aug-2022  rin Minor cosmetic changes. NFC.

- Use switch instead of if-else-if chain.
- Dedup codes a bit.
 1.60 22-Feb-2021  rin Elucidate why synchronous transfer is disabled for AV Macs.

Sync negotiation times out when drive advertises that capability:

----
sd1 at scsibus0 target 1 lun 0: <codesrc, SCSI2SD, 6.0> disk fixed
sd1: 16384 MB, 2088 cyl, 255 head, 63 sec, 512 bytes/sect x 33554432 sectors
sd1: sync (160.00ns offset 15), 8-bit (6.250MB/s) transfers
...
sd1(esp0:0:1:0): esp0: timed out [ecb 0x9f7fc4 (flags 0x1, dleft 8, stat 0)], <state 5, nexus 0x9f7fc4, phase(l 1, c 1, p 1), resid 8, msg(q 0,o 80) DMA active>
sd1(esp0:0:1:0): sync negotiation disabled
sd1(esp0:0:1:0): esp0: timed out [ecb 0x9f7fc4 (flags 0x41, dleft 8, stat 0)], <state 5, nexus 0x9f7fc4, phase(l 1, c 1, p 1), resid 8, msg(q 20,o 80) DMA active> AGAIN
sd1: async, 8-bit transfers
----

This is observed for real SCSI drives as well as SCSI2SD (rev 6.0).

Note that this is not a fallout from DMA patch for AV Macs; timeout
takes place even if ``avdma'' code is forcibly disabled.

No binary changes.
 1.59 22-Feb-2021  rin - Add missing \n's to printf(9).
- Whitespace fixes.
 1.58 23-Jul-2019  rin branches: 1.58.10;
PR port-mac68k/24883

Support DMA xfer for SCSI adapter of AV Mac (660/840AV), written by
Michael Zucca.

This improves disk I/O performance by nearly one order of magnitude.
In addition, interrupt storm due to heavy disk PIO is resolved.

I'm deeply grateful to Michael Zucca for his analysis of DMA engine
and submission of PR. I also thank Izumi Tsutsui (useful comments on
port-mac68k@) and Martin Husemann (test on 660AV).
 1.57 23-Jul-2019  rin PR port-mac68k/24883

Style-only changes in preparation to import AV DMA code:

- G/C unused from esp_softc
- clean up headers:
- prefer <sys/bus.h> over <machine/bus.h>
- G/C unused
- sort
- staticify private functions and variables
- stop using inline qualifier for functions called via function pointers
- use C99 initializer
- provide bus_space_vaddr(9) and use it, instead of using member of
bus_handle_t directly
- use uint*_t:
- u_char --> uint8_t
- u_int*_t --> uint*_t
- use proper names from ncr53c9xreg.h instead of magic numbers
- and some KNF, and etc.

No functional changes intended.
 1.56 08-Jan-2019  jdolecek no need to include <machine/param.h> if <sys/param.h> already included
 1.55 18-Feb-2012  rmind branches: 1.55.38; 1.55.40;
Replace few simple_lock(9) cases.
 1.54 02-Aug-2011  uebayasi branches: 1.54.2; 1.54.6;
ncr53c9x was converted to use mutex(9), follow that. Fix DEBUG build too.
 1.53 02-Aug-2011  uebayasi Include sys/simplelock.h to use simple_lock(); fix build.
 1.52 23-Nov-2009  rmind Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.51 02-Jun-2008  hauke esp_quick_dma_go() gets called from the MI ncr53c9x_intr() handler,
which protects itself against multiple invocation with a
simple_lock. Follow the example of ncr53c9x_poll() for servicing an
interrupt that came while we run in splhigh(), and 'manually' unlock
the MI handler for calling ncr53c9x_intr().

Fixes PR mac68k/38758.
 1.50 13-Apr-2008  tsutsui branches: 1.50.2; 1.50.4; 1.50.6;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.49 17-Oct-2007  garbled branches: 1.49.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.48 08-Jun-2007  tsutsui branches: 1.48.10;
On my LC630 64KB DMA xfer causes timeout errors
so limit sc_maxxfer size to 63KB.
 1.47 07-Mar-2007  tsutsui branches: 1.47.2; 1.47.4; 1.47.10;
Previous fix is not correct. sc_dmaaddr is actually
pointer against pointer, so just use proper casts
rather than bogus void pointers.
 1.46 05-Mar-2007  he Add two instances of an overlooked indirection.
 1.45 04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.44 08-Mar-2006  lukem branches: 1.44.14; 1.44.16;
Use the SI capitalization for "Hz", "kHz", and "MHz" in comments and strings.
Add a space between numbers and Hz unit.
 1.43 24-Dec-2005  perry branches: 1.43.4; 1.43.6; 1.43.8; 1.43.10;
__asm__ -> __asm
__const__ -> const
__inline__ -> inline
__volatile__ -> volatile
 1.42 24-Dec-2005  perry Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.41 11-Dec-2005  christos merge ktrace-lwp.
 1.40 16-Jun-2005  jmc branches: 1.40.2;
Fixes for volatile problems
 1.39 05-Mar-2005  chs use attach args instead of dv_unit, just like cf_unit.
 1.38 19-Jan-2005  chs branches: 1.38.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.37 15-Jan-2005  chs branches: 1.37.2;
really ansify.
 1.36 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.35 15-Jul-2003  lukem __KERNEL_RCSID()
 1.34 02-Oct-2002  thorpej branches: 1.34.6;
Use CFATTACH_DECL().
 1.33 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.32 27-Sep-2002  provos remove trailing \n in panic(). approved perry.
 1.31 30-May-2002  thorpej Don't use multi-line string literals.
 1.30 18-Nov-2001  briggs branches: 1.30.8;
Correct operation of non-pseudo-DMA mode. Used on 660 & 840 AV models.
From Takeshi Shibagaki<ie9t-sbgk@asahi-net.or.jp>.
 1.29 25-Apr-2001  bouyer branches: 1.29.2; 1.29.8;
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.28 18-Jan-2001  briggs branches: 1.28.2;
Handle the TRPAD case a little better.
Also, if the so-called DMA operation is a write and ends without target-
complete set, count the data in the FIFO as residual and add that to the
amount in the counters. Hauke Fath reports that this passes early testing
on his Quantum Viking.
 1.27 29-Dec-2000  briggs Do not try to second-guess the ncr53c9x driver by setting *dmasize to 0
if it is 64k. TCL and TCM will be set properly if we just leave it alone.
Not only that, the ncr53c9x driver issues TRPAD or TRANS based on this
value. We do not want TRPAD in this case!
 1.26 29-Dec-2000  briggs Rework the esp driver a little bit to improve performance. This requires
an ugly bit where we record the value of a2 while handling a "nofault" bus
error in locore.s in order to know how far the transaction got before a
disconnect (see esp.c comments for more details on this).
Also get rid of a loop (and delay()!) in the interrupt routine--hinted at
and researched by Chas Williams <chas@cmf.nrl.navy.mil>.
 1.25 05-Jun-2000  nisimura branches: 1.25.2;
Have MI ncr53c9x_attach() the 2nd and 3rd arguments for scsipi_adater
and scsipi_device respectively, with size reduction of ncr53c9x_softc.
Specifying NULL instructs the driver to use default adapter and default
device codes. Every target port has ncr53c9x_attach(sc, NULL, NULL) anyway.
 1.24 19-Oct-1999  thorpej branches: 1.24.4;
Program the 53c96's interrupt routing info into the VIA before doing
anything that might cause an interrupt (e.g. the SCSI bus reset in
ncr53c9x_attach()). If we don't do this, the initial interrupt is
lost, thus causing the state machine to never enter IDLE state, thus
causing SCSI commands to never be executed.

Fixes kern/8544, reported by Erik Bertelsen <erik@mediator.uni-c.dk>.
 1.23 27-Jun-1999  briggs branches: 1.23.2; 1.23.4; 1.23.6;
Undo some of my recent changes that were misguided.
 1.22 09-Jun-1999  briggs Remove some register declarations.
Get Q9x0 dual SCSI at least basically working.
Be paranoid about some register reads.
 1.21 01-Jun-1999  briggs Raise spl4 to spl6 in quick_go--I am now experimenting with interrupts
at levels 5 (sound) and 6 (via1) on the Q700.
Raise splhigh when reading and writing registers. It's ugly, but it's
possible that we could get an interrupt from a higher-level source,
causing a re-read of a memory location.
This is not good when, e.g., we are reading the interrupt register.
Ideally, we would just raise splhigh() in ncr53c9x_readregs(), but
that's m.i. code, and it may be expensive on other architectures.
 1.20 22-Dec-1998  scottr branches: 1.20.2; 1.20.6;
vm_offset_t -> {paddr_t, vaddr_t}
 1.19 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.18 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.17 05-Sep-1998  pk Relinquish my copyright claims on this file.
 1.16 09-May-1998  briggs Get both SCSI busses operational on the Q900 and Q950.
 1.15 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.14 12-Jan-1998  thorpej Update for changes to config.
 1.13 19-Nov-1997  briggs * Disable parity checking on all devices until we find a better way to
deal with cheap CD-ROMs and other devices that do not appear to have
any way to enable parity generation. In the future, it might be nice
to have this configurable on a per-device basis with back-to-back
parity errors automatically disabling parity for the device. That
would require some MI changes.
* Handle unaligned and odd-length transfers.
This could probably be handled better in the future.
 1.12 05-Nov-1997  briggs A first cut at faster SCSI for non-AV quadras. Could probably perform better,
but is a marked improvement. This takes advantage of a pseudo-DMA hardware
hack of Apple's that exposes a 16-bit register that the Apple-designed
memory controller acts like a DMA controller and handshakes into or out
of the FIFO. Wierd.
 1.11 27-Aug-1997  bouyer branches: 1.11.4;
Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.10 05-Mar-1997  briggs branches: 1.10.2; 1.10.4;
Copyright foo.
 1.9 01-Mar-1997  scottr Fix prototype for espmatch()
 1.8 28-Feb-1997  scottr Convert to generalized VIA interrupt registration
 1.7 27-Feb-1997  briggs mac68k-specific portion of m.i. ncr53c9x driver.
 1.6 16-Dec-1996  scottr branches: 1.6.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.5 10-Dec-1996  thorpej Fill in sc_link.max_target
 1.4 04-Nov-1996  briggs - Move offset for 2nd scsi controller (Q900/Q950/WGS95) to 0x402
instead of 0x400.
- Restructure interrupt handling for more performance--continue to
read/write data as long as the device keeps us in a data xfer phase.
There is still a lot of room for speed improvement here. Perhaps it
lies is speeding up the interrupt path in general?
 1.3 02-Nov-1996  briggs Improve reliability on my Q700, at least. Was getting the occasional
glitch--an extra byte on occasion.
 1.2 30-Oct-1996  briggs macs with scsibase offset 0x10000 from iobase use a SCSI CLK of 16.5MHz
(off PrimeTime)--all others appear to use 25MHz.
 1.1 29-Oct-1996  briggs Interrupt-driven, but slow, NCR 53c96 driver for the 040-based macs. Contains
some guesses for the machines that have two of these buggers (I don't have
such a machine). This driver is a copy of the sparc/alpha esp with a
minimum of changes--after we get it performing a bit more respectably,
we should see about re-normalizing the sources.
 1.6.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.10.4.1 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.11.4.2 19-Nov-1997  mellon Pull rev 1.13 up from trunk (briggs)
 1.11.4.1 15-Nov-1997  mellon Pull rev 1.12 up from trunk (briggs)
 1.20.6.2 01-Jul-1999  thorpej Sync w/ -current.
 1.20.6.1 21-Jun-1999  thorpej Sync w/ -current.
 1.20.2.1 01-Nov-1999  scottr Sync with main branch.
 1.23.6.1 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.23.4.1 15-Nov-1999  fvdl Sync with -current
 1.23.2.5 29-Mar-2001  bouyer Pass compile-test on i386.
 1.23.2.4 11-Feb-2001  bouyer Sync with HEAD.
 1.23.2.3 05-Jan-2001  bouyer Sync with HEAD
 1.23.2.2 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.23.2.1 20-Oct-1999  thorpej Sync w/ trunk.
 1.24.4.1 22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.25.2.2 22-Dec-2001  he Pull up revision 1.30 (requested by briggs):
Correct operation of non-pseudo-DMA mode, as used on 660 and 840
AV models.
 1.25.2.1 25-Jan-2001  jhawk Pull up revisions 1.26-1.28 (requested by briggs):
Improve performance of the pseudo-DMA mode of the esp driver, and handle
residual FIFO data on write.
 1.28.2.1 21-Jun-2001  nathanw Catch up to -current.
 1.29.8.4 18-Oct-2002  nathanw Catch up to -current.
 1.29.8.3 20-Jun-2002  nathanw Catch up to -current.
 1.29.8.2 08-Jan-2002  nathanw Catch up to -current.
 1.29.8.1 25-Apr-2001  nathanw file esp.c was added on branch nathanw_sa on 2002-01-08 00:26:08 +0000
 1.29.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.29.2.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.29.2.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.30.8.1 14-Jul-2002  gehenna catch up with -current.
 1.34.6.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.34.6.6 08-Mar-2005  skrll Sync with HEAD.
 1.34.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.34.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.34.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.34.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.34.6.1 03-Aug-2004  skrll Sync with HEAD
 1.37.2.1 29-Apr-2005  kent sync with -current
 1.38.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.40.2.2 03-Sep-2007  yamt sync with head.
 1.40.2.1 21-Jun-2006  yamt sync with head.
 1.43.10.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.43.8.1 13-Mar-2006  yamt 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.44.16.1 12-Mar-2007  rmind Sync with HEAD.
 1.44.14.1 11-May-2009  bouyer Pull up following revision(s) (requested by hauke in ticket #1315):
sys/arch/mac68k/obio/esp.c: revision 1.51 via patch
sys/arch/mac68k/conf/GENERIC: revision 1.188
Add LOCKDEBUG option, commented out, so that people know it's there.
esp_quick_dma_go() gets called from the MI ncr53c9x_intr() handler,
which protects itself against multiple invocation with a
simple_lock. Follow the example of ncr53c9x_poll() for servicing an
interrupt that came while we run in splhigh(), and 'manually' unlock
the MI handler for calling ncr53c9x_intr().
Fixes PR mac68k/38758.
 1.47.10.1 26-Jun-2007  garbled Sync with HEAD.
 1.47.4.1 11-Jul-2007  mjf Sync with head.
 1.47.2.1 15-Jul-2007  ad Sync with head.
 1.48.10.1 06-Nov-2007  matt sync with HEAD
 1.49.16.2 05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.49.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.50.6.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.50.4.2 11-Mar-2010  yamt sync with head
 1.50.4.1 04-May-2009  yamt sync with head.
 1.50.2.1 04-Jun-2008  yamt sync with head
 1.54.6.1 24-Feb-2012  mrg sync to -current.
 1.54.2.1 17-Apr-2012  yamt sync with head
 1.55.40.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.55.40.1 10-Jun-2019  christos Sync with HEAD
 1.55.38.1 18-Jan-2019  pgoyette Synch with HEAD
 1.58.10.1 03-Apr-2021  thorpej Sync with HEAD.
 1.10 15-Aug-2022  rin Rework avdma to fix PR port-mac68k/56131 as well as add synchronous
transfer support.

According to analysis by Michael Zucca, PSC (DMAC for Quadra/Centris AV)
seems to require that DMA buffer is
(1) aligned to 16-byte boundaries, and
(2) multiple of 16 bytes in size.
If the buffer does not satisfy these constraints, esp.c rev 1.63 and
prior carry out partial PIO to align or shave off it.

However, partial PIO does not always work correctly for combination of
NCR53C94 and PSC, which results in failures observed as port-mac68k/56131.

Also, PIO spoils synchronous transfer, which is timing critical.

Therefore, for buffers that do not satisfy the boundary conditions,
completely stop using PIO and use DMA with ``bounce'' buffers.

This fixes port-mac68k/56131 and enables sync transfer as a big bonus.

Note that bounce DMA does not hurt performance at all. For filesystem
and swap I/O, buffers always satisfy the constraints above, and bounce
DMA is necessary only
(a) when disk is attached, or
(b) for special utilities like fsck(8) or fdisk(8),
as far as I can tell.

Also:

- Stop providing ``DMA-friendly'' sc_imess and sc_omess; transfer for
MSGIN or MSGOUT does not almost certainly satisfy boundary condition
(2). Again, this does not affect performance at all.

- SCSI bus frequency is 20MHz (i.e., 5MB/s for sync transfer) for AV
models, according to ``Quadra 840AV Service Source''.
 1.9 23-Jul-2019  rin PR port-mac68k/24883

Support DMA xfer for SCSI adapter of AV Mac (660/840AV), written by
Michael Zucca.

This improves disk I/O performance by nearly one order of magnitude.
In addition, interrupt storm due to heavy disk PIO is resolved.

I'm deeply grateful to Michael Zucca for his analysis of DMA engine
and submission of PR. I also thank Izumi Tsutsui (useful comments on
port-mac68k@) and Martin Husemann (test on 660AV).
 1.8 23-Jul-2019  rin PR port-mac68k/24883

Style-only changes in preparation to import AV DMA code:

- G/C unused from esp_softc
- clean up headers:
- prefer <sys/bus.h> over <machine/bus.h>
- G/C unused
- sort
- staticify private functions and variables
- stop using inline qualifier for functions called via function pointers
- use C99 initializer
- provide bus_space_vaddr(9) and use it, instead of using member of
bus_handle_t directly
- use uint*_t:
- u_char --> uint8_t
- u_int*_t --> uint*_t
- use proper names from ncr53c9xreg.h instead of magic numbers
- and some KNF, and etc.

No functional changes intended.
 1.7 13-Apr-2008  tsutsui branches: 1.7.92;
Split device_t/softc for MI ncr53c9x and some related devices,
with various cleanup.
 1.6 29-Dec-2000  briggs branches: 1.6.126;
Rework the esp driver a little bit to improve performance. This requires
an ugly bit where we record the value of a2 while handling a "nofault" bus
error in locore.s in order to know how far the transaction got before a
disconnect (see esp.c comments for more details on this).
Also get rid of a loop (and delay()!) in the interrupt routine--hinted at
and researched by Chas Williams <chas@cmf.nrl.navy.mil>.
 1.5 25-Nov-1997  briggs branches: 1.5.16; 1.5.26;
Forgot a declaration in last change to esp.c.
 1.4 05-Nov-1997  briggs A first cut at faster SCSI for non-AV quadras. Could probably perform better,
but is a marked improvement. This takes advantage of a pseudo-DMA hardware
hack of Apple's that exposes a 16-bit register that the Apple-designed
memory controller acts like a DMA controller and handshakes into or out
of the FIFO. Wierd.
 1.3 27-Feb-1997  briggs branches: 1.3.8;
mac68k-specific portion of m.i. ncr53c9x driver.
 1.2 02-Nov-1996  briggs branches: 1.2.6;
Improve reliability on my Q700, at least. Was getting the occasional
glitch--an extra byte on occasion.
 1.1 29-Oct-1996  briggs Interrupt-driven, but slow, NCR 53c96 driver for the 040-based macs. Contains
some guesses for the machines that have two of these buggers (I don't have
such a machine). This driver is a copy of the sparc/alpha esp with a
minimum of changes--after we get it performing a bit more respectably,
we should see about re-normalizing the sources.
 1.2.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.8.2 26-Nov-1997  mellon Pull rev 1.5 up from trunk (briggs)
 1.3.8.1 15-Nov-1997  mellon Pull rev 1.4 up from trunk (briggs)
 1.5.26.1 25-Jan-2001  jhawk Pull up revision 1.6 (requested by briggs):
Improve performance of the pseudo-DMA mode of the esp driver, and handle
residual FIFO data on write.
 1.5.16.1 05-Jan-2001  bouyer Sync with HEAD
 1.6.126.1 02-Jun-2008  mjf Sync with HEAD.
 1.7.92.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.59 26-Jul-2019  rin Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.58 27-Oct-2012  chs branches: 1.58.38;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.57 17-Oct-2007  garbled branches: 1.57.54; 1.57.64;
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.56 29-Aug-2007  jmmv Pack all global video-related variables into a structure for clarity.

A comment said that they weren't in a struct for speed reasons but...
this should not affect performance because these variables are mostly
used to set other variables (hence they are read few times).
 1.55 29-Aug-2007  jmmv Move the definition of multiple video-related variables into a new
header file (machine/video.h) so that we can kill all the "manual"
externs spread around the code (which were inconsistent among them).
 1.54 29-Aug-2007  jmmv Split the global videosize variable into videowidth and videoheight:
makes the code clearer and avoids multiple parts of it having to know
how videosize was encoded.
 1.53 04-Mar-2007  christos branches: 1.53.2; 1.53.10; 1.53.14; 1.53.18; 1.53.20;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.52 11-Dec-2005  christos branches: 1.52.26;
merge ktrace-lwp.
 1.51 15-Jan-2005  chs branches: 1.51.10;
de-__P, remove register, ansify, b* -> mem*.
 1.50 15-Jul-2003  lukem __KERNEL_RCSID()
 1.49 02-Oct-2002  thorpej branches: 1.49.6;
Use CFATTACH_DECL().
 1.48 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.47 04-Dec-2000  scottr branches: 1.47.4; 1.47.8;
Unmap the valkyrie register space when we're finished with it in
the match function. It's not like we can save that state for later,
and we don't use it anyway.
 1.46 04-Dec-2000  scottr Fix PR 11000: The esp driver needs two longwords in DAFB register space to
implement pseudo-DMA transfers with the SCSI controller. This caused our
match to fail when we couldn't map the entire DAFB register/control space
for our own use. Instead, we map only (about) what we will need in two
separate regions.

As a consequence we no longer do Turbo SCSI configuration here; indeed, it
may have caused us trouble later on if we actually changed the values
stored in those registers in the esp driver.
 1.45 30-Jul-2000  briggs Fixup for bogus assumptions about bus_space_handle_t.
 1.44 14-Feb-2000  scottr branches: 1.44.4;
Merge wscons work onto the main development branch.
 1.43 19-Jul-1999  scottr branches: 1.43.2;
The Quadra 605 and LC 47x apparently share the same logic board,
and hence need the same video hack. From Ken'ichi Ishizaka.
 1.42 28-Apr-1999  scottr From Ken'ichi Ishizaka: correct the calculation of the frame buffer
offset by masking off garbage bits in the DAFB v7. This has been
tested at all resolutions and common color depths on the LC47x.
 1.41 06-Jan-1999  scottr branches: 1.41.2; 1.41.4;
Add RBV monitor sense code (formerly commented out in rbv_vidstatus())
to the match function, and print out more detailed information when
attaching RBV video.
 1.40 21-Aug-1998  scottr Remove an extraneous printf when attaching a Valkyrie.
 1.39 20-Aug-1998  scottr Match grf_obio devices correctly for the 58x/63x.
 1.38 13-Aug-1998  scottr Add a comment regarding the broken behavior of the DAFB v7.
 1.37 12-Aug-1998  scottr The Performa/LC 58x have a Valkyrie, not the DAFB.
 1.36 12-Aug-1998  scottr New and improved console framebuffer initialization and autoconfig. This
resolves a great many issues, including Performa 58x interrupt handling
and offset displays on some models.

Programs that depend on the old (pre-NetBSD 1.1) grf interface may break.
That's actually a separate issue uncovered by this code, not caused by it.
 1.35 01-Jul-1998  scottr Add a GRF_COMPAT option so that old-style grf ioctl() code can be
removed from the kernel.
 1.34 02-Jun-1998  scottr Kill unused variable that resulted from the last change.
 1.33 02-Jun-1998  scottr Store the PA of the framebuffer in the softc. This eliminates the need
for the sc_phys callback; we can just store the PA in the grfbus attach
args, rather than a function pointer, which simplifies the code nicely.
 1.32 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.31 22-Mar-1998  scottr The monitor sense code we have is not reliable on DAFB-based machines with
certain 17" monitors. Change from Michael R. Zucca, PR 4988.

XXX - This can cause problems on system with the DAFB chip which currently
use only a NuBus-based video adapter. In particular, grf devices may not be
attached properly in this case. This unfortunate situation is less annoying
than not having a reasonable console, however. A reasonable, reliable
monitor sense algorithm for the DAFB would resolve the problem.
 1.30 22-Mar-1998  scottr Disable Valkyrie interrupts on the Quadra 630. Part of a change
from Michael R. Zucca, PR 4988.
 1.29 13-Jan-1998  scottr Update for bus.h changes.
 1.28 12-Jan-1998  thorpej Update for changes to config.
 1.27 08-Nov-1997  scottr KNF: Fix some whitespace inconsistencies.
 1.26 08-Nov-1997  briggs Force the probe to find the internal video for the 63x/575 models.
 1.25 08-Oct-1997  briggs branches: 1.25.2;
Disable video interrupts on the AV machines. Thanks to Michael R. Zucca
(mrz5149@cs.rit.edu) for the addresses and hints as to how the interrupts
might be disabled, and thanks to Henry Hotz (h.b.hotz@jpl.nasa.gov) for
testing on the 840AV.
Unmap the DAFB regs on the other Quadras after attachment. They're not
used.
 1.24 03-Aug-1997  scottr Fix grf{i,m}v_phys() prototypes.
 1.23 03-Aug-1997  scottr Overhaul grf drivers to correct recent problems with X and dt
(address error faults), as well as other reported problems:

- Simplify grfmv_phys() to work like grfiv_phys(), and eliminate the
second argument to both, as we don't use it anyway.
- Handle fbbase and fboff consistently throughout. Closes PR 3862.
- Eliminate grfaddr() by pulling it into grfmmap(), which is the
only place it was used, previously.
- grfmap() now gets the physical address of the framebuffer from
the appropriate driver, rather than try to compute it by itself.
Be careful with aligning the base to a page address and increase
the length of the mapped region appropriately. Closes PR 2867.
 1.22 26-Jul-1997  scottr branches: 1.22.2;
KNF
 1.21 10-Jun-1997  veego s/mac68k_trunc_page/m68k_trunc_page/
 1.20 21-Apr-1997  briggs Take care when accessing DAFB--some quadra-class machines use other video
controllers.
 1.19 01-Apr-1997  briggs Remove tag.
 1.18 01-Apr-1997  briggs - Support DAFB machines mo' better. Actually detect if a monitor is
present and initialize a few things. No color support, yet.
- Properly disable interrupts for DAFB.
- Rearrange for better nubus display card interrupt support. Only register
an interrupt if we know how to clear it.
- Complain if we don't know about a given display card and can not install
an interrupt handler.
- Change MYSTERY stuff to cb264--still need to get the DrSW so we can
actually call the routine to clear an interrupt from this card.
 1.17 20-Feb-1997  scottr We need bus.h now, due to recent nubus_attach_args change.
 1.16 16-Dec-1996  scottr branches: 1.16.6;
Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_CONFIG.
 1.15 13-Oct-1996  christos backout previous kprintf change
 1.14 11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.13 04-Aug-1996  scottr Add a way to tell grf_establish() that internal video doesn't actually
occupy a slot. This is necessary so that GRFIOCMAP can find the correct
physical address of the framebuffer. Fixes P550, some LC models, and
perhaps the PB520.
 1.12 19-May-1996  scottr branches: 1.12.4;
New grf attachment code, mostly by Jason Thorpe with some cleanup by me.
This will allow dt and X to work with a generic kernel, rather than
compiling different kernels that attach grf0 to a NuBus adapter or
internal video.
 1.11 05-May-1996  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.10 11-Aug-1995  briggs Don't fake these values.
 1.9 04-Aug-1995  briggs Nuke int_video_start in favor of consistent use of mac68k_vidlog.
Don't find the internal video more than once.
Probe for internal video before nubus instead of after.
 1.8 04-Aug-1995  briggs Be consistent and use mac68k_vidlog instead of int_video_start.
 1.7 30-Jul-1995  briggs Fix the internal video probe again.
 1.6 28-Jul-1995  briggs Don't show up in "slot" 0xe.\n
 1.5 06-Jul-1995  briggs Add another routine for the grf display-specific drivers to return a physical
address.
 1.4 04-Jul-1995  briggs First cut at a kludge for IIvx internal video.
 1.3 02-Jul-1995  briggs Set and use new fboff element from grfmode structure.
 1.2 21-Jun-1995  briggs Be a bit more careful on the probe... Make sure that the current slot's
addresses contain the int_video_start--or assume that internal video is
is "slot" 0xE.
 1.1 29-Apr-1995  briggs Add new nubus handling that's much more robust.
Update via, if_ae, and grf accordingly.
Revamp grf.
 1.12.4.1 05-Aug-1996  jtc Pulled up from rev 1.13 by request from Scott Reynolds
 1.16.6.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.22.2.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.22.2.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.25.2.1 09-Nov-1997  mellon Pull rev 1.26 up from trunk (briggs)
 1.41.4.2 02-Jul-2000  he Pull up revision 1.43 (requested by scottr):
Add support for Quadra 605 on-board video.
 1.41.4.1 28-Apr-1999  perry branches: 1.41.4.1.2;
pullup 1.41->1.42 (scottr)
 1.41.4.1.2.2 02-Aug-1999  thorpej Update from trunk.
 1.41.4.1.2.1 21-Jun-1999  thorpej Sync w/ -current.
 1.41.2.5 12-Dec-1999  scottr Replace references to PGOFSET with m68k_trunc_page() and m68k_page_offset(),
as appropriate.
 1.41.2.4 28-Nov-1999  scottr If we're not the console device, make sure the base PA is page-aligned
and adjust the offset if appropriate.
 1.41.2.3 01-Nov-1999  scottr Sync with main branch.
 1.41.2.2 16-May-1999  scottr Sync with main branch.
 1.41.2.1 11-Mar-1999  scottr First cut at grf emulation. Neither GRFIOCMAP nor mmap'ing a wsdisplay device
work, though several other grf ioctls are properly emulated.
 1.43.2.2 08-Dec-2000  bouyer Sync with HEAD.
 1.43.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.44.4.3 15-Dec-2000  he Pull up revision 1.47 (requested by scottr):
Be careful to unmap anything we map in the drivers' match function
in order to avoid potential future problems.
 1.44.4.2 15-Dec-2000  he Pull up revision 1.46 (requested by scottr):
Map only the register space of the DAFB required to set up the
video hardware. Fixes PR#11000.
 1.44.4.1 06-Aug-2000  briggs Pullups approved by thorpej --
Add byte-swap and stride options to bus_space. Allocate as normal, then
call mac68k_bus_space_handle_swapped() or mac68k_bus_space_handle_set_stride().
Stride is untested. Swapped code works for SMC ethernet.

Add bus_space_*_stream_N functions to bus_space.

Add a DIAGNOSTIC panic if (count-using) bus_space macros are called with
a count of zero. Some drivers do this accidentally and some bus_space
implementations will fail if count is passed as zero (they are set up in
a do-{}-while structure).

There were some bogus assumptions about bus_space_handle_t and some
function calls that didn't match prototypes--fix those here, too.
 1.47.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.47.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.49.6.4 17-Jan-2005  skrll Sync with HEAD.
 1.49.6.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.49.6.2 18-Sep-2004  skrll Sync with HEAD.
 1.49.6.1 03-Aug-2004  skrll Sync with HEAD
 1.51.10.1 03-Sep-2007  yamt sync with head.
 1.52.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.53.20.1 06-Nov-2007  matt sync with HEAD
 1.53.18.1 03-Sep-2007  jmcneill Sync with HEAD.
 1.53.14.1 03-Sep-2007  skrll Sync with HEAD.
 1.53.10.1 03-Oct-2007  garbled Sync with HEAD
 1.53.2.1 09-Oct-2007  ad Sync with head.
 1.57.64.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.57.54.1 30-Oct-2012  yamt sync with head
 1.58.38.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1 26-Jul-2019  rin branches: 1.1.10;
Add genfb(4) driver for mac68k grfbus.
1, 2, 4, 8, 15, and 32 color-depths are supported.

ANSI colors on console are functional for depth >= 4.

Graphic applications based on wsfb API should work, provided
they can correctly handle fbi_fboffset and your color depth.

wsfb driver of Xorg 1.20 and mlterm-fb (framebuffer version of
x11/mlterm) work fine for depth == 1 || depth >= 8.

For depth == 8 (256 colors), graphic applications require
colormap callback, which is currently supported for some
internal graphic adapters, and only Civic (found on Quadra
AV series) was tested. Register definition and its usage are
taken from Linux. You can easily support other adapters if
Linux supports that.

Have fun, and any problem reports are welcomed!
 1.1.10.2 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.1.10.1 26-Jul-2019  martin file grf_obioreg.h was added on branch phil-wifi on 2020-04-13 08:03:58 +0000
 1.20 20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h> include.
 1.19 24-Jan-2021  rin Add rnd(9) support.
 1.18 27-Oct-2012  chs branches: 1.18.50;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.17 05-Mar-2007  he branches: 1.17.78; 1.17.88;
Fix this so that it builds after sc_txbuf and sc_rxbuf no longer are void*.
 1.16 12-Dec-2006  martin branches: 1.16.2;
Convert DMA memory allocation to bus_dmamem_alloc. From Dave Huang.
 1.15 11-Dec-2005  christos branches: 1.15.20; 1.15.22; 1.15.24;
merge ktrace-lwp.
 1.14 15-Jan-2005  chs branches: 1.14.10;
de-__P, remove register, ansify, b* -> mem*.
 1.13 26-Mar-2004  wiz Update David Huang's email address in the license
per his request in PR 24907.
 1.12 15-Jul-2003  lukem __KERNEL_RCSID()
 1.11 02-Apr-2003  thorpej branches: 1.11.2;
Use PAGE_SIZE rather than NBPG.
 1.10 20-Oct-2002  chs merge the 12 copies of vm_machdep.c on the m68k platforms.
clean up some other stuff along the way, including:
- use m68k/cacheops.*, remove duplicates from cpu.h.
- centralize a few declarations in (all the copies of) cpu.h.
- define M68K_VAC on platforms which have a VAC.
- switch the sun platforms to the (now common) proc_trampoline().
- do the phys_map thang on the sun platforms too, no reason not to.
 1.9 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.8 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.7 29-Jun-2000  mrg branches: 1.7.4; 1.7.8;
remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.6 08-Jul-1998  scottr branches: 1.6.16;
mac68k/obio/if_mc_obio.c needs hide/integrate defines, too. Moved back to
if_mcvar.h.
 1.5 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.4 13-Jan-1998  scottr Update for bus.h changes.
 1.3 07-Nov-1997  briggs NetBSD RCSIds.
 1.2 05-Nov-1997  briggs Check for machine class, not for PSCBase as initial check in mc_obio_match().
 1.1 04-Nov-1997  briggs branches: 1.1.2;
Add in the if_mc ethernet driver for the AMD "MACE" part. This is the
internal ethernet on the Quadra/Centris 660av/840av.
Add initial support for the PSC (DMA controller) to support the above
(DMA SCSI remains unsupported). This involved also changing the way
that several interrupts are handled.
Above from David Huang <khym@bga.com>
Since the interrupts changed somewhat, we must also make the ipls
dynamic, defaulting to their prior levels and adjusted for the AVs.
I modelled this on the hp300.
 1.1.2.1 12-Nov-1997  mellon Pull rev 1.3 up from trunk (briggs)
 1.6.16.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.8.2 11-Nov-2002  nathanw Catch up to -current
 1.7.8.1 18-Oct-2002  nathanw Catch up to -current.
 1.7.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.11.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.11.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.11.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.11.2.1 03-Aug-2004  skrll Sync with HEAD
 1.14.10.2 03-Sep-2007  yamt sync with head.
 1.14.10.1 30-Dec-2006  yamt sync with head.
 1.15.24.1 15-Dec-2006  tron Pull up following revision(s) (requested by martin in ticket #272):
sys/arch/mac68k/dev/if_mc.c: revision 1.28
sys/arch/mac68k/obio/if_mc_obio.c: revision 1.16
sys/arch/mac68k/dev/if_mcvar.h: revision 1.12
Convert DMA memory allocation to bus_dmamem_alloc. From Dave Huang.
 1.15.22.1 18-Dec-2006  yamt sync with head.
 1.15.20.1 12-Jan-2007  ad Sync with head.
 1.16.2.1 12-Mar-2007  rmind Sync with HEAD.
 1.17.88.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.17.78.1 30-Oct-2012  yamt sync with head
 1.18.50.1 03-Apr-2021  thorpej Sync with HEAD.
 1.29 20-Feb-2021  rin sn(4): Add rnd(9) support.
 1.28 23-Apr-2008  tsutsui branches: 1.28.102;
Split softc/device_t and misc cleanup for sn(4).
 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 10-Jun-2007  tsutsui branches: 1.26.10;
Switch mac68k's sn(4) Ethernet to MI SONIC driver.

Tested with Apple Ethernet CS Twisted-Pare Card on LC630 by me
and Quadra 650 on-board Ethernet by hauke@.
NuBus based cards and PowerBook variants are still untested.
 1.25 11-Dec-2005  christos branches: 1.25.30; 1.25.32; 1.25.38;
merge ktrace-lwp.
 1.24 15-Jan-2005  chs branches: 1.24.10;
de-__P, remove register, ansify, b* -> mem*.
 1.23 15-Jul-2003  lukem __KERNEL_RCSID()
 1.22 02-Apr-2003  thorpej branches: 1.22.2;
Use PAGE_SIZE rather than NBPG.
 1.21 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.20 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.19 29-Sep-1999  scottr branches: 1.19.16; 1.19.20;
Normalize autoconfig output.
 1.18 28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.17 05-Jul-1998  jonathan branches: 1.17.8; 1.17.12;
defopt INET, NETATALK.
 1.16 09-Jun-1998  scottr The Performa 58x comm slot SONIC cards behave the same way as in
the LC/Performa 57x. From Yasuhiro Endoh.
 1.15 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.14 13-Jan-1998  scottr Update for bus.h changes.
 1.13 05-Nov-1997  briggs For the LC575/Q630 (comm-slot machines), try to derive the card settings.
Unfortunately, there does not seem to be a good way to determine what
variety of comm-slot card is present in a machine. There is still an
interrupt issue preventing these cards from working--hopefully that will
be ironed out shortly.
 1.12 09-Oct-1997  briggs branches: 1.12.2;
Probe for the SONIC before saying that we found it. Some early Centris
models (low-end) shipped without ethernet installed.
 1.11 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.10 15-Jun-1997  scottr branches: 1.10.4;
Update from Denny Gentry <denny1@home.com>, PR 3685:

Simplify the way transmit buffers are managed, remove assumptions about
NBPG, simplify sonic_get handling, update snioctl to be more like other
current drivers, and probably a few other changes I've now forgotten about.
 1.9 22-Apr-1997  scottr If we can't map SONIC register space, just print a diagnostic message and
continue. Make formatting consistent and KNF while here.
 1.8 13-Apr-1997  briggs Some updates based on information from Bob Nestor <rnestor@metronet.com>
about his SONIC-T LC/PDS card.
 1.7 10-Apr-1997  briggs Changes from Denny Gentry <denny1@home.com>:
Change in the way receive buffer areas are handled. Before we gave
the chip 16 buffers, each 1536 bytes (big enough for one packet).
Now we're handing the chip 8 buffers, each 4 Kbytes, and letting
the chip fit as many packets as it can in each one. This should
help keep it from running out of buffer space. Also make some of
the performance-crucial routines inline. It made no measurable
difference except to make me feel better

Changes from Bob Nestor <rnestor@metronet.com> to get closer to support
for his Apple SONIC-based nubus card.

Changes from me to try to get SONIC's MAC address from MacOS settings if
we can't read the PROM space.
 1.6 04-Apr-1997  briggs Do not set DCR_SYNC for the C/Q[68]xx systems.
Thanks to Steve Brown <sbrown@best.com> for working with me to find this.
 1.5 30-Mar-1997  briggs Some new SONIC code from Denny Gentry <denny1@home.com> with a couple of
tweaks and bug fixes by yours truly.

Here's what Denny had to say:

nubus.h:
- add a drsw entry for my card
[ I also added a couple of constants for more display cards ]
if_sn.c:
- allocate sc->space using malloc (Scott wanted this).
- make csr accesses use NIC_PUT/GET, remove sc->sc_csr.
- add multicast and IFF_PROMISC support. multicast isn't
well tested, but I made sure the unicast case still
works.
- finish the new arp interface, remove sc->sc_enaddr
if_snreg.h:
- remove struct sonic_reg
if_snvar.h:
- add NIC_PUT and NIC_GET macros a la if_ae
- remove sc_txhead, it isn't used.
if_sn_nubus.c:
- clean up support for my SE/30 card.
- Move add_nubus_intr from if_sn.c (to keep if_sn.c MI)
if_sn_obio.c:
- make Q610, C610, Q650, C650, Q800 use EXBUS.
- PB500 had a "return" where "break" was intended. PB500
probably wasn't working.
- move add_nubus_intr from if_sn.c.
- add an "explanation" why Apple's ethernet addr is encoded
in token ring format in the PROM.
 1.4 29-Mar-1997  briggs Fix bug that would have prevented PB5xx series from detecting the SONIC.
Bug noticed by Denny Gentry.
 1.3 17-Mar-1997  briggs Make this compile again. XXX - save ethernet address in softc until multicast is supported.
 1.2 16-Mar-1997  is On request from Allen Briggs, converted this to new ARP
system. Somebody should actually test if this compiles (and works) on
Mac68k... I only carefully checked cvs diff -u.
 1.1 15-Mar-1997  briggs SONIC driver--originally from pica. Much work done by Dennis Gentry and
Takeshi Yanagisawa to get it working. Some minor hacking by me here and
there.
 1.10.4.2 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.12.2.1 15-Nov-1997  mellon Pull rev 1.13 up from trunk (briggs)
 1.17.12.1 01-Jul-1999  thorpej Sync w/ -current.
 1.17.8.1 01-Nov-1999  scottr Sync with main branch.
 1.19.20.1 18-Oct-2002  nathanw Catch up to -current.
 1.19.16.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.22.2.4 17-Jan-2005  skrll Sync with HEAD.
 1.22.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.22.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.22.2.1 03-Aug-2004  skrll Sync with HEAD
 1.24.10.1 03-Sep-2007  yamt sync with head.
 1.25.38.1 26-Jun-2007  garbled Sync with HEAD.
 1.25.32.1 11-Jul-2007  mjf Sync with head.
 1.25.30.1 15-Jul-2007  ad 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.1 02-Jun-2008  mjf Sync with HEAD.
 1.28.102.1 03-Apr-2021  thorpej Sync with HEAD.
 1.8 14-Jun-2025  nat When checking the sector header don't bypass the retry counter.
 1.7 02-Jan-2015  christos branches: 1.7.54;
avoid trigraph
 1.6 30-Nov-2010  hauke branches: 1.6.18; 1.6.36;
Fix an embarassing tyop. gcc should run aspell over the comments...
 1.5 26-May-2008  hauke branches: 1.5.20;
Switch files I authored to two-clause BSD license.
 1.4 29-Aug-2002  hannken branches: 1.4.108; 1.4.110; 1.4.112; 1.4.114;
Get rid of error -66 (sector not found).

From Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
 1.3 20-Nov-2001  chs branches: 1.3.8;
prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.2 27-Mar-1999  scottr branches: 1.2.22; 1.2.26;
Update from Hauke to resolve some relatively severe performance problems.
 1.1 18-Feb-1999  scottr branches: 1.1.2;
First cut at a floppy disk device driver, for IWM and IWM-compatible
controllers. Supports GCR-encoded disks only (400K and 800K); neither
of the 1.44M formats will work until someone figures out how to drive
the SWIM and its descendants.

This code was written by Hauke Fath, and had only minor touchup (mostly
KNF) by me.
 1.1.2.1 16-May-1999  scottr Sync with main branch.
 1.2.26.2 17-Sep-2002  nathanw Catch up to -current.
 1.2.26.1 08-Jan-2002  nathanw Catch up to -current.
 1.2.22.2 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.22.1 10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.8.1 31-Aug-2002  gehenna catch up with -current.
 1.4.114.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.4.112.1 04-May-2009  yamt sync with head.
 1.4.110.1 04-Jun-2008  yamt sync with head
 1.4.108.1 02-Jun-2008  mjf Sync with HEAD.
 1.5.20.1 05-Mar-2011  rmind sync with head
 1.6.36.1 06-Apr-2015  skrll Sync with HEAD
 1.6.18.1 03-Dec-2017  jdolecek update from HEAD
 1.7.54.1 02-Aug-2025  perseant Sync with HEAD
 1.62 06-Aug-2025  hauke Sync the iwm_match() code with the comments (and intentions), and fix
the conditions to match the right machines.

For matched hardware, we set IWMBase and break out of the case block; the
default is no match.
 1.61 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.60 13-May-2021  hauke branches: 1.60.4;
We do not match machines whose SWIM does not support the IWM register
set used by this driver (SWIM II/III, SWIM behind IOP, AV models' DMA
based controllers). Unfortunately, this distinction does not run
cleanly along MACH_CLASS* lines, and we have to look at MACH_MAC{model} tags.
 1.59 24-Apr-2021  thorpej branches: 1.59.2; 1.59.4;
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.58 19-Dec-2020  thorpej branches: 1.58.2;
malloc(9) -> kmem(9)
 1.57 12-Nov-2019  msaitoh branches: 1.57.8;
Add missing initialization of sc_dev.
 1.56 26-Apr-2015  mlelstv branches: 1.56.10; 1.56.18; 1.56.22;
Use C99-style initializers for struct dkdriver.
 1.55 03-Jan-2015  christos fix typo
 1.54 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.53 02-Jan-2015  christos name the flag ioctl argument "flag" like most other drivers.
 1.52 01-Jan-2015  christos declare error
 1.51 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.50 25-Jul-2014  dholland branches: 1.50.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.49 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.48 16-Mar-2014  dholland branches: 1.48.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.47 27-Oct-2012  chs branches: 1.47.2;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.46 13-Jan-2009  yamt branches: 1.46.14; 1.46.24;
g/c BUFQ_FOO() macros and use bufq_foo() directly.
 1.45 11-Jan-2009  oster Deal with new dev_t build lossage. Fix from lukem.
 1.44 12-Nov-2008  ad Remove LKMs and switch to the module framework, pass 1.

Proposed on tech-kern@.
 1.43 15-Jun-2008  tsutsui branches: 1.43.2; 1.43.4;
Don't pass fdUnit to lookup softc of iwm. It's a parent of fd, not fd itself.
 1.42 13-Jun-2008  cegger use device_lookup_private to get softc
 1.41 26-May-2008  hauke branches: 1.41.2;
Switch files I authored to two-clause BSD license.
 1.40 17-Oct-2007  garbled branches: 1.40.16; 1.40.18; 1.40.20; 1.40.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.39 08-Oct-2007  ad Merge disk init changes from the vmlocking branch. These seperate init /
destroy of 'struct disk' from attach / detach.
 1.38 29-Jul-2007  ad branches: 1.38.4; 1.38.6; 1.38.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.37 09-Jul-2007  ad branches: 1.37.2; 1.37.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.36 04-Mar-2007  christos branches: 1.36.2; 1.36.4; 1.36.10;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.35 11-Dec-2005  christos branches: 1.35.26;
merge ktrace-lwp.
 1.34 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.33 16-Jun-2005  jmc branches: 1.33.2;
Shadowing and const fixes.
 1.32 16-Jan-2005  chs branches: 1.32.2;
handle lack of locators in LKM context differently.
 1.31 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.30 15-Dec-2004  jmc If LKM deal w. locators different
 1.29 14-Dec-2004  chs use the generated macros in locators.h rather than hard-coded numbers
to index the cf_loc[] array. reviewed by allen briggs.
 1.28 28-Oct-2004  yamt move buffer queue related stuffs from buf.h to their own header, bufq.h.
 1.27 22-Sep-2004  yamt fix printf formats to match with sys/buf.h 1.75.
 1.26 13-Sep-2004  drochner use config_found() instead of config_found_sm() if no submatch
function is used
 1.25 27-Oct-2003  fredb Initialize some "might (not) be used uninitialized" variables.
 1.24 15-Jul-2003  lukem __KERNEL_RCSID()
 1.23 02-May-2003  dsl branches: 1.23.2;
Change return type of readdisklabel() to const char *
I hope I've found all the correct places!
 1.22 03-Feb-2003  jdolecek attempt to fix compilationg errors for printf formats due to 64bit daddr_t
adresses PR port-mac68k/20188 by Hauke Fath
 1.21 06-Jan-2003  wiz writable, not writeable.
 1.20 01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.19 01-Nov-2002  mrg implement separate read/write disk statistics:
- disk_unbusy() gets a new parameter to tell the IO direction.
- struct disk_sysctl gets 4 new members for read/write bytes/transfers.
when processing hw.diskstats, add the read&write bytes/transfers for
the old combined stats to attempt to keep backwards compatibility.

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

this is just the kernel portion.
 1.18 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.17 02-Oct-2002  jdolecek remove local declaration of iwm_cd and fd_cd for LKM case; it's superfluous
and doesn't even compile after latest autoconf changes
 1.16 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 06-Sep-2002  gehenna make this compile with _LKM.
 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 29-Aug-2002  hannken Convert to new device buffer queue interface.

Tested with help from Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
on Performa 600 and Quadra 700.
 1.11 27-May-2000  jdolecek branches: 1.11.6; 1.11.8; 1.11.12; 1.11.20;
fix prototype for fd_mod_free() - should fix port-mac68k/10063
 1.10 19-May-2000  thorpej A foolish consistency; most parts of the kernel use bp->b_data, so
change these from bp->b_un.b_addr to bp->b_data, as well. This also
allows us more flexibility to experiment with other data buffer types
hung off of struct buf.
 1.9 05-Apr-2000  jdolecek LKM fixes:
* fix a typo in callout_stop() call
* prototype fd_mod_init(), fd_mod_free() to avoid warnings
* include iwm_mod.h

Fix sent in port-mac68k/9787 by Dave Huang.
 1.8 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.7 24-Feb-2000  scottr Turn off some noise during autoconfig on the IIfx/Q9x0, making it
conditional on the TRACE_CONFIG debugging flag.
 1.6 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.5 27-Jan-2000  ender Fix PR 9302. Fix provided by Hauke Fath (hauke@Espresso.Rhein-Neckar.DE).
 1.4 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.3 25-Oct-1999  kleink Wrap an otherwise unused variable inside #ifdef DIAGNOSTIC; from Ben Mesander
in PR port-mac68k/8513.
 1.2 27-Mar-1999  scottr branches: 1.2.8; 1.2.10; 1.2.12;
Update from Hauke to resolve some relatively severe performance problems.
 1.1 18-Feb-1999  scottr branches: 1.1.2;
First cut at a floppy disk device driver, for IWM and IWM-compatible
controllers. Supports GCR-encoded disks only (400K and 800K); neither
of the 1.44M formats will work until someone figures out how to drive
the SWIM and its descendants.

This code was written by Hauke Fath, and had only minor touchup (mostly
KNF) by me.
 1.1.2.4 13-Feb-2000  scottr Sync with main branch.
 1.1.2.3 06-Feb-2000  scottr Sync with main branch.
 1.1.2.2 01-Nov-1999  scottr Sync with main branch.
 1.1.2.1 16-May-1999  scottr Sync with main branch.
 1.2.12.2 27-Dec-1999  wrstuden Pull up to last week's -current.
 1.2.12.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.2.10.1 15-Nov-1999  fvdl Sync with -current
 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.11.20.2 31-Aug-2002  gehenna catch up with -current.
 1.11.20.1 17-May-2002  gehenna Add device switch.
 1.11.12.5 07-Jan-2003  thorpej Sync with HEAD.
 1.11.12.4 03-Jan-2003  thorpej Sync with HEAD.
 1.11.12.3 11-Nov-2002  nathanw Catch up to -current
 1.11.12.2 18-Oct-2002  nathanw Catch up to -current.
 1.11.12.1 17-Sep-2002  nathanw Catch up to -current.
 1.11.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.11.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.11.6.1 10-Oct-2001  fvdl Convert all remaining devices.
 1.23.2.9 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.23.2.8 25-Jan-2005  skrll Adapt to branch.
 1.23.2.7 17-Jan-2005  skrll Sync with HEAD.
 1.23.2.6 18-Dec-2004  skrll Sync with HEAD.
 1.23.2.5 02-Nov-2004  skrll Sync with HEAD.
 1.23.2.4 24-Sep-2004  skrll Sync with HEAD.
 1.23.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.23.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.23.2.1 03-Aug-2004  skrll Sync with HEAD
 1.32.2.2 16-Jan-2005  chs handle lack of locators in LKM context differently.
 1.32.2.1 16-Jan-2005  chs file iwm_fd.c was added on branch kent-audio2 on 2005-01-16 00:32:04 +0000
 1.33.2.3 27-Oct-2007  yamt sync with head.
 1.33.2.2 03-Sep-2007  yamt sync with head.
 1.33.2.1 21-Jun-2006  yamt sync with head.
 1.35.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.36.10.2 16-Oct-2007  garbled Sync with HEAD
 1.36.10.1 03-Oct-2007  garbled Sync with HEAD
 1.36.4.1 11-Jul-2007  mjf Sync with head.
 1.36.2.3 20-Aug-2007  ad - Alter disk attach/detach to fix a panic when closing a vnd device.
- Sync with HEAD.
 1.36.2.2 19-Aug-2007  ad - Back out the biodone() changes.
- Eliminate B_ERROR (from HEAD).
 1.36.2.1 15-Jul-2007  ad Sync with head.
 1.37.4.1 15-Aug-2007  skrll Sync with HEAD.
 1.37.2.1 07-Aug-2007  matt Sync with HEAD.
 1.38.8.1 14-Oct-2007  yamt sync with head.
 1.38.6.1 06-Nov-2007  matt sync with HEAD
 1.38.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.40.22.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.40.20.1 04-May-2009  yamt sync with head.
 1.40.18.2 17-Jun-2008  yamt sync with head.
 1.40.18.1 04-Jun-2008  yamt sync with head
 1.40.16.3 17-Jan-2009  mjf Sync with HEAD.
 1.40.16.2 29-Jun-2008  mjf Sync with HEAD.
 1.40.16.1 02-Jun-2008  mjf Sync with HEAD.
 1.41.2.1 18-Jun-2008  simonb Sync with head.
 1.43.4.1 19-Jan-2009  skrll Sync with HEAD.
 1.43.2.1 13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.46.24.3 03-Dec-2017  jdolecek update from HEAD
 1.46.24.2 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.46.24.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.46.14.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.46.14.1 30-Oct-2012  yamt sync with head
 1.47.2.1 18-May-2014  rmind sync with head
 1.48.2.1 10-Aug-2014  tls Rebase.
 1.50.4.2 06-Jun-2015  skrll Sync with HEAD
 1.50.4.1 06-Apr-2015  skrll Sync with HEAD
 1.56.22.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #425):

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

Add missing initialization of sc_dev.

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

Add missing initialization of sc_dev.
 1.56.18.1 13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.56.10.1 14-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #1439):

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

Add missing initialization of sc_dev.


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


Add missing initialization of sc_dev.
 1.57.8.1 03-Jan-2021  thorpej Sync w/ HEAD.
 1.58.2.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.59.4.1 31-May-2021  cjep sync with head
 1.59.2.1 17-Jun-2021  thorpej Sync w/ HEAD.
 1.60.4.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.16 10-Aug-2020  rin Clean up _LKM --> _MODULE leftovers.

Note that _KERNEL is always defined for modules.
 1.15 27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.14 26-May-2008  hauke branches: 1.14.32; 1.14.42;
Switch files I authored to two-clause BSD license.
 1.13 05-Mar-2007  he branches: 1.13.40; 1.13.42; 1.13.44; 1.13.46;
Need char* for pointer arithmetic done in iwm_fd.c.
 1.12 04-Mar-2007  christos 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 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.9 16-Jun-2005  jmc branches: 1.9.2;
Shadowing and const fixes.
 1.8 15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.7 06-Sep-2002  gehenna branches: 1.7.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.6 29-Aug-2002  hannken Convert to new device buffer queue interface.

Tested with help from Hauke Fath <hauke@Espresso.Rhein-Neckar.DE>
on Performa 600 and Quadra 700.
 1.5 23-Mar-2000  thorpej branches: 1.5.8; 1.5.12; 1.5.20;
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.4 21-Jan-2000  thorpej Update for sys/buf.h/disksort_*() changes.
 1.3 27-Mar-1999  scottr branches: 1.3.8;
Update from Hauke to resolve some relatively severe performance problems.
 1.2 18-Feb-1999  scottr branches: 1.2.2;
Er, function prototypes don't belong in fooreg.h.
 1.1 18-Feb-1999  scottr First cut at a floppy disk device driver, for IWM and IWM-compatible
controllers. Supports GCR-encoded disks only (400K and 800K); neither
of the 1.44M formats will work until someone figures out how to drive
the SWIM and its descendants.

This code was written by Hauke Fath, and had only minor touchup (mostly
KNF) by me.
 1.2.2.2 06-Feb-2000  scottr Sync with main branch.
 1.2.2.1 16-May-1999  scottr Sync with main branch.
 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.5.20.2 31-Aug-2002  gehenna catch up with -current.
 1.5.20.1 19-May-2002  gehenna Remove unnecessary prototype.
 1.5.12.1 17-Sep-2002  nathanw Catch up to -current.
 1.5.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.5.8.1 06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.7.6.2 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.7.6.1 17-Jan-2005  skrll Sync with HEAD.
 1.9.2.2 03-Sep-2007  yamt sync with head.
 1.9.2.1 21-Jun-2006  yamt sync with head.
 1.11.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.13.46.1 23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.13.44.1 04-May-2009  yamt sync with head.
 1.13.42.1 04-Jun-2008  yamt sync with head
 1.13.40.1 02-Jun-2008  mjf Sync with HEAD.
 1.14.42.1 20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.14.32.1 30-Oct-2012  yamt sync with head
 1.3 27-Mar-1999  scottr This file is no longer used by anything.
 1.2 27-Mar-1999  scottr Update from Hauke to resolve some relatively severe performance problems.
 1.1 18-Feb-1999  scottr branches: 1.1.2;
First cut at a floppy disk device driver, for IWM and IWM-compatible
controllers. Supports GCR-encoded disks only (400K and 800K); neither
of the 1.44M formats will work until someone figures out how to drive
the SWIM and its descendants.

This code was written by Hauke Fath, and had only minor touchup (mostly
KNF) by me.
 1.1.2.1 16-May-1999  scottr Sync with main branch.
 1.8 04-Mar-2007  christos 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 05-Feb-2005  chs branches: 1.6.6;
remove some leftover references to a.out symbol names.
 1.5 15-Jan-2005  chs branches: 1.5.2; 1.5.4;
de-__P, remove register, ansify, b* -> mem*.
 1.4 06-Jan-2003  wiz branches: 1.4.2;
writable, not writeable.
 1.3 27-Mar-1999  scottr branches: 1.3.26;
Update from Hauke to resolve some relatively severe performance problems.
 1.2 18-Feb-1999  scottr branches: 1.2.2;
Er, function prototypes don't belong in fooreg.h.
 1.1 18-Feb-1999  scottr First cut at a floppy disk device driver, for IWM and IWM-compatible
controllers. Supports GCR-encoded disks only (400K and 800K); neither
of the 1.44M formats will work until someone figures out how to drive
the SWIM and its descendants.

This code was written by Hauke Fath, and had only minor touchup (mostly
KNF) by me.
 1.2.2.1 16-May-1999  scottr Sync with main branch.
 1.3.26.1 07-Jan-2003  thorpej Sync with HEAD.
 1.4.2.2 06-Feb-2005  skrll Sync with HEAD.
 1.4.2.1 17-Jan-2005  skrll Sync with HEAD.
 1.5.4.1 12-Feb-2005  yamt sync with head.
 1.5.2.1 29-Apr-2005  kent sync with -current
 1.6.6.1 03-Sep-2007  yamt sync with head.
 1.7.26.1 12-Mar-2007  rmind Sync with HEAD.
 1.27 07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.26 24-Apr-2021  thorpej branches: 1.26.8;
Merge thorpej-cfargs branch:

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

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

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

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

...and a sentinel value CFARG_EOL.

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

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.25 06-Jun-2011  matt branches: 1.25.68;
CFATTACH_DECL(..., sizeof(struct device), -> CFATTACH_DECL_NEW(..., 0
struct device * -> device_t
struct cfdata * -> cfdata_t
use bool when appropriate
 1.24 28-Apr-2008  martin branches: 1.24.22; 1.24.32;
Remove clause 3 and 4 from TNF licenses
 1.23 11-Dec-2005  christos branches: 1.23.74; 1.23.76; 1.23.78;
merge ktrace-lwp.
 1.22 26-Aug-2005  drochner s/locdesc_t/int/g
 1.21 30-Jun-2005  drochner branches: 1.21.2;
adaptions to config_search() change, and minor autoconf fixes, mostly from Havard Eidnes
 1.20 19-Jan-2005  chs only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.19 15-Jan-2005  chs branches: 1.19.2;
de-__P, remove register, ansify, b* -> mem*.
 1.18 15-Dec-2004  jmc Use correct locator name
 1.17 14-Dec-2004  chs use the generated macros in locators.h rather than hard-coded numbers
to index the cf_loc[] array. reviewed by allen briggs.
 1.16 15-Jul-2003  lukem __KERNEL_RCSID()
 1.15 01-Jan-2003  thorpej branches: 1.15.2;
Use aprint_normal() for cfprint routines.
 1.14 02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.13 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.12 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.11 10-Apr-2002  briggs Accept the bus_dma_tag_t for obio, too.
 1.10 02-May-1998  scottr branches: 1.10.30; 1.10.34;
Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.9 12-Jan-1998  thorpej Update for changes to config.
 1.8 09-Oct-1997  jtc Fix tipo inherited from old version of TNF copyright template.
 1.7 13-Feb-1997  scottr branches: 1.7.4;
Add hsk and drq locators, which will be used only by SCSI devices.
 1.6 11-Feb-1997  scottr Add a bus space tag field to obio_attach args, initialize it in
obio_search(), and use it in the ASC driver. Thanks to Jason for
pointing this out. Minor KNFing while I'm here.
 1.5 17-Dec-1996  scottr branches: 1.5.4;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.4 16-Dec-1996  scottr Convert all foo_match() functions to use a `struct cfdata *' for their
second argument. The NuBus autoconfig code had to be reorganized as a
result of this, and looks much more like a directly-attached bus now.
These changes eliminate __BROKEN_INDIRECT_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  briggs Prototype for -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-uninitialized
Also change the device probing scheme to use something a bit more rational.
A current side-effect is that nubus cards are double-mapped. I expect
to fix that shortly.
Also change splclock() to block everything but serial hardware interrupts.
 1.5.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.7.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.10.34.3 03-Jan-2003  thorpej Sync with HEAD.
 1.10.34.2 18-Oct-2002  nathanw Catch up to -current.
 1.10.34.1 17-Apr-2002  nathanw Catch up to -current.
 1.10.30.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.30.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.15.2.7 10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.15.2.6 24-Jan-2005  skrll Sync with HEAD.
 1.15.2.5 17-Jan-2005  skrll Sync with HEAD.
 1.15.2.4 18-Dec-2004  skrll Sync with HEAD.
 1.15.2.3 21-Sep-2004  skrll Fix the sync with head I botched.
 1.15.2.2 18-Sep-2004  skrll Sync with HEAD.
 1.15.2.1 03-Aug-2004  skrll Sync with HEAD
 1.19.2.1 29-Apr-2005  kent sync with -current
 1.21.2.1 21-Jun-2006  yamt sync with head.
 1.23.78.1 16-May-2008  yamt sync with head.
 1.23.76.1 18-May-2008  yamt sync with head.
 1.23.74.1 02-Jun-2008  mjf Sync with HEAD.
 1.24.32.1 23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.24.22.1 12-Jun-2011  rmind sync with head
 1.25.68.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.25.68.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.25.68.4 04-Apr-2021  thorpej CFARG_SUBMATCH -> CFARG_SEARCH for the indirect configuration uses.
 1.25.68.3 03-Apr-2021  thorpej Give config_attach() the tagged variadic argument treatment and
mechanically convert all call sites.
 1.25.68.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.25.68.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.26.8.1 04-Aug-2021  thorpej Adapt to CFARGS().
 1.8 28-Apr-2008  martin 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 14-Dec-2004  chs use the generated macros in locators.h rather than hard-coded numbers
to index the cf_loc[] array. reviewed by allen briggs.
 1.5 10-Apr-2002  briggs branches: 1.5.10;
Accept the bus_dma_tag_t for obio, too.
 1.4 09-Oct-1997  jtc branches: 1.4.30; 1.4.34;
Fix tipo inherited from old version of TNF copyright template.
 1.3 13-Feb-1997  scottr branches: 1.3.4;
Add hsk and drq locators, which will be used only by SCSI devices.
 1.2 11-Feb-1997  scottr Add a bus space tag field to obio_attach args, initialize it in
obio_search(), and use it in the ASC driver. Thanks to Jason for
pointing this out. Minor KNFing while I'm here.
 1.1 17-Dec-1996  scottr branches: 1.1.4;
Revamp mainbus and obio autoconfiguration, with some direction (and the
indirect bus code framework) from Jason Thorpe. This allows us to dump
bus_scan() and bus_print(), and move bus_peek() and bus_mapin() to the
NuBus code (since they'll eventually go away, anyway).
 1.1.4.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.4.1 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.4.34.1 17-Apr-2002  nathanw Catch up to -current.
 1.4.30.1 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.5.10.1 18-Dec-2004  skrll 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.1 02-Jun-2008  mjf Sync with HEAD.
 1.29 24-May-2025  nat Default to sbc drq_intr on the PowerBook 1xx.

I was faced with two options:

1) Downgrade pdma with PDMA_NOWRITE for the PowerBook 1xx. (much slower)

2) Use sbc drq intr (much faster and well tested).

I chose the later...much faster and compatible with more scsi peripherals.
 1.28 02-Apr-2025  nat Fallback to the faster option.

Tested thouroughly on my PowerBook 520c for many months.
 1.27 02-Apr-2025  nat We have many locks? Choose the right one.
(It was meant to be a spinlock as it can run in an interrupt context).
 1.26 22-Nov-2024  nat Serialize drq interrupt.

This results in error free transfers between disks.

Part of PR kern/58452.
 1.25 23-Nov-2009  rmind branches: 1.25.100;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.24 16-Dec-2008  christos replace bitmask_snprintf(9) with snprintb(3)
 1.23 04-Apr-2008  tsutsui branches: 1.23.4; 1.23.12;
Split devict_t/softc for ncr5380sbc SCSI, and misc cosmetic changes.
 1.22 29-Mar-2006  thorpej branches: 1.22.62;
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 05-Mar-2005  chs branches: 1.20.4;
use attach args instead of dv_unit, just like cf_unit.
 1.19 19-Jan-2005  chs branches: 1.19.2;
only one of the obio locators was actually used, so get rid of the others
and collapse the two variations of obio into one. use the remaining locator
("addr") to differentiate the two possible esp and sbc devices (instead of
using the unit number).
 1.18 15-Jan-2005  chs branches: 1.18.2;
de-__P, remove register, ansify, b* -> mem*.
 1.17 15-Jul-2003  lukem __KERNEL_RCSID()
 1.16 02-Oct-2002  thorpej branches: 1.16.6;
Use CFATTACH_DECL().
 1.15 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14 25-Apr-2001  bouyer branches: 1.14.2; 1.14.8;
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.13 25-Mar-2000  tsutsui branches: 1.13.6;
Add a "sc_rev" member to ncr5380_softc and handle CXD1180 quirk
in MI ncr5380sbc.
 1.12 18-Mar-2000  mycroft Fix pasto in previous.
 1.11 18-Mar-2000  mycroft Add a ncr5380_attach() routine which does part of the initialization, attaches
the scsibus, and does the addref/delref dance.
 1.10 22-Dec-1998  scottr branches: 1.10.10;
vm_offset_t -> {paddr_t, vaddr_t}
 1.9 19-Nov-1998  thorpej Adapt to the new scsipi_adapter interface.
 1.8 02-May-1998  scottr Move on-board I/O and NuBus drivers to their own directories
via repository copy, and make the necessary adjustments to reflect
the moved files.
 1.7 16-Dec-1997  scottr Don't enable interrupts unless we are using reselect or interrupt-
driven PDMA modes.
 1.6 10-Oct-1997  scottr branches: 1.6.2;
Remove advertising clause.
 1.5 27-Aug-1997  bouyer Merge scsipi branch in the mainline. This add support for ATAPI devices
(currently only CD-ROM drives on i386). The sys/dev/scsipi system provides 2
busses to which devices can attach (scsibus and atapibus). This needed to
change some include files and structure names in the low level scsi drivers.
 1.4 11-Aug-1997  scottr Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.3 07-Apr-1997  scottr branches: 1.3.2; 1.3.4;
Always enable SCSI IRQ interrupt; the SBC_INTR flag now controls only
the SCSI DRQ interrupt, for "blind" transfers.
 1.2 15-Mar-1997  is New ARP system, supports IPv4 over any hardware link.

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

For the detailed change history, look at the commit log entries for
the is-newarp branch.
 1.1 01-Mar-1997  scottr branches: 1.1.2;
Split bus-dependent autoconfig code from the driver. This allows for
the future addition of a Duo Dock front end.
 1.1.2.1 12-Mar-1997  is Merge in changes from The Trunk, partially just reimplementing newarp.
 1.3.4.3 14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.2 27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.4.1 23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.3.2.2 14-Aug-1997  bouyer Sync with trunk.
 1.3.2.1 01-Jul-1997  bouyer Updates for new scsipi subsystem. Actally known to work on i386 and sparc.
 1.6.2.1 17-Dec-1997  mellon Pull rev 1.7 up from trunk (scottr)
 1.10.10.2 27-Mar-2001  bouyer Convert to thorpej_scsipi (untested).
 1.10.10.1 20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.13.6.1 21-Jun-2001  nathanw Catch up to -current.
 1.14.8.2 18-Oct-2002  nathanw Catch up to -current.
 1.14.8.1 25-Apr-2001  nathanw file sbc_obio.c was added on branch nathanw_sa on 2002-10-18 02:38:31 +0000
 1.14.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.16.6.6 08-Mar-2005  skrll Sync with HEAD.
 1.16.6.5 24-Jan-2005  skrll Sync with HEAD.
 1.16.6.4 17-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.18.2.1 29-Apr-2005  kent sync with -current
 1.19.2.1 19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.20.4.1 21-Jun-2006  yamt sync with head.
 1.21.12.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.21.10.1 19-Apr-2006  elad sync with head - 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.62.2 17-Jan-2009  mjf Sync with HEAD.
 1.22.62.1 02-Jun-2008  mjf Sync with HEAD.
 1.23.12.1 19-Jan-2009  skrll Sync with HEAD.
 1.23.4.2 11-Mar-2010  yamt sync with head
 1.23.4.1 04-May-2009  yamt sync with head.
 1.25.100.1 02-Aug-2025  perseant Sync with HEAD
 1.32 20-Aug-2022  tsutsui Unmap resources and print error messages properly in error paths.
 1.31 20-Aug-2022  tsutsui KNF and misc style fixes.
 1.30 31-May-2020  rin For wdc_obio_match(), struct wdc_regs is too large for stack.
Use kmem_alloc(9) instead.

Frame size becomes:
3088 --> 0
 1.29 20-Oct-2017  jdolecek move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)

on topic of PR kern/52606
 1.28 07-Oct-2017  jdolecek Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch

ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
 1.27 25-Oct-2013  martin branches: 1.27.18;
Simplify
 1.26 31-Jul-2012  bouyer branches: 1.26.2; 1.26.4;
Apply back changes that were reverted on Jul 24 and Jul 26 (general ata/wdc
cleanup and SATA PMP support), now that I'm back to fix the fallouts.
 1.25 26-Jul-2012  jakllsch Revert, with intention of restoring in a less invasive way, the SATA Port
Multiplier code.

ok christos@
 1.24 02-Jul-2012  bouyer Add sata Port MultiPlier (PMP) support to the ata bus layer,
as described in
http://mail-index.netbsd.org/tech-kern/2012/06/23/msg013442.html
PMP support in integrated to the atabus layer.
struct ata_channel's ch_drive[] is not dynamically allocated, and ch_ndrive
(renamed to ch_ndrives) closely reflects the size of the ch_drive[] array.
Add helper functions atabus_alloc_drives() and atabus_free_drives()
to manage ch_drive[]/ch_ndrives.
Add wdc_maxdrives to struct wdc_softc so that bus front-end can specify
how much drive they really support (master/slave or single).
ata_reset_drive() callback gains a uint32_t *sigp argument which,
when not NULL, will contain the signature of the device being reset.
While there, some cosmetic changes:
- added a drive_type enum to ata_drive_datas, and stop encoding the
probed drive type in drive_flags (we were out of drive flags anyway).
- rename DRIVE_ATAPIST to DRIVE_ATAPIDSCW to better reflect what this
really is
- remove ata_channel->ata_drives, it's redundant with the pointer in
ata_drive_datas
- factor out the interpretation of SATA signatures in sata_interpet_sig()

propagate these changes to the ATA HBA drivers, and add support for PMP
to ahcisata(4) and siisata(4).

Thanks to:
- Protocase (http://www.protocase.com/) which provided a system
with lots of controllers, SATA PMP and drive slots
- Conservation Genomics Laboratory, Department of Biology, New Mexico State
University for hosting the above system
- Brook Milligan, who set up remote access and has been very responsive
when SATA cable move was needed
 1.23 18-Mar-2008  cube branches: 1.23.38;
Split device_t and softc for ATA devices, as well as wd(4). Other
cosmetic changes where appropriate.
 1.22 05-Oct-2006  tsutsui branches: 1.22.28; 1.22.48; 1.22.52;
Don't call wdc_init_shadow_regs() before struct ata_channel is
properly initilized in wdc_obio_attach().
Fixes NULL pointer deref during boot.
 1.21 29-Mar-2006  thorpej branches: 1.21.8; 1.21.10;
Use device_cfdata().
 1.20 16-Jan-2006  bouyer branches: 1.20.2; 1.20.4; 1.20.6; 1.20.8; 1.20.10;
properly use ata_channel->ch_ndrive:
- initialize it properly in the bus front-ends (all 2, exept in wdc_pcmcia.c
for the "Sandisk CompactFlash Card" where it's set to 1)
- remplace hardcoded '2' by ata_channel->ch_ndrive in MI IDE drivers.

From Christos Zoulas in kern/32501.
 1.19 11-Dec-2005  christos branches: 1.19.2;
merge ktrace-lwp.
 1.18 15-Jan-2005  chs branches: 1.18.8; 1.18.10;
de-__P, remove register, ansify, b* -> mem*.
 1.17 20-Aug-2004  thorpej Move most of wdc_softc into a new atac_softc structure that contains
info common to all types of ATA controllers.
 1.16 14-Aug-2004  thorpej - Split the register handles out of struct wdc_channel into a separate
wdc_regs structure, and array of which (indexed per channel) is pointed
to by struct wdc_softc.
- Move the resulting wdc_channel structure to atavar.h and rename it to
ata_channel. Rename the corresponding flags.
- Add a "ch_ndrive" member to struct ata_channel, which indicates the
maximum number of drives that can be present on the channel. For now,
this is always 2. Add an ATA_MAXDRIVES constant that places an upper
limit on this value, also currently 2.
 1.15 25-May-2004  thorpej Add the notion of "shadow registers" to the wdc driver. These shadow
registers are registers that overlap with others on many controllers, but
which may actually be distinct on some controllers. Right now, the two
shadows are:

- wd_status (usually overlaps wd_command)
- wd_features (usually overlaps wd_error)

Add a new helper function, wdc_init_shadow_regs(), used to initialize
the shadow register handles on controllers where they do actually overlap.

Partially from Jordan Rhody @ Wasabi Systems, Inc.
 1.14 09-Jan-2004  fredb Back out CVS fallout from last commit. Really make this build again.
 1.13 06-Jan-2004  he Make these compile again after the latest adjustments.
 1.12 03-Jan-2004  thorpej More wdc_channel structure member namespace cleanup:
- channel -> ch_channel
- wdc -> ch_wdc
 1.11 03-Jan-2004  thorpej Rename "struct channel_softc" to "struct wdc_channel".
 1.10 01-Jan-2004  thorpej Rename:
- wdc_xfer to ata_xfer
- channel_queue to ata_queue
and move them to <dev/ata/atavar.h> so they can be used by non-wdc ATA
controllers. Clean up the member names of these structures while at it.
 1.9 31-Dec-2003  thorpej Simplify allocation of the channel queue.
 1.8 14-Dec-2003  fredb Adapt to MI ATA/wdc changes. Especially, now that the address of
each individual ATA register is in the attachment structure, we
can dispense with the custom bus_space mapping hack which set the
stride, then unset it for particular bus_space functions. (There
is really no stride; the data register is read and written to
consecutive bytes. The control register mappings just happen to
be separated by four bytes.) While we're here, de-__P(), and lose
a confusing shift.

This has been tested on Quadra 630. Reviewed by bouyer.
 1.7 08-Oct-2003  bouyer Adapt for wdcattach() prototype change.
 1.6 25-Sep-2003  mycroft Hide the use of config_interrupts() in one place.
 1.5 19-Sep-2003  mycroft 1) Use config_interrupts() to attach IDE and ATAPI drives. This eliminates
most polling.
2) Clean up some goofiness in pciide -- get rid of the whole "candisable" path
(it's gratuitous) and simplify the code by calling pciide_map_compat_intr(),
*_set_modes() and wdc_print_modes() from central locations.
3) Add a register writability and register ghost test to eliminate phantom
drives more quickly.
 1.4 15-Jul-2003  lukem __KERNEL_RCSID()
 1.3 02-Oct-2002  thorpej branches: 1.3.6;
Use CFATTACH_DECL().
 1.2 27-Sep-2002  thorpej Declare all cfattach structures const.
 1.1 27-Apr-2002  shiba branches: 1.1.6; 1.1.8;
Add IDE drive support.

Note:
(1) Character device major number chages to 49 from 48(in my original
code). So it is necessary to rebuild device files.
(2) Must use Booter 2.0.0a10 or later.
(3) Default mode is cpu busy wait. It is defined by flags 0x1000.
It will be more slow than before.
No flags means hardware interrupt mode. But it might be able to
get no interrupts.

Support machines:
(1) Quadra 630 series
(2) PowerBook 150

Non tested machine:
(1) PowerBook 190 series

Approved by: briggs
 1.1.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.1.8.2 23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.1.8.1 27-Apr-2002  jdolecek file wdc_obio.c was added on branch kqueue on 2002-06-23 17:37:52 +0000
 1.1.6.3 18-Oct-2002  nathanw Catch up to -current.
 1.1.6.2 20-Jun-2002  nathanw Catch up to -current.
 1.1.6.1 27-Apr-2002  nathanw file wdc_obio.c was added on branch nathanw_sa on 2002-06-20 03:39:31 +0000
 1.3.6.5 17-Jan-2005  skrll Sync with HEAD.
 1.3.6.4 21-Sep-2004  skrll Fix the sync with head I botched.
 1.3.6.3 18-Sep-2004  skrll Sync with HEAD.
 1.3.6.2 25-Aug-2004  skrll Sync with HEAD.
 1.3.6.1 03-Aug-2004  skrll Sync with HEAD
 1.18.10.3 24-Mar-2008  yamt sync with head.
 1.18.10.2 30-Dec-2006  yamt sync with head.
 1.18.10.1 21-Jun-2006  yamt sync with head.
 1.18.8.1 16-Oct-2006  ghen Pull up following revision(s) (requested by tsutsui in ticket #1536):
sys/arch/mac68k/obio/wdc_obio.c: revision 1.22
Don't call wdc_init_shadow_regs() before struct ata_channel is
properly initilized in wdc_obio_attach().
Fixes NULL pointer deref during boot.
 1.19.2.1 01-Feb-2006  yamt sync with head.
 1.20.10.1 31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.20.8.1 19-Apr-2006  elad sync with head - hopefully this will work
 1.20.6.1 01-Apr-2006  yamt sync with head.
 1.20.4.1 22-Apr-2006  simonb Sync with head.
 1.20.2.1 09-Sep-2006  rpaulo sync with head
 1.21.10.1 22-Oct-2006  yamt sync with head
 1.21.8.1 18-Nov-2006  ad Sync with head.
 1.22.52.1 03-Apr-2008  mjf Sync with HEAD.
 1.22.48.1 24-Mar-2008  keiichi sync with head.
 1.22.28.1 23-Mar-2008  matt sync with HEAD
 1.23.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.23.38.1 30-Oct-2012  yamt sync with head
 1.26.4.1 18-May-2014  rmind sync with head
 1.26.2.2 03-Dec-2017  jdolecek update from HEAD
 1.26.2.1 20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.27.18.2 27-Sep-2017  jdolecek change wdc_init_shadow_regs() to accept only struct wdc_regs, it doesn't
touch anything else

factor out the probe-only struct ata_channel initialization to wdcprobe(), to
reduce duplication of logic in individual drivers, and to actually work now
that more init is needed beyond the memset()
 1.27.18.1 26-Sep-2017  jdolecek switch to ata_queue_alloc() so that this at least compiles

RSS XML Feed